next next up down toc toc mail

8.10.  The Eight Queens on a Chess Board Problem

The eight queens on a chess board is the problem of putting eight queens on the chess board in such a way that they cannot attack each other. A chess board is an eight by eight matrix. A queen can attack any other queen along the eight paths which extend from queen. These paths are vertically, horizontally, and diagonally.

[picture]

The algorithm as a Nassi Shneidermann diagram:

Procedure 8_queen(int nqueen, boolean board[8][8] )

[picture]

Main program:

[picture]


back next up down toc toc mail


Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1998).

Last modified: 27/July/98 (12:14)