Upload
eddie
View
5
Download
0
Embed Size (px)
DESCRIPTION
Hello
Citation preview
DATASTRUCTURE
Sudoku
Sudoku java source codepublic class Sudoku{public int[] puzzle = new int[81]; private void makePuzzle(int[] puzzle, int i) { for (int x = 1; x< 10 ; x++) { puzzle[i]=x; if(checkConstraints(puzzle)) { if (i==80)//terminal condition { System.out.println(this);//print out the completed puzzle puzzle[i]=0; return; } else makePuzzle(puzzle,i+1);//find a number for the next square } puzzle[i]=0;//this try didn't work, delete the evidence } } private boolean checkConstraints(int[] puzzle) { int test; //test that rows have unique values for (int column=0; column