Presentation is loading. Please wait.

Presentation is loading. Please wait.

Easy, Hard, and Impossible Elaine Rich. Easy Tic Tac Toe.

Similar presentations


Presentation on theme: "Easy, Hard, and Impossible Elaine Rich. Easy Tic Tac Toe."— Presentation transcript:

1 Easy, Hard, and Impossible Elaine Rich

2 Easy

3 Tic Tac Toe

4 Hard

5 Chess

6 The Turk Unveiled in 1770.

7 Searching for the Best Move A B C D E F G H I J K L M (8) (-6) (0) (0) (2) (5) (-4) (10) (5)

8 How Much Computation Does it Take? Middle game branching factor  35 Lookahead required to play master level chess  8 35 8 

9 How Much Computation Does it Take? Middle game branching factor  35 Lookahead required to play master level chess  8 35 8  2,000,000,000,000 Seconds in a year 

10 How Much Computation Does it Take? Middle game branching factor  35 Lookahead required to play master level chess  8 35 8  2,000,000,000,000 Seconds in a year  31,536,000 Seconds since Big Bang  300,000,000,000,000,000

11 The Turk Still fascinates people.

12 How Did It Work?

13 A Modern Reconstruction Built by John Gaughan. First displayed in 1989. Controlled by a computer. Uses the Turk’s original chess board.

14 Chess Today In 1997, Deep Blue beat Garry Kasparov.

15 Seems Hard But Really Easy

16 Nim The player who takes the last stick(s) wins. At your turn, you must choose a pile, then remove as many sticks from the pile as you like.

17 Nim Now let’s try:

18 Nim Now let’s try: Oops, now there are a lot of possibilities to try.

19 Nim http://www.gamedesign.jp/flash/nim/nim.html

20 Decimal Numbers 100001000100101 8989

21 Decimal Numbers 100001000100101 8989 587

22 Decimal Numbers 100001000100101 8989 567567 34765

23 Decimal Numbers 100001000100101 8989 567567 3476534785

24 Binary Numbers 168421 5

25 Binary Numbers 168421 5101 9

26 Binary Numbers 168421 5101 91001 21

27 Binary Numbers 168421 5101 91001 2110101 3

28 Binary Numbers 168421 5101 91001 2110101 311 16

29 Binary Numbers 168421 5101 91001 2110101 311 1610000

30 Nim 10 (2) 11 (3) 11 To form the last row: XOR each column. My turn: XOR: if number of 1’s is even:0 if number of 1’s is odd:1

31 Nim 10 (2) 11 (3) 11 For the current player: Guaranteed loss if last row is all 0’s. Guaranteed win otherwise. My turn:

32 Nim 100 (4) 010 (2) 101 (5) 011 For the current player: Guaranteed loss if last row is all 0’s. Guaranteed win otherwise. My turn:

33 Nim For the current player: Guaranteed loss if last row is all 0’s. Guaranteed win otherwise. Your turn: 100 (4) 001 (1) 101 (5) 000

34 Following Paths

35 Seven Bridges of Königsberg

36 Seven Bridges of Königsberg: Seven Bridges of Königsberg 1 3 4 2

37 Seven Bridges of Königsberg: Seven Bridges of Königsberg As a graph: 1 3 4 2

38 Eulerian Paths and Circuits Cross every edge exactly once. Leonhard Euler 1707 - 1783

39 Eulerian Paths and Circuits Cross every edge exactly once. There is a circuit if every node touches an even number of edges. Leonhard Euler 1707 - 1783

40 So, Can We Do It? As a graph: 1 3 4 2

41 The Good King and the Evil King The good king wants to build exactly one new bridge so that: There’s an Eulerian path from the pub to his castle. But there isn’t one from the pub to the castle of his evil brother on the other bank of the river.

42 Here’s What He Starts With As a graph: 1 3 4 2

43 Here’s What He Ends Up With As a graph: 1 3 4 2

