Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Give the solution to the n-queen problem
ResourceFunction["NQueenSolution"][n] gives the solution to the n-queen problem. |
| "Unique" | show only one solution |
| "All" | show all solutions |
| "CountAll" | give the number of all solutions |
Get one of the solutions to the 8-queens problem:
| In[1]:= |
| Out[1]= |
Visualize this solution:
| In[2]:= | ![]() |
| Out[3]= | ![]() |
Get all the solutions to the 8-queens problem:
| In[4]:= |
| Out[5]= |
Count the number of solutions:
| In[6]:= |
| Out[6]= |
Compute the number of solutions directly:
| In[7]:= |
| Out[7]= |
Display the solution with a beautiful chessboard:
| In[8]:= | ![]() |
View the solution:
| In[9]:= |
| Out[9]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License