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

Retire 'finished' from MovePicker

It is not useful becasue it is safe to call
get_next_move() multiple times when phase == PH_STOP

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2010-01-03 13:27:31 +01:00
parent 5c8f571459
commit c8af7a867e
2 changed files with 4 additions and 10 deletions

View file

@ -74,7 +74,6 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
const History& h, SearchStack* ss) : pos(p), H(h) { const History& h, SearchStack* ss) : pos(p), H(h) {
int searchTT = ttm; int searchTT = ttm;
ttMoves[0].move = ttm; ttMoves[0].move = ttm;
finished = false;
lastBadCapture = badCaptures; lastBadCapture = badCaptures;
pinned = p.pinned_pieces(pos.side_to_move()); pinned = p.pinned_pieces(pos.side_to_move());
@ -156,7 +155,7 @@ void MovePicker::go_next_phase() {
return; return;
case PH_STOP: case PH_STOP:
lastMove = curMove + 1; // hack to be friendly for get_next_move() lastMove = curMove + 1; // Avoids another go_next_phase() call
return; return;
default: default:
@ -346,14 +345,10 @@ Move MovePicker::get_next_move() {
Move MovePicker::get_next_move(Lock &lock) { Move MovePicker::get_next_move(Lock &lock) {
lock_grab(&lock); lock_grab(&lock);
if (finished)
{ // Note that it is safe to call many times
lock_release(&lock); // get_next_move() when phase == PH_STOP
return MOVE_NONE;
}
Move m = get_next_move(); Move m = get_next_move();
if (m == MOVE_NONE)
finished = true;
lock_release(&lock); lock_release(&lock);
return m; return m;

View file

@ -64,7 +64,6 @@ private:
const Position& pos; const Position& pos;
const History& H; const History& H;
MoveStack ttMoves[2], killers[2]; MoveStack ttMoves[2], killers[2];
bool finished;
int phase; int phase;
const uint8_t* phasePtr; const uint8_t* phasePtr;
MoveStack *curMove, *lastMove, *lastBadCapture; MoveStack *curMove, *lastMove, *lastBadCapture;