some mathematics of machine gaming

55
Some Mathematics of Machine Some Mathematics of Machine Gaming Gaming Prepared for Prepared for American Mathematics Association of Two Year Colleges American Mathematics Association of Two Year Colleges in Minneapolis for New Orleans in Minneapolis for New Orleans 2 November 2007 2 November 2007 By Robert N. Baker By Robert N. Baker New Mexico State University-Grants New Mexico State University-Grants [email protected] **This version for the AMATYC website has **This version for the AMATYC website has been edited to reduce file size** been edited to reduce file size** 1

Upload: regina

Post on 06-Jan-2016

41 views

Category:

Documents


2 download

DESCRIPTION

Some Mathematics of Machine Gaming. Prepared for American Mathematics Association of Two Year Colleges in Minneapolis for New Orleans 2 November 2007 By Robert N. Baker New Mexico State University-Grants [email protected] - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Some Mathematics of Machine Gaming

Some Mathematics of Machine Some Mathematics of Machine GamingGaming

Prepared for Prepared for American Mathematics Association of Two Year CollegesAmerican Mathematics Association of Two Year Colleges

in Minneapolis for New Orleansin Minneapolis for New Orleans2 November 20072 November 2007

By Robert N. BakerBy Robert N. BakerNew Mexico State University-GrantsNew Mexico State University-Grants

[email protected]

**This version for the AMATYC website has been **This version for the AMATYC website has been edited to reduce file size**edited to reduce file size**

11

Page 2: Some Mathematics of Machine Gaming

My thesis: My thesis:

You don’t need to rig the machine You don’t need to rig the machine to make profit, just rig the numbers.to make profit, just rig the numbers.

The latter is legal, the former is not.

This workshop investigates how to do so, in classroom ready activities,

with keystrokes for using table featuresof the TI -83 model graphing calculator.

Page 3: Some Mathematics of Machine Gaming

The Deck: A Set to Model Computer MemoryThe Deck: A Set to Model Computer Memory

The Standard Deck of Cards and the Algebra of Manipulating Computer The Standard Deck of Cards and the Algebra of Manipulating Computer

Memories at the MAA at Reed College, 1996Memories at the MAA at Reed College, 1996

** ** Dynamic Memories: S. Brent Morris, NSA ** ** Dynamic Memories: S. Brent Morris, NSA DirectorDirector

Serial access and “the Perfect Shuffle”Serial access and “the Perfect Shuffle”

** ** Static Memories: aka RAM** ** Static Memories: aka RAM me, grad studentme, grad studentDirect access and set constructionDirect access and set construction

**Naming and accessing locations **Naming and accessing locations In an economical fashion In an economical fashion

**Constructing large blocks on demand **Constructing large blocks on demand From non-contiguous locationsFrom non-contiguous locations

Originally the deck was designed as a physical model of the ancient four-Originally the deck was designed as a physical model of the ancient four-tier Caste Social System of China, < 1000 ADtier Caste Social System of China, < 1000 AD

Pips evolved to indicate things associated with the four classes in different Pips evolved to indicate things associated with the four classes in different societies across Eurasia, through about 1600 AD.societies across Eurasia, through about 1600 AD.

Peasants (clubs) Military (spades) Peasants (clubs) Military (spades) Professional (diamonds) Theological Professional (diamonds) Theological (hearts)(hearts)

33

Page 4: Some Mathematics of Machine Gaming

In 2007, decks of cards, on sale literally around the world, use the pips and colors and structure established by 1600 in France.

Historical Note: The deck called the “tarot” spun off the standard deck sometime after 1400’ish, in Italy.

Page 5: Some Mathematics of Machine Gaming

Expansion-enabling technology for deck

< 1000 A.D. Chinese paper and printing- Block printing on tiles, heavy paper- Popular among royalty (invented by ? 969 A.D. ?)

< 1300 World trade routes- Italy, Marco Polo, the Silk Road, the Turks- Muslim expansion, Iberian peninsula mines

< 1400 Renaissance Art, rise of Leisure, intellectual discourse< 1500 Johann Gutenberg’s printing press (Cash for a starving artist!)< 1600 Christian expansion, Central American mines, more world trade routes< 1800 New Orleans, Mississippi River trade, riverboat culture of movement

- Improved printing, cutting, stock- Rounded corners eased shuffling! - Factory system kept price down.

1800s America moved west in wagons- “Corner indicators” printed for shortcut- New! Blank card(s) in each deck free. < 1870- Players adopted blank as wild card < 1871- Joker (from tarot Jester?) introduced < 1875

Improved deck as model of real society: The one of every bunch who fits nowhere and everywhere.!?

Page 6: Some Mathematics of Machine Gaming

PokerPoker A “vying” game; winner determined by players A “vying” game; winner determined by players

comparing their combinations of cardscomparing their combinations of cards Evolved in parlors and around campfires Evolved in parlors and around campfires

around the world for more than 500 yearsaround the world for more than 500 years Formalized in cosmopolitan 1800s New Orleans Formalized in cosmopolitan 1800s New Orleans

with a 20 card deck for 4 players max.with a 20 card deck for 4 players max. Now a television sport! (my San Diego topic)Now a television sport! (my San Diego topic) Now also a one-player machine game--the Now also a one-player machine game--the

topic of today’s workshop.topic of today’s workshop.

66

Page 7: Some Mathematics of Machine Gaming

Poker across continents and centuries: A “combination” game

? 969 A.D. Chinese emperor Mu Tsung & wife (inventress?)< 15th Century Persian game As ras15th Century Regional European variations similar in structure

- Italian Il Frusso, Primiera; French LaPrime, L’Amigu, L’Mesle or Brelan- English Post and Pair and Brag; German Pochen

< 1700 Cardano, Pascal, Fermat, Huygens establish theory of probability1708 -P. R. de Montmort, Essai d’analyse sur les jeux de hazard (Analtyic Essay

on Games of Chance). Applied probability to card games and all life.1718 Louisiana territory game Poque - Five card hand from 20 card deck, one bet & showdown 1800 Faro and 3-card Monte still most popular card games on the circuit 1834 J. H. Green documented “the cheating game,” by the name Poker≈ 1840 Full-deck Poker introduced

- Lowered typical hand; enabled more players per game- The “flush” arose outside of royal setting, accepted

1860s 5-card “Draw” poker introduced--a second bet - 5-card “Stud” poker introduced--four bets possible- “Straight” became an officially-valued hand- “Bluffing” entered as strategy- Faro and 3-card Monte lost favor on the circuit

1870 “Jacks or Better” introduced, also known as “Jack-pots”- Added more bets, increased single pots, strategy

≤ 1875 The new Joker employed as a wild card1900 “Low ball” and “split pot” games introduced - Increased pot sizes, number of winners 1930s “7-card stud” popularity rose above 5-card draw’s

(Better: fewer cards “down” makes cheating harder, no discards to watch.)1931 Nevada legalized games of chance

Page 8: Some Mathematics of Machine Gaming

Defining Order on the setDefining Order on the set

Comparative-valueComparative-value for the deck’s “kinds” for the deck’s “kinds”

In the rules of poker, In the rules of poker, the kinds are given a (transitive) ordering. the kinds are given a (transitive) ordering.

HIGHHIGH ToTo LOWLOWAces, kings, queens, jacks, 10’s, … , 3’s, 2’sAces, kings, queens, jacks, 10’s, … , 3’s, 2’s

A > k > q > j > 10 > 9 > … > 3 > 2A > k > q > j > 10 > 9 > … > 3 > 2

This post-1800 ordering is used to determine the winner of the cut, This post-1800 ordering is used to determine the winner of the cut, and to help well-define an order on the hands. and to help well-define an order on the hands.

(Some house rules allow the ace also low.)(Some house rules allow the ace also low.)

88

Page 9: Some Mathematics of Machine Gaming

Defining Order in the gameDefining Order in the game

Comparative-valueComparative-value for the types of hands for the types of hands

In the rules of poker, In the rules of poker, the types of hands are given a (transitive) ordering. the types of hands are given a (transitive) ordering.

HIGHHIGH To LOWLOWStraight Flush, 4 of a kind, full house, flush, straight, 3 of a Straight Flush, 4 of a kind, full house, flush, straight, 3 of a

kind, kind,

two pair, one pair, none of the above.two pair, one pair, none of the above.

SF > 4K > FH > Fl > St > 3k > 2pair > 1pair > notaSF > 4K > FH > Fl > St > 3k > 2pair > 1pair > nota

This ordering is used to determine the winner of each round of play This ordering is used to determine the winner of each round of play (also known as a hand), nested on the ordering of the kinds. (also known as a hand), nested on the ordering of the kinds. 99

Page 10: Some Mathematics of Machine Gaming

In poker, the value/ordering of hands is given by In poker, the value/ordering of hands is given by “the rules of the game.”“the rules of the game.”

Circa 15th CenturyCirca 15th Century

It is not an arbitrary order.It is not an arbitrary order.

Two hands compare inversely to the Two hands compare inversely to the

probabilities of getting themprobabilities of getting them(dealt from a randomized deck)(dealt from a randomized deck)

Circa 18th Century Circa 18th Century

Higher valued hands have lower probability of Higher valued hands have lower probability of occurrence.occurrence.

1010

Page 11: Some Mathematics of Machine Gaming

Essential thesisEssential thesis: : Roll the Bones: The history of gambling Roll the Bones: The history of gambling

by David G. Schwartzby David G. Schwartz

The The elaboration of probabilityelaboration of probability allowed for another allowed for another path: using a path: using a discrepancy between the true odds and discrepancy between the true odds and actual payouts to carve out a statistically actual payouts to carve out a statistically guaranteed profitguaranteed profit. This is the most significant change . This is the most significant change in all of gambling history and directly let to lotteries, in all of gambling history and directly let to lotteries, bookmaking, and casinos. Thanks to a better bookmaking, and casinos. Thanks to a better understanding of probability, professional gamblers understanding of probability, professional gamblers can now offer casual players the chance to bet as much can now offer casual players the chance to bet as much as they liked against an impersonal vendor, with the as they liked against an impersonal vendor, with the “house odds” the irreducible price of entertainment. “house odds” the irreducible price of entertainment.

Pg. 80: 2006 Gotham Books, Penguin Group, Inc.Pg. 80: 2006 Gotham Books, Penguin Group, Inc. 1111

Page 12: Some Mathematics of Machine Gaming

We will look at how to exploit this We will look at how to exploit this difference between odds and difference between odds and payout, beginning with:payout, beginning with:

Probabilities of differentProbabilities of different poker handspoker hands

Probabilities can be computed for five-card Probabilities can be computed for five-card hands in straight poker from a randomized 52-hands in straight poker from a randomized 52-card deck, by counting 5-card subsets of the card deck, by counting 5-card subsets of the deck and using techniques from probability deck and using techniques from probability theory. theory.

1212

Page 13: Some Mathematics of Machine Gaming

General Definition Applied:General Definition Applied:

The probability you get a certain type, call it The probability you get a certain type, call it type E, of valued combination in your 5 cards type E, of valued combination in your 5 cards from a randomized deck, ie. hand, is defined from a randomized deck, ie. hand, is defined in general by: in general by:

Pr (E) =Pr (E) = the number of different ways of satisfying E the number of different ways of satisfying E

the number of different 5-card hands in the deck the number of different 5-card hands in the deck

1313

Page 14: Some Mathematics of Machine Gaming

First identify the denominatorFirst identify the denominator … …

the number of “different” 5-card hands. the number of “different” 5-card hands. - ie. the number of 5-element subsets of a 52-- ie. the number of 5-element subsets of a 52-element set element set

- ie. the number of ways to choose 5 items from - ie. the number of ways to choose 5 items from 5252

By the multiplication rule for events, there By the multiplication rule for events, there are:are:

52 • 51 • 50 • 49 • 48 = 311,875,200 52 • 51 • 50 • 49 • 48 = 311,875,200

ways to be dealt five cards from the deck.ways to be dealt five cards from the deck.

1414

Page 15: Some Mathematics of Machine Gaming

But this computation implies a concern But this computation implies a concern for the process, which is not reflected for the process, which is not reflected by rules for the game of poker. by rules for the game of poker.

Poker values only the finished five-card Poker values only the finished five-card

product (subset, combination), not the product (subset, combination), not the order in which they arrived order in which they arrived (permutation). (permutation).

What adjustment is needed to compute What adjustment is needed to compute the number we want? the number we want?

1515

Page 16: Some Mathematics of Machine Gaming

InvestigationInvestigation: :

Let a poker hand include a 1, 2, 3, 4, Let a poker hand include a 1, 2, 3, 4, and 5. and 5. List allList all of the ways this one of the ways this one poker hand can result, written “first-poker hand can result, written “first-card-dealt on left, to last-card-dealt card-dealt on left, to last-card-dealt on right”. on right”.

Then count the number of these Then count the number of these different permutations of these five different permutations of these five cards that all lead to the same poker cards that all lead to the same poker hand (combination).hand (combination).

1616

Page 17: Some Mathematics of Machine Gaming

A method:A method: Keep as much as constant as possible for as long as possible, to make exhaustive list.

    1234512345 1324513245 1423514235 15234 15234 1235412354 1325413254 1425314253 15243   15243   1243512435 1342513425 1432514325 15324 15324 1245312453 1345213452 1435214352 15342   15342   1253412534 1352413524 1452314523 15423 15423 1254312543 1354213542 1453214532 15432   15432  

__________________________________________________________________________________2 • 3 + 2 • 3 2 • 3 + 2 • 3 + + 2 • 3 +2 • 3 + 2 • 3 ways2 • 3 ways

= (2 • 3) • 4 = 4! different permutations = (2 • 3) • 4 = 4! different permutations listed so far, all with the 1 dealt first.listed so far, all with the 1 dealt first.

1717

Page 18: Some Mathematics of Machine Gaming

This list includes only the ways to This list includes only the ways to hold this hand where the hold this hand where the

ace was ace was the first card received the first card received by the player.by the player.

Four different but similar lists--with the Four different but similar lists--with the 2 listed first, 3 first, the 4 and 5--yield 2 listed first, 3 first, the 4 and 5--yield a total of 5 lists for these five cards, a total of 5 lists for these five cards, each with 24 different orderings. each with 24 different orderings.

Thus we have constructed the Thus we have constructed the (2 • 3 • 4) • 5 = 5! = 120 (2 • 3 • 4) • 5 = 5! = 120 ways to be dealt this hand.ways to be dealt this hand.

(Solution Cont.)(Solution Cont.)

1818

Page 19: Some Mathematics of Machine Gaming

With With (2 • 3 • 4) • 5 = 5! = 120(2 • 3 • 4) • 5 = 5! = 120 different different ways to be dealt this one particular poker hand, we ways to be dealt this one particular poker hand, we generalize to say the same is true for any poker generalize to say the same is true for any poker hand. hand.

Thus, we can assert Thus, we can assert

(311,875,200) / 120 = (311,875,200) / 120 = 2,598,9602,598,960

different five-card hands are possible different five-card hands are possible to construct from a standard deck of 52 cards. to construct from a standard deck of 52 cards.

1919

Page 20: Some Mathematics of Machine Gaming

Second, identify the numerators:

The numbers of each of the types of The numbers of each of the types of handshands from a standard deck of 52 from a standard deck of 52 playing cards. playing cards.

Each computation represents its own Each computation represents its own rationale for approaching the given rationale for approaching the given counting problem. There are often several counting problem. There are often several different ways to discover the one absolute different ways to discover the one absolute answer to “how many ways can you ...?”answer to “how many ways can you ...?”

In the following, “aCb” stands for the In the following, “aCb” stands for the standard computation a!/[(a-b)! b!]. standard computation a!/[(a-b)! b!]. 2020

Page 21: Some Mathematics of Machine Gaming

Numbers of Hands

1 pair, no better1 pair, no better i) 13 • 4C2 •12C3 •4^3 1,098,2401,098,240 ii) (52 • 3 / 2!) (48 • 44 • 40 / 3!)  

2 pairs, no better2 pairs, no better i) 13C2 • 4C2 • 4C2 • 11 • 4 123,552123,552 ii) [(52 • 3 / 2) (48 • 3 / 2) / 2!] • 44

iii) [(13C1 • 4C2) (12C1 • 4C2) / 2!] • 11C1 • 4C1

 3 of a kind, no better3 of a kind, no better i) 13 • 4C3 • 12C2 • 4^2

54,91254,912 ii) (52 • 3 • 2 / 3!) (48 • 44 / 2!) iii) 13 • 4C3 • (12 • 4C1 • 11 • 4C1 /

2!)  Straight, no betterStraight, no better i) 10 • 4^5 - 40

10,20010,200 (there are 40 “straight flush” hands!) Flush, no betterFlush, no better i) 13C5 • 4 - 40

5,1085,108   Full-houseFull-house i) 13 • 4C3 • 12 • 4C2

3,7443,744 ii) (52 • 3 • 2 / 3!) (48 • 3 /2!)  

2121

Page 22: Some Mathematics of Machine Gaming

Numbers of Hands, cont.

4 of a kind4 of a kind i) 13 • 4C4 • 12 • 4C1i) 13 • 4C4 • 12 • 4C1 624624 ii) (52 • 3 • 2 • 1 / 4!) • 48ii) (52 • 3 • 2 • 1 / 4!) • 48    

Straight FlushStraight Flush i) 10 • 4i) 10 • 4 4040

None of the Above, None of the Above, “nota”: “nota”: 1,302,540 1,302,540

for these two methods, you need some of the above informationfor these two methods, you need some of the above information i) (hands without even a pair) - (hands that are flush OR straight)

[(13 • 4) (12 • 4) (11 • 4) (10 • 4) (9 • 4) / 5!] - (10,200 + 5,108 + 40)= 1,317,888 - 15,348 =

ii) (total number of hands) - (hands noted above as valued) 2,598,960 - (40 + 624 + 3744 + 5108 + 10,200 + 54,912 + 123,552 +

1,098,240) = 2,598,960 - 1,296,420

2222

Page 23: Some Mathematics of Machine Gaming

Sum of numbers of different Sum of numbers of different hands = hands =

2,598,960 2,598,960

This number agrees with the value This number agrees with the value independently computed via 52 independently computed via 52

choose 5. choose 5.

2323

Page 24: Some Mathematics of Machine Gaming

The Probabilities for 5-card poker hands The Probabilities for 5-card poker hands from a randomized 52-card deck.from a randomized 52-card deck.

