movegen: refactor
This commit is contained in:
parent
8e57d6f916
commit
00e1f8d4b7
|
@ -57,25 +57,7 @@ ExtMove *generate(Position *pos, ExtMove *moveList);
|
|||
/// in handy to use this class instead of the low level generate() function.
|
||||
struct MoveList
|
||||
{
|
||||
MoveList() = delete;
|
||||
|
||||
MoveList &operator=(const MoveList &) = delete;
|
||||
|
||||
static void create();
|
||||
static void shuffle();
|
||||
|
||||
// TODO: Move to private
|
||||
inline static Move moveTable[SQUARE_NB][MD_NB] = { {MOVE_NONE} };
|
||||
|
||||
inline static std::array<Move, FILE_NB * RANK_NB> movePriorityTable {
|
||||
(Move)8, (Move)9, (Move)10, (Move)11, (Move)12, (Move)13, (Move)14, (Move)15,
|
||||
(Move)16, (Move)17, (Move)18, (Move)19, (Move)20, (Move)21, (Move)22, (Move)23,
|
||||
(Move)24, (Move)25, (Move)26, (Move)27, (Move)28, (Move)29, (Move)30, (Move)31,
|
||||
};
|
||||
|
||||
explicit MoveList(Position *pos) : last(generate(pos, moveList))
|
||||
{
|
||||
}
|
||||
explicit MoveList(Position *pos) : last(generate(pos, moveList)) {}
|
||||
|
||||
const ExtMove *begin() const
|
||||
{
|
||||
|
@ -97,6 +79,18 @@ struct MoveList
|
|||
return std::find(begin(), end(), move) != end();
|
||||
}
|
||||
|
||||
|
||||
static void create();
|
||||
static void shuffle();
|
||||
|
||||
inline static std::array<Move, FILE_NB *RANK_NB> movePriorityTable {
|
||||
(Move) 8, (Move) 9, (Move)10, (Move)11, (Move)12, (Move)13, (Move)14, (Move)15,
|
||||
(Move)16, (Move)17, (Move)18, (Move)19, (Move)20, (Move)21, (Move)22, (Move)23,
|
||||
(Move)24, (Move)25, (Move)26, (Move)27, (Move)28, (Move)29, (Move)30, (Move)31,
|
||||
};
|
||||
|
||||
inline static Move moveTable[SQUARE_NB][MD_NB] = { {MOVE_NONE} };
|
||||
|
||||
private:
|
||||
ExtMove moveList[MAX_MOVES], *last;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue