I need to simulate a roulette table where a perosn bets $10 on red 1 time, 5 times,20 times, 100 times and 10,000 times, i then need to find out how much the person wins or loses once they play 10,000 times.

I have no idea how to do this the only line of code i have is

RandomChoice[{17/36, 17/36, 1/18} -> {red, black, green}]
  • $\begingroup$ Spoiler: They lose. $\endgroup$ – ciao Oct 12 '20 at 1:04
  • 1
    $\begingroup$ RandomChoice[{17/36, 17/36, 1/18} -> {red, black, green},10000] will make your line of code spin the wheel 10 thousand times. Can you then figure out how to use Count on that result to find the number of times it landed on red? You should probably start with fewer spins, maybe 10, so you can check the result yourself and make certain it is correct. After you can trust the result from Count then can you see how to calculate total money won or lost? $\endgroup$ – Bill Oct 12 '20 at 2:34

I never played roulette, so check my assumptions: There are 37 wholes, 18 red 18 black, 1 green. If I set on red and the ball stop on red, I get twice my money back, otherwise I lose all. With this assumptions:

We mark "win" by 1 and loose by "0". Then playing n times the numbers of "wins" is:

 Count[RandomChoice[{18, 19} -> {1, 0}, n], 1]

If we now double the money from every "win" and subtract the money we started with, we get the win or lose by:

Table[ Print[
  StringForm["Earnings `` from `` rounds", 
   2 Count[RandomChoice[{18, 19} -> {1, 0}, n], 1] - n, n]], {n, {5, 
   20, 100, 10^4}}]

Earnings -3 from 5 rounds

Earnings 2 from 20 rounds

Earnings -2 from 100 rounds

Earnings -204 from 10000 rounds

After this, I do not think that I will start playing roulette.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.