Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Difference between revisions of "Move Representation"


Line 1: Line 1:
The move is represented by a 16-bit integer
+
The representation of a chess game includes representation of positions and moves. Positions represent states of game and moves represent operators which are used to achieve transition from one position to another. Both of these representations must be able to do the following operations:
value with following bit mask.
+
 
 +
* make move
 +
* unmake move
 +
* generate a list of all possible moves
 +
* generate a list of all possible capture moves
 +
* evaluate a position
 +
* store moves
 +
* compare positions
 +
* set position
 +
* check if position has been repeated 3 times
 +
* check rule of 50 moves
 +
* check if king is in check
 +
 
 +
All of these operations must be very time efficient because they take place inside the search algorithm. Efficient presentation of game will therefore exhibit an efficient chess program.
 +
 
 +
The move is represented by a 16-bit integer value with following bit mask.
  
 
0000000000111111 - index of square from.<br>
 
0000000000111111 - index of square from.<br>
Line 6: Line 21:
 
1111110000000000 - index of square to.<br>
 
1111110000000000 - index of square to.<br>
  
First six bits are used for the description of source square, next four for promotion piece type and last six for destination square. Promotion piece type is
+
First six bits are used for the description of source square, next four for promotion piece type and last six for destination square. Promotion piece type is optionaly.
optionaly.
+
 
 +
[[Category:Borko Bošković]]
 +
[[Category:Chess program BBChess]]
 +
 
 +
[[sl:Predstavitev potez]]

Revision as of 07:27, 14 October 2006

The representation of a chess game includes representation of positions and moves. Positions represent states of game and moves represent operators which are used to achieve transition from one position to another. Both of these representations must be able to do the following operations:

  • make move
  • unmake move
  • generate a list of all possible moves
  • generate a list of all possible capture moves
  • evaluate a position
  • store moves
  • compare positions
  • set position
  • check if position has been repeated 3 times
  • check rule of 50 moves
  • check if king is in check

All of these operations must be very time efficient because they take place inside the search algorithm. Efficient presentation of game will therefore exhibit an efficient chess program.

The move is represented by a 16-bit integer value with following bit mask.

0000000000111111 - index of square from.
0000001111000000 - promotion piece (optionally).
1111110000000000 - index of square to.

First six bits are used for the description of source square, next four for promotion piece type and last six for destination square. Promotion piece type is optionaly.