Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
July 9th, 2006, 04:48 AM
 brett777
Registered User

Join Date: Jun 2006
Posts: 8
Time spent in forums: 1 h 43 m 9 sec
Reputation Power: 0
Fruit machine simulation - question

I was thinking about how a fruit machine simulation would work and one question that has always puzzled me is how they adjust the odds for winning (or perhaps I should say losing). I.e. the person that owns or is renting the fruit machine can adjust the odds to a particular percentage payout. E.g. 70% payout would equate to the punter gets back 70p (on average) out of each pound that is inserted. It's a well know factoid in the UK that certain fruit machines, e.g. where there is a high volume of passing trade, like a fast food place, have very low payouts - which is to say that the payout percentage has been set low.

One way that I could simulate this would be to set up three arrays that would represent the three (just three for now) reels and populate the arrays, e.g. array1 = { "melon", "pear", "apple", etc }, and likewise for array2 and array3, then have a payoff array. We pick an index at random in each of the three arrays (reels) and then compare this value to the payoff array, so we might get "pear", "pear", "pear" and check in the payoff array where three pears pays 2.00. In this case the frequency of the fruit symbols and their combinations will determine the average payout over time.

Rather than just apply a percentage factor to the winning amount, imagine that there is a payout list on the front of the machine that says "Three pears pays 2.00", "Three apples pays 3.00", so we can't just say 2.00 / 70%. One way that I could change the payout percentage would be to have say 50 fruit symbols in each reel array and change the frequencies of the different fruit items. A bit of tweaking and this should do.

But bearing in mind that reels in a real fruit machine are fixed, how do they change the payout percentage? If I know this then perhaps I could think how this would work in an analogous way in a simulation.

Anyone have any ideas how this works in RL?

#2
July 9th, 2006, 01:33 PM
 Schol-R-LEA
Commie Mutant Traitor

Join Date: Jun 2004
Location: Norcross, GA (again)
Posts: 1,798
Time spent in forums: 1 Month 2 Weeks 3 Days 1 h 39 m 19 sec
Reputation Power: 1569
For a moment I was confused by this, but then I remembered that 'fruit machine' is British slang for 'slot machine'. Gotcha.

Yeah, it's certainly possible to simulate slots, and in fact (in US casinos at least) mechanical slot machines have largely been replaced with 'video slots', which are cheaper to buy and maintain, can be reconfigured to different styles, and are more easily set to give the desired odds (desired by the casino, that is. The players usually want rather better odds than those, but tampering with game odds in most places carries penalties ranging from a stiff fine, to nice long swim under the boardwalk in a cement overcoat, depending on where you are and who you've crossed.)

As for how you would do it, there are several possible approaches that I can think of. If you want to simulate how mechanical slots work reasonably closely, what you'll want is to have 'reels' with several entries for the lower-paying items, and only a few or even just one for the higher-paying ones. For further realism, you can keep track of the position of the reels after each draw, and then use the random value as a modular offset from the current position; though to do that well, you would have to interpolate the least common values between the most common more or less evenly. to get the odds of a payout would require a bit of calculating, as you would have to get the combinatorial odds of the combination coming up over the range of all possible permutations; you'll have to pardon me if I can't recall the exact way you would do this offhand, but it isn't too difficult of memory serves. This article covers the basic methods though it focuses more on roulette and poker than on slots), while this one gives a bit more of the theoretical basis of probability calculations.

A simpler method, closer to how (AFAIK) some modern video slots work, would be to have a range of values for each combination, with the most common having the largest range and the least common the smallest. Needless to say, you can give more or less arbitrary odds of a combination coming up this way. To calculate the payout odds, you would simply take the ratio of the number of values assigned to a combination over the total range of possible values. So, if you have 1728 combinations (equivalent to three reels with 12 possible outcomes per reel), you might assign three triple bars (the top payout in most US machines) to a value of 0 (zero), three double bars to an outcome of 1, 2 or 3, two triple bars and a seven to 4, 5, 6, 7, and so on, up to 1727, with most of the range taken up with garbage combinations such as 'orange bar cherry'; the odds for the first would be one in 1728, the second 3:1728, the third 4:1728, etc.

You might want to check out the Wikipedia entries on slot machines, odds, probability and similar topics for some additional information on the terminology, odds calculations and so on. The Institute for the Study of Gambling and Commercial Gaming may have some articles which would be of interest as well, I suppose.
__________________
Rev First Speaker Schol-R-LEA;2 JAM LCF ELF KoR KCO BiWM TGIF
#define KINSEY (rand() % 7) λ Scheme is the Red Pill
Scheme in ShortUnderstanding the C/C++ Preprocessor
Taming PythonA Highly Opinionated Review of Programming Languages for the Novice, v1.1

FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. \$4500 obo. tverres@et.ins.gov

Last edited by Schol-R-LEA : July 9th, 2006 at 01:40 PM.

#3
July 9th, 2006, 03:44 PM
 brett777
Registered User

Join Date: Jun 2006
Posts: 8
Time spent in forums: 1 h 43 m 9 sec
Reputation Power: 0
Hi. Well that certainly is a lot to think about so I'll consider it over the next few hours and see what I can come up with. Thanks for the references as well.

b.

 Viewing: Dev Shed Forums > Programming Languages > Game Development > Fruit machine simulation - question