foreground : Sudoku game, is a mathematical puzzle game, is the abbreviation of "Independent digital game", originated in Switzerland at the end of 18th century, after the development in the United States, in Japan to flourish.
Sudoku game can train the player's logic reasoning ability, many educators think Sudoku is a good way to exercise their brains.
But how to make this game? The first thing to know about its rules:
1. The game begins with a section of nine Gongge with numbers. In the 9x9 of the large nine Gongge (that is, 3 square width x3 gecko) Phalanx, each lattice is subdivided into a small nine gongge.
2. The game starts, has given a number of numbers, the other palace left White, the player needs to logically figure out what the remaining space is.
3. When filling numbers, the following conditions must be met: Fill in the blanks with the numbers in the 1~9 so that each number appears only once in each row, column, and small nine lattice of the "nine Gongge".
Sudoku Digital arrangement of the ever-changing way, play logic is simple, each Sudoku game solution is unique.
production process : First understand that Sudoku is divided into 3*3 9 large Gongge, and then 9 Omiya lattice inside again sub-3*3 small Gongge, this is the Sudoku table, and then in the arrangement of numbers in the inside, I set the size of 500*500,
But fear the player is not accustomed to, so the set can freely adjust the size of the function, that is, you can freely shrink the window, the table will follow its changes.
I choose to use 2 graphs, one is randomly arranged according to the traversal algorithm of a Sudoku table, here I call the answer, the other is to hide most of the numbers, only show some of the number of the Sudoku table, which is called the game table.
However, the player can only see the game side, the answer table is hidden in the following, which shows the digital background color is gray, and can not be modified, but the white background color of the lattice is allowed to fill the number, however, the game table above the number, may not be the same as the answer,
But because of the calendar algorithm, in judging rows, columns, each big Gongge, meet the conditions of no same number are counted in accordance with, anyway, the answer only one, to meet the nature of the game, let the players explore themselves, direct appearance of the same number, that is, the error, immediately
The number cannot be entered again, but there is no end-of-game hint, as the game continues. Only know all the grid is filled, and there is no error, the game table will be compared with the answer table, in fact, is generally correct, and then will pop out the success of the prompt.
Difficulties and Solutions : Because of the core code of the Sudoku game, most of my code is also a reference on the Internet, one of the more troublesome is that there is no way to adjust a more than one interface, originally imagined to make the same Gobang, making 2 interfaces, one for the large interface, the other is a Sudoku interface, In the Sudoku interface, there are select buttons, such as "Reset Game", "Exit Game", "View Answer", "difficulty" and so on. But I in the initial production interface when the choice of the statement is the interface of the 3*3 evenly distributed statements, if you want to change, it may be necessary to fill the game interface in the large interface, due to time problems, not to achieve.
There are more problems is to understand the use of online code, because the core code of the Sudoku is to traverse the algorithm to determine whether the correct, first set a good answer, and then according to the number of the display to constantly judge whether the number is correct, mainly to understand the realization of the idea.
Experience : In fact, a lot of game development must be detailed analysis and clear goals, because in the production, you will find that the difficulty is not terrible, terrible is the whim of things, often you will want to achieve these things, you will find it difficult to adjust the direction and goals of your original production, Take Sudoku game to do for example, it is not difficult to make, according to the reference on the Internet and their own Java knowledge, integration can be achieved, but the trouble is, you want to more new play, you will sacrifice a lot of things, there may be a conflict with their own goals, so, in formulating good goals, should first go to realize, To find a second goal, or two can not reach the shore, will only live in the bottleneck.
The design and realization of Sudoku Game