2025-02-02 17:13:55 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../move.hpp"
|
|
|
|
|
2025-02-02 16:49:10 +01:00
|
|
|
#include <cstdint>
|
2025-02-02 20:17:36 +01:00
|
|
|
#include <optional>
|
2025-02-03 01:05:37 +01:00
|
|
|
#include <ostream>
|
2025-02-02 17:13:55 +01:00
|
|
|
#include <vector>
|
2025-02-02 16:49:10 +01:00
|
|
|
|
|
|
|
enum Piece : int8_t {
|
2025-02-02 15:15:14 +01:00
|
|
|
None = 0,
|
|
|
|
King = 1,
|
|
|
|
Pawn = 2,
|
|
|
|
Knigt = 3,
|
|
|
|
Bishop = 4,
|
|
|
|
Rook = 5,
|
|
|
|
Queen = 6,
|
|
|
|
};
|
|
|
|
|
2025-02-02 16:49:10 +01:00
|
|
|
enum Colour : int8_t {
|
2025-02-02 15:15:14 +01:00
|
|
|
White = 8,
|
|
|
|
Black = 16,
|
|
|
|
};
|
2025-02-02 17:13:55 +01:00
|
|
|
|
2025-02-03 01:05:37 +01:00
|
|
|
inline std::ostream& operator<<(std::ostream& os, const int8_t& i) {
|
|
|
|
os << std::to_string(i);
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
2025-02-02 17:13:55 +01:00
|
|
|
class Board;
|
2025-02-02 18:17:37 +01:00
|
|
|
struct Coords;
|
2025-02-02 17:16:37 +01:00
|
|
|
|
2025-02-03 00:08:13 +01:00
|
|
|
std::vector<Move> legal_moves(int8_t, const Board&, const Coords, bool = false);
|
2025-02-02 19:49:21 +01:00
|
|
|
std::vector<Move> keep_only_blocking(const std::vector<Move>, const Board&);
|
2025-02-02 20:17:36 +01:00
|
|
|
std::optional<Move> move_for_position(const Board&, const Coords, const Coords);
|
|
|
|
std::vector<Move> look_direction(const Board&, const Coords, int, int);
|
2025-02-02 17:16:37 +01:00
|
|
|
|
2025-02-02 18:17:37 +01:00
|
|
|
std::vector<Move> pawn_moves(const Board&, const Coords);
|
|
|
|
std::vector<Move> rook_moves(const Board&, const Coords);
|
|
|
|
std::vector<Move> knight_moves(const Board&, const Coords);
|
|
|
|
std::vector<Move> bishop_moves(const Board&, const Coords);
|
|
|
|
std::vector<Move> queen_moves(const Board&, const Coords);
|
|
|
|
std::vector<Move> king_moves(const Board&, const Coords);
|