44 Unfortuntately, There Isn’t Always a Trick Suppose we need to visit every node exactly once.

45 The Traveling Salesman Problem Find the shortest circuit that visits every city exactly once. 15 20 25 8 9 23 40 10 4 7 3 28

46 Visting Nodes Rather Than Edges ● A Hamiltonian path: visit every node exactly once. ● A Hamiltonian circuit: visit every node exactly once and end up where you started. All these people care: Salesmen, Farm inspectors, Network analysts

47 The Traveling Salesman Problem 15 20 25 8 9 23 40 10 4 7 3 28 Given n cities: Choose a first cityn Choose a secondn-1 Choose a thirdn-2 … n!

48 The Traveling Salesman Problem Can we do better than n! ● First city doesn’t matter. ● Order doesn’t matter. So we get (n-1!)/2.

49 The Growth Rate of n! 2211479001600 36126227020800 4241387178291200 5120141307674368000 67201520922789888000 7504016355687428096000 840320176402373705728000 936288018121645100408832000 103628800192432902008176640000 113991680036 3.6  10 41

50 Putting it into Perspective Speed of light 3  10 8 m/sec Width of a proton10 -15 m At one operation in the time it takes light to cross a proton 3  10 23 ops/sec Since Big Bang 3  10 17 sec Ops since Big Bang 9  10 40 ops36! = 3.6  10 41 Neurons in brain10 11 Parallel ops since Big Bang 9  10 51 43! = 6  10 52

51 1.Use a technique that is guaranteed to find an optimal solution and likely to do so quickly. 2.Use a technique that is guaranteed to run quickly and find a “good” solution. Getting Close Enough The Concorde TSP Solver found an optimal route that visits 24,978 cities in Sweden.Concorde TSP The World Tour Problem

52 Is This The Best We Can Do? Would you like to win $1M? The Millenium Prize Probably.

53 Impossible

54 An Interesting Puzzle List 1List 2 1bbbb 2babbbba 3 a 4bbbaababbb 2 List 1 b a b b b List 2b a

55 An Interesting Puzzle List 1List 2 1bbbb 2babbbba 3 a 4bbbaababbb 2 1 List 1 b a b b b b List 2b a b b b

56 An Interesting Puzzle List 1List 2 1bbbb 2babbbba 3 a 4bbbaababbb 2 1 1 List 1 b a b b b b b List 2b a b b b b b b

57 An Interesting Puzzle List 1List 2 1bbbb 2babbbba 3 a 4bbbaababbb 2 1 1 3 List 1 b a b b b b b b a List 2b a b b b b b b a

58 The Post Correspondence Problem List 1List 2 111011 2010 3001110

59 The Post Correspondence Problem List 1List 2 1aba 2 ba 3aabaa

60 The Post Correspondence Problem List 1List 2 1babab 2abbbb 3bababb

61 The Post Correspondence Problem List 1List 2 111011 2011011 31110

62 Can A Program Do This? Can we write a program to answer the following question: Given a PCP problem, decide whether or not it has a solution. Return: True if it does. False if it does not.

63 The Post Correspondence Problem A program to solve this problem: Until a solution or a dead end is found do: If dead end, halt and report no. Generate the next candidate solution. Test it. If it is a solution, halt and report yes. So, if there are say 4 rows in the table, we’ll try: 1 2 3 4 1,1 1,2 1,3 1,4 1,5 2,1 …… 1,1,1 ….

64 Will This Work? If there is a solution: If there is no solution:

65 A Tiling Problem

66

67

68

69

70

71

72

73

74

75 Another Tiling Problem

76

77

78 Can A Program Do This? Can we write a program to answer the following question: Given a tiling problem T, decide whether or not T can tile a plane. Return: True if it can. False if it can not.

79 Deciding a Tiling Problem A program to solve this problem: Until the answer is clearly yes or a dead end is found do: If dead end, halt and report no. Generate the next candidate solution. Test it. If it is a solution, halt and report yes.

