Share Tips, Code Samples, etc. with the Visual Prolog community.
ordak
Posts: 8
Joined: 11 Jun 2007 10:45

Eight Queens Problem

Unread post by ordak »

Hi,

This code is a solution to eight queens problem.There are 92 solutions to this problem in the 8x8 board.
The general problem is a nxn board that can have n queens on it , that none of them attacks others.
For more info search the web here is an address to problem and some solutions:

http://en.wikipedia.org/wiki/Eight_queens_puzzle for definition.
http://en.wikipedia.org/wiki/Eight_quee ... _solutions some solutions in various PLs.

The project is coded in VP 7.1, and is a console project.You can improve the code in various aspects. For example creating a GUI project that displays solving process or by improving its solving method to find all solutions in less time and with less positions searched.Also you can generalize it to solve nxn problems either for finding all solutions or to find only one solution.If you did so,please post your code for every one here,Thanks !
Attachments
8q.zip
Codes for VP 7.1 Console project to solve eight queens problem
(3.53 KiB) Downloaded 1878 times
ordak
Posts: 8
Joined: 11 Jun 2007 10:45

Unread post by ordak »

Hi again ,
:-)

This attachment is a try for solving N queens problem for N=1 to N=10.Also it can find some solutions for N=11 to N=15 (finding more solutions is possible but it is memory and time consuming).Replies are welcome,Thanks.
Attachments
nq.zip
N queens solutions for N<11.
(3.88 KiB) Downloaded 1483 times
Post Reply