aboutsummaryrefslogtreecommitdiff
path: root/src/moves.hpp
diff options
context:
space:
mode:
authorAdam <adammegarules1@gmail.com>2026-08-18 20:55:21 +0200
committerAdam <adammegarules1@gmail.com>2026-08-18 20:55:21 +0200
commita4024e15a807e26ddad04d6804742fab0d6c8c96 (patch)
tree7e951f816614fbf40eba1b32cbee61bbb54fbdfb /src/moves.hpp
parentfcc0dc87f04403c8073ab769d3046d32342e6c2a (diff)
perf(board): implementing magic bitboards for faster move generation
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);