mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Fix an off-by-one bug in sort_multipv()
Second parameter of insertion_sort() is a pointer to the element _after_ the last of the list, e.g. end() when sorting all items. If we want to sort say the first 2 moves we should write: sort_multipv(2); So, becuase in root moves loop move counter 'i' starts from 0, we need to pass: sort_multipv(i+1); To sort up to move 'i' included. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
5405efabcb
commit
3201a43460
1 changed files with 1 additions and 1 deletions
|
@ -149,7 +149,7 @@ namespace {
|
|||
void set_non_pv_scores(const Position& pos);
|
||||
|
||||
void sort() { insertion_sort<RootMove, Base::iterator>(begin(), end()); }
|
||||
void sort_multipv(int n) { insertion_sort<RootMove, Base::iterator>(begin(), begin() + n); }
|
||||
void sort_multipv(int n) { insertion_sort<RootMove, Base::iterator>(begin(), begin() + n + 1); }
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue