# Enigmatic Code

Programming Enigma Puzzles

## Puzzle #135: You don’t know jackpot

I figured something was wrong with the slot machine in Pete’s Gas Station when I saw the peeling paint on top. But I knew for certain when I put in 50 cents, got three 7s, and nothing came out.

There are three possible symbols: cherries, a melon and a 7. It should have given me \$5 for all three 7s, \$2 for two 7s, and \$1 if only the rightmost symbol was a 7.

“Oh, it’s fine”, said Pete. “Three 7s was the old jackpot setting. I’ve got the new jackpot written down… it’s here somewhere”. While he was searching, I saw a woman play five times and get the following:

“House always wins”, she muttered before leaving. Pete wandered in: “Sorry, can’t seem to find it”. “No problem”, I said, “I think I’ve got it”.

What is the jackpot setting?

[puzzle#135]

### 6 responses to “Puzzle #135: You don’t know jackpot”

1. Jim Randell 16 October 2021 at 10:25 am

I thought this puzzle could do with a bit more explanation.

This is what I assumed:

– The new jackpot is some 3-sequence with elements chosen from: (7, Melon, Cherries).

– When a play is made the 3-sequence is matched, position-wise against the jackpot, and the prizes are: \$5 if all three match; \$2 if there are two matches; \$1 if just the rightmost value matches.

– (7, 7, 7) resulted in zero winnings.

– The total winnings made by the five illustrated plays was less than \$2.50 (the cost of 5 plays).

Under these conditions I find a unique sequence for the new jackpot.

The following Python program runs in 53ms.

Run: [ @replit ]

```from enigma import subsets, join, printf

# check winning values against jackpot
def win(vs, js):
# count the number of matches (per column)
k = sum(x == y for (x, y) in zip(vs, js))
# all 3 the same
if k == 3: return 500
# 2 the same
if k == 2: return 200
# RH column the same
if k == 1 and js[-1] == vs[-1]: return 100
# otherwise, lose
return 0

# consider possible jackpots
for js in subsets('7MC', size=3, select="M"):
# setter got no payout for 777
if win('777', js) != 0: continue
# woman played 5 times, but ended up down
w = sum(win(vs, js) for vs in ['MCC', 'CM7', 'M7M', '7MC', 'CCM'])
if w < 250:
printf("{js} -> {w}", js=join(js, sep=" ", enc="()"))
```

Solution: The new jackpot is: (Cherries, 7, Cherries).

So the five illustrated plays won \$2.00 (both (M, C, C) and (7, M, C) win \$1), for a cost of \$2.50.

2. Hugh Casement 16 October 2021 at 11:39 am

There are 27 possible results, so the machine collects an average of \$13.50 in stake money while paying out \$5 + 5 × \$2 + 4 × \$1 = \$19. That doesn’t sound like a bargain for the house! I suspect the \$2 is paid out only when a particular two match, not just any two.

• Jim Randell 16 October 2021 at 12:01 pm

@Hugh: Assuming the symbols appear with the same frequency.

If (with the 777 jackpot), there is only one 7 symbol on each reel, but multiple copies of the other symbols it would change the odds in the house’s favour.

• Hugh Casement 16 October 2021 at 5:35 pm

Thanks, Jim. I admit I’ve never been tempted to try one of those fruit machines (slot machine, in British usage, means what I think North Americans call a vending machine).
In fact I appear to have miscalculated: there would be six ways of winning \$2 if each wheel bears only three symbols.
However, on the principle that such a machine should pay out a fairly large proportion of the stake money, to encourage people to keep playing, we should probably have nine symbols on each wheel, two of which are 7 (assuming the \$5 pay-out goes to three 7s). I think the pay-out then comes to about 0.84 of the takings in the long term.
Three out of thirteen would give a greater proportional pay-out, but it might be hard to fit so many symbols round the circumference of a wheel.

This site uses Akismet to reduce spam. Learn how your comment data is processed.