Can someone help with an algorithm to solve the 8-queens problem using Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone help with an algorithm to solve the 8-queens problem using Java

School work

5th Aug 2018, 8:03 PM
Frigate
Frigate - avatar
3 Answers
0
the algorithm should start by placing a queen somewhere then the algorithm should go trow all queens and look which places on the board are ok to place a queen. Then it should place one queen on the ok spots. if the algorithm fails to place 8 queens all queens are removed and the starting position oft the first queen is changed. helps?
7th Aug 2018, 5:33 PM
Anton Böhler
Anton Böhler - avatar
0
use maybe an arraylist
7th Aug 2018, 5:35 PM
Anton Böhler
Anton Böhler - avatar
0
good luck Frigate !
7th Aug 2018, 5:36 PM
Anton Böhler
Anton Böhler - avatar