From 00e1f8d4b751b655d69da251294a19c7981d77f4 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sun, 30 Aug 2020 22:10:15 +0800 Subject: [PATCH] movegen: refactor --- src/movegen.h | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/movegen.h b/src/movegen.h index c31fa4cf..425ccfee 100644 --- a/src/movegen.h +++ b/src/movegen.h @@ -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 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 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; };