Get the Wizard's free newsletter!

Monthly, 100% spam-free

Ask the Wizard:

Non-Casino Games

Asked & Answered
Specific Games
Baccarat
Bingo
Blackjack
Caribbean Stud Poker
Craps
Horse Racing
Keno
Let it Ride
Lottery
Pai Gow Poker
Poker
Roulette
Slot Machines
Spanish 21
Sports Betting
Texas Holdem
Three Card Poker
Video Poker
Other Casino Games
Non-Casino Games
TV Game Shows
General Topics
Betting Systems
Boyfriends
Casinos
Dealers
General
Online Gaming
Probability
Table Games in general
Taxes on Winnings
The Wizard himself
Back issues
See old columns
Ask the Wizard!
Submit your question...

You are playing a game that involves three people: (a) yourself, (b) your opponent, and (c) a referee. Each of you picks a real number between 0 and 1 in secret. Once all the numbers have been selected, they are revealed. The player who guessed closest to the referee's number, without going over, wins. If both players go over, or there is a tie, the game is repeated until somebody wins.

Is there a number you can pick that will maximize your chances of winning, if the other player picks randomly? What if the other player has a strategy too? — Andrew from Toronto

I hope you’re happy, I spent all day on this. I probably didn’t need to, but I was overcomplicating the problem, and got bogged down in 8 by 8 matrix algebra. Lesson learned, a simple problem usually has a simple answer.

Getting back to the question at hand, assuming your opponent randomly chooses a number between 0 and 1, you should pick 1/3. That will give you a 8/18 chance of a win, 5/18 chance of a tie, and 5/18 chance of a loss, for an expected win of 1/6 per game.

For my more mathematically inclined readers, I won’t just blurt out the answer to the second part. If you want to know, I posted the answer on my own mathproblems.info, problem 196. March 24, 2008

Je ne pas compre your NIM game! I always thought the key to winning is to leave your opponent (in this case, the computer) with dots that add up to the next lowest number that equals its summary in binary numbers, that is, if I have 17 dots, I take 2 and leave 15, the summary of binary numbers 1,2,4,8. But this doesn't seem to work. Am I right or wrong? – Jack from Troy
You are on the right track with the binary numbers but that is not quite the winning strategy. First, if you can leave your opponent with an odd number of rows of one each then do so. Otherwise break down each row into its binary components. For example, 99 would be 64+32+2+1. Then add up the number of each component over all the rows. Then look for a play that will leave your opponent with an even number of all binary components over all the rows.

Let’s look at an example. Suppose it is your turn with the following scenario.

The following table breaks down each row into its binary components.

Player's Turn 1
Row 1 2 4 8 16
6 0 1 1 0 0
9 1 0 0 1 0
4 0 0 1 0 0
5 1 0 1 0 0
25 1 0 0 1 1
Total 3 1 3 2 1

You can see that there is an odd number of ones, twos, fours, and sixteens. Clearly we need to get the row of 25 under 16 to eliminate the 16 unit. To keep the total of the binary components even we need to remove the 1, add a 2, add a 4, keep the 8, and remove the 16. That means the best play is 2+4+8=14 in the last row. Leaving 14 in the bottom row we have the following.

Computer's Turn 1
Row 1 2 4 8 16
6 0 1 1 0 0
9 1 0 0 1 0
4 0 0 1 0 0
5 1 0 1 0 0
14 0 1 1 1 0
Total 2 2 4 2 0

The computer takes its turn, leaving us with this.

Here is the binary breakdown of that.

Player's Turn 2
Row 1 2 4 8 16
6 0 1 1 0 0
9 1 0 0 1 0
2 0 1 0 0 0
5 1 0 1 0 0
14 0 1 1 1 0
Total 2 3 3 2 0

Here we need to remove a 2 and a 4, to get those totals even. There is only one row, the 14, which has both components. So remove 6 from that, leaving 8.

Computer's Turn 2
Row 1 2 4 8 16
6 0 1 1 0 0
9 1 0 0 1 0
2 0 1 0 0 0
5 1 0 1 0 0
8 0 0 0 1 0
Total 2 2 2 2 0

The computer takes its turn, leaving us with this.

Now we need to change the 1, 4, and 8 columns.

Player's Turn 3
Row 1 2 4 8 16
6 0 1 1 0 0
4 0 0 1 0 0
2 0 1 0 0 0
5 1 0 1 0 0
8 0 0 0 1 0
Total 1 2 3 1 0

That can be done by changing the row of 8 to 5 as follows.

