This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 15-121: Introduction to Data StructuresFall 2009Exercise10/15/2009PuzzleExtra CreditDue: Fri, Oct 238am Assignment: (worth up to 5 extra credit points) Use the files in Puzzle.zipas a start for this exercise. For this assignment, you will get the computer to solve a Hi-Q puzzle. [Hi-Q is a brand name of sorts. See a briefdescription at a commercial site.]The idea is to place pegs in a grid of holes, and then jump pegs over each other, eliminating the peg which was jumped over. The version of the puzzle you will be asked to solve is the one shown at the commercial site, and the Java graphics is:Rules:You can jump over a peg with another peg horizontally or vertically (not diagonally!). When you jump over a peg, you remove it. Goal:Do a series of jumps such that there is only one peg left on the board.Your program must compute a list of PuzzleMoves that will get to one peg OR display "NO SOLUTION" if there is no solution to the initial configuration. (HINT: use the backtracking model we've seen in class.)Note: your program does NOT have to have the final peg in the...
View Full Document
- Spring '09
- Data Structures