Sorry again I forgot a part of the function in my previous post:
---
# add nbQueens (5) new queens on safe squares
def newQueens(nbQueens=5):
        solution = []                                           # one solution
        for i in range(len(board)):                     # 64 squares
                if len(solution) < nbQueens:    # 5 queens
                        if board[i][2]==0:                      # free square
                                solution.append(i)              # a queen 
position
                                queenCtrl(board[i])             # the queen 
controls squares
        if calcCtrl() == len(board):            # whole board controlled
                allSolutions.append(solution)   # add this solution to the list
        resetCtrl()                                                     # reset 
the controled squares

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to