queens.icn: Program to generate solutions to the n-queens problem

June 10, 1988; Stephen B. Wampler
This file is in the public domain.
   This program displays the solutions to the non-attacking n-
queens problem: the ways in which n queens can be placed on an
n-by-n chessboard so that no queen can attack another. A positive
integer can be given as a command line argument to specify the
number of queens. For example,

        iconx queens -n8

displays the solutions for 8 queens on an 8-by-8 chessboard.  The
default value in the absence of an argument is 6.  One solution
for six queens is:

       -------------------------
       |   | Q |   |   |   |   |
       -------------------------
       |   |   |   | Q |   |   |
       -------------------------
       |   |   |   |   |   | Q |
       -------------------------
       | Q |   |   |   |   |   |
       -------------------------
       |   |   | Q |   |   |   |
       -------------------------
       |   |   |   |   | Q |   |
       -------------------------

Comments: There are many approaches to programming solutions to
the n-queens problem.  This program is worth reading for
its programming techniques.

Source code | Program Library Page | Icon Home Page