The probability of an event = (# of elements in that event)___(# of elements in that event)___ (# of elements in the sample space) (# of elements in the sample space)

Then straight poker probabilities fall from the defining formula: Then straight poker probabilities fall from the defining formula:

The probability of a hand = (# of ways that hand can (# of ways that hand can occur)occur) 2,598,960 2,598,960

For ease of writing, let s = 2,598,960 the number of different 5-card hands.For ease of writing, let s = 2,598,960 the number of different 5-card hands.

2424

Page 25: Some Mathematics of Machine Gaming

Type of hand Type of hand MethodMethod ProbabilityProbability ...and no better. ...and no better.

Straight FlushStraight Flush 40/s40/s ≈ .00001539 ≈ .00001539 4 of a kind4 of a kind 624/s ≈ .00024010 624/s ≈ .00024010 Full houseFull house 3,744/s ≈ .00144058   3,744/s ≈ .00144058   FlushFlush 5,108/s ≈ .00196540  5,108/s ≈ .00196540  StraightStraight 10,200/s10,200/s ≈ .00392464 ≈ .00392464 3 of a kind3 of a kind 54,912/s54,912/s ≈ .02112845   ≈ .02112845   Two pairsTwo pairs 123,552/s123,552/s ≈ .04753902 ≈ .04753902 One pairOne pair 1,098,240/s ≈ .42256903   1,098,240/s ≈ .42256903   None of the aboveNone of the above 1,302,540/s ≈ .50117739 1,302,540/s ≈ .50117739

2525

Page 26: Some Mathematics of Machine Gaming

Two tools needed in the move to machines:

Definition: A random variable is a function with a non-numeric domain (often well-defined situations) and numeric range. It is a rule that assigns a number to a condition. Often defined with a function table, a random variable is neither random nor variable.

Definition: The expected value of a random variable is a weighted average of the random variable’s values (range), with their probabilities as the weights. For random variable called $ with range values $i then

ExpVal($) = ∑ $i • Pr ( $i )

Page 27: Some Mathematics of Machine Gaming

Cooperative Data Entry: Observed on the helm of USCG M/V Planetree, 2001

To transfer data surely and quickly: Use two pairs to accommodate the human propensity for typos.

On deck at the source of data: One person reads the data out loud. One person reads and listens, to catch spoken typos.

In the helm at the destination of data: One person types the data into the machine. One person listens and watches, to catch written

typos.

Page 28: Some Mathematics of Machine Gaming

To a single-player game … To a single-player game … Winning determined by comparing the player Winning determined by comparing the player

to the true odds, rather than to other players.to the true odds, rather than to other players. Winnings determined from the true odds, Winnings determined from the true odds,

rather than by vying.rather than by vying.

In a “fair game” each hand paid at the In a “fair game” each hand paid at the reciprocal of its probability. (Our first activity.)reciprocal of its probability. (Our first activity.)

Commercial machine games are designed to Commercial machine games are designed to generate profit at specified rates, typically generate profit at specified rates, typically capped by state laws. (Our second activity.)capped by state laws. (Our second activity.)

2828

Page 29: Some Mathematics of Machine Gaming

A Problem: A Problem:

Logistical and psychological difficulties arise Logistical and psychological difficulties arise in paying out in Single-Player games. in paying out in Single-Player games.

Our Solution: Our Solution: Define and adjust a random variable Define and adjust a random variable until it meets given constraints. until it meets given constraints. I’ll call it “payout” and denote it “$”I’ll call it “payout” and denote it “$”

For this we will use the power of the For this we will use the power of the list in TI-83 calculatorslist in TI-83 calculators

2929

Page 30: Some Mathematics of Machine Gaming

First, we’ll use the number First, we’ll use the number 2,598,960 2,598,960 often, so want to give it an often, so want to give it an easy easy name. I like the letter “s.” name. I like the letter “s.”

In the home screen of your calculator (use 2nd In the home screen of your calculator (use 2nd QUIT to get there, from anywhere)QUIT to get there, from anywhere) type 2 5 9 8 9 6 0 STO then ALPHA S then ENTERtype 2 5 9 8 9 6 0 STO then ALPHA S then ENTER

(S is the letter on the LN button, in the leftmost column.)(S is the letter on the LN button, in the leftmost column.)

From here on, use 2nd RCL ALPHA s to invoke 2,598,960.From here on, use 2nd RCL ALPHA s to invoke 2,598,960.

3030

Page 31: Some Mathematics of Machine Gaming

Next, we’ll begin work with lists. Next, we’ll begin work with lists.

Hit STAT then ENTER to get into the lists Hit STAT then ENTER to get into the lists window. window.

We’ll want to use at least 6 lists, so if already We’ll want to use at least 6 lists, so if already full of data, you should clear them. full of data, you should clear them.

3131

Page 32: Some Mathematics of Machine Gaming

** Indicates auxiliary calculator info, often relevant to students.** Indicates auxiliary calculator info, often relevant to students.

**** To clear all listsTo clear all lists, ,

use 2nd MEM ClrAllLists. use 2nd MEM ClrAllLists.

MEM is an option on the + key. Once in the MEM is an option on the + key. Once in the MEM window, you may simply hit the 4 key to activate MEM window, you may simply hit the 4 key to activate 4: ClrAllLists, or else you may arrow down to highlight 4: ClrAllLists, or else you may arrow down to highlight 4: ClrAllLists and then hit ENTER. 4: ClrAllLists and then hit ENTER.

Either way, the calculator will go to its home Either way, the calculator will go to its home screen, awaiting your command to execute that screen, awaiting your command to execute that operation. Hit ENTER. Then return to the list screen via operation. Hit ENTER. Then return to the list screen via STAT ENTER. STAT ENTER.

3232

Page 33: Some Mathematics of Machine Gaming

** Indicates auxiliary calculator info, often relevant to students.** Indicates auxiliary calculator info, often relevant to students.

**** To clear one entire list, To clear one entire list,

arrow up until the list title is highlighted, hit CLEAR then hit the down arrow.

That list will be emptied, awaiting data input, without altering the contents of any other list.

3333

Page 34: Some Mathematics of Machine Gaming

** Indicates auxiliary calculator info, often relevant to students.** Indicates auxiliary calculator info, often relevant to students.

**** To remove one entry from a list, To remove one entry from a list, use arrows to highlight it, then hit DEL.

This will remove that value, and move the rest of the list up by one position.

**** To change one entry in a list, To change one entry in a list, highlight it, key in your desired value, then

hit ENTER. 3434

Page 35: Some Mathematics of Machine Gaming

In L1 enter the basic data for our investigation: In L1 enter the basic data for our investigation:

The “number of ways” each type of hand can occur.The “number of ways” each type of hand can occur.

Arrow the cursor into L1 then type:Arrow the cursor into L1 then type:

40 ENTER 624 ENTER 3744 ENTER 40 ENTER 624 ENTER 3744 ENTER

5108, 10200, 54912, 123552, 5108, 10200, 54912, 123552,

1098240, 1302540. 1098240, 1302540.

Be sure to hit ENTER after each value.Be sure to hit ENTER after each value.

3535

Page 36: Some Mathematics of Machine Gaming

In L2, compute probabilities.In L2, compute probabilities.

Right arrow into L2, then up arrow until Right arrow into L2, then up arrow until title is highlighted. title is highlighted.

Type 2nd L1 ÷ ALPHA S ENTER Type 2nd L1 ÷ ALPHA S ENTER

L2 fills with decimal L2 fills with decimal approximations for the approximations for the probabilities of each of the types probabilities of each of the types of handsof hands

3636

Page 37: Some Mathematics of Machine Gaming

** Indicates auxiliary calculator info, often relevant to students.** Indicates auxiliary calculator info, often relevant to students.

**** Recall: 1.5E–5 is the TI’s format for Recall: 1.5E–5 is the TI’s format for scientific notation, and means 0.000015. scientific notation, and means 0.000015.

**** To view an entry with more accuracy, To view an entry with more accuracy, highlight that entry, look on bottom row of highlight that entry, look on bottom row of

screenscreen

3737

Page 38: Some Mathematics of Machine Gaming

Use L3 to compute a fair game payout rule:Use L3 to compute a fair game payout rule:

In theory, in a fair game the payout for an event should be In theory, in a fair game the payout for an event should be

inversely proportionalinversely proportional to its probability. Thus we can to its probability. Thus we can create a reasonable random variable for payout by taking the create a reasonable random variable for payout by taking the

reciprocals of probabilities.reciprocals of probabilities.

Right arrow into L3, then up arrow until title is Right arrow into L3, then up arrow until title is highlighted. Type 1 ÷ 2nd L2 ENTER highlighted. Type 1 ÷ 2nd L2 ENTER

L3 fills with the reciprocals of the L3 fills with the reciprocals of the probabilitiesprobabilities

3838

Page 39: Some Mathematics of Machine Gaming

In computing the expected value of this payout design, In computing the expected value of this payout design, each product-pair is a number times its reciprocal (pr each product-pair is a number times its reciprocal (pr times 1/pr), thus 1. times 1/pr), thus 1.

With a partition of 9 elements, the expected value of With a partition of 9 elements, the expected value of this random variable is 9.this random variable is 9.

For our goal of a fair game, with our random variable of For our goal of a fair game, with our random variable of inverses, the cost to play should be 9. inverses, the cost to play should be 9.

3939

Page 40: Some Mathematics of Machine Gaming

This, however, is not convenient to consumers. This, however, is not convenient to consumers.

We We cancan adjust our random variable’s values to adjust our random variable’s values to yield an expected value of 1, with yield an expected value of 1, with commensurate cost to play of 1, commensurate cost to play of 1,

by simply dividing each of its values by 9.   by simply dividing each of its values by 9.  

4040

Page 41: Some Mathematics of Machine Gaming

Use L4 to construct a better random variable. Use L4 to construct a better random variable.

Right arrow into L4, then up arrow until title is Right arrow into L4, then up arrow until title is highlighted. Type 2nd L3 ÷ 9 ENTER . highlighted. Type 2nd L3 ÷ 9 ENTER .

L4 fills with payout values for a conjectured L4 fills with payout values for a conjectured fair game with cost to play of 1.fair game with cost to play of 1.

4141

Page 42: Some Mathematics of Machine Gaming

We can now use features of the We can now use features of the calculator to find the expected value calculator to find the expected value for the suggested payouts, ie. for the for the suggested payouts, ie. for the random variable $. random variable $.

To determine To determine E E ($) = ∑ ($ • ($) = ∑ ($ • P P ($)) ($))

we need determine the products $ • we need determine the products $ • P P ($) and then sum them. ($) and then sum them.

4242

Page 43: Some Mathematics of Machine Gaming

The traditional paper and pencil approach The traditional paper and pencil approach requires that we compute each of the nine requires that we compute each of the nine products x times P(x), organize these in a products x times P(x), organize these in a table, and then add them to obtain the random table, and then add them to obtain the random variable’s expected value. variable’s expected value.

This method can be duplicated with the lists in This method can be duplicated with the lists in the calculator. Use the lists that already the calculator. Use the lists that already contain the given information: L2 has the contain the given information: L2 has the probabilities, L4 has the suggested “fair game” probabilities, L4 has the suggested “fair game” payout assignments. payout assignments.

4343

Page 44: Some Mathematics of Machine Gaming

To duplicate the traditional method:To duplicate the traditional method: In LIST EDIT screen, arrow into L5, then up In LIST EDIT screen, arrow into L5, then up arrow until title is highlighted. arrow until title is highlighted. Type 2nd L2 * 2nd L4 ENTER .Type 2nd L2 * 2nd L4 ENTER .

L5 fills with the desired products x * P (x). L5 fills with the desired products x * P (x).

To obtain the sum of these products, and thus the To obtain the sum of these products, and thus the expected value of the game, we then can: expected value of the game, we then can:

Use the STAT CALC features of the Use the STAT CALC features of the calculator. calculator.

4444

Page 45: Some Mathematics of Machine Gaming

Tradition continued:Tradition continued:

In Home Screen, compute E($) by summing the list In Home Screen, compute E($) by summing the list of products in L5.of products in L5.

Type 2nd QUIT to get to home screen, then STAT Type 2nd QUIT to get to home screen, then STAT then arrow right to CALC then ENTER = 1 for then arrow right to CALC then ENTER = 1 for the 1-Var Stats summary. the 1-Var Stats summary.

(This places you back in home screen, where you are prompted to supply the location for a list of data.)

Type 2nd L5 ENTER Type 2nd L5 ENTER to obtain basic stats on data in L5. to obtain basic stats on data in L5. Look on the second line from the top of this summary, Look on the second line from the top of this summary,

∑ ∑ xx gives the sum of the products stored in L5, the sum of the products stored in L5,

which iswhich is the desired “expected value” the desired “expected value”. .

4545

Page 46: Some Mathematics of Machine Gaming

OR to obtain that sum of products more directly: OR to obtain that sum of products more directly: The calculator can also give us our desired result more The calculator can also give us our desired result more directly—using its “sum” feature. directly—using its “sum” feature.

From the home screen, hit: From the home screen, hit: 2nd LIST right arrow to MATH then type 5. 2nd LIST right arrow to MATH then type 5.

This places sum( on the home screen. This command needs a list This places sum( on the home screen. This command needs a list for its argument. for its argument.

Type 2nd L5 ) Enter. Type 2nd L5 ) Enter. The returned sum is the desired “expected value.”The returned sum is the desired “expected value.”    

Is it the same as ∑ Is it the same as ∑ x x found in the first method? found in the first method?

4646

Page 47: Some Mathematics of Machine Gaming

Yet Yet anotheranother way to obtain the sum way to obtain the sum from the from the home screen, without needing to prepare L5 and its home screen, without needing to prepare L5 and its intermediate products.intermediate products.

In the home screen, type In the home screen, type 2nd ENTRY2nd ENTRY , edit the argument to , edit the argument to “Sum (“Sum (L2•L4L2•L4)”. Hit )”. Hit EnterEnter.  .  

This should yield the same expected value as found above. It This should yield the same expected value as found above. It provides a method to obtain the sum of products, without provides a method to obtain the sum of products, without documenting those products themselves.  documenting those products themselves.  

Some keystrokes given later in this activity use this time-Some keystrokes given later in this activity use this time-saving method, when trying via guess and check to discover a saving method, when trying via guess and check to discover a random variable that will address legal concerns as well as random variable that will address legal concerns as well as human psychology in the programming of gaming machines. human psychology in the programming of gaming machines.

4747

Page 48: Some Mathematics of Machine Gaming

Enter data in L1, Compute Enter data in L1, Compute L1/s in L2L1/s in L2 L3 = 1/L2L3 = 1/L2 L4 = L3/9L4 = L3/9

Type, T Probability, P(T) 1/P(T) (1/P(T))(1/9)

Let s = 2,598,960 rv 1 ≈ rv 2 ≈

Straight Flush 40/s ≈ 0.000015 64974 7219.3

Four of a Kind 624/s ≈ 0.000240 4165 462.8

Full House 3744/s ≈ .00144 694 77.1

Flush 5108/s ≈ .00197 509 56.5

Straight 10200/s ≈ .00392 255 28.3

Three of a kind 54912/s ≈ .02113 48 5.3

Two Pair 123532/s ≈ .04753 21 2.3

One Pair 1098240/s ≈ .42257 2.37 0.26

N.o.t.A 1302540/s ≈ .50118 2 0.22

Expected Value: 9 1

Fair Game cost to Play 9 1

# payouts per 100,000 plays 100000 100000

# credits paid out per 100K plays 900000 1000004848

Page 49: Some Mathematics of Machine Gaming

Problem: Problem: The payouts for a fair game with cost of 1 include decimal The payouts for a fair game with cost of 1 include decimal

fractions. fractions. This is inconvenient; the machine and players want payouts This is inconvenient; the machine and players want payouts

only in whole number multiples of the cost to play. only in whole number multiples of the cost to play.

Note: Note: No nice sample size smaller than 100,000 plays enables us even to No nice sample size smaller than 100,000 plays enables us even to expectexpect a straight flush in the sample. a straight flush in the sample.

In the above table, I chose to round probabilities to 5 decimal places to In the above table, I chose to round probabilities to 5 decimal places to ease working with sample sizes 100,000.   ease working with sample sizes 100,000.  

  

4949

Page 50: Some Mathematics of Machine Gaming

Activity 1: In search of expected value of 1 with Activity 1: In search of expected value of 1 with whole number payout values.whole number payout values.

1) 1) In L5, round to whole number values to In L5, round to whole number values to approximate the values in L4.  approximate the values in L4.  

2) 2) Check the expected value by the following key Check the expected value by the following key strokes, for sum of Probs • Payouts: strokes, for sum of Probs • Payouts:

2nd QUIT 2nd LIST arrow right to MATH then 2nd QUIT 2nd LIST arrow right to MATH then hit 5 = Sum( 2nd L2 * 2nd L5 ) ENTERhit 5 = Sum( 2nd L2 * 2nd L5 ) ENTER

5050

Page 51: Some Mathematics of Machine Gaming

Activity 1: (Fair Game Cont.) Activity 1: (Fair Game Cont.)

3) 3) Adjust the list in L5 (hit STAT ENTER, arrow Adjust the list in L5 (hit STAT ENTER, arrow into L5) to bring you closer to an expected value of 1, into L5) to bring you closer to an expected value of 1, then check via: 2nd QUIT 2nd ENTRY ENTER then check via: 2nd QUIT 2nd ENTRY ENTER

4) 4) Repeat steps 2 and 3 until you’ve got a sum of Repeat steps 2 and 3 until you’ve got a sum of products, ie expected value, equal to 1.products, ie expected value, equal to 1.

5) 5) Does your random variable pay out often enough Does your random variable pay out often enough to keep the interest of a paying player? to keep the interest of a paying player?

5151

Page 52: Some Mathematics of Machine Gaming

