, , , , , , ,

[SOLVED] Cs211 eight queens with “fancy print” chessboard

$25

File Name: Cs211_eight_queens_with_“fancy_print”_chessboard.zip
File Size: 489.84 KB

5/5 - (1 vote)

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.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Cs211 eight queens with “fancy print” chessboard
$25