Forum Discussion
Solving the Eight Queens Chess Problem with a Lambda
- Jul 13, 2023
Patrick2788 I think i dun it ... see attached
EDIT: I updated the function to take advantage of the fact that the 2nd 1/2 of the solutions are symmetric to the first 1/2 (I didn't optimize for the 1/2 of the middle value when n is odd) but now instead of crashing at n=12 it finds all the solutions for n=12 (14,200). i also updated the sheet format to make entry and viewing a little easier.
EDIT2: I fixed the above version and added better format and added the checkerboard output with a pulldown selector to pick which solution to show on the board:
BTW: I just tried 13 and it found 73,712 solutions and 14 found 365,596 solutions. Can you please verify them for me?
Patrick2788 I think i dun it ... see attached
EDIT: I updated the function to take advantage of the fact that the 2nd 1/2 of the solutions are symmetric to the first 1/2 (I didn't optimize for the 1/2 of the middle value when n is odd) but now instead of crashing at n=12 it finds all the solutions for n=12 (14,200). i also updated the sheet format to make entry and viewing a little easier.
EDIT2: I fixed the above version and added better format and added the checkerboard output with a pulldown selector to pick which solution to show on the board:
BTW: I just tried 13 and it found 73,712 solutions and 14 found 365,596 solutions. Can you please verify them for me?
I've obtained a list of all 92 solutions and checked them against your formula where n=8. The result was 92/92! (I've attached a simple workbook which lists all 92).
With your solution and the use of recursion it looks like you've found a way to do some backtracking. I'd be interested in reading your approach to this problem.