Question: this is a Java program Using recursion and backtracking algorithm Introduction: The following game is actually a puzzle where the board has the form of

this is a Java program Using recursion and backtracking algorithm Introduction: The following game is actually a puzzle where the board has the form of a cross. It consists of 32 fields. 31 of these fields contain a peg. The single field in the middle of the board is empty. (We mark a peg with X and an empty field with O in the following examples) Sotave Pudde-Bound FleMove Help 99 Ready 1... The rules of this game are simple: you can take a peg and jump over another neighboring peg the peg you jumped over is removed from the board you solved the puzzle if at the end only on peg exists and is located in the middle of the board At the start there are only a few possible moves, but the choices are increasing during the game. The following tables give the initial position of the pegs and subsequent moves.X X X X X X X X X X X X X X X XO XXX X X X X X X X X X X XXX XXX XXX X X X X X X X XOOX X X X X X X X X X X XXX XXX XXX X X X X X X X X X X XO X X X X X X X X X X X O XX XXX XXX XXX X X X X X X X more XO X X X X X moves X X XOOXX ---- OXX XXX \Omicron \Omicron \Omicron \Omicron \Omicron \Omicron \Omicron 00 Requirements: Implement a recursive backtracking algorithm in Java, that finds a solution to this puzzle. The solution can be stored as a sequence of boards: one for each move. The board should be implemented as a Java class with an internal 7x7 matrix (two dimensional array). In the backtracking algorithm you must compute all possible jumps for a given situation. Your program might include a class called Puzzle which includes the following methods: 1. findSolution (int move): Backtracking algorithm to solve the puzzle. move- current number of move, first move must be 12. main ():Starts the backtracking algorithm and prints out the solution as the sequence of all resulting intermediate board situation. 3. print (): print current situation of the board. 4. constructor : creates a new puzzle instance with empty solution and initial start position of all pegs.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!