This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 1.
15 illegal illegal Are there other solutions? There must be,
due to summetry:
steps + +++
+ Q++ ++Q+
ill I placed 4 queens on a 4x4 board.
Problem solved. ++Q+
16 The program is long and complicated. It
certainly does not fit onto one screen. It
moves from one row to the next row with a
while loop. However, it moves from one
column to the next column by recursion. This
is done as follows: We can continue the program
to find this and other solutions. Q
17 18 void PlaceNextQueen (int Column,
PlaceNextQueen(Column+1, Board, Done);
} Please study the program in your textbook.
Good exercise: Try to write the FUNCTION
Attack which is used in the book, but not
explained. Attack(Board, Row, Column)
returns TRUE if on the board there is any queen
that can attack the field in row Row and column
Column. 19 20...
View Full Document
This document was uploaded on 03/31/2014 for the course CS 114 at NJIT.
- Spring '09
- Assembly Language