]> git.sesse.net Git - stockfish/commit
Fix an off-by-one bug in sort_multipv()
authorMarco Costalba <mcostalba@gmail.com>
Sat, 1 Jan 2011 14:07:45 +0000 (15:07 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 1 Jan 2011 15:07:30 +0000 (16:07 +0100)
commit3201a434603b0cd6707391c9026f31a519d46dc0
treed54eabab1b06797da19544bb7826d4c392229da6
parent5405efabcbd1b60f64a5d88b596178dcf92e98e4
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>
src/search.cpp