lab_006 - 15-121 Fall 2009Homework Assignment 7Slide...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 15-121 Fall 2009Homework Assignment 7Slide PuzzleOverview:Sliding tile puzzles(follow this link for an interactive puzzle) are common children's games and party favors. The slide puzzle consists of a three by three board with eight numbered tiles and a blank space, denoted by a zero. A tile adjacent to the blank space can slide into the space. The objective is to figure out the steps needed to get from one configuration (which is is an arbitrary arrangement of the tiles), for example, 1 2 34 0 57 8 6to the goal configuration: 1 2 34 5 67 8 0Finding such a solution of the general n2- 1 puzzle is known to be NP-complete, and furthermore, the best known algorithm for solving the eight puzzle optimally is A*. Objectives:Representing a seemingly complex problem in a workable form Construct and analyze game trees Understand and implement heuristic search Practice working in small teams to solve problems, design algorithms and write code Assignment:In this assignment you will implement a program that uses BFS search and A* search to solve the Eight Puzzle game. Your program will take an initial board position, and then try to find a sequence of moves from the initial position to the goal position. Moves are represented by moving the blank space left, right, up, or down. For example, suppose we wanted to solve the puzzle shown above. This could be accomplished by the following sequence of moves (we represent a move as the direction the empty space moved): 1 2 3 1 2 3 1 2 34 0 5 R 4 5 0 D 4 5 67 8 6 7 8 6 7 8 0initial goalwhere R=right, L=left, U=up, D=down. So we can solve this puzzle with the sequence of moves "RD". Game Tree:Given the initial board: 1 2 34 0 67 5 8we can determine all the boards that are one move away Repeating this recursively will create a game tree of boards with the initial puzzle at the root This is not a binary tree. Some nodes have two children, some have three, and some have four. Also note that the tree has no leaf nodes, since every board can be transformed into another board by moving a tile. As a consequence of this, there is an infinite number of nodes in our tree. We label the edges connecting the nodes in the tree according to the empty space move. That it is, instead of thinking of moving a specific tile in a specific direction, we can think of moving the empty space in the opposite direction....
View Full Document

This note was uploaded on 12/19/2009 for the course CS 121 taught by Professor Reid-miller during the Spring '09 term at Carnegie Mellon.

Page1 / 7

lab_006 - 15-121 Fall 2009Homework Assignment 7Slide...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online