mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 08:36:33 +08:00
Optimisation of Position::see and Position::see_sign
Stephane's patch removes the only usage of Position::see, where the returned value isn't immediately compared with a value. So I replaced this function by its optimised and more specific version see_ge. This function also supersedes the function Position::see_sign. bool Position::see_ge(Move m, Value v) const; This function tests if the SEE of a move is greater or equal than a given value. We use forward iteration on captures instread of backward one, therefore we don't need the swapList array. Also we stop as soon as we have enough information to obtain the result, avoiding unnecessary calls to the min_attacker function. Speed tests (Windows 7), 20 runs for each engine: Test engine: mean 866648, st. dev. 5964 Base engine: mean 846751, st. dev. 22846 Speedup: 1.023 Speed test by Stephane Nicolet Fishtest STC test: LLR: 2.96 (-2.94,2.94) [0.00,5.00] Total: 26040 W: 4675 L: 4442 D: 16923 http://tests.stockfishchess.org/tests/view/57f648990ebc59038170fa03 No functional change.
This commit is contained in:
committed by
Marco Costalba
parent
1e586288ca
commit
073eed590e
@@ -115,7 +115,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Value th)
|
||||
ttMove = ttm
|
||||
&& pos.pseudo_legal(ttm)
|
||||
&& pos.capture(ttm)
|
||||
&& pos.see(ttm) > threshold ? ttm : MOVE_NONE;
|
||||
&& pos.see_ge(ttm, threshold + 1)? ttm : MOVE_NONE;
|
||||
|
||||
stage += (ttMove == MOVE_NONE);
|
||||
}
|
||||
@@ -201,7 +201,7 @@ Move MovePicker::next_move() {
|
||||
move = pick_best(cur++, endMoves);
|
||||
if (move != ttMove)
|
||||
{
|
||||
if (pos.see_sign(move) >= VALUE_ZERO)
|
||||
if (pos.see_ge(move, VALUE_ZERO))
|
||||
return move;
|
||||
|
||||
// Losing capture, move it to the beginning of the array
|
||||
@@ -295,7 +295,7 @@ Move MovePicker::next_move() {
|
||||
{
|
||||
move = pick_best(cur++, endMoves);
|
||||
if ( move != ttMove
|
||||
&& pos.see(move) > threshold)
|
||||
&& pos.see_ge(move, threshold + 1))
|
||||
return move;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user