Thread: Java and Sudoku
View Single Post
Old 12-07-2006, 03:49 AM   #2 (permalink)
Vorph
Never Go Full Retard
 
Vorph's Avatar
 
Join Date: May 2002
Location: Hell
Posts: 5,863
Do you have to actually solve a puzzle or just determine if a given 9x9 grid is valid under the rules of sudoku?

If you're just checking for valid grids, a linear search is the simplest way (binary is for sorted lists). Not the most efficient thing in the world, but for evaluating a single 9 by 9 grid it doesn't really matter. Looking for duplicates is probably a little more efficient, but at 6AM I make no promises about my ability to calculate big O.

Solving a puzzle is a lot more complicated and you should read up on how a backtracking search algorithm works.
Vorph is offline   Reply With Quote

 
Uberguilds Network