Eight Queens with "Fancy Print" Chessboard As discussed in class... Modify the Eight Queens program (1 dimensional array- no goto version) so that it prints out a chessboard with some "fancy" representation of a queen in the appropriate positions. How to do it: In class we went over the code to print out a chessboard. You need to: 1. Augment that code by adding two additional “box"es, wq which represents a picture of a queen placed in a "white" square, and bq, representing a picture of a queens placed in a "black" square. 2. After the code that fills the array board[8][8] with the addresses of bb and wb, insert code to change eight entries in that array to reflect the positions of eight queens on the board. You will get these positions from a one dimensional aray q[8] representing a solution to the eight queens problem. The change that you make in these eight places is to replace the pointer in board for one representing either a wq, or bq, as appropriate for that position. You know the eight positions because, given q[i], i represents the column and q[i] represents the row. You can tell whether its black or white by looking at the row and column indexes of its position on the board. 3. The code described above (in 2.) goes into the print function. You pass the arrays q and board to print. In the function you modify board using q • print the picture of the board "Clean up" array board, by restoring its original values, to get ready for the next call to print.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

I need simple C++ code 

CS211
Eight Queens with "Fancy Print" Chessboard
As discussed in class ...
Modify the Eight Queens program (1 dimensional array - no goto version) so that it prints out a
chessboard with some "fancy" representation of a queen in the appropriate positions.
How to do it:
In class we went over the code to print out a chessboard. You need to:
1. Augment that code by adding two additional "box"es, wq which represents a picture of a
queen placed in a "white" square, and bq, representing a picture of a queens placed in a "black"
square.
2. After the code that fills the array board[8][8] with the addresses of bb and wb, insert code to
change eight entries in that array to reflect the positions of eight queens on the board. You
will get these positions from a one dimensional array q[8] representing a solution to the eight
queens problem. The change that you make in these eight places is to replace the pointer in board
for one representing either a wq, or bq, as appropriate for that position. You know the eight
positions because, given q[i], i represents the column and q[i] represents the row. You can tell
whether its black or white by looking at the row and column indexes of its position on the board.
3. The code described above (in 2.) goes into the print function. You pass the arrays q and
board to print. In the function you
• modify board using q
• print the picture of the board
"Clean up" array board, by restoring its original values, to get ready for the next call to
print.
Transcribed Image Text:CS211 Eight Queens with "Fancy Print" Chessboard As discussed in class ... Modify the Eight Queens program (1 dimensional array - no goto version) so that it prints out a chessboard with some "fancy" representation of a queen in the appropriate positions. How to do it: In class we went over the code to print out a chessboard. You need to: 1. Augment that code by adding two additional "box"es, wq which represents a picture of a queen placed in a "white" square, and bq, representing a picture of a queens placed in a "black" square. 2. After the code that fills the array board[8][8] with the addresses of bb and wb, insert code to change eight entries in that array to reflect the positions of eight queens on the board. You will get these positions from a one dimensional array q[8] representing a solution to the eight queens problem. The change that you make in these eight places is to replace the pointer in board for one representing either a wq, or bq, as appropriate for that position. You know the eight positions because, given q[i], i represents the column and q[i] represents the row. You can tell whether its black or white by looking at the row and column indexes of its position on the board. 3. The code described above (in 2.) goes into the print function. You pass the arrays q and board to print. In the function you • modify board using q • print the picture of the board "Clean up" array board, by restoring its original values, to get ready for the next call to print.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education