aboutsummaryrefslogtreecommitdiff
path: root/src/moves.hpp
blob: 5f893ca5e65579a796743e3e2b44c85272279260 (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
27
28
29
30
31
32
33
34
35
#ifndef SRC_MOVES_H_
#define SRC_MOVES_H_

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

struct Position {
  uint8_t rank;
  uint8_t file;

  bool operator==(const Position &) const = default;
};

struct Move {
  Position From;
  Position To;

  bool operator==(const Move &) const = default;
};

enum MoveResult {
  SUCCES,
  FRIENDLY_PIECE,
  PIECE_IN_WAY,
};

MoveResult PlayMove(Move move, board *b); // TODO implement
std::vector<Move> GetLegalMoves(board *b);
Position IndexToPosition(int i);
void GenerateSlidingMoves(board *b, int from,
                          const std::array<int, 4> &directions,
                          std::vector<Move> &moves);

#endif /* SRC_MOVES_H_ */