1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-02 09:39:36 +00:00

MovePicker doesn't need to know if called from a pv node

This was needed by an old optimization in sorting of
non-captures that is now obsoleted by new std::sort()
approach.

Remove also the unused depth member data. Interestingly
this has always been unused since the Glaurung days.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2009-06-11 11:04:05 +02:00
parent c7843f2f79
commit 3e0753bef3
4 changed files with 11 additions and 18 deletions

View file

@ -63,10 +63,8 @@ namespace {
/// search captures, promotions and some checks) and about how important good
/// move ordering is at the current node.
MovePicker::MovePicker(const Position& p, bool pv, Move ttm, Depth d,
MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
const History& h, SearchStack* ss) : pos(p), H(h) {
pvNode = pv;
ttMove = ttm;
if (ss)
{
@ -76,17 +74,14 @@ MovePicker::MovePicker(const Position& p, bool pv, Move ttm, Depth d,
} else
mateKiller = killer1 = killer2 = MOVE_NONE;
depth = d;
movesPicked = 0;
numOfMoves = 0;
numOfBadCaptures = 0;
checkKillers = checkLegal = false;
movesPicked = numOfMoves = numOfBadCaptures = 0;
checkKillers = checkLegal = finished = false;
if (p.is_check())
phaseIndex = EvasionsPhaseIndex;
else if (depth > Depth(0))
else if (d > Depth(0))
phaseIndex = MainSearchPhaseIndex;
else if (depth == Depth(0))
else if (d == Depth(0))
phaseIndex = QsearchWithChecksPhaseIndex;
else
phaseIndex = QsearchWithoutChecksPhaseIndex;

View file

@ -65,7 +65,7 @@ public:
PH_STOP
};
MovePicker(const Position& p, bool pvnode, Move ttm, Depth d, const History& h, SearchStack* ss = NULL);
MovePicker(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss = NULL);
Move get_next_move();
Move get_next_move(Lock& lock);
int number_of_moves() const;
@ -85,8 +85,6 @@ private:
Move ttMove, mateKiller, killer1, killer2;
Bitboard pinned, dc;
MoveStack moves[256], badCaptures[64];
bool pvNode;
Depth depth;
int phaseIndex;
int numOfMoves, numOfBadCaptures;
int movesPicked;

View file

@ -141,7 +141,7 @@ Move move_from_san(const Position& pos, const string& movestr) {
assert(pos.is_ok());
MovePicker mp = MovePicker(pos, false, MOVE_NONE, OnePly, H);
MovePicker mp = MovePicker(pos, MOVE_NONE, OnePly, H);
// Castling moves
if (movestr == "O-O-O" || movestr == "O-O-O+")
@ -365,7 +365,7 @@ namespace {
if (type_of_piece(pc) == KING)
return AMBIGUITY_NONE;
MovePicker mp = MovePicker(pos, false, MOVE_NONE, OnePly, H);
MovePicker mp = MovePicker(pos, MOVE_NONE, OnePly, H);
Move mv, moveList[8];
int n = 0;

View file

@ -1054,7 +1054,7 @@ namespace {
// Initialize a MovePicker object for the current position, and prepare
// to search all moves
MovePicker mp = MovePicker(pos, true, ttMove, depth, Threads[threadID].H, &ss[ply]);
MovePicker mp = MovePicker(pos, ttMove, depth, Threads[threadID].H, &ss[ply]);
Move move, movesSearched[256];
int moveCount = 0;
@ -1315,7 +1315,7 @@ namespace {
// Initialize a MovePicker object for the current position, and prepare
// to search all moves:
MovePicker mp = MovePicker(pos, false, ttMove, depth, Threads[threadID].H, &ss[ply]);
MovePicker mp = MovePicker(pos, ttMove, depth, Threads[threadID].H, &ss[ply]);
Move move, movesSearched[256];
int moveCount = 0;
@ -1535,7 +1535,7 @@ namespace {
// Initialize a MovePicker object for the current position, and prepare
// to search the moves. Because the depth is <= 0 here, only captures,
// queen promotions and checks (only if depth == 0) will be generated.
MovePicker mp = MovePicker(pos, pvNode, ttMove, depth, Threads[threadID].H);
MovePicker mp = MovePicker(pos, ttMove, depth, Threads[threadID].H);
Move move;
int moveCount = 0;
Bitboard dcCandidates = mp.discovered_check_candidates();