1. Computing

Placing 8 Queen's on a ChessBoard

Fancy Delphi Application Contest Entry #2 by Mikael Eriksson

By

8 Queens on a ChessBoard - Fancy Delphi Application Contest Entry #2

8 Queens on a ChessBoard - Fancy Delphi Application Contest Entry #2

In chess, a queen can move as far as she pleases, horizontally, vertically, or diagonally. A chess board has 8 rows and 8 columns. The standard 8 by 8 Queen's problem asks how to place 8 queens on an ordinary (empty) chess board so that no queen is under attack by another.

Placing 8 queen's on a chessboard is a classic use of backtracking algorithm - a great problem for the FDAC - Fancy Delphi Application Contest.

Rate this FDAC Entry!

8 Queens

"8 Queens" is a Delphi application hosting a chess board to try for yourself and a button that will give you the possible solutions.

Start by double-clicking a cell in a grid. The program will display what cells are "taken" by this action - so that queens do not threaten each other on the next move. Continue placing your queens. You should put 8 of them.

If you fail, you can always go for the "Solve" button. This will display the list of possible solutions in a string list. Double click an item to be displayed in the grid.

"8 Queens" was submitted by "Mikael Eriksson".

Do you have a FDA(C)? Submit your Delphi code to the Fancy Delphi Application Contest.

©2014 About.com. All rights reserved.