““Institutionalized mercantile gambling” Institutionalized mercantile gambling” Is not interested in sponsoring fair games.

It employs Machine Poker for profit

““using a discrepancy between the true odds and using a discrepancy between the true odds and actual payouts to carve out a statistically actual payouts to carve out a statistically

guaranteed profit.”guaranteed profit.”

By using a well-designed random variable By using a well-designed random variable (call it “payout”, with nickname “$”)(call it “payout”, with nickname “$”)

Based on known probabilitiesBased on known probabilities

IfIf the laws of probability hold in the long run the laws of probability hold in the long run(and watch that random-number generator)(and watch that random-number generator)

Then Then the costs to players the costs to players willwill exceed the payout. exceed the payout. 5252

Page 53: Some Mathematics of Machine Gaming

We will design one. Our method: Assign numeric We will design one. Our method: Assign numeric values to each type of hand, do the values to each type of hand, do the computations; adjust until legal and profitable , computations; adjust until legal and profitable , etc.etc.

Activity 2: Determine random variable assignments Activity 2: Determine random variable assignments for an expected value of 0.86.for an expected value of 0.86.

1) 1) In L6, enter values (use the fair game values in L5 In L6, enter values (use the fair game values in L5 as guidance) to guess. as guidance) to guess.

    2) 2) Check the expected value by the following key Check the expected value by the following key strokes: 2nd QUIT 2nd ENTRY and edit Sum strokes: 2nd QUIT 2nd ENTRY and edit Sum argument to “L2*L6” then hit ENTER.   argument to “L2*L6” then hit ENTER.  

