1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Retire badCaptures[] array in MovePicker

Use the tail of moves[] array to store bad captures.

No functional change but some move reorder. Verified with old perft.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2010-09-13 09:49:49 +02:00
parent 4143d00011
commit 42ed488987
2 changed files with 9 additions and 11 deletions

View file

@ -75,7 +75,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
int searchTT = ttm; int searchTT = ttm;
ttMoves[0].move = ttm; ttMoves[0].move = ttm;
badCaptureThreshold = 0; badCaptureThreshold = 0;
lastBadCapture = badCaptures; badCaptures = moves + 256;
pinned = p.pinned_pieces(pos.side_to_move()); pinned = p.pinned_pieces(pos.side_to_move());
@ -148,10 +148,10 @@ void MovePicker::go_next_phase() {
return; return;
case PH_BAD_CAPTURES: case PH_BAD_CAPTURES:
// Bad captures SEE value is already calculated so just sort them // Bad captures SEE value is already calculated so just pick
// to get SEE move ordering. // them in order to get SEE move ordering.
curMove = badCaptures; curMove = badCaptures;
lastMove = lastBadCapture; lastMove = moves + 256;
return; return;
case PH_EVASIONS: case PH_EVASIONS:
@ -292,12 +292,10 @@ Move MovePicker::get_next_move() {
if (seeValue >= badCaptureThreshold) if (seeValue >= badCaptureThreshold)
return move; return move;
// Losing capture, move it to the badCaptures[] array, note // Losing capture, move it to the tail of the array, note
// that move has now been already checked for legality. // that move has now been already checked for legality.
assert(int(lastBadCapture - badCaptures) < 63); (--badCaptures)->move = move;
lastBadCapture->move = move; badCaptures->score = seeValue;
lastBadCapture->score = seeValue;
lastBadCapture++;
} }
break; break;

View file

@ -65,8 +65,8 @@ private:
MoveStack ttMoves[2], killers[2]; MoveStack ttMoves[2], killers[2];
int badCaptureThreshold, phase; int badCaptureThreshold, phase;
const uint8_t* phasePtr; const uint8_t* phasePtr;
MoveStack *curMove, *lastMove, *lastGoodNonCapture, *lastBadCapture; MoveStack *curMove, *lastMove, *lastGoodNonCapture, *badCaptures;
MoveStack moves[256], badCaptures[64]; MoveStack moves[256];
}; };