Computer's Turn 3
Row 1 2 4 8 16
6 0 1 1 0 0
4 0 0 1 0 0
2 0 1 0 0 0
5 1 0 1 0 0
5 1 0 1 0 0
Total 2 2 4 0 0

The computer takes its turn, leaving us with this.

Now we need to change the 2 and 4 totals.

Player's Turn 4
Row 1 2 4 8 16
6 0 1 1 0 0
4 0 0 1 0 0
2 0 1 0 0 0
5 1 0 1 0 0
3 1 1 0 0 0
Total 2 3 3 0 0

This can be done by changing the 6 to a 0.

Computer's Turn 4
Row 1 2 4 8 16
0 0 0 0 0 0
4 0 0 1 0 0
2 0 1 0 0 0
5 1 0 1 0 0
3 1 1 0 0 0
Total 2 2 2 0 0

The computer takes its turn, leaving us with this.

Now we need to change the 2s and 4s.

Player's Turn 5
Row 1 2 4 8 16
0 0 0 0 0 0
2 0 1 0 0 0
2 0 1 0 0 0
5 1 0 1 0 0
3 1 1 0 0 0
Total 2 3 1 0 0

This can be accomplished by changing the row of 5 to 3. If you can ever get your opponent to an x,x,y,y situation you can't help but win, if you can maintain the same situation until the end.

Computer's Turn 5
Row 1 2 4 8 16
0 0 0 0 0 0
2 0 1 0 0 0
2 0 1 0 0 0
3 1 1 0 0 0
3 1 1 0 0 0
Total 2 4 0 0 0

The next few moves I keep the computer on x,x,y,y patterns. Here the computer leaves me with 2,2,3,2; so I leave it with 2,2,2,2.

The computer then gives me 2,2,1,2. I leave it with 2,2,1,1.

The computer then leaves me with 2,2,1. I leave it with 2,2. If you can ever get your opponent to two equal rows you can't help but win, just keep the rows equal.

The computer then leaves me with a single pile of 2, and I remove 1.

Here is the end of the game.

August 9, 2006
In your Nov 28, 2002 column you addressed the proper strategy for the game Pearls Before Swine. They also have a sequel called Pearls Before Swine II. How do I beat this version?

I explain in the 11/28/02 column how to play once there are only three rows left. Here is my strategy for four rows. When it is your turn look up the configuration along the left column and play what is on the right column. For example the starting position of 3456 is listed last and shows you should remove 4 pearls from the row with 5, leaving 1346. If the left column says "Lose" there is no way to win if the opponent plays optimal strategy, which the game at Transcience always seems to do.

A pattern to this table seems to be that you should force the opponent to a situation where the sum of the pearls in the smallest and greatest rows equals the sum of the two in the middle. This would include leaving zero in the row with the least number of pearls.

Pearls Before Swine II Strategy
You Have Leave
1111 111
1112 111
1113 111
1114 111
1115 111
1116 111
1122 Lose
1123 1122
1124 1122
1125 1122
1126 1122
1133 Lose
1134 1133
1135 1133
1136 1133
1144 Lose
1145 1144
1146 1144
1155 Lose
1156 1155
1222 1122
1223 1122
1224 1122
1225 1122
1226 1122
1233 123
1234 123
1235 123
1236 123
1244 1144
1245 145
1246 246
1255 1155
1256 Lose
1333 1133
1334 1133
1335 1133
1336 1133
1344 1144
1345 145
1346 Lose
1355 1155
1356 1256
1444 1144
1445 1144
1446 1144
1455 1155
1456 1346
2222 Lose
2223 2222
2224 2222
2225 2222
2226 2222
2233 Lose
2234 2233
2235 2233
2236 2233
2244 Lose
2245 2244
2246 2244
2255 Lose
2256 2255
2333 2233
2334 2233
2335 2233
2336 2233
2344 2244
2345 Lose
2346 1346
2355 2255
2356 2345
2444 2244
2445 2244
2446 2244
2455 2255
2456 2345
3333 Lose
3334 3333
3335 3333
3335 3333
3336 3333
3344 Lose
3345 3344
3346 3344
3355 Lose
3356 3355
3444 3344
3445 3344
3446 3344
3455 3355
3456 1346

Brad S. wrote in to add a general strategy for any number of pearls and rows. First you break down each row into its binary components. For example the starting position of the Transcience game would be as follows.

  • 3 = 2+1
  • 4 = 4
  • 5 = 4+1
  • 6 = 4+2

Then you endeavor to pair up each term. For example in the above there are two 1's, two 2's, and three 4's. So there is an extra 4. You then remove 4 from any of the rows with a 4 term. Keep doing this until you can get your opponent down to 2,2 or an odd number of 1's. March 13, 2006

