Skip to main content

Grid-Based Backtracking Visualizer

Animate queen placements, highlight invalid moves/conflicts in red, and demonstrate the physical backtracking steps as the recursion winds down.

Backtracking Visualizer

An interactive playground for exploring N-Queens layout searches and Sudoku constraints solvers.

4x4
300ms
Step 0Total -1
States Evaluated
0
Backtracks
0
Solutions Found
0
Backtracking Execution Trace
1: function solveNQueens(row) {
2: if (row === N) return true; // Solution found
3: for (let col = 0; col < N; col++) {
4: if (isSafe(row, col)) {
5: placeQueen(row, col);
6: if (solveNQueens(row + 1)) return true;
7: removeQueen(row, col); // Backtrack
8: }
9: }
10: return false;
11: }
status:
Queen Placed / Safe Cell
Evaluating / Check
Constraint Violation / Conflict
Backtracking / Undo cell