Information Technology Reference
In-Depth Information
Fig. 5. The chain in Dots-and-Boxes
Fig. 6. The corresponding chain in Strings-and-Coins
Fig. 7. The cycle in Dots-and-Boxes
Fig. 8. The cycle in Strings-and-Coins
4 The Design and Implementation of Dots Chessboard Based on
the Game Strings-and-Coins
Based on the analysis of Strings-and-Coins, we can play Dots-and-Boxes in a general
graph, and in section III we have provided the simply design of the description of
chessboard, and in this section we will provide an simply implementation of the pro-
gram of playing the game Dots-and-Boxes.
In the previous section we have seen how the game of Dots-and-Boxes must be
played. Now we will outline how to implement the suggested theory in a game playing
system.
z Game rule implementation
We should make sure that both player obey the rules and make their moves when they
are supposed to, like that you can choose if you make move first or make the computer
move first, and when the player get boxes(coins) he/she should make another move unit
no boxes can be obtain in this turn.
So we should keep track of the moves in program made on the board to check for
illegal moves and to keep track of the score of both players. This is enough to play a
complete game of Dots-and-Boxes or Strings-and-Coins, obeying the rules as described
in sections above, also we need to keep track of a few other features of the game in
order to implement a game playing device. The structures that arise during the game
must be represented after each move. during the game, just like an human player this is
not something that needs to be updated just before the computer's next turn, but every
time a move is made since everybody thinks all the time, not only when it's one's turn.
z Game representation
By the function DoMove We will keep track whose turn it is in the game and keeps the
score. We can set who moves first at the beginning of the game, like the human player
Search WWH ::




Custom Search