Sunday, February 19, 2012

Fun Math Games - Monty Hall and Nim

You unlock this door with the key of imagination.  Behind it is another dimension.  A dimension of goats.  A dimension of cars.  A dimension of counter-intuitive probability tricks with which you can astound your friends.    You're moving into a land of both shadow and substance, of things and ideas.  You've just crossed over into:  The Math Games Zone.

Monty Hall's Flying Circus:

The premise:  Gameshow host Monty Hall gives you three doors to choose from.  Behind one of the doors is a brand new Tesla Roadster, behind two of the doors are common goats.  You are to choose a door and walk away with whatever is behind it.  You pick one door.  Monty then opens one of the two remaining doors to show you a goat.  Monty then presents you with a choice:  Do you stick with your current unopened door or do you switch to the OTHER unopened door.

At first, one might think that it doesn't matter whether you switch or not. We might say "One door has a goat, the other has a car, it's 50-50 now so it doesn't make a difference."

Of course, that's wrong.  It's actually in your best interest to switch doors (if you value cars over goats, that is).  Here's why:  If you switch once the third door has been eliminated, you are guaranteed to get the opposite of whatever it was that you selected at first.  If you selected the car, you'll get a goat and if you selected a goat, you'll get the car.  When you initially chose your first door, you only had a 1/3 chance of getting the car.  Since switching reverses your odds, that means if you switch, you now have a 1/3 chance of getting not-the-car —in other words you have a 2/3 chance of getting the car.  You will win two out of three times if you switch.  Try it with some playing cards or coins —it really works!

If you want to try it out, this cool interactive game from the New York Times explains the Monty Hall Problem:

The Secret of Nim:

The Premise:  In Nim, you have several piles or rows of objects (marbles, for example) of differing number, and a partner.  You each take turns removing the marbles from the piles/rows, but you can only take marbles from one row at a time.  The person who is left with the last marble loses.

There is a great series of flash-based Nim games out there called "pearls before swine"
Pearls Before Swine
Pearls Before Swine 2
Pearls Before Swine 3

If you don't know the theory behind this game it can be absolutely maddening.
It doesn't help that there's more than one way of learning to win at Nim, and one includes learning binary (which is kind of unreasonable)

But there is also a more organic way of doing it and it works like so:

Look at the rows of objects one at a time and count off groups of 1, 2, 4, 8, 16 (and other doubles) in *descending order* that is, start with the biggest number you can find, and work your way down.

For example:
ooooo - this row has one 4 and one 1
oooo - this row has one 4
ooo - this row has one 2 and one 1
oo - this row has one 2
o - this row has one 1

Every time you make a move, make sure that there are an even number of every kind of group.  (Think of it like each group needs to be cancelled out by a group of equal size)
in the above configuration, there are two 4s, two 2s, but three 1s.  You'll need to remove one of those 1s.

Similarly, in this screwy setup:

ooooooo - one 4, one 2, one 1
ooooooooooo - one 8, one 2, one 1
ooo - one 2, one 1

You'll want to remove SEVEN marbles from the second row, so that it becomes

ooooooo - one 4, one 2, one 1
oooo - one 4
ooo - one 2, one 1

By sticking to this pattern, you can repeatedly trick your opponent into cornering himself.

Note:  this stops working when you get lower than a pair of 2 in one row and 2 in another row.
Never leave your opponent with a row of one or you're doomed.
Also, you can create an odd configuration if it's three rows with one marble each, because your opponent will need to make it two rows of one during his turn, dooming himself.

Mastering this game feels great, and you can use it to confound all your pals.

Go and enjoy The Number Games.

1 comment:

  1. Pearls before swine is BRUTAL. I tried figuring it out for an hour on my own and barely got the inkling that I needed to force him into the following configuration:


    I of course looked up on line how to solve it. lol, SO difficult.