80 Will This Work? If T can tile a plane: If T can not tile a plane:

81 Programs Debug Programs read name if name = “Elaine” then print “You win!!” else print “You lose  ” Given an arbitrary program, can it be guaranteed to halt?

82 Programs Debug Programs read number set result to 1 set counter to 2 until counter > number do set result to result * counter add 1 to counter print result Given an arbitrary program, can it be guaranteed to halt?

83 Programs Debug Programs read number set result to 1 set counter to 2 until counter > number do set result to result * counter add 1 to counter print result Given an arbitrary program, can it be guaranteed to halt? Suppose number = 5: result number counter 152 25 3 654 2455 12056

84 Programs Debug Programs read number set result to 1 set counter to 2 until counter > number do set number to number * counter add 1 to counter print result Given an arbitrary program, can it be guaranteed to halt? Suppose number = 5: result number counter 1 52 1 10 3 1 304 11205 16006

85 Programs Debug Programs Given an arbitrary program, can it be guaranteed to halt? read number until number = 1 do if number is even then: number  number/2 if number is odd then: number  3  number + 1 Suppose number is 7: The 3x + 1 Problem

86 Programs Debug Programs Given an arbitrary program, can it be guaranteed to halt? Collatz Conjecture: This program always halts. We can try it on big numbers: http://www.nitrxgen.net/collatz/7865765/ read number until number = 1 do if number is even then: number  number/2 if number is odd then: number  3  number + 1

87 The Impossible The halting problem cannot be solved. We can prove that no program can ever be written that can look at arbitrary other programs and decide whether or not they always halt.

88 The Halting Problem is Not Solvable Consider the following program: Trouble(string) = If Halts(string, string) then loop forever else halt. Now we invoke Trouble( ). What should Halts(, ) say? If it: Returns True (Trouble will halt): Trouble ______ Returns False (Trouble will not halt):

89 The Halting Problem is Not Solvable Consider the following program: Trouble(string) = If Halts(string, string) then loop forever else halt. Now we invoke Trouble( ). What should Halts(, ) say? If it: Returns True (Trouble will halt): Trouble loops Returns False (Trouble will not halt): Trouble ______

90 The Halting Problem is Not Solvable Consider the following program: Trouble(string) = If Halts(string, string) then loop forever else halt. Now we invoke Trouble( ). What should Halts(, ) say? If it: Returns True (Trouble will halt): Trouble loops Returns False (Trouble will not halt): Trouble halts So there is no answer that Halts can give that does not lead to a contradiction.

91 Other Unsolvable Problems Tiling: We can encode a, pair as an instance of a tiling problem so that there is an infinite tiling iff does not halt on. 00010000111000000111110000000000000 00010000111010000111110000000000000 00010000111011000111110000000000000 … So if the tiling problem were solvable then Halting would be. But Halting isn’t. So neither is the tiling problem.

92 Other Unsolvable Problems PCP: We can encode a, pair as an instance of PCP so that the PCP problem has a solution iff halts on. 2 1 1 List 1 b a b b b b b List 2b a b b b b b b So if PCP were solvable then Halting would be. But Halting isn’t. So neither is PCP.

93 Which is Amazing Given the things programs can do. http://www.bdi.com/content/sec.php?section=BigDog

94 Which is Amazing Given the things programs can do. REEM-A http://www.youtube.com/watch_popup?v=2wzT4vafXOA& vq=medium

95 Which is Amazing Given the things programs can do. http://pc.watch.impress.co.jp/docs/2003/1218/sony_06.wmv

96 Which is Amazing Given the things programs can do. http://www.youtube.com/watch?v=WFR3lOm_xhE

97 Which is Amazing Given the things programs can do. http://www.google.com/selfdrivingcar/


Download ppt "Easy, Hard, and Impossible Elaine Rich. Easy Tic Tac Toe."

Similar presentations


Ads by Google