2022-04-14 20:03:32 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "app_consts.hpp"
|
|
|
|
#include "piece.hpp"
|
|
|
|
|
|
|
|
class Board
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Board();
|
|
|
|
Board(std::string board_fen);
|
|
|
|
|
|
|
|
void load_FEN(std::string board_fen);
|
2022-04-15 02:40:00 +00:00
|
|
|
std::string make_FEN();
|
2022-04-14 20:03:32 +00:00
|
|
|
|
|
|
|
void draw_board(SDL_Surface* dest_surface);
|
|
|
|
|
2022-04-15 02:40:00 +00:00
|
|
|
Team get_active_color();
|
|
|
|
Piece get_piece(int x, int y);
|
|
|
|
Piece get_piece(int space);
|
|
|
|
bool get_able_to_castle(Team team, Type board_half);
|
|
|
|
int get_en_passant();
|
|
|
|
int get_half_turn_count();
|
|
|
|
int get_full_turn_count();
|
|
|
|
|
|
|
|
void set_selected_space(int x, int y);
|
|
|
|
void set_selected_space(int space);
|
|
|
|
|
|
|
|
void get_selected_space(int* x, int* y);
|
|
|
|
int get_selected_space();
|
|
|
|
|
|
|
|
std::vector<int> get_moves_for_space(int x, int y);
|
|
|
|
std::vector<int> get_moves_for_space(int space);
|
|
|
|
|
|
|
|
bool is_check(Team team);
|
2022-04-14 20:03:32 +00:00
|
|
|
private:
|
|
|
|
Piece game_board[BOARD_SIZE][BOARD_SIZE];
|
|
|
|
Team active_color;
|
|
|
|
bool able_to_castle[2][2];
|
2022-04-15 02:40:00 +00:00
|
|
|
int en_passant;
|
2022-04-14 20:03:32 +00:00
|
|
|
int half_turn_count, full_turn_count;
|
2022-04-15 02:40:00 +00:00
|
|
|
int selected_space;
|
|
|
|
|
|
|
|
MoveType can_move(int space_from, int space_to);
|
2022-04-14 20:03:32 +00:00
|
|
|
};
|