Forum Discussion

Patrick2788's avatar
Patrick2788
Silver Contributor
Jul 07, 2023
Solved

Solving the Eight Queens Chess Problem with a Lambda

  Background "The eight queens puzzle is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other; thus, a solution requires that no two queens...
  • mtarler's avatar
    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?

Resources