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

Use MovePicker's move ordering also at root

After testing on our russian cluster: +3 elo after 4200 games

So keep it becuase it allows a good semplification.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Joona Kiiski 2010-08-19 13:29:40 +03:00 committed by Marco Costalba
parent 79a28841f9
commit a44f79141e

View file

@ -117,7 +117,7 @@ namespace {
struct RootMove { struct RootMove {
RootMove() { nodes = cumulativeNodes = ourBeta = theirBeta = 0ULL; } RootMove() { mp_score = 0; nodes = cumulativeNodes = ourBeta = theirBeta = 0ULL; }
// RootMove::operator<() is the comparison function used when // RootMove::operator<() is the comparison function used when
// sorting the moves. A move m1 is considered to be better // sorting the moves. A move m1 is considered to be better
@ -125,11 +125,12 @@ namespace {
// have equal score but m1 has the higher beta cut-off count. // have equal score but m1 has the higher beta cut-off count.
bool operator<(const RootMove& m) const { bool operator<(const RootMove& m) const {
return score != m.score ? score < m.score : theirBeta <= m.theirBeta; return score != m.score ? score < m.score : mp_score <= m.mp_score;
} }
Move move; Move move;
Value score; Value score;
int mp_score;
int64_t nodes, cumulativeNodes, ourBeta, theirBeta; int64_t nodes, cumulativeNodes, ourBeta, theirBeta;
Move pv[PLY_MAX_PLUS_2]; Move pv[PLY_MAX_PLUS_2];
}; };
@ -143,6 +144,8 @@ namespace {
public: public:
RootMoveList(Position& pos, Move searchMoves[]); RootMoveList(Position& pos, Move searchMoves[]);
void set_mp_scores(const Position &pos);
int move_count() const { return count; } int move_count() const { return count; }
Move get_move(int moveNum) const { return moves[moveNum].move; } Move get_move(int moveNum) const { return moves[moveNum].move; }
Value get_move_score(int moveNum) const { return moves[moveNum].score; } Value get_move_score(int moveNum) const { return moves[moveNum].score; }
@ -739,6 +742,7 @@ namespace {
while (1) while (1)
{ {
// Sort the moves before to (re)search // Sort the moves before to (re)search
rml.set_mp_scores(pos);
rml.sort(); rml.sort();
// Step 10. Loop through all moves in the root move list // Step 10. Loop through all moves in the root move list
@ -2777,6 +2781,26 @@ namespace {
} }
void RootMoveList::set_mp_scores(const Position &pos)
{
MovePicker mp = MovePicker(pos, MOVE_NONE, ONE_PLY, H);
Move move;
int moveCount = 0;
while ((move = mp.get_next_move()) != MOVE_NONE)
{
moveCount++;
for (int i = 0; i < count; i++)
{
if (moves[i].move == move)
{
moves[i].mp_score = 512 - moveCount;
break;
}
}
}
}
// RootMoveList simple methods definitions // RootMoveList simple methods definitions
void RootMoveList::set_move_nodes(int moveNum, int64_t nodes) { void RootMoveList::set_move_nodes(int moveNum, int64_t nodes) {