Skip navigation

Over the years chess positions have been represented by bit maps and coordinates.  Bit maps are the most efficient representation of a chess board, and it is used by many programs to save storage.  A coordinate system uses an array or a list to store information about a chess position.  These two approaches have been applied to various chess applications.  In this text chess positions will be described in logic programming framework, a similar approach to McCarthy’s frame problem (McCarthy 1969).

First, the domain knowledge begins with the square(X,Y) relation.  The board starts with square(1,1) to square(8,8).  Thus, there are definitions for all 64 squares.  The next piece of domain knowledge is color relation with two facts – color(white) and color(black).  The piece relation has the following facts – piece(pawn), piece(knight), piece(bishop), piece(rook), piece(queen), and piece(king).  That is the basic knowledge in the domain.

The current state of each piece on the board will be defined as four tuple relation called state.  The state fact has four elements – color, piece, square, and position.  Upon close study, one can easily derive the state relation with the first three elements easily.  The state relation was first defined in Learning Chess Patterns (Morales 1992).  The color is an element of the set of {white, black}.  The piece is an element of the set of { pawn, knight, bishop, rook, queen, king }.  The square is the piece current location from the set of { square(1,1), square(1,2), …., square(8,7), square(8,8) }.  The last element state relation is the position number.  The position is an integer in the positive integer number set and allows a history of the positions.  Without this position information, the history of the previous position is lost after the move transition.

Example 1: Describe the state of the white king located at 4,4 and the black king located at 6,6.

state(color(white), piece(king), square(4,4), position(1)).
state(color(black), piece(king), square(6,6), position(1)).

Example 2: Using the position above, update the state after the white king moves to 4,5.

state(color(white), piece(king), square(4,5), position(2)).
state(color(black), piece(king), square(6,6), position(2)).

The state will have more state relations as their more pieces in the board.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.