# Pearls before swine

1. Mar 24, 2005

### BicycleTree

2. Mar 24, 2005

### T@P

there is a strategy. if there are 2 piles (rows whatever) then if you go first you must take out of the larger pile to make them the same size. then whatever you opponent does, just copy him. that way you win. im not sure about 3 piles, but i imagine its similar.

3. Mar 24, 2005

### T@P

in three piles i havent come up with a strategy yet but the idea i think is to make sure you dont end up with two rows with equal size... in fact you want him to end the third row while the other two have different sizes.

4. Mar 24, 2005

### BicycleTree

That's not a simple strategy. For Nim there is a simple way to win no matter how many rows there are. There must be some way to speed the computation because I just wrote a Java program to find the right move and although it works, it's taking forever on this problem (rows with 5, 7, and 11). Whereas Juan in the game can move very quickly. Of course my algorithm is very inefficient and recursive, needlessly re-calculating positions many (probably millions, in this case) of times.

Last edited: Mar 24, 2005
5. Mar 25, 2005

### BicycleTree

Confim: There Is a simple strategy and it's a lot like the strategy for Nim. I just got to level 11, 10-2 my favor since I made a couple mistakes at the beginning. Now this is a real brain teaser. (fair to use Google to find the strategy for normal nim)

Further brain teaser (that I haven't solved): How do you prove that the strategy works?

6. Mar 27, 2005

### Hellstorm

You can beat it realy easy... just open 2 games up... have one start first, then after he has started, you follow behind doing the exact same thing on the other one... and at the end, you will win... Oh, wait... that don't work for the 3ed version... anyway... on 1 and 2 it does... oh, too bad....

Last edited: Mar 27, 2005
7. Mar 28, 2005

### Galileo

The strategy for Nim where you have win if you take the last pearl is very similar.
In fact, you can use the exact same strategy and only change your moves at the end when you can clearly see what the right move is. I got me to level 23, then made a stupid mistake by trying to take back a move by rewinding the flash applet. Then it crashed.

8. Mar 28, 2005

### BicycleTree

Yup! That's the strategy.