mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Use a constant instead of value_mate_in(PLY_MAX)
And also apply the same to value_mated_in(PLY_MAX) No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
b27e237b04
commit
408fdcc93f
3 changed files with 20 additions and 15 deletions
|
@ -920,7 +920,7 @@ namespace {
|
||||||
&& !isCheck
|
&& !isCheck
|
||||||
&& refinedValue < beta - razor_margin(depth)
|
&& refinedValue < beta - razor_margin(depth)
|
||||||
&& ttMove == MOVE_NONE
|
&& ttMove == MOVE_NONE
|
||||||
&& abs(beta) < value_mate_in(PLY_MAX)
|
&& abs(beta) < VALUE_MATE_IN_PLY_MAX
|
||||||
&& !pos.has_pawn_on_7th(pos.side_to_move()))
|
&& !pos.has_pawn_on_7th(pos.side_to_move()))
|
||||||
{
|
{
|
||||||
Value rbeta = beta - razor_margin(depth);
|
Value rbeta = beta - razor_margin(depth);
|
||||||
|
@ -939,7 +939,7 @@ namespace {
|
||||||
&& depth < RazorDepth
|
&& depth < RazorDepth
|
||||||
&& !isCheck
|
&& !isCheck
|
||||||
&& refinedValue >= beta + futility_margin(depth, 0)
|
&& refinedValue >= beta + futility_margin(depth, 0)
|
||||||
&& abs(beta) < value_mate_in(PLY_MAX)
|
&& abs(beta) < VALUE_MATE_IN_PLY_MAX
|
||||||
&& pos.non_pawn_material(pos.side_to_move()))
|
&& pos.non_pawn_material(pos.side_to_move()))
|
||||||
return refinedValue - futility_margin(depth, 0);
|
return refinedValue - futility_margin(depth, 0);
|
||||||
|
|
||||||
|
@ -949,7 +949,7 @@ namespace {
|
||||||
&& depth > ONE_PLY
|
&& depth > ONE_PLY
|
||||||
&& !isCheck
|
&& !isCheck
|
||||||
&& refinedValue >= beta
|
&& refinedValue >= beta
|
||||||
&& abs(beta) < value_mate_in(PLY_MAX)
|
&& abs(beta) < VALUE_MATE_IN_PLY_MAX
|
||||||
&& pos.non_pawn_material(pos.side_to_move()))
|
&& pos.non_pawn_material(pos.side_to_move()))
|
||||||
{
|
{
|
||||||
ss->currentMove = MOVE_NULL;
|
ss->currentMove = MOVE_NULL;
|
||||||
|
@ -970,7 +970,7 @@ namespace {
|
||||||
if (nullValue >= beta)
|
if (nullValue >= beta)
|
||||||
{
|
{
|
||||||
// Do not return unproven mate scores
|
// Do not return unproven mate scores
|
||||||
if (nullValue >= value_mate_in(PLY_MAX))
|
if (nullValue >= VALUE_MATE_IN_PLY_MAX)
|
||||||
nullValue = beta;
|
nullValue = beta;
|
||||||
|
|
||||||
if (depth < 6 * ONE_PLY)
|
if (depth < 6 * ONE_PLY)
|
||||||
|
@ -1131,7 +1131,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
// Move count based pruning
|
// Move count based pruning
|
||||||
if ( moveCount >= futility_move_count(depth)
|
if ( moveCount >= futility_move_count(depth)
|
||||||
&& !(threatMove && connected_threat(pos, move, threatMove))
|
&& !(threatMove && connected_threat(pos, move, threatMove))
|
||||||
&& bestValue > value_mated_in(PLY_MAX)) // FIXME bestValue is racy
|
&& bestValue > VALUE_MATED_IN_PLY_MAX) // FIXME bestValue is racy
|
||||||
{
|
{
|
||||||
if (SpNode)
|
if (SpNode)
|
||||||
lock_grab(&(sp->lock));
|
lock_grab(&(sp->lock));
|
||||||
|
@ -1162,7 +1162,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
|
|
||||||
// Prune moves with negative SEE at low depths
|
// Prune moves with negative SEE at low depths
|
||||||
if ( predictedDepth < 2 * ONE_PLY
|
if ( predictedDepth < 2 * ONE_PLY
|
||||||
&& bestValue > value_mated_in(PLY_MAX)
|
&& bestValue > VALUE_MATED_IN_PLY_MAX
|
||||||
&& pos.see_sign(move) < 0)
|
&& pos.see_sign(move) < 0)
|
||||||
{
|
{
|
||||||
if (SpNode)
|
if (SpNode)
|
||||||
|
@ -1494,7 +1494,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
|
|
||||||
// Detect non-capture evasions that are candidate to be pruned
|
// Detect non-capture evasions that are candidate to be pruned
|
||||||
evasionPrunable = isCheck
|
evasionPrunable = isCheck
|
||||||
&& bestValue > value_mated_in(PLY_MAX)
|
&& bestValue > VALUE_MATED_IN_PLY_MAX
|
||||||
&& !pos.move_is_capture(move)
|
&& !pos.move_is_capture(move)
|
||||||
&& !pos.can_castle(pos.side_to_move());
|
&& !pos.can_castle(pos.side_to_move());
|
||||||
|
|
||||||
|
@ -1674,10 +1674,10 @@ split_point_start: // At split points actual search starts from here
|
||||||
|
|
||||||
Value value_to_tt(Value v, int ply) {
|
Value value_to_tt(Value v, int ply) {
|
||||||
|
|
||||||
if (v >= value_mate_in(PLY_MAX))
|
if (v >= VALUE_MATE_IN_PLY_MAX)
|
||||||
return v + ply;
|
return v + ply;
|
||||||
|
|
||||||
if (v <= value_mated_in(PLY_MAX))
|
if (v <= VALUE_MATED_IN_PLY_MAX)
|
||||||
return v - ply;
|
return v - ply;
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
|
@ -1689,10 +1689,10 @@ split_point_start: // At split points actual search starts from here
|
||||||
|
|
||||||
Value value_from_tt(Value v, int ply) {
|
Value value_from_tt(Value v, int ply) {
|
||||||
|
|
||||||
if (v >= value_mate_in(PLY_MAX))
|
if (v >= VALUE_MATE_IN_PLY_MAX)
|
||||||
return v - ply;
|
return v - ply;
|
||||||
|
|
||||||
if (v <= value_mated_in(PLY_MAX))
|
if (v <= VALUE_MATED_IN_PLY_MAX)
|
||||||
return v + ply;
|
return v + ply;
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
|
@ -1811,8 +1811,8 @@ split_point_start: // At split points actual search starts from here
|
||||||
Value v = value_from_tt(tte->value(), ply);
|
Value v = value_from_tt(tte->value(), ply);
|
||||||
|
|
||||||
return ( tte->depth() >= depth
|
return ( tte->depth() >= depth
|
||||||
|| v >= Max(value_mate_in(PLY_MAX), beta)
|
|| v >= Max(VALUE_MATE_IN_PLY_MAX, beta)
|
||||||
|| v < Min(value_mated_in(PLY_MAX), beta))
|
|| v < Min(VALUE_MATED_IN_PLY_MAX, beta))
|
||||||
|
|
||||||
&& ( ((tte->type() & VALUE_TYPE_LOWER) && v >= beta)
|
&& ( ((tte->type() & VALUE_TYPE_LOWER) && v >= beta)
|
||||||
|| ((tte->type() & VALUE_TYPE_UPPER) && v < beta));
|
|| ((tte->type() & VALUE_TYPE_UPPER) && v < beta));
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
#include "move.h"
|
#include "move.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
const int PLY_MAX = 100;
|
|
||||||
const int PLY_MAX_PLUS_2 = PLY_MAX + 2;
|
|
||||||
|
|
||||||
/// The SearchStack struct keeps track of the information we need to remember
|
/// The SearchStack struct keeps track of the information we need to remember
|
||||||
/// from nodes shallower and deeper in the tree during the search. Each
|
/// from nodes shallower and deeper in the tree during the search. Each
|
||||||
|
|
|
@ -158,6 +158,9 @@ const bool CpuIs64Bit = false;
|
||||||
typedef uint64_t Key;
|
typedef uint64_t Key;
|
||||||
typedef uint64_t Bitboard;
|
typedef uint64_t Bitboard;
|
||||||
|
|
||||||
|
const int PLY_MAX = 100;
|
||||||
|
const int PLY_MAX_PLUS_2 = PLY_MAX + 2;
|
||||||
|
|
||||||
enum ValueType {
|
enum ValueType {
|
||||||
VALUE_TYPE_NONE = 0,
|
VALUE_TYPE_NONE = 0,
|
||||||
VALUE_TYPE_UPPER = 1,
|
VALUE_TYPE_UPPER = 1,
|
||||||
|
@ -172,6 +175,10 @@ enum Value {
|
||||||
VALUE_MATE = 30000,
|
VALUE_MATE = 30000,
|
||||||
VALUE_INFINITE = 30001,
|
VALUE_INFINITE = 30001,
|
||||||
VALUE_NONE = 30002,
|
VALUE_NONE = 30002,
|
||||||
|
|
||||||
|
VALUE_MATE_IN_PLY_MAX = VALUE_MATE - PLY_MAX,
|
||||||
|
VALUE_MATED_IN_PLY_MAX = -VALUE_MATE + PLY_MAX,
|
||||||
|
|
||||||
VALUE_ENSURE_INTEGER_SIZE_P = INT_MAX,
|
VALUE_ENSURE_INTEGER_SIZE_P = INT_MAX,
|
||||||
VALUE_ENSURE_INTEGER_SIZE_N = INT_MIN
|
VALUE_ENSURE_INTEGER_SIZE_N = INT_MIN
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue