The SANDBOX

Sudoku Solver

5
1
4
4
8
5
1
9
7
5
2
3
8
5
7
9
1
2
7
3
4
2
8
2
1
3
5
6
4
9
2
5
1
6
4
6
5
8

What am I looking at?

A brute-force, depth-first sudoku solver.

On each step, the board is validated and, if valid, the board state is pushed onto a stack and the next square is assigned a value of 1. When an invalid board is generated, the top board on the stack is popped and the next board in the stack becomes the active board.

On the next go around, the next square is assigned a value of 2 and the cycle continues. When the last attempt was a 9, we pop twice and the active square is now the previously active square.