How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper •...
Transcript of How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper •...
![Page 1: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/1.jpg)
How Complicated is Minesweeper?Richard Kaye
http://web.mat.bham.ac.uk/R.W.Kaye/
Birmingham University
ASE2003 – p. 1
![Page 2: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/2.jpg)
Minesweeper
• Minesweeper is a familiar computer gamerequiring you to locate the mines in aminefield without being blown up.
• When skilfully played, the task can becompleted without having to take many riskyguesses!
ASE2003 – p. 2
![Page 3: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/3.jpg)
Minesweeper
• Minesweeper is a familiar computer gamerequiring you to locate the mines in aminefield without being blown up.
• When skilfully played, the task can becompleted without having to take many riskyguesses!
• In fact the complexity of minesweeper is related to animportant unsolved problem in mathematics, which inturn relates to cracking codes on the internet.
ASE2003 – p. 2
![Page 4: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/4.jpg)
Playing the game
Does (2,6) have a mine?
ASE2003 – p. 3
![Page 5: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/5.jpg)
Playing the game
These must have mines
ASE2003 – p. 3
![Page 6: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/6.jpg)
Playing the game
Does (5,2) have a mine?
ASE2003 – p. 3
![Page 7: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/7.jpg)
Playing the game
If so, does (5,7) have a mine?
ASE2003 – p. 3
![Page 8: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/8.jpg)
Playing the game
If (5,2) and (5,7) have mines
ASE2003 – p. 3
![Page 9: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/9.jpg)
Playing the game
If (5,2) has a mine but (5,7) hasn’t
ASE2003 – p. 3
![Page 10: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/10.jpg)
Playing the game
If (5,2) is clear
ASE2003 – p. 3
![Page 11: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/11.jpg)
Playing the game
So (2,6) is clear!
ASE2003 – p. 3
![Page 12: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/12.jpg)
A puzzle
Determine the location of all mines!
ASE2003 – p. 4
![Page 13: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/13.jpg)
A puzzle
Can this be a mine?
ASE2003 – p. 4
![Page 14: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/14.jpg)
A puzzle
If this is a mine the one next to it is clear. . .
ASE2003 – p. 4
![Page 15: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/15.jpg)
A puzzle
So. . .
ASE2003 – p. 4
![Page 16: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/16.jpg)
A puzzle
. . . which is impossible!
ASE2003 – p. 4
![Page 17: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/17.jpg)
A puzzle
Therefore. . .
ASE2003 – p. 4
![Page 18: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/18.jpg)
A puzzle
Solved!
ASE2003 – p. 4
![Page 19: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/19.jpg)
What is the question?
• Minesweeper appears to be difficult to playwell. How difficult is it?
ASE2003 – p. 5
![Page 20: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/20.jpg)
What is the question?
• Minesweeper appears to be difficult to playwell. How difficult is it?
• To formulate this question precisely we needto specify what we mean by playing ‘well’. Wecan at least assume a good player will nottake stupid risks:
ASE2003 – p. 5
![Page 21: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/21.jpg)
What is the question?
• Minesweeper appears to be difficult to playwell. How difficult is it?
• To formulate this question precisely we needto specify what we mean by playing ‘well’. Wecan at least assume a good player will nottake stupid risks:
• We want to play in such a way that we nevermake a risky move when there is somesquare which can be uncovered safely.
ASE2003 – p. 5
![Page 22: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/22.jpg)
The consistency problem
• Given a minesweeper configuration, is itconsistent? I.e., could it have arisen fromsome pattern of mines?
ASE2003 – p. 6
![Page 23: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/23.jpg)
The consistency problem
• Given a minesweeper configuration, is itconsistent? I.e., could it have arisen fromsome pattern of mines?
• To determine if a square is free of any mineschange the configuration marking it with amine. Then ask if the result is consistent. Ifnot, it is safe to clear the square!
ASE2003 – p. 6
![Page 24: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/24.jpg)
How might we solve it?
• Problems like this are quite general andrequire a computer algorithm or computerprogram as the solution.
ASE2003 – p. 7
![Page 25: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/25.jpg)
How might we solve it?
• Problems like this are quite general andrequire a computer algorithm or computerprogram as the solution.
• There is an algorithm that solves this problemand solves the consistency problem. All youneed to do is go though all the differentcombinations for the mines on the minefield inturn.
ASE2003 – p. 7
![Page 26: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/26.jpg)
So what’s the difficulty?
• Typical minesweeper configurations havemany squares. (The so-called ‘advanced’board has 99 mines in 480 squares, that’s5602209993374213454290589857758. . . 9570631168198385673295159633481600
or over 10100 possible ways of placing these99 mines.)
ASE2003 – p. 8
![Page 27: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/27.jpg)
So what’s the difficulty?
• Typical minesweeper configurations havemany squares. (The so-called ‘advanced’board has 99 mines in 480 squares, that’s5602209993374213454290589857758. . . 9570631168198385673295159633481600
or over 10100 possible ways of placing these99 mines.)
• No known method can search through allthese possibilities in reasonable time.
ASE2003 – p. 8
![Page 28: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/28.jpg)
Can we avoid this difficulty?
• Possibly. In fact no-one knows the answer tothis question.
ASE2003 – p. 9
![Page 29: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/29.jpg)
Can we avoid this difficulty?
• Possibly. In fact no-one knows the answer tothis question.
• We can hope for a fast or efficient algorithmthat takes time proportional to a fixedpolynomial in the number of squares in theinput configuration (Polynomial Time) ratherthan Exponential Time.
ASE2003 – p. 9
![Page 30: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/30.jpg)
Can we avoid this difficulty?
• Possibly. In fact no-one knows the answer tothis question.
• We can hope for a fast or efficient algorithmthat takes time proportional to a fixedpolynomial in the number of squares in theinput configuration (Polynomial Time) ratherthan Exponential Time.
• However, it seems unlikely that such analgorithm exists.
ASE2003 – p. 9
![Page 31: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/31.jpg)
A wire
Minesweeper is complicated by the fact thatsomething in one part of the board can affect the
whole board.
ASE2003 – p. 10
![Page 32: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/32.jpg)
A wire
Minesweeper is complicated by the fact thatsomething in one part of the board can affect the
whole board.
ASE2003 – p. 10
![Page 33: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/33.jpg)
A wire
Minesweeper is complicated by the fact thatsomething in one part of the board can affect the
whole board.
ASE2003 – p. 10
![Page 34: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/34.jpg)
A wire
Minesweeper is complicated by the fact thatsomething in one part of the board can affect the
whole board.
ASE2003 – p. 10
![Page 35: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/35.jpg)
A splitter
Use this to split, bend, or ‘invert’ wires.
ASE2003 – p. 11
![Page 36: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/36.jpg)
A splitter
Use this to split, bend, or ‘invert’ wires.
ASE2003 – p. 11
![Page 37: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/37.jpg)
A crossover
Use this to cross two wires over!
ASE2003 – p. 12
![Page 38: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/38.jpg)
A crossover
Use this to cross two wires over!
ASE2003 – p. 12
![Page 39: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/39.jpg)
A crossover
Use this to cross two wires over!
ASE2003 – p. 12
![Page 40: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/40.jpg)
A crossover
Use this to cross two wires over!
ASE2003 – p. 12
![Page 41: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/41.jpg)
An XOR gate
ASE2003 – p. 13
![Page 42: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/42.jpg)
An XOR gate
ASE2003 – p. 13
![Page 43: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/43.jpg)
An XOR gate
ASE2003 – p. 13
![Page 44: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/44.jpg)
An AND gate
An AND gate. . .ASE2003 – p. 14
![Page 45: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/45.jpg)
An AND gate
. . . and its internal wires.ASE2003 – p. 14
![Page 46: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/46.jpg)
An AND gate
If t is a mine. . .ASE2003 – p. 14
![Page 47: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/47.jpg)
An AND gate
If t is not a mine. . .ASE2003 – p. 14
![Page 48: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/48.jpg)
An OR gate
An OR gate. . .
ASE2003 – p. 15
![Page 49: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/49.jpg)
An OR gate
. . . with the internal wires shown.
ASE2003 – p. 15
![Page 50: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/50.jpg)
An OR gate
If r is free. . .
ASE2003 – p. 15
![Page 51: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/51.jpg)
An OR gate
If r has a mine (case 1). . .
ASE2003 – p. 15
![Page 52: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/52.jpg)
An OR gate
If r has a mine (case 2). . .
ASE2003 – p. 15
![Page 53: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/53.jpg)
Minesweeper electronics
• Wire: allows us to carry signals around
ASE2003 – p. 16
![Page 54: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/54.jpg)
Minesweeper electronics
• Wire: allows us to carry signals around• Splitter: allows us to bend, split and invert
signals in wires
ASE2003 – p. 16
![Page 55: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/55.jpg)
Minesweeper electronics
• Wire: allows us to carry signals around• Splitter: allows us to bend, split and invert
signals in wires• Crossover: allows us to make arbitrary
circuits in the plain
ASE2003 – p. 16
![Page 56: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/56.jpg)
Minesweeper electronics
• Wire: allows us to carry signals around• Splitter: allows us to bend, split and invert
signals in wires• Crossover: allows us to make arbitrary
circuits in the plain• Logic gates: NOT AND OR XOR, etc.
ASE2003 – p. 16
![Page 57: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/57.jpg)
NP-completeness
• We can build any logic circuits inminesweeper, so. . .
ASE2003 – p. 17
![Page 58: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/58.jpg)
NP-completeness
• We can build any logic circuits inminesweeper, so. . .
• An algorithm solving the minesweeperconsistency problem would allow us to solvequestions about simple (propositional) logic.
ASE2003 – p. 17
![Page 59: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/59.jpg)
NP-completeness
• We can build any logic circuits inminesweeper, so. . .
• An algorithm solving the minesweeperconsistency problem would allow us to solvequestions about simple (propositional) logic.
• Many other problems can be phrased as logicproblems and therefore reduced tominesweeper consistency problems.
ASE2003 – p. 17
![Page 60: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/60.jpg)
NP-completeness
• We can build any logic circuits inminesweeper, so. . .
• An algorithm solving the minesweeperconsistency problem would allow us to solvequestions about simple (propositional) logic.
• Many other problems can be phrased as logicproblems and therefore reduced tominesweeper consistency problems.
• The Minesweeper Consistency Problem isNP-complete.
ASE2003 – p. 17
![Page 61: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/61.jpg)
Some interesting NP problems
• The travelling salesman problem
ASE2003 – p. 18
![Page 62: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/62.jpg)
Some interesting NP problems
• The travelling salesman problem• Many other problems is scheduling, packing,
decision maths, etc.
ASE2003 – p. 18
![Page 63: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/63.jpg)
Some interesting NP problems
• The travelling salesman problem• Many other problems is scheduling, packing,
decision maths, etc.• Other games, such as Tetris
ASE2003 – p. 18
![Page 64: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/64.jpg)
Some interesting NP problems
• The travelling salesman problem• Many other problems is scheduling, packing,
decision maths, etc.• Other games, such as Tetris• Factorizing integers
ASE2003 – p. 18
![Page 65: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/65.jpg)
Some interesting NP problems
• The travelling salesman problem• Many other problems is scheduling, packing,
decision maths, etc.• Other games, such as Tetris• Factorizing integers• Determining a computer user’s secret key
from his public key
ASE2003 – p. 18
![Page 66: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/66.jpg)
The P equals NP question
• The ‘P equals NP question’ asks if every NPproblem has an efficient algorithm. No-oneknows the answer! A prize of $1,000,000 hasbeen offered for a proof either way.
ASE2003 – p. 19
![Page 67: How Complicated is Minesweeper?web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf · Minesweeper • Minesweeper is a familiar computer game requiring you to locate the mines in a minefield](https://reader034.fdocuments.in/reader034/viewer/2022042103/5e80fd9724cbb73a941d3d0a/html5/thumbnails/67.jpg)
The P equals NP question
• The ‘P equals NP question’ asks if every NPproblem has an efficient algorithm. No-oneknows the answer! A prize of $1,000,000 hasbeen offered for a proof either way.
• It would suffice to show• either that the minesweeper consistency
problem has and efficient solution• or that there is no such algorithm for the
minesweeper consistency problem
ASE2003 – p. 19