aarigela/N-Queens-Problem
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
nQueens.py : Solve the N-Queens problem The N-queens problem is: Given an empty NxN chessboard, place N queens on the board so that no queen can attack any other, i.e. such that no two queens share the same row, column or diagonal. Sample output :- [<username> ~]$ py nQueens.py 8 _ _ _ _ Q _ _ _ _ _ _ _ _ _ Q _ _ Q _ _ _ _ _ _ _ _ _ _ _ Q _ _ _ _ Q _ _ _ _ _ Q _ _ _ _ _ _ _ _ _ _ Q _ _ _ _ _ _ _ _ _ _ _ Q Here, Q's indicate the positions of queens on the board.