Search Discussion question
Taken from CS188 Summer 2022
1 Towers of Hanoi
The Towers of Hanoi is a famous problem for studying recursion in computer science and recurrence
equations in discrete mathematics. We start with N discs of varying sizes on a peg (stacked in
order according to size), and two empty pegs. We are allowed to move a disc from one peg to
another, but we are never allowed to move a larger disc on top of a smaller disc. The goal is to
move all the discs to the rightmost peg (see figure).
In this problem, we will formulate the Towers of Hanoi as a search problem.
(a) Propose a state representation for the problem
(b) What is the size of the state space?
(c) What is the start state?
(d) From a given state, what actions are legal?
(e) What is the goal test?
1
2 8-Puzzle Problem
Consider the game of 8-Puzzle below:
Goal is to start from an unordered configuration of blocks, and using 2d sliding end up with an
ordering where the first slot is empty.
(a)What are the states?
(b)How to model the Search States?
(c) What are the actions?
(d)What is the goal test?
2
(e) What about the cost, what do you use to represent cost of action then then you will try to
minimize in the long run?
(f) Draw the search tree for first row.