+ 1

The Gambling Machine Puzzle

An entrepreneur has devised a gambling machine that chooses two random variables x and y that are uniformly and independently distributed between 0 and 100. He plans to tell any customer the value of x and to ask him whether y > x or x > y. If the customer guesses correctly, he is given y dollars. If x = y, he’s given y/2 dollars. And if he’s wrong about which is larger, he’s given nothing. The entrepreneur plans to charge his customers $40 for the privilege of playing the game. Would you play?

28th Jun 2017, 11:40 PM
Zhuoyu Wang
Zhuoyu Wang - avatar
8 ответов
0
The answer is: we should play it. When x>70.7, choose x>y and otherwise, then the expected award is 40.3, slightly larger than 40. Here is the example of the solution code (the key is how to find out this best decision threshold). https://code.sololearn.com/c0WIs9iH32HX/?ref=app Since some modules are not available in this palyground, please run the code here: https://trinket.io/python3/e2fc570179?start=result It takes a while to get the result. If you can't or don't want to run the code but want to see the results directly, here is the plot: https://python3-5.trinket.io/python3-generated/6z4lhaor/trinket_plot.png
3rd Jul 2017, 7:57 AM
Zhuoyu Wang
Zhuoyu Wang - avatar
+ 11
I won't play because there is around 65% chance of losing money. Check this code (https://code.sololearn.com/W5aCpYIKGboq/?ref=app). After playing once, click the "Analyse" button to check the chances of winning/losing money.
29th Jun 2017, 4:25 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 3
Please solve this puzzle using your program skills. The challege is not coding the gambling machine, but to do some analyses and make your decision based on your analyses. This challege needs some programming skills and some analytical skills, just like the technical qestions you will have in your job interview. Tips: (1) consider a threshold. If x > threshold, then choose x > y; if else, then choose x < y. (2) do some simulation to find the expected loss/gain of each bet at current threshold. You can generate a large amount of random data and calculate the mean value of the gain. (3) Consider a series of threshold: for each threashold, do (1) and (2). So for each threashold, you will have a expected loss/gain. (4) Based on the result of (3), you should be able to find the best threshold that give you the best gain, and you will see if there is a range of the threshold that the gain is positive. You should play if the gain is positive for some threshold, and you should use the best threshold in the play. Example code will be given later.
29th Jun 2017, 3:04 AM
Zhuoyu Wang
Zhuoyu Wang - avatar
29th Jun 2017, 1:46 AM
Javier Jimenez
Javier Jimenez - avatar
0
I revisited my logic here. it looks like it is possible to make some money, but it doesn't come easy https://code.sololearn.com/c06uDvoA22iJ/#py
29th Jun 2017, 3:50 AM
Javier Jimenez
Javier Jimenez - avatar
0
The gambling machine puzzle is intriguing and challenges our logic! As I delved into the discussion on SoloLearn, I realized how much there is to learn. If you're interested in expanding your understanding of gambling and betting, check out the mobile app at https://odds-96.com.in/mobile-app/. It’s perfect for learning while enjoying games. The blend of fun and education makes for a unique experience. Join the conversation and enhance your skills in this exciting field!
24th Oct 2024, 12:36 PM
bromoni