hydromatic / morel

Standard ML interpreter, with relational extensions, implemented in Java
Apache License 2.0
294 stars 15 forks source link

Solve the "N Queens" problem #148

Open julianhyde opened 2 years ago

julianhyde commented 2 years ago

Solve the N Queens problem. There is a program in Standard ML at Rosetta Code but Morel currently throws StackOverflowError for n > 7.

For n = 8, the program generates the solution (8,4),(7,2),(6,7),(5,3),(4,6),(3,8),(2,5),(1,1)

 .  .  X  .  .  .  .  .
 .  .  .  .  .  X  .  .
 .  .  .  X  .  .  .  .
 .  X  .  .  .  .  .  .
 .  .  .  .  .  .  .  X
 .  .  .  .  X  .  .  .
 .  .  .  .  .  .  X  .
 X  .  .  .  .  .  .  .