//main entry function that calls the right
//functions for gettnig sodoku answer
func TestGetSodokuSolution(t *testing.T) {

	solutionizer := buildSolutionizer()
	board := sodoku.GetPreDefinedBoard(TABLE, 9)

	computedAnswer := solutionizer.GetSodokuSolution(board)

	compactAnswer := compactString(computedAnswer)
	compactCorrectAnswer := compactString(TABLE_ANSWER)

	if compactAnswer != compactCorrectAnswer {
		t.Error("Expected ", compactCorrectAnswer, " GOT ", compactAnswer)
	}
}
Esempio n. 2
0
func main() {

	start := time.Now()
	inputEntries := os.Args[1]

	solutionizer := &solutions.Solutionizer{}
	board := sodoku.GetPreDefinedBoard(inputEntries, 9)

	solutionizer.GetSodokuSolution(board)
	fmt.Println(board.GetStringFormat())
	fmt.Printf("Succesfully completed board = %v\n", board.IsBoardComplete())
	fmt.Printf("%v difficulty\n", solutionizer.Difficulty())

	elapsed := time.Since(start)
	fmt.Println("Solutionizer took %s", elapsed)
}