Breakfast Bytes Easy, Hard, and Impossible

Slides:



Advertisements
Similar presentations
Adversarial Search Reference: “Artificial Intelligence: A Modern Approach, 3 rd ed” (Russell and Norvig)
Advertisements

AI for Connect-4 (or other 2-player games) Minds and Machines.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
CS 61B Data Structures and Programming Methodology July 31, 2008 David Sun.
Easy, Hard, and Impossible. Easy Tic Tac Toe Hard.
Using Reduction for the Game of NIM. At each turn, a player chooses one pile and removes some sticks. The player who takes the last stick wins. Problem:
The Power and the Limits of Computation Elaine Rich.
Section 3.1: Proof Strategy Now that we have a fair amount of experience with proofs, we will start to prove more difficult theorems. Our experience so.
Easy, Hard, and Impossible Elaine Rich. Easy Tic Tac Toe.
Game Playing. Towards Intelligence? Many researchers attacked “intelligent behavior” by looking to strategy games involving deep thought. Many researchers.
MA/CSSE 474 Theory of Computation Enumerability Reduction.
Backtracking and Games Eric Roberts CS 106B January 28, 2013.
Easy, Hard, and Impossible Elaine Rich. Easy Tic Tac Toe.
The Lovely Game of NIM. Version 1 - Classic NIM You will need seven objects, such as counters or blocks. It is a game for two players. Place the 7 counters.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
1 Decisions in games Minimax algorithm  -  algorithm Tic-Tac-Toe game Decisions in games Minimax algorithm  -  algorithm Tic-Tac-Toe game.
Hex: a Game of Connecting Faces. Player 1 Player 2 Players take turns placing blue chips (player 1) and red chips (player 2). Player 1 plays first. Player.
Hubert Chan (Chapters 1.6, 1.7, 4.1)
Game playing Types of games Deterministic vs. chance
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
Adversarial Environments/ Game Playing
Backtracking, Search, Heuristics
The Acceptance Problem for TMs
Set Operations CS 202, Spring 2008 Epp, chapter 5.
Instructor: Vincent Conitzer
Name: Aimee McLaughlin
FLOWCHARTS Part 1.
Great Theoretical Ideas in Computer Science
9.3 Nim Game (Game with matches)
CSE15 Discrete Mathematics 02/08/17
Recitation #3 Tel Aviv University 2016/2017 Slava Novgorodov
Top 10 Ways to be a Good Sport
PENGANTAR INTELIJENSIA BUATAN (64A614)
CS Fall 2016 (Shavlik©), Lecture 11, Week 6
Heuristic Search A heuristic is a rule for choosing a branch in a state space search that will most likely lead to a problem solution Heuristics are used.
Adversarial Search.
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
State Space 4 Chapter 4 Adversarial Games.
CSE 311: Foundations of Computing
Dot Cards Face-Off Game
David Kauchak CS52 – Spring 2016
Hubert Chan (Chapters 1.6, 1.7, 4.1)
CS 4700: Foundations of Artificial Intelligence
Introduction to Operations Research
Nim Game Lesson1 Compendium , page 173 Guidebook , page 127 THE LESSON Lesson Title: NIM lesson1 Date: Length of the Lesson: 45 minutes.
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
Nim Game Lesson1 Compendium , page 173 Guidebook , page 127 THE LESSON Lesson Title: NIM lesson1 Date: Length of the Lesson: 45 minutes.
Alpha-Beta Search.
NIM - a two person game n objects are in one pile
Alpha-Beta Search.
At least two sprites moving on the stage.
Instructor: Vincent Conitzer
Alpha-Beta Search.
N6 Calculating with fractions
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
DW Daniel High, SC; Jan 25, 2010 Murali Sitaraman
Game Playing Fifth Lecture 2019/4/11.
Alpha-Beta Search.
Instructor: Vincent Conitzer
Try starting with fewer objects to investigate.
Alpha-Beta Search.
Backtracking, Search, Heuristics
CS51A David Kauchak Spring 2019
CS51A David Kauchak Spring 2019
MA/CSSE 474 Theory of Computation
Lecture 4: Tree Search Strategies
Backtracking, Search, Heuristics
Unit II Game Playing.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

Breakfast Bytes Easy, Hard, and Impossible Elaine Rich

Easy

Tic Tac Toe Let the kids play a game or two. At first, it appears we need to search to find a winning strategy. But quickly we realize that there’s exactly one optimal move. This game is trivial.

Hard

Chess Image from: http://www.polandchess.com/chess_sets_galleries/Staunton5_wb_chess_set/Staunton5_wb_chess_set.htm

The Turk Built in 1770. Unveiled in 1770.

Searching for the Best Move B C D E F G H I J K L M (8) (-6) (0) (0) (2) (5) (-4) (10) (5) Point out that we don’t just want to pick D so that we can go to L because we don’t get to pick the move from D. Note that the number of leaf nodes is 3 * 3. Ask how many there would be at the next level.

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

