Question: For this project, you will implement the recursive solution to the Eight Queens Problem from the textbook. If you need a refresher on the Eight

For this project, you will implement the recursive solution to the Eight Queens Problem from the textbook. If you need a refresher on the Eight Queens Problem, check out this video (Links to an external site.)Links to an external site..

Your solution will work for boards of size 4 through 12. The number of queens you attempt to place on the board is determined by the board size. So, a 4x4 board has 4 queens placed on it and a 12x12 board has 12 queens placed on it.

Requirements

Create the file Chessboard.hpp which contains the header and definitions for the class Chessboard that, at the minimum:

Stores the board as a dynamic char array initially populated with ' ' space representing the board has no pieces on it.

A constructor that defaults the board to 8x8.

A constructor that allows the size of the board n to be given and creates the board as nxn.

Has a set method that takes the row, column, and char to set in that square of the board. Use 'Q' to represent a queen.

A get method that, given row and column numbers, returns the char in that square.

A get method that will return the size of the board n where the board is nxn.

A method that will display the contents of the board to the console. It should display Q for each queen and X for each blank (see below for an example).

The private recursive method placeQueens().

Follow the pseudocode on pages 179-180.

The public method doEightQueens() which calls the recursive method placeQueens().

Other appropriate/needed methods for your solution.

The file Project2.cpp which, at a minimum:

Prompts the user for the size of the board they'd like to solve the Eight Queens Problem on. Don't allow a board size of less than 4 or greater than 12.

Creates a board object of that size and calls doEightQueens() on it.

Displays the solution found to the screen. (Note there should always be a solution for any board size 4 - 12.)

Sample Output

A run of your program should look something like this:

Hello! I'd like to solve the Eight Queens Problem for you. How large is the board? 4 Thanks! Looks like we're solving the Four Queens Problem today! Here is a solution I found for the placement of queens on a 4x4 board: X X Q X Q X X X X X X Q X Q X X

Other requirements

Follow the course code style guide and good programming practices.

Make sure your code handles incorrect/unusual data properly.

If you wrote the program in an environment other than Visual Studio 2017 it is your responsibility to ensure that it works in VS 2017 (which is what Ill be grading in).

Put a comment at the top of all files with your full name, class number, and assignment name like so:

// Joe Smith // CS250 Programming Project 1

Due Date

See below.

Turn in

Upload a zip file containing only Chessboard.hpp and Project2.cpp. Do not upload the entire Visual Studio project.

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!