move_picker: swap-and-reduce for TT move - #191
Conversation
| } | ||
|
|
||
| private: | ||
| movegen::Move pickMove(uint16_t pos) |
There was a problem hiding this comment.
might improve performance a bit - it's a smaller method, so most likely worth it :)
| movegen::Move pickMove(uint16_t pos) | |
| inline movegen::Move pickMove(uint16_t pos) |
| return std::nullopt; | ||
|
|
||
| m_moves.nullifyMove(i); | ||
| assert(!m_moves[m_syzygyHead].isNull()); |
There was a problem hiding this comment.
Don't think we need to check for null anymore - movegen does not generate nullmoves :)
|
|
||
| for (uint16_t i = 0; i < m_moves.count(); i++) { | ||
| for (uint16_t i = 0; i < m_size; i++) { | ||
| if (!m_moves[i].isNull() && m_moves[i] == *m_ttMove) { |
There was a problem hiding this comment.
No need to check for null-move anymore :) (goes for all the picking now stages)
| if (!m_moves[i].isNull() && m_moves[i] == *m_ttMove) { | |
| if (m_moves[i] == *m_ttMove) { |
| std::optional<movegen::Move> bestMove { std::nullopt }; | ||
| int32_t bestScore = std::numeric_limits<int32_t>::min(); | ||
| uint16_t bestMoveIndex {}; | ||
| bool foundBestMove { false }; |
There was a problem hiding this comment.
Probably cleaner to use a std::optional for the index as it's used to pick the move :)
| std::optional<movegen::Move> bestMove {}; | ||
| int32_t bestScore = std::numeric_limits<int32_t>::min(); | ||
| uint16_t bestMoveIndex {}; | ||
| bool foundBestMove { false }; |
|
|
||
| movegen::ValidMoves m_moves {}; | ||
| std::array<int32_t, s_maxMoves> m_scores {}; | ||
| uint16_t m_size {}; |
There was a problem hiding this comment.
maybe rename to align with the head used for syzygy :)
| uint16_t m_size {}; | |
| uint16_t m_tail {}; |
| movegen::ValidMoves m_moves {}; | ||
| std::array<int32_t, s_maxMoves> m_scores {}; | ||
| uint16_t m_size {}; | ||
| uint16_t m_syzygyHead {}; |
There was a problem hiding this comment.
I'd add a comment to each of these to explain how they're not connected (syzygy we pick from the front and otherwise we move the picked move to the back and decrease the tail etc)
| private: | ||
| movegen::Move pickMove(uint16_t pos) | ||
| { | ||
| auto pickedMove = m_moves[pos]; |
There was a problem hiding this comment.
| auto pickedMove = m_moves[pos]; | |
| const auto pickedMove = m_moves[pos]; |
b9c1219 to
d963bf0
Compare
| } | ||
|
|
||
| constexpr std::optional<movegen::Move> pickTtMove() | ||
| constexpr std::optional<movegen::Move> |
d963bf0 to
78b9302
Compare
Instead of leaving null 'holes' in the move picker, we move picked moves to the back of the array of all moves and reduce the size accordingly. Bench has changed, because quiet moves at the root have no history, and are therefore picked in their order of generation. So changing the move order has large effects down the search. Bench 1446371
78b9302 to
b7b0066
Compare
Instead of leaving null 'holes' in the move picker, we move picked moves to the back of the array of all moves and reduce the size accordingly.
Bench has changed, because quiet moves at the root have no history, and therefore picked in their order of generation. So changing the move order has large effects down the search.
https://openbench.bunny.beer/test/564/
Bench 1513294