The data structure used to represent information on the board is mainly discussed. In general, it is related to the specific chess class. Generally, a two-dimensional array is used to describe the information of the Board and its pawns. Chinese chess can use a two-dimensional array of 9x10 bytes to represent the Chinese chess board. Each byte in the array represents an intersection point on the board,
The value indicates what pawns are placed on the intersection or no pawns. However, in Chinese chess, there are 14 different chess pieces, and 7 are red and black.
In the following format.
"2, 3, 6, 5, 1, 5, 6, 3, 2 』
"0, 0, 0, 0, 0, 0, 0, 0 』
"0, 4, 0, 0, 0, 0, 0, 4, 0 』
"7, 0, 7, 0, 7, 0, 7, 0, 7 』
"0, 0, 0, 0, 0, 0, 0, 0 』
"0, 0, 0, 0, 0, 0, 0, 0 』
"14,0, 14,0, 14,0, 14,0, 14 』
"0, 11, 0, 0, 0, 0, 0, 11, 0 』
"0, 0, 0, 0, 0, 0, 0, 0 』
"9, 10, 13, 12, 8, 12, 13, 10, 9 』
The numbers on the Board represent different types of chess games, for example, 2 represents a black car, 9 represents a red car, and so on.
There are other representation methods, such as bit representation.