Skip to content

Commit

Permalink
Clean up RootMove less operator
Browse files Browse the repository at this point in the history
This is used by std::stable_sort() to sort moves from highest score to lowest score.

1) The comment is incorrect since highest to lowest means descending.
2) It's more natural to implement a less operator using another less operator rather than a greater operator.

No functional change.

Resolves official-stockfish#504
  • Loading branch information
mstembera authored and zamar committed Nov 21, 2015
1 parent 328098d commit 79f3930
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct RootMove {

explicit RootMove(Move m) : pv(1, m) {}

bool operator<(const RootMove& m) const { return score > m.score; } // Ascending sort
bool operator<(const RootMove& m) const { return m.score < score; } // Descending sort
bool operator==(const Move& m) const { return pv[0] == m; }
void insert_pv_in_tt(Position& pos);
bool extract_ponder_from_tt(Position& pos);
Expand Down

0 comments on commit 79f3930

Please sign in to comment.