konglify
konglify
  • Threads: 28
  • Posts: 160
Joined: Aug 28, 2014
June 10th, 2017 at 11:30:40 AM permalink
Hi all,
I am self learning the math theory on slots and card games. I am also learning some numerical simulation to help my understanding the model. I have a question that bugging me for long time. As I know, each slot game should have a finite cycle, I mean each reel has finite symbols so the total number of resulting screen from all reels are finite. That cycle could be pretty big and listing all winning/losing combination may be tedious or too complicate sometimes. That's why we need computer simulation in some cases. However, what is the good size of cycle for simulation so the result will be close to the theory as possible? Someone said the simulation cycle should be at least half of the real cycle, someone said it should be sqrt root of the real cycle. And some one said I should choose a cycle, run the simulation ten times and find the standard deviation of all batches to tell if the result is good enough. I know those answers may be telling in some ways but I still doubt why and in what way to choose the correct or good cycle for simulation from statistical point of view. Thanks.
charliepatrick
charliepatrick
  • Threads: 39
  • Posts: 3011
Joined: Jun 17, 2011
June 10th, 2017 at 8:59:39 PM permalink
One important thing is to ensure you have a good enough Random Number Generator.

When I look at Blackjack or (say) 3 card poker one needs to ensure that the rare cases came up fairly often - for instance having a Royal Flush being Tied with another Royal Flush. If you're running a game where there's a high payout for something rare then it's essential you have a fair representation of these or such than the odd jackpot or not has little influence on the overall result.

Personally I do make several runs and see how consistent the results are. For instance at Blackjack sometime ago I was looking at countability but the player always used the same playing strategy, so you should get the same results.
Six decks, UK rules, 10m shoes
CSM95m hands0.4727%
66% pen370m hands0.4796%
83% pen462m hands0.4880%


And here's another simulation I was doing playing around with 3-card poker hands (looking into various Dealer Qualifying ideas), these are the results for holding AKQh, amazingly the dealer managed to Tie 6 times!
Count: 527277 Exp: 1.7256255392579811 Hands: 2318 Win: 3376 Lose: 0 Tie: 6 CHY: 0 DNQ: 624
KevinAA
KevinAA
  • Threads: 18
  • Posts: 283
Joined: Jul 6, 2017
July 9th, 2017 at 10:12:57 PM permalink
When I first started writing computer programs for simulations like this, I noticed that I was not getting proper results. I could tell because I was simulating keno, and in keno you can calculate the probability of winning any prize exactly. I noticed that for 8 spots, the estimated probability of winning all 8 of 8 was far too much, always 3 or 4 times as much as expected, even if I did 10s of millions of trials.

The way I "fixed" it (not perfectly since my computer is a pseudorandom number generator, but close enough) was to say if r is a random number between 0 and 1, then for, say getting 7 of 8, or 8 of 8, instead of having two different ranges between 0 and 1 in which the random number must lie in order to win 7 of 8 or 8 of 8, respectively (where 8 of 8 is a very tiny range), I tossed both of those prizes into one larger bucket (the 4,5, or 6 of 8 worked fine on their own). I changed the program to say if the random number is in the range of winning 7 OR 8 of 8 (which is 0.000165), then call randomize() (i.e., seed the random number generator again), then pick another random number and based on what range between 0 and 1 that one is in, you won either 7 of 8, or all 8. I got much better results.
KevinAA
KevinAA
  • Threads: 18
  • Posts: 283
Joined: Jul 6, 2017
July 9th, 2017 at 10:27:07 PM permalink
Quote: konglify

Hi all,
I am self learning the math theory on slots and card games. I am also learning some numerical simulation to help my understanding the model. I have a question that bugging me for long time. As I know, each slot game should have a finite cycle, I mean each reel has finite symbols so the total number of resulting screen from all reels are finite. That cycle could be pretty big and listing all winning/losing combination may be tedious or too complicate sometimes. That's why we need computer simulation in some cases. However, what is the good size of cycle for simulation so the result will be close to the theory as possible? Someone said the simulation cycle should be at least half of the real cycle, someone said it should be sqrt root of the real cycle. And some one said I should choose a cycle, run the simulation ten times and find the standard deviation of all batches to tell if the result is good enough. I know those answers may be telling in some ways but I still doubt why and in what way to choose the correct or good cycle for simulation from statistical point of view. Thanks.



No slot machines or video poker games operate in a cycle. Same goes for blackjack (if you consider playing one shoe to be "one game" for this purpose). Each game is independent of one another. For example, if the probability of winning the jackpot is 1 in a million, it doesn't mean you're guaranteed to win once if you play one million times. You could not win or you could win twice.

What I prefer is to make the number of trials such that the expected value of jackpots is 10. Then if the observed number of jackpots is 9 or 11, that looks fine. If I consistently get 5 or 15, I know something is wrong.
charliepatrick
charliepatrick
  • Threads: 39
  • Posts: 3011
Joined: Jun 17, 2011
July 9th, 2017 at 11:50:15 PM permalink
Quote: KevinAA

... call randomize() ...

To be able to run simulations using random number generators you have to code your own. You can either use an initial seed (to get the same results every time) or use the time to do it. e.g. see https://en.wikipedia.org/wiki/Mersenne_Twister
  • Jump to: