#include "constants.h" #include #include #include #include // Returns a list of positions with PieceType pt int get_pos_of(PieceType pt, std::array const *board); std::unordered_set get_poss_of(PieceType pt, std::array const *board); // Convert a Position number into a pair of x y coordiinates std::pair pos_to_pair(Position pn); // Check if int is a valid position in enum of Position // Allow ints, and pairs to be checked. bool is_valid_position(int pos); // Returns rank enum value for given pos Rank get_rank(int pos); // Checks if given piece matches a certain color. bool is_white(PieceType pt); bool is_black(PieceType pt); Color get_color(Position pn, std::array const *board); Color get_color(PieceType pt); // NO_COLOR returns NO_COLOR // WHITE returns BLACK // BLACK returns WHITE Color rev_color(Color c); // Get all positions of pieces which can move to this square // This may require helper functions for each individual peice. // TODO rename to something less stupid. void get_possible_movers(Position pn, std::array *pt,std::unordered_set *moves); // Get all possible moved for piece in Position pn. // This may require helper functions for each individual piece. void get_possible_moves(Position pn, std::array *pt,std::unordered_set *moves); // This functions removes moves that put your own king in check. void filter_checked_moves(int pos, std::array *board, std::unordered_set *moves); // Get all moves for piece in Position pn. void get_all_moves(int pos, std::array *pt,std::unordered_set *moves, bool recursive=true, int en_passant=Position::NA); std::unordered_set get_all_moves(int pos, std::array board, bool recursive=true, int en_passant=Position::NA); // Dumb function to do board moves. // Does not check if move is valid, just does it. std::array dumb_move(int move, std::array board);