Information Technology Reference
In-Depth Information
Class Node
{
Public:
Edge* NextEdge(Edge* Next);
Node* NextNode(Edge* Next);
Int x,y;//the location of this coin
Edge* edge[4];//the four edges connected to this coin
Int degree;//the count of edges connected to it
Int owner;//the player got this coin
Int ground;//is it a ground node
}
Fig. 10. The definition of Node
about the start node and end node of this edge. For example, horizontal[1][0] represents
that this string is an horizontal string and it is connected by the nodes square[0][1] and
square[1][1].Similarly each array element in the array vertical[6][6] indicates that this
string is a vertical string and it is connected by the nodes square[1][0] and
square[1][1].Fig.11 shows the detailed definition of the string class.
Class Edge
{
Public:
Int length;
Node* node[2];
Edge* next;
Edge* prev;
Int removed;
}
Fig. 11. The definition of Edge
z Game structure representation
In Dots-and-Boxes game, the count of chains is the key for the player to win a Dots
game, and the Chain Rule tells you how many chains you should make to force your
opponent to open the first long chain or cycle:
If there is an odd numbers of dot, then the first player should make an odd number of
chains and the second player an even number of chains.
If there is an even number of total dots, then the first player should make an even
number of chains and the second player an odd number of chains.
For the board sizes of 6*6 dots (5*5 boxes), we can get it that first player should
make an even number of chains, and second player should make an odd number of
chains.
So the chain is an important aspect of wining the Dots game, and in our board de-
scription, how to inspect that if the chain is formed after one move and get the count of
chains is important for the player or program.
All structures that are discovered during the game will be stored in corresponding
lists. Each structure will have its own list, like that the chain will be stored in the chain
Search WWH ::




Custom Search