MarkZH / Genetic_Chess

An amateur attempt at breeding a chess-playing AI.
MIT License
10 stars 2 forks source link

New Look Ahead Gene functioning #59

Closed MarkZH closed 6 years ago

MarkZH commented 6 years ago

Current algorithm: for game tree nodes with depth > 0, calculate how long it will take to evaluate all resultant moves from a given board position. If this time is less than the time allotted for the move, recurse and examine the resulting moves. Otherwise, recurse anyway with a certain probability depending on whether the resulting board state has capturing moves.

New idea: When allocating time to examine deep positions in the game tree use

time_for_this_move = (time_left/moves_left)*(1 + factor);

where factor will be genetically determined and have several versions for whether the move captures, the move results in pieces in danger, or other factors (perhaps factor = 0; if moves_left == 1). Then, inLook_Ahead_Gene::enough_time_to_recurse(), return time_for_this_move > time_to_examine;. No probability. Actually, that line could just be moved to Genetic_AI::game_tree_search() and only call on the Look Ahead Gene for factors.

In other words, allocate more time than is available with the knowledge that alpha-beta pruning will cut off searches early, thus not actually using up all the time allocated. This should make factor active throughout the game tree search, instead of just at the leaves, where there is no information about how many nodes are left unexamined. This should make Genetic AIs more aggressive in using the time available.

MarkZH commented 6 years ago

Implemented by merging from now deleted new_clock_control branch.