aboutsummaryrefslogtreecommitdiff
path: root/src/moves.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/moves.hpp')
-rw-r--r--src/moves.hpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/moves.hpp b/src/moves.hpp
index e0ed427..47e41c0 100644
--- a/src/moves.hpp
+++ b/src/moves.hpp
@@ -10,12 +10,16 @@ enum move_generate_options : std::uint8_t {
CAPTUARES_ONLY,
NON_CAPTUARES_ONLY,
};
-
+void initMagicBitboards();
std::vector<uint16_t> GetLegalMoves(Game *g,
const move_generate_options &options);
std::vector<uint16_t> GetPseudoLegalMoves(const Game &g,
const move_generate_options &options);
-Position IndexToPosition(int i);
+constexpr Position IndexToPosition(int i) {
+ auto rank = static_cast<uint8_t>(i / 8);
+ auto file = static_cast<uint8_t>(i % 8);
+ return {.rank = rank, .file = file};
+}
bool IsSquareAttacked(const Game &g, Position square, bool byColor);
GameState GetNewGameState(Game *g);