Title |
Graphic simulation of the n_Queen problem using Backtracking. |
Author |
Abhishek H Dwivedi |
Author Email |
yarrows [at] indiatimes.com |
Description |
This C code will solve the n-Queen problem using the backtracking approach.The object of this problem is to place n Queens in an nXn chess-board, such that none of them can threaten each othe in one move.It graphically shows the movement of queens, as the algorithm runs.It halts momentarily whenever a solution is found, for the user to view it. It resumes to find other solutions on hitting a key at this juncture.When the queen of the 1st row reaches the last column, and since there is no row behind it to backtrack to, the program exits.The user can exit the program by hitting any key,during the normal running of the program.
Parameters :None.The user will be asked to enter the size of the chess-board(eg. Enter 8 if you want to solve for an 8X8 chess-board). |
Category |
C++ » Algorithms |
Hits |
393364 |
Code |
Select and Copy the Code
|
|