/// perft() is our utility to verify move generation is bug free. All the legal
/// moves up to given depth are generated and counted and the sum returned.
/// perft() is our utility to verify move generation is bug free. All the legal
/// moves up to given depth are generated and counted and the sum returned.
MateThreatExtension[1] = Depth(get_option_value_int("Mate Threat Extension (PV nodes)"));
MateThreatExtension[0] = Depth(get_option_value_int("Mate Threat Extension (non-PV nodes)"));
MateThreatExtension[1] = Depth(get_option_value_int("Mate Threat Extension (PV nodes)"));
MateThreatExtension[0] = Depth(get_option_value_int("Mate Threat Extension (non-PV nodes)"));
ThreatDepth = get_option_value_int("Threat Depth") * OnePly;
Chess960 = get_option_value_bool("UCI_Chess960");
ThreatDepth = get_option_value_int("Threat Depth") * OnePly;
Chess960 = get_option_value_bool("UCI_Chess960");
Value root_search(Position& pos, SearchStack ss[], RootMoveList& rml, Value alpha, Value beta) {
Value oldAlpha = alpha;
Value root_search(Position& pos, SearchStack ss[], RootMoveList& rml, Value alpha, Value beta) {
Value oldAlpha = alpha;
Value oldAlpha, value;
bool isCheck, mateThreat, singleEvasion, moveIsCheck, captureOrPromotion, dangerous;
int moveCount = 0;
Value oldAlpha, value;
bool isCheck, mateThreat, singleEvasion, moveIsCheck, captureOrPromotion, dangerous;
int moveCount = 0;
if (depth < OnePly)
return qsearch(pos, ss, alpha, beta, Depth(0), ply, threadID);
if (depth < OnePly)
return qsearch(pos, ss, alpha, beta, Depth(0), ply, threadID);
bool isCheck, useFutilityPruning, singleEvasion, moveIsCheck, captureOrPromotion, dangerous;
bool mateThreat = false;
int moveCount = 0;
bool isCheck, useFutilityPruning, singleEvasion, moveIsCheck, captureOrPromotion, dangerous;
bool mateThreat = false;
int moveCount = 0;
if (depth < OnePly)
return qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID);
if (depth < OnePly)
return qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID);