/*
Pseudocode for Cutoff Checks
Copyright 2017 Tom Kerrigan
There are notes at the end of this file.
*/
#define CUTOFF_CHECK_DEPTH 4
int search(int alpha, int beta, int depth)
{
...
// normal hash table probe
x = probe_hash_table(hash_key, alpha, beta, depth);
if (x != KEEP_SEARCHING)
return x;
generate_moves();
for (i = 0; i < moves; i++)
{
if (deferred_moves != 0 && // note 1
depth >= CUTOFF_CHECK_DEPTH) // note 2
{
// cutoff check
x = probe_hash_table(hash_key, alpha, beta, depth);
if (x != KEEP_SEARCHING)
return x;
}
make_move(move[i]);
...
/*
Note 1:
If there aren't any deferred moves, it's impossible that a deferred move would have failed high.
Note 2:
CUTOFF_CHECK_DEPTH reduces memory traffic by preventing cutoff checks at shallow depths.
VERSION HISTORY
Version 1.0, 8/24/17
- First version
*/