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.