Java Reference
In-Depth Information
13
Sudoku Application
“The attempt to combine wisdom and power has only rarely
been successful and then only for a short while.”
—Albert Einstein
U ntil now, most of the concepts discussed throughout the course of this topic
were either described abstractly or, for the sake of simplicity, demonstrated with
small blocks of code or trivial programs. For this final chapter, we'll apply what
we've learned to create something with a bit more substance. Our sample appli-
cation utilizes and combines many more of the techniques and mechanisms elab-
orated upon, more closely resembling how JavaFX might be employed in the real
world.
The application we've chosen to implement is the game of Sudoku. As Sudoku
has gained considerable worldwide popularity recently, it is likely to have been
encountered by many reading this topic. To the uninitiated, you'll find that
Sudoku is easy to learn, and furthermore easy to become addicted to playing.
From a JavaFX perspective, Sudoku represents a reasonable example of how the
logic required for the rules of the game and the presentation of that game can be
nicely delineated.
For those unfamiliar with the game, a standard Sudoku board has nine rows and
nine columns of spaces. The board is also grouped into nine boxes or regions. To
solve a Sudoku puzzle, the numbers 1 through 9 must appear in each row, col-
umn, and box—but only once—and not in any particular order. New Sudoku
puzzles start out with a certain number of spaces already filled in. In general, the
fewer the number of pre-defined spaces, the more difficult the puzzle. The job of
the person playing the game is to use logic to fill in the rest of the spaces.
333
 
Search WWH ::




Custom Search