5353

Page 54: Some Mathematics of Machine Gaming

Activity 2: (Cont.) Activity 2: (Cont.)

3) 3) Adjust list to get closer to 0.86, as needed (hit Adjust list to get closer to 0.86, as needed (hit STAT ENTER, arrow into L6). STAT ENTER, arrow into L6).

Check via 2nd QUIT 2nd ENTER ENTER. Check via 2nd QUIT 2nd ENTER ENTER.

4) 4) Repeat step 3 until sum is very close to 0.86 and Repeat step 3 until sum is very close to 0.86 and payouts seem reasonablepayouts seem reasonable

5) Argue the psychological acceptability, to players, 5) Argue the psychological acceptability, to players, of your payout schedule. Use number of payouts per of your payout schedule. Use number of payouts per 100,000 plays as one of your measurable indicators.100,000 plays as one of your measurable indicators.

5454

Page 55: Some Mathematics of Machine Gaming

ConclusionsConclusions Comparative games can be adapted to single-player Comparative games can be adapted to single-player

games through probability.games through probability.

““Random variable”, payout schedule, same thing: a Random variable”, payout schedule, same thing: a rule assigning numbers to situations.rule assigning numbers to situations.

Even truly random machines pay the house, as Even truly random machines pay the house, as players accept payouts disparate from odds.players accept payouts disparate from odds.

In our technologic age, once-intimidating numbers In our technologic age, once-intimidating numbers aren’t so difficult to work with, and learn from.aren’t so difficult to work with, and learn from.

…… ??????

5555