icamp: game simulation and analysis analysis of the game “poison” sarah eichhorn university of...

26
iCAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

Upload: brianne-blizzard

Post on 01-Apr-2015

215 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

iCAMP: Game Simulation and Analysis

Analysis of the Game “Poison”

Sarah EichhornUniversity of California Irvine

iCAMP Overview Meeting, 5/5/10

Page 2: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

Rules of Poison

• Two players alternate turns

• There are 10 objects

• Each turn a player must take either 1 or 2 objects

• The player to take the last object loses and is “poisoned”

Page 3: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10
Page 4: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

Questions:

• Is Poison a fair game?

• What is the best strategy for each player?

• Are there interesting variants of the game?

Page 5: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

“ If you can't solve a problem, then there is an easier problem you can solve: find it.”

- George Polya

“How to Solve It”

Page 6: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10
Page 7: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10
Page 8: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

# of Objects Winner

1

2

3

4

5

6

7

8

9

10

Page 9: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

# of Objects Winner

1 Player 2

2

3

4

5

6

7

8

9

10

Page 10: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10
Page 11: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

# of Objects Winner

1 Player 2

2 Player 1

3

4

5

6

7

8

9

10

Page 12: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10
Page 13: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

# of Objects Winner

1 Player 2

2 Player 1

3 Player 1

4

5

6

7

8

9

10

Page 14: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

or

Page 15: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

# of Objects Winner

1 Player 2

2 Player 1

3 Player 1

4 Player 2

5

6

7

8

9

10

Page 16: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

# of Objects Winner

1 Player 2

2 Player 1

3 Player 1

4 Player 2

5 Player 1

6 Player 1

7 Player 2

8 Player 1

9 Player 1

10 Player 2

Page 17: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

• Poison is an unfair game!

• With 10 objects, Player 2 should be able to win regardless of what Player 1 does.

• Could we predict who should win with more objects?

Page 18: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

Modular Arithmetic

Modular arithmetic basically only keeps track of the remainder when dividing by a given integer

Ex.) 4=1(mod3) 5=2(mod3) 2=2(mod3) 3=0(mod3) 67=1(mod3)

Page 19: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

# of Objects Winner

1 Player 2

2 Player 1

3 Player 1

4 Player 2

5 Player 1

6 Player 1

7 Player 2

8 Player 1

9 Player 1

10 Player 2

Page 20: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

• Player 2 wins if the # of objects=1(mod3)

Otherwise, Player 1 wins

• Ex.) Poison with 2009 objects

2009/3=669.66667

2009=2(mod3)

Player 1 should have a winning strategy

Page 21: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

Player 2 wins!

Page 22: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

Winning Strategy

• If you are Player 2 when there are 10 objects, you would like to continue having it be your turn when # of objects=1(mod3)

• Therefore, your strategy is always to do the opposite of what your opponent does

ie.) If the other player takes 1, you take 2. If the other player takes 2, you take 1.

Page 23: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

Game Variants

• The variants of Poison are often called Nim

Variants:• Vary the number of objects• Vary number of objects allowed to take per turn• Nim Heaps – Piles of objects, on your turn you

can remove any number of objects from a single pile, including the whole pile.

Page 24: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

Game Theory and Adaptive Learning

• Can we write a program to train a computer to figure out the best strategy to play a game?

• Idea:

- Start by picking moves randomly

- Let the computer play game many times

- Reward the moves that lead to a win and

punish those leading to loss by weighting

the “move” options

Page 25: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10

Conclusions

• You are now a Poison grand master and can always win (provided you can talk the other person to going first!)

• Computational game theory is an exciting area of mathematics with many interesting applications

Page 26: ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10