deal or no deal c code or Logic of how the banker offers

This is a discussion on deal or no deal c code or Logic of how the banker offers within the C Programming forums, part of the General Programming Boards category; how to randomize the value to the 26 briefcase using array formula for the offer of the banker ty in ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    19

    deal or no deal c code or Logic of how the banker offers

    how to randomize the value to the 26 briefcase using array
    formula for the offer of the banker

    ty in advance!

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Well there are several ways:

    Keep a sorted array of the amounts, and randomly select one for each of the cases, ie:
    Case 1:
    Select 1-26 (rand()) from amounts
    Remove the item from amounts (plugging the hole)

    So on and so forth. There are however other methods, which could be better.

  3. #3
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218

  4. #4
    Registered User
    Join Date
    Sep 2008
    Posts
    21
    All of the above is correct. As far as the offer goes it's the total amount still available divided by the number of cases remaining plus a little bit for incentive.

    Ex 1:

    Lets say there are three cases left: .01, 200,000.00, and 1,000,000.00

    The bankers offer would be about:

    (.01 + 200,000.00 + 1,000,000.00) / 3 + incentive

    400,000.00 + incentive

    Ex 2:

    Four cases: .01, 1.00, 100,000.00, 1,000,000.00

    The offer: (.01 + 1.00 + 100,000.00 + 1,000,000.00) / 4

    275,000.25 + incentive
    Last edited by rmetcalf; 09-18-2008 at 09:33 AM.

  5. #5
    Budding Synth Programmer samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Trefforest
    Posts
    368
    I'd imagine the banker's offer is based around the average of all the unopened boxes (or just a little less, maybe you could set a rick factor to determine how much higher or lower than the average the offer is).
    MSVC++ 6.0

  6. #6
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I would use a more advanced function than what rmetcalf had suggested. That or stick with what he said and calculate the incentive based on probabilities. Lets start with a hypothetical:

    You have 4 cases left: $1.00, $50.00, $1,000.00, and $1,000,000.00

    The average of those numbers is $400,414.00, right? Should the banker offer you $400k? I wouldn't.

    So what if instead you look at it as you have a 1 in 4 chance of getting a large prize (call anything over $10,000 a large prize... hell even $10,000 if that is large enough for you) and use those to make a coefficient for probability.

    So lets call the coefficient 0.25 in my example, since you aren't exactly likely to get a mil. Which gives me an offer of $100,105. Which sounds better, right?

    You can play with algorithms for calculating the probabilities. But I think that is the best route and likely the technique actually used for the show. Will your program include ascii babes?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. << !! Posting Code? Read this First !! >>
    By kermi3 in forum C Programming
    Replies: 0
    Last Post: 10-03-2002, 04:04 PM
  2. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM
  3. << !! Posting Code? Read this First !! >>
    By biosx in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2002, 12:51 PM
  4. Replies: 0
    Last Post: 02-21-2002, 06:05 PM
  5. Replies: 4
    Last Post: 01-16-2002, 12:04 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21