Say you won a contest where at halftime of an NBA game you got to shoot a free throw and if you make it you win $1 million. Further, you can keep shooting free throws, double or nothing, till you miss or choose to stop. If you're a 75% free throw shooter, when would you stop? Can you ever? At some point the money starts to mean less and less. What would you do? -- Pete from New York

At some point you should refuse a good bet because the stakes are too high. Personally, I think a good measure of the enjoyment one gets from money is the log of the amount. The base of the log does not matter so let's use 10. However, we can't take a log less than 10, so let's say the enjoyment is 0 for any amount less than ten. So in your example let's assume you have $0 before winning the $1,000,000. Now you have log(1,000,000) = 6 units of happiness. The expected value of your happiness taking the free throw is 0.75*log(2,000,000) + 0.25*0 = 4.975772. This is less than 6 so in this case you should take the million and walk. However, it might be different if you already had some money. Let's say you already have $200,000. Then your happiness by walking is log(1,200,000) = 6.07918. Your happiness by risking the million is 0.75*log(2,200,000) + 0.25*log(200,000) = 6.082075, so you marginally take the second shot. If you were to win that your choice would be between log(2,200,000) = 6.34242 and 0.75*log(4,200,000)+0.25*log(200,000) = 6.29269. In this case you should not take a third shot and walk with the $2,000,000 win. The breakeven point for accepting the first double is an existing wealth of $191,487. To accept two doubles you should have $382,975 in other money. Sept. 11, 2005

If dynamite is introduced as an option in the game of rock/paper/scissors, where dynamite beats rock and paper, but scissors beats dynamite, what should the optimal strategy be if two perfect logicians are playing?

First, we can rule out ever playing paper. Regardless of what the other person throws you will make out equal or better by throwing dynamite over paper. Once paper is eliminated, dynamite essentially becomes the new paper, beating rock and losing to scissors. So the perfect strategy is to pick randomly, and with equal probability, between rock, scissors, and dynamite. Sept. 4, 2005

In the game of Yahtzee if only the Yahtzee itself is left on the card what is the probability of making it?

The following table shows the probability of success on the last roll according to the number of additional dice you need to make a Yahtzee.
Last Roll Yahtzee Probabilities
Needed Probability
of Success

0 1
1 0.166667
2 0.027778
3 0.00463
4 0.000772

The next table shows the probabilities of improvement. The left column shows how many dice you need before any given roll and the top column shows how many you need after the roll. The body shows the probability of the given degree of improvement.

Probabilities of Improvement
Need Before Roll 0 1 2 3 4 Total
0 1 0 0 0 0 1
1 0.166667 0.833333 0 0 0 1
2 0.027778 0.277778 0.694444 0 0 1
3 0.00463 0.069444 0.37037 0.555556 0 1
4 0.000772 0.01929 0.192901 0.694444 0.092593 1

The next table shows the probability on the initial roll of needing 0 to 4 more dice to make a Yahtzee.

First Roll Yahtzee Probabilities
Needed Probability
0 0.000772
1 0.019290
2 0.192901
3 0.694444
4 0.092593

The next table shows the probability of improvement and then eventual success according to the number needed after the first roll. For example, if the player needs 3 more dice to make a Yahtzee the probability of improving to needing 2 more after the second roll and making the Yahtzee on the third roll is 0.010288066.

Probabilities of Yahtzee after first roll according to number needed before and after second roll

Need Before Roll 0 1 2 3 4 Total
0 1 0 0 0 0 1
1 0.166667 0.138889 0 0 0 0.305556
2 0.027778 0.046296 0.01929 0 0 0.093364
3 0.00463 0.011574 0.010288 0.002572 0 0.029064
4 0.000772 0.003215 0.005358 0.003215 0.000071 0.012631

To get the final answer take the dot product of the number needed after the first roll (two tables up) and the probability of eventual success in the final column (one table up). This is 0.092593*0.012631 + 0.694444*0.029064 + 0.192901*0.093364 + 0.019290*0.305556 + 0.000772*1 = 4.6028643%. To confirm this, I did a 100,000,000 game simulation and the simulated probability was 4.60562%. Dec. 13, 2004

What is the house edge in solitaire?

I don't know. If you find out please tell me. I'm particularly interested because Cryptologic casinos just introduced two versions of Klondike solitaire. Nov. 8, 2004

Who has the advantage in Risk when the attacker rolls three dice and the defender rolls two?

For those who aren't familiar with the game, Risk is the greatest board game ever made. Those who haven't played haven't lived yet. To answer your question, in the common 3 on 2 battle the following are the possible outcomes:
  • Defender loses both: 37.17%
  • Each loses one: 33.58%
  • Attacker loses both: 29.26% Oct. 8, 2004

What is your advice for playing rocks/paper/scissors?

The best piece of advice anywhere on this site may be this: The first round, ALWAYS PICK PAPER. That is because amateur players tend to pick rock the first time. Just hold out your hand in each position, one at a time, and you'll see that rock is the most comfortable and natural choice. If you play repeated rounds you should pick whatever would beat your opponent the last round with probability less than one-third. This is because I believe amateurs repeat less than one-third of the time. If playing a pro who you fear can get into your head then randomize by looking at the second hand of your watch, divide the number of seconds by three and take the remainder, then map the remaider as follows 0=rock, 1=scissors, 2=paper (or any other mapping as long as determined in advance). So the next time you go to a restaurant Dutch style, I suggest playing a single round for the check and then pick paper. You can thank me later. Sept. 30, 2004

What set in monopoly is the best?

I like the orange set the best. It offers the best return on investment. For example a hotel costs $500 on the orange set and the average rent is $966.67, for a rent to expense ratio of 1.93. The only set with a higher ratio is the light blue set, at 2.27. However, the maximum rent on the light blues is only $600. The rents with three houses on the oranges are the same as the hotels on the light blues, but cost 20% less, with room to build more. Also, the oranges are ripe for landing on just coming out of jail. So take my advice and when trading try to get the orange set. Jan. 31, 2004

Hi, at www.transience.com.au/pearl.html there is a game called Pearls for Swine. The pearls are grouped into three rows (5+4+3) ,and on your turn you may remove as many pearls as you like from one row. The object of the game is to leave the last of the pearls for your opponent to take. The player (me) always starts, (and always loses). Why do I never win? My opponent has a cunning system to always win, can you reveal his secret? Regards, Atle Skau from Porsgrunn, Norway

Start by taking 2 pearls from the row with 3 pearls. Regardless of what the computer does, try to force him onto 1+2+3 or 0+x+x (where x>1). You will then be able to force a win if you just think ahead a few moves. Nov. 28, 2002

What are the odds of winning a standard game of Klondike Solitaire as in the Windows version? - James Wyatt from Greeley, USA

I'm afraid I don't know. In the early days of Vegas they used to offer solitaire, I think Klondike, as a form of gambling but I don't know the exact betting rules. The odds on this would be very hard to figure out. May 1, 2001

Bank of America is offering to triple a selected deposit a day made at an ATM. The contest is for about 2 months. Are my odds better when depositing $300...to make three deposits of $100 or one of $300...or are my overall odds so low that the difference isn't worth the effort? -Daniel from Las Vegas, USA

Your expected win is the same regardless of how many times you divide your total deposits. A good strategy would be to deposit and withdraw the same money over and over as many times as possible. However, your odds may be so bad that it isn't worth the bother. Feb. 10, 2001

How do you win money playing solitaire in Vegas? --Pattie from Arlington, USA

I have never seen solitaire played for money in Vegas. I understand in the early days of Vegas people wagered on the standard Klondike variation of solitaire but I don't know anything else about it. Nov. 11, 2000

I like to play the game liars poker with dollar bills. what is the probability of getting any 1,2,3,4, or 5 of the same number on a bill. thank you. If I am playing with 3 people, what is the probability of any 1 number showing up. - John from New York

First let me answer the unasked question on the probability that a specific number will show up n times on a random bill. There are 8 digits on a bill so the probability of n of a specific number is combin(8,n)*98-n/108. The following are these probabilities for n=0 to 8.
0
0.43046721
1
0.38263752
2
0.14880348
3
0.03306744
4
0.00459270
5
0.00040824
6
0.00002268
7
0.00000072
8
0.00000001

Next is the probability that any number will appear n times on a dollar bill, where no other number appears more than n times.

 

0
0.0181440
1
0.6191640
2
0.3124800
3
0.0458955
4
0.0045927
5
0.0040824
6
0.0002268
7
0.0000072
8
0.0000001

I interpret your last question to be what is the probability that a specific number will show up at least once on at least 1 of 3 bills. The answer is 1-(9/10)24=.920234. Aug. 13, 2000

©1998-2010 Wizard Of Odds Consulting, Inc. All rights reserved.   Privacy/Terms   Contact   Advertise   About Us   Links

The Wizard's other sites: Wizard of Vegas, Wizard of Macau, Math Problems The Wizard recommends: The Bear Growls,   Casinomeister, Online Casino Suite