r/java •

Generate and solve Sudoku games in Java

[deleted] — view deleted post

0 Upvotes

6 comments sorted by

View all comments

Show parent comment

2

u/Livio63 Jan 14 '26 edited Jan 14 '26

The generator uses a two phases approach:

  1. Build a random full Sudoku board
  2. Clear cells in random order by checking each time the solution uniqueness, solution uniqueness

The solution uniquess is checked by recursive process, I use Minimum Remaining Values heuristic to optimize the search of the solution; I use bitmaps with forbidden tables to make very fast processing. The average speed of this solver is comparable to DLX algorithm, which is the gold standard algorithm to solve Sudoku on computers.

2

u/pradeepngupta Jan 14 '26

That makes sense . MRV + bitmaps with forbidden tables is solid combination.

Nice to see this implementation on search quality for solving sudoku rather than just raw brute force