aboutsummaryrefslogtreecommitdiff
path: root/src/moves.hpp
blob: 0e8174c625cb460d95909df03318319e48ad79c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef SRC_MOVES_H_
#define SRC_MOVES_H_

#include "board/board.hpp"
#include <cstdint>
#include <vector>

enum move_generate_options : std::uint8_t {
  ALL,
  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);
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 GetboardState(Game *g, const std::vector<uint16_t> &moves);

#endif /* SRC_MOVES_H_ */