mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 16:47:37 +00:00
Revert "null move reorder" series
Does not seem to improve on the standard, latest results
from Joona after 2040 games are negative:
Orig - Mod: 454 - 424 - 1162
And is more or less the same I got few days ago.
So revert for now.
Verified same functionality of 595a90dfd
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
+3
-14
@@ -40,9 +40,7 @@
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
CACHE_LINE_ALIGNMENT
|
CACHE_LINE_ALIGNMENT
|
||||||
const MovegenPhaseT MainSearchPhaseTable[] = { PH_NULL_MOVE, PH_TT_MOVES, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP};
|
const MovegenPhaseT MainSearchPhaseTable[] = { PH_TT_MOVES, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP};
|
||||||
const MovegenPhaseT MainSearchNoNullPhaseTable[] = { PH_TT_MOVES, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP};
|
|
||||||
const MovegenPhaseT LowSearchPhaseTable[] = { PH_TT_MOVES, PH_NULL_MOVE, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP};
|
|
||||||
const MovegenPhaseT EvasionsPhaseTable[] = { PH_EVASIONS, PH_STOP};
|
const MovegenPhaseT EvasionsPhaseTable[] = { PH_EVASIONS, PH_STOP};
|
||||||
const MovegenPhaseT QsearchWithChecksPhaseTable[] = { PH_TT_MOVES, PH_QCAPTURES, PH_QCHECKS, PH_STOP};
|
const MovegenPhaseT QsearchWithChecksPhaseTable[] = { PH_TT_MOVES, PH_QCAPTURES, PH_QCHECKS, PH_STOP};
|
||||||
const MovegenPhaseT QsearchWithoutChecksPhaseTable[] = { PH_TT_MOVES, PH_QCAPTURES, PH_STOP};
|
const MovegenPhaseT QsearchWithoutChecksPhaseTable[] = { PH_TT_MOVES, PH_QCAPTURES, PH_STOP};
|
||||||
@@ -62,7 +60,7 @@ namespace {
|
|||||||
/// move ordering is at the current node.
|
/// move ordering is at the current node.
|
||||||
|
|
||||||
MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
|
MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
|
||||||
const History& h, SearchStack* ss, bool useNullMove) : pos(p), H(h) {
|
const History& h, SearchStack* ss) : pos(p), H(h) {
|
||||||
ttMoves[0].move = ttm;
|
ttMoves[0].move = ttm;
|
||||||
if (ss)
|
if (ss)
|
||||||
{
|
{
|
||||||
@@ -82,10 +80,8 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
|
|||||||
|
|
||||||
if (p.is_check())
|
if (p.is_check())
|
||||||
phasePtr = EvasionsPhaseTable;
|
phasePtr = EvasionsPhaseTable;
|
||||||
else if (d >= Depth(3 * OnePly))
|
|
||||||
phasePtr = useNullMove ? MainSearchPhaseTable : MainSearchNoNullPhaseTable;
|
|
||||||
else if (d > Depth(0))
|
else if (d > Depth(0))
|
||||||
phasePtr = useNullMove ? LowSearchPhaseTable : MainSearchNoNullPhaseTable;
|
phasePtr = MainSearchPhaseTable;
|
||||||
else if (d == Depth(0))
|
else if (d == Depth(0))
|
||||||
phasePtr = QsearchWithChecksPhaseTable;
|
phasePtr = QsearchWithChecksPhaseTable;
|
||||||
else
|
else
|
||||||
@@ -105,9 +101,6 @@ void MovePicker::go_next_phase() {
|
|||||||
phase = *(++phasePtr);
|
phase = *(++phasePtr);
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
|
|
||||||
case PH_NULL_MOVE:
|
|
||||||
return;
|
|
||||||
|
|
||||||
case PH_TT_MOVES:
|
case PH_TT_MOVES:
|
||||||
curMove = ttMoves;
|
curMove = ttMoves;
|
||||||
lastMove = curMove + 2;
|
lastMove = curMove + 2;
|
||||||
@@ -258,10 +251,6 @@ Move MovePicker::get_next_move() {
|
|||||||
{
|
{
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
|
|
||||||
case PH_NULL_MOVE:
|
|
||||||
go_next_phase();
|
|
||||||
return MOVE_NULL;
|
|
||||||
|
|
||||||
case PH_TT_MOVES:
|
case PH_TT_MOVES:
|
||||||
while (curMove != lastMove)
|
while (curMove != lastMove)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-2
@@ -38,7 +38,6 @@
|
|||||||
struct SearchStack;
|
struct SearchStack;
|
||||||
|
|
||||||
enum MovegenPhase {
|
enum MovegenPhase {
|
||||||
PH_NULL_MOVE, // Null move
|
|
||||||
PH_TT_MOVES, // Transposition table move and mate killer
|
PH_TT_MOVES, // Transposition table move and mate killer
|
||||||
PH_GOOD_CAPTURES, // Queen promotions and captures with SEE values >= 0
|
PH_GOOD_CAPTURES, // Queen promotions and captures with SEE values >= 0
|
||||||
PH_KILLERS, // Killer moves from the current ply
|
PH_KILLERS, // Killer moves from the current ply
|
||||||
@@ -65,7 +64,7 @@ class MovePicker {
|
|||||||
MovePicker& operator=(const MovePicker&); // silence a warning under MSVC
|
MovePicker& operator=(const MovePicker&); // silence a warning under MSVC
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MovePicker(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss = NULL, bool useNullMove = false);
|
MovePicker(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss = NULL);
|
||||||
Move get_next_move();
|
Move get_next_move();
|
||||||
Move get_next_move(Lock& lock);
|
Move get_next_move(Lock& lock);
|
||||||
int number_of_moves() const;
|
int number_of_moves() const;
|
||||||
|
|||||||
+41
-47
@@ -1281,56 +1281,13 @@ namespace {
|
|||||||
bool mateThreat = false;
|
bool mateThreat = false;
|
||||||
bool isCheck = pos.is_check();
|
bool isCheck = pos.is_check();
|
||||||
|
|
||||||
bool useNullMove = ( allowNullmove
|
// Null move search
|
||||||
|
if ( allowNullmove
|
||||||
&& depth > OnePly
|
&& depth > OnePly
|
||||||
&& !isCheck
|
&& !isCheck
|
||||||
&& !value_is_mate(beta)
|
&& !value_is_mate(beta)
|
||||||
&& ok_to_do_nullmove(pos)
|
&& ok_to_do_nullmove(pos)
|
||||||
&& approximateEval >= beta - NullMoveMargin);
|
&& approximateEval >= beta - NullMoveMargin)
|
||||||
|
|
||||||
// Null move search not allowed, try razoring
|
|
||||||
if ( !useNullMove
|
|
||||||
&& !value_is_mate(beta)
|
|
||||||
&& depth < RazorDepth
|
|
||||||
&& approximateEval < beta - RazorApprMargins[int(depth) - 2]
|
|
||||||
&& ss[ply - 1].currentMove != MOVE_NULL
|
|
||||||
&& ttMove == MOVE_NONE
|
|
||||||
&& !pos.has_pawn_on_7th(pos.side_to_move()))
|
|
||||||
{
|
|
||||||
Value v = qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID);
|
|
||||||
if (v < beta - RazorMargins[int(depth) - 2])
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Go with internal iterative deepening if we don't have a TT move
|
|
||||||
if (UseIIDAtNonPVNodes && ttMove == MOVE_NONE && depth >= 8*OnePly &&
|
|
||||||
evaluate(pos, ei, threadID) >= beta - IIDMargin)
|
|
||||||
{
|
|
||||||
search(pos, ss, beta, Min(depth/2, depth-2*OnePly), ply, false, threadID);
|
|
||||||
ttMove = ss[ply].pv[ply];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize a MovePicker object for the current position, and prepare
|
|
||||||
// to search all moves.
|
|
||||||
MovePicker mp = MovePicker(pos, ttMove, depth, H, &ss[ply], useNullMove);
|
|
||||||
|
|
||||||
Move move, movesSearched[256];
|
|
||||||
int moveCount = 0;
|
|
||||||
Value value, bestValue = -VALUE_INFINITE;
|
|
||||||
Bitboard dcCandidates = mp.discovered_check_candidates();
|
|
||||||
Value futilityValue = VALUE_NONE;
|
|
||||||
bool useFutilityPruning = depth < SelectiveDepth
|
|
||||||
&& !isCheck;
|
|
||||||
|
|
||||||
// Loop through all legal moves until no moves remain or a beta cutoff
|
|
||||||
// occurs.
|
|
||||||
while ( bestValue < beta
|
|
||||||
&& (move = mp.get_next_move()) != MOVE_NONE
|
|
||||||
&& !thread_should_stop(threadID))
|
|
||||||
{
|
|
||||||
|
|
||||||
// Null move search
|
|
||||||
if (move == MOVE_NULL)
|
|
||||||
{
|
{
|
||||||
ss[ply].currentMove = MOVE_NULL;
|
ss[ply].currentMove = MOVE_NULL;
|
||||||
|
|
||||||
@@ -1367,9 +1324,46 @@ namespace {
|
|||||||
&& connected_moves(pos, ss[ply - 1].currentMove, ss[ply].threatMove))
|
&& connected_moves(pos, ss[ply - 1].currentMove, ss[ply].threatMove))
|
||||||
return beta - 1;
|
return beta - 1;
|
||||||
}
|
}
|
||||||
continue;
|
}
|
||||||
|
// Null move search not allowed, try razoring
|
||||||
|
else if ( !value_is_mate(beta)
|
||||||
|
&& depth < RazorDepth
|
||||||
|
&& approximateEval < beta - RazorApprMargins[int(depth) - 2]
|
||||||
|
&& ss[ply - 1].currentMove != MOVE_NULL
|
||||||
|
&& ttMove == MOVE_NONE
|
||||||
|
&& !pos.has_pawn_on_7th(pos.side_to_move()))
|
||||||
|
{
|
||||||
|
Value v = qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID);
|
||||||
|
if (v < beta - RazorMargins[int(depth) - 2])
|
||||||
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Go with internal iterative deepening if we don't have a TT move
|
||||||
|
if (UseIIDAtNonPVNodes && ttMove == MOVE_NONE && depth >= 8*OnePly &&
|
||||||
|
evaluate(pos, ei, threadID) >= beta - IIDMargin)
|
||||||
|
{
|
||||||
|
search(pos, ss, beta, Min(depth/2, depth-2*OnePly), ply, false, threadID);
|
||||||
|
ttMove = ss[ply].pv[ply];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize a MovePicker object for the current position, and prepare
|
||||||
|
// to search all moves.
|
||||||
|
MovePicker mp = MovePicker(pos, ttMove, depth, H, &ss[ply]);
|
||||||
|
|
||||||
|
Move move, movesSearched[256];
|
||||||
|
int moveCount = 0;
|
||||||
|
Value value, bestValue = -VALUE_INFINITE;
|
||||||
|
Bitboard dcCandidates = mp.discovered_check_candidates();
|
||||||
|
Value futilityValue = VALUE_NONE;
|
||||||
|
bool useFutilityPruning = depth < SelectiveDepth
|
||||||
|
&& !isCheck;
|
||||||
|
|
||||||
|
// Loop through all legal moves until no moves remain or a beta cutoff
|
||||||
|
// occurs.
|
||||||
|
while ( bestValue < beta
|
||||||
|
&& (move = mp.get_next_move()) != MOVE_NONE
|
||||||
|
&& !thread_should_stop(threadID))
|
||||||
|
{
|
||||||
assert(move_is_ok(move));
|
assert(move_is_ok(move));
|
||||||
|
|
||||||
bool singleReply = (isCheck && mp.number_of_moves() == 1);
|
bool singleReply = (isCheck && mp.number_of_moves() == 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user