The game of Nim (Level 2)

Nim is a two-player game that is played with piles of stones (or markers).

In Extreme Nim, the game begins with three piles of stones (how many stones in each pile is arbitrary, and will be chosen at random for each game).

Players alternate taking turns, where a "turn" consists of taking some or all of the stones from one of the piles. For example, if there were 5 stones in the first pile, 12 in the second pile, and 8 stones in the third pile, then a player could take 1, 2, 3, 4, or 5 stones from the first pile, or 1, 2, ... , or 12 stones from the second pile, or 1, 2, ..., or 8 stones from the third pile. You can't take from more than one pile in the same turn, and you must take at least one stone from one of the piles on your turn.

The winner of the game is the player who plays last -- in other words, when there are no stones left, the player who played last is the winner. (This means that it's a bad idea to take all the stones in the next-to-last pile and leave the other pile for the other player!).

You'll be playing against the computer, so keep your wits sharp!