Draw Scoring

Chess programming

Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.

Draw Scoring

Draws of repetition

Before a search begins, the program generates a list of all the legal moves from the current position. Each of the moves is considered in turn. If the position that results from the making of a move is a repetition of a previous position in the game, the move is added to an array called Ply0DrawMoves. The program also generates all legal responses to each of these moves and again tests for position repetition, this time placing moves in an array called Ply1DrawMoves. During the search, any move at ply 0 that is found in the Ply0DrawMoves array is scored as a draw. Any move considered at ply 1 that is found in the Ply1DrawMoves array is also scored as a draw.

This method is used for reasons of speed but is not entirely satisfactory because draws of repetition are not detected at any depth greater than ply 1. Nevertheless, this implementation serves well enough to prevent the program from accepting draws of repetition in won positions.

The fifty move rule

The fifty moves rules states that if 50 moves have been made by each side in which no pawns of either colour have been moved and no capturing moves by either side have been made then the game is drawn. Rival detects draws by the fifty move rule at any stage during a search by using a counter variable in the position structure.

The Contempt Factor

The program does not score a draw as zero points. Instead, a contempt factor is used. Any draw moves at ply 0 are scored at contempt. Any draw moves at ply 1 are scored at minus contempt. This causes the program to accept a draw only if it considers that it is losing by more than the contempt factor.