Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Knights your problem without recursion in C++ 8x8 board The board state at each instant is an 88 array of integers all of whose elements

Knights your problem without recursion in C++
8x8 board
The board state at each instant is an 88 array of integers all of whose elements are initially set at 1. As you move to a square, you replace the corresponding array element by the sequence number of the move made (such as 1 for the square visited after the first move, 2 for the second move etc.). At each instant the board state with any other necessary information is pushed on to the stack. This is to recover from the case when the knight is trapped somewhere, with no unvisited square to move to, without finding the complete solution. In such a case, you back-track along the traversed path by popping the states from the stack, until you find a square from which you can make a valid move. While back-tracking you should also unmark the the squares (i.e., put 1 at the corresponding elements of the current board state) so that you can visit those squares again.
If, at a particular instant, the knights position on the board is given by (i,j), there may be at most eight possible moves for the knight which will move it to one of the squares (i 2,j + 1),(i1,j +2),(i+1,j +2),(i+2,j +1),(i+2,j 1),(i+1,j 2),(i1,j 2),(i2,j 1).
The summary of the project:
I) Implementation of a singly linked list (with associated operations) to store the user inputsconcerning the initial positions of the knight.
(ii) Solving the knights tour problem for each initial position using a stack, backtracking, andusing Warnsdoffs heuristic for the first 32 moves.
The two components should work together. All the messages, and/or the transcript of a session demonstrating the successful operation of the complete program, should be saved in the output file.
You should submit the source code and the output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions