complexity of games & puzzles - mit opencourseware · reproduced by permission of taylor and...

35
b un Complexity of Games & Puzzles Complexity of Games & Puzzles [Demaine, Hearn & many others] [Demaine, Hearn & many others] ounded bounded NP PSPACE EXPTIME P Undecidable NEXPTIME PSPACE PSPACE Rengo Kriegspiel? bridge? Image courtesy of Jason Whittaker . Courtesy of BigJ_Smack Image courtesy of Nguyen Dai . Image courtesy of Herman Hiddema Image courtesy of Marie-Lan Nguyen . Image courtesy of PartsnPieces. Image is in the public domain . Courtesy of Sam Cancilla . Used with permission. Courtesy of Glenn Peters. Used with permission. 0 players 1 player 2 players team, (simulation) (puzzle) (game) imperfect info Images by MIT OpenCourseWare. 1

Upload: others

Post on 11-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

bun

Complexity of Games & PuzzlesComplexity of Games & Puzzles[Demaine, Hearn & many others][Demaine, Hearn & many others]

ound

ed

boun

ded

NP

PSPACE EXPTIME

P

Undecidable

NEXPTIMEPSPACE

PSPACE

Rengo Kriegspiel?

bridge?

Image courtesy of Jason Whittaker.

Courtesy of BigJ_Smack

Image courtesy of Nguyen Dai.

Image courtesy of Herman Hiddema

Image courtesy of Marie-Lan Nguyen.

Image courtesy of PartsnPieces.

Image is in the public domain.

Courtesy of Sam Cancilla. Used with permission.

Courtesy of Glenn Peters. Used with permission.

0 players 1 player 2 players team, (simulation) (puzzle) (game) imperfect info

Images by MIT OpenCourseWare.

1

Page 2: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Constraint LogicConstraint Logic[Hearn & Demaine 2009][Hearn & Demaine 2009]

boun

ded

unbo

unde

d

PSPACE EXPTIME

P

Undecidable

NEXPTIME

PSPACE

NP PSPACE

0 players 1 player 2 players team, (simulation) (puzzle) (game) imperfect info

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

2

Page 3: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Constraint GraphsConstraint Graphs

Machine = graph,red & blue edges

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 3

Page 4: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Constraint GraphsConstraint Graphs

Machine state= orientation

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

constraint graph

4

Page 5: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Constraint LogicConstraint Logic

= 11 1

= 2 2

Rule: at least 2 unitsincoming at a vertex

Move: reverse an edge, preserving RuleCopyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

5

Page 6: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

AND vertexAND vertex

FT F TT T inputs1 1

1 1

2 output

F T

not your usual Rule: at least 2 units AND gate! incoming at a vertex

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

6

Page 7: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

SPLIT vertexSPLIT vertex

T T FF F outputs1

1 1

2 input

T F

Rule: at least 2 units incoming at a vertex

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

7

Page 8: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

OR vertexOR vertex

FT F TT T inputs2 2

2 2

2 output

TF T

not your usual Rule: at least 2 unitsOR gate! incoming at a vertex

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

8

Page 9: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Decision ProblemDecision Problem

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

can you reverse this edge?

9

Page 10: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Constraint LogicConstraint Logic[Hearn & Demaine 2009][Hearn & Demaine 2009]

boun

ded

unbo

unde

d

PSPACE EXPTIME

P

Undecidable

NEXPTIME

PSPACE

NP PSPACE

0 players 1 player 2 players team, (simulation) (puzzle) (game) imperfect info

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 10

Page 11: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Decision ProblemDecision Problem

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

can you reverse this edge?

Theorem: PSPACE-complete

11

Page 12: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

SlidingSliding--BlockBlockPuzzlesPuzzles

Courtesy of Dr. Jim Storer. Used with permission.

12

Page 13: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

SlidingSliding--Block PuzzlesBlock PuzzlesCorollary:[Hearn & Demaine 2002][Hearn & Demaine 2002] PSPACE-complete

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 13

Page 14: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

SlidingSliding--Block PuzzlesBlock PuzzlesCorollary:[Hearn & Demaine 2002][Hearn & Demaine 2002] PSPACE-complete

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 14

Page 15: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Wiring Vertices TogetherWiring Vertices Together

AND wants red OR wants blue

2 OR

AND 1

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 15

Page 16: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

RedRed--Blue ConversionBlue Conversion

assume an even number of conversionsCopyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

16

Page 17: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

RedRed--Blue ConversionBlue Conversion

assume an even number of conversionsCopyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 17

Page 18: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

BooleanBooleanFormulasFormulas

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. DeReproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

maine.18

Page 19: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Quantified Boolean FormulasQuantified Boolean Formulas (QBF)(QBF)

x x y y w w z z

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

19

Page 20: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Existential QuantifierExistential Quantifier

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 20

Page 21: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

Universal QuantifierUniversal Quantifier

21

Page 22: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

LatchLatch

A

Blockedun

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

22

Page 23: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Universal QuantifierUniversal Quantifier

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 23

Page 24: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Crossover GadgetCrossover Gadget

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 24

Page 25: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

OR fromOR fromProtector ORProtector OR

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 25

Page 26: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Rush HourRush Hour[Hearn & Demaine 2002][Hearn & Demaine 2002]

PSPACE-completeness known [Flake & Baum 2002]Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

26

Page 27: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

TriangularTriangularRush HourRush Hour[Hearn & Demaine 2009]

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 27

Page 28: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Open: 1Open: 1××1 Rush Hour1 Rush Hour[Tromp & Cilibrasi 2008][Tromp & Cilibrasi 2008]

• P or PSPACE-complete or …?

Image courtesy of John Tromp. Used with permission.

28

Page 29: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Plank PuzzlesPlank Puzzles [Hearn 2004][Hearn 2004]

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

29

Page 30: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

SokobanSokoban[Hearn & Demaine 2002][Hearn & Demaine 2002]

PSPACE-completeness known [Culberson 1998]Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc.

30

Page 31: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

PushPush--2F2F[Demaine, Hearn, Hoffmann 2002][Demaine, Hearn, Hoffmann 2002]

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 31

Page 32: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Constraint LogicConstraint Logic[Hearn & Demaine 2009][Hearn & Demaine 2009]

boun

ded

unbo

unde

d

PSPACE EXPTIME

P

Undecidable

NEXPTIME

PSPACE

NP PSPACE

0 players 1 player 2 players team, (simulation) (puzzle) (game) imperfect info

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32

Page 33: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

Constraint LogicConstraint Logic[Hearn & Demaine 2009][Hearn & Demaine 2009]

boun

ded

unbo

unde

d

PSPACE EXPTIME

P

Undecidable

NEXPTIME

PSPACE

NP PSPACE

0 players 1 player 2 players team, (simulation) (puzzle) (game) imperfect info

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 33

Page 34: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

AmazonsAmazons[Hearn 2005][Hearn 2005]

fanout

Copyright (2009) From Games, Puzzles, and Computation by Robert A. Hearn and Erik D. Demaine.Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 34

Page 35: Complexity of Games & Puzzles - MIT OpenCourseWare · Reproduced by permission of Taylor and Francis Group, LLC, a division of Informa plc. 32. Constraint Logic [Hearn & Demaine 2009]

MIT OpenCourseWarehttp://ocw.mit.edu

ES.268 The Mathematics in Toys and GamesSpring 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.