10X12 Chess Game Grids Offset Representation

Moves of the computer chess game are done with a separate numbering system used based on few numbers and the actual piece among all the possible 12 pieces that resides on a square is represented using these numbers. Following numbers are few sample considered here. A 0 represents an empty square, pawn is represented with 1, King is represented with 6, 2 is for Knight, 3 for Bishop and 4 is used for Rook. Positive numbers are used for white pieces and blacks are represented with negative numbers. Once these pieces and their relative position is decided using these numbers, all the possible moves based on the position of the piece can be done easily.

The validity of the move is checked with respect to the target piece on the desired square to move and the number of the piece on the on the target square. If the number 99 is observed on the target square, then it is considered as the illegal move and the move is not accepted as per the logic and if the square contains 0 or any positive integer, then it is considered as the legal  move, as 0 represents the empty square and positive number indicates a white piece.

There are some advanced techniques to this offset estimation are introduced later and the main logic in these techniques is based on the 64-bit integer, where each and every bit represents the square in the chess board and this approach is known as bit-board or bit-map approach. Bits are used as the important entity in this approach and as mentioned each bit represent the square in the 8X8 board and the bit value 1 indicates that there is a piece in that particular square and 0 indicate that the corresponding square is empty. 

Leave a Reply

Your email address will not be published. Required fields are marked *