Logo

Recursive backtracking

Eight queens puzzle

Javascript (animated)

click on a square on the chessboard to place a queen

This animation shows how a backtracking algorithm works on the eight queens puzzle. The algorithm only takes a few milliseconds, but is shown here at a slower speed to show how it works. The following code shows how to solve this problem with Javascript.

Support me

Eight queens puzzle at Wikipedia

Javascript source code:

NOTE: to keep things simple, the animation code is not included in the source

Report an issue

Um die Bedienung der Website zu erleichtern, verwenden wir Cookies. Wenn Sie diese Website benutzen, stimmen Sie den Datenschutzrichtlinien zu.
We use cookies to make the website easier to use. By using this website you agree to the privacy policy.