The Turk Still fascinates people.

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

Chess Today In 1997, Deep Blue beat Garry Kasparov. What about role playing games? Need a lot more knowledge.

Seems Hard But Really Easy

Nim At your turn, you must choose a pile, then remove as many sticks from the pile as you like.                                                     Let the kids play. First player should remove one stick from either pile 1 or pile 2 or remove all sticks from pile 3. Then there is no guaranteed winning move for the other player. The player who takes the last stick(s) wins.

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

Decimal Numbers 10000 1000 100 10 1 89 8 9 Need to introduce this in order to be able to explain the “trick” for Nim.

Decimal Numbers 10000 1000 100 10 1 89 8 9 587 Need to introduce this in order to be able to explain the “trick” for Nim.

Decimal Numbers 10000 1000 100 10 1 89 8 9 567 5 6 7 34765 Need to introduce this in order to be able to explain the “trick” for Nim.

Decimal Numbers 10000 1000 100 10 1 89 8 9 567 5 6 7 34765 3 4 Need to introduce this in order to be able to explain the “trick” for Nim.

Binary Numbers 16 8 4 2 1 5 Need to introduce this in order to be able to explain the “trick” for Nim.

Binary Numbers 16 8 4 2 1 5 9

Binary Numbers 16 8 4 2 1 5 9 21

Binary Numbers 16 8 4 2 1 5 9 21 3

Binary Numbers 16 8 4 2 1 5 9 21 3

Binary Numbers 16 8 4 2 1 5 9 21 3

Nim My turn: 10 (2) 11 (3) 11 For the current player:                                                     10 (2) 11 (3) 11 To form last row, XOR each column. I should remove one stick from either pile one or pile two. For the current player: Guaranteed loss if last row is all 0’s. Guaranteed win otherwise.

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

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

Impossible

An Interesting Puzzle List 1 List 2 1 b bbb 2 babbb ba 3 a 4 bbbaa List 1 b a b b b List 2 b a

An Interesting Puzzle List 1 List 2 1 b bbb 2 babbb ba 3 a 4 bbbaa 2 1 List 1 b a b b b b List 2 b a b b b

An Interesting Puzzle List 1 List 2 1 b bbb 2 babbb ba 3 a 4 bbbaa 2 1 1 List 1 b a b b b b b List 2 b a b b b b b b

An Interesting Puzzle List 1 List 2 1 b bbb 2 babbb ba 3 a 4 bbbaa 2 1 1 3 List 1 b a b b b b b b a List 2 b a b b b b b b a

The Post Correspondence Problem List 1 List 2 1 11 011 2 01 3 001 110 Easy to see that this one is impossible. We rule out all possibilities.

The Post Correspondence Problem List 1 List 2 1 ab a 2 ba 3 aa baa Let students try this one. 1,3 and 1,2,3 are solutions.

The Post Correspondence Problem List 1 List 2 1 ba bab 2 abb bb 3 Let the students try this one. No solution exists.

The Post Correspondence Problem List 1 List 2 1 1101 2 0110 11 3 110 Tell them about this one. Its shortest solution has length 252

What is a Program?

What is a Program? A procedure that can be performed by a computer.

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 ….

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 …. But what if there is no solution?

A Tiling Problem Explain the rules.

A Tiling Problem

A Tiling Problem

A Tiling Problem

A Tiling Problem

A Tiling Problem

A Tiling Problem

A Tiling Problem

A Tiling Problem

A Tiling Problem Now notice that we can tile forever because this 3 x 3 is the same top and bottom and right and left.

Another Tiling Problem This one can easily be shown not to work.

Another Tiling Problem Hand out cut out tiles and let the students try this one. There’s a 2 x 3 that is symmetric.

Another Tiling Problem

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

Programs Debug Programs Given an arbitrary program, can it be guaranteed to halt? 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 Easy to show this one halts because counter gets one step closer to number each time. Simulation on next slide.

Programs Debug Programs Given an arbitrary program, can it be guaranteed to halt? 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 Suppose number = 5: result number counter 1 5 2 2 5 3 6 5 4 24 5 5 120 5 6 Easy to show this one halts because counter gets one step closer to number each time.

Programs Debug Programs Given an arbitrary program, can it be guaranteed to halt? 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 Suppose number = 5: result number counter 1 5 2 1 10 3 1 30 4 1 120 5 1 600 6 Easy to show this one never halts.

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

Programs Debug Programs Given an arbitrary program, can it be guaranteed to halt? read number until number = 1 do if number is even then set number to number/2 if number is odd then set number to 3number + 1 Collatz Conjecture: This program (which solves the 3x+1 problem) always halts. We can try it on big numbers: http://math.carleton.ca/%7Eamingare/mathzone/3n+1.html

The halting problem cannot be solved. 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.

Which is Amazing Given the things programs can do.

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

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