From 16add284ef012f914d0d3442ee67ec2149a30db7 Mon Sep 17 00:00:00 2001 From: Tait Hoyem <44244401+TTWNO@users.noreply.github.com> Date: Tue, 23 Apr 2019 22:36:16 +0000 Subject: [PATCH] Make unordered_sets unto vectors --- src/all_moves_functions.cpp | 32 +++++++++++++-------------- src/bitwise.h | 2 +- src/functions.cpp | 24 ++++++++++---------- src/functions.h | 14 ++++++------ tests/B_test_boards.h | 20 ++++++++--------- tests/W_test_boards.h | 20 ++++++++--------- tests/custom_printing.cpp | 6 ++--- tests/main.cpp | 6 ++--- tests/test_functions.cpp | 44 ++++++++++++++++++------------------- tests/test_functions.h | 16 +++++++------- tests/valid_moves.h | 30 ++++++++++++------------- 11 files changed, 107 insertions(+), 107 deletions(-) diff --git a/src/all_moves_functions.cpp b/src/all_moves_functions.cpp index 3e79d77..b918e79 100644 --- a/src/all_moves_functions.cpp +++ b/src/all_moves_functions.cpp @@ -1,5 +1,5 @@ #include "constants.h" -#include +#include #include #include @@ -23,7 +23,7 @@ Color _rev_color(Color c){ } // This function will set the boolean guarding it to false if it is blocked, thus stopping it from running. -void _add_if_not_blocked(int pos, int from, std::unordered_set *pns, std::array *board, Color color_of_piece, Color color_of_opposite, bool *is_not_blocked){ +void _add_if_not_blocked(int pos, int from, std::vector *pns, std::array *board, Color color_of_piece, Color color_of_opposite, bool *is_not_blocked){ if (*is_not_blocked){ if (!is_valid_position(pos)){ *is_not_blocked = false; @@ -31,47 +31,47 @@ void _add_if_not_blocked(int pos, int from, std::unordered_set *pns, std::a if (_xy_is_color(pos, board, color_of_piece)){ *is_not_blocked = false; } else if (_xy_is_color(pos, board, color_of_opposite)){ - pns->insert(make_move(from, pos)); + pns->push_back(make_move(from, pos)); *is_not_blocked = false; } else { - pns->insert(make_move(from, pos)); + pns->push_back(make_move(from, pos)); } } } } // This function is for non-ray types only, as it ignores the 'ray rules', and just jumps over stuff (e.g. knight), or only moves one space generally (e.g. king) -void _add_if_not_blocked(int pos, int from, std::unordered_set *pns, std::array *board, Color color_of_piece, Color color_of_opposite){ +void _add_if_not_blocked(int pos, int from, std::vector *pns, std::array *board, Color color_of_piece, Color color_of_opposite){ if (!is_valid_position(pos) || _xy_is_color(pos, board, color_of_piece)){ return; } else { - pns->insert(make_move(from, pos)); + pns->push_back(make_move(from, pos)); } } // This is a specialized function for the pawn's diagonal takes. // It will only to pns if there is a piece of opposite color on it. -void _pawn_diag_add_if_not_blocked(int pos, int from, std::unordered_set *pns, std::array *board, Color color_of_piece, Color color_of_opposite, int en_passant){ +void _pawn_diag_add_if_not_blocked(int pos, int from, std::vector *pns, std::array *board, Color color_of_piece, Color color_of_opposite, int en_passant){ if (is_valid_position(pos) && (_xy_is_color(pos, board, color_of_opposite) || pos == en_passant)){ - pns->insert(make_move(from, pos)); + pns->push_back(make_move(from, pos)); } } // This is a specialized functions for the pawn's inability to take going forward. -// Notice the lack of insertion where there usually is when (x,y) is a different color. -void _pawn_add_if_not_blocked(int pos, int from, std::unordered_set *pns, std::array *board, Color color_of_piece, Color color_of_opposite, bool *is_not_blocked){ +// Notice the lack of push_backion where there usually is when (x,y) is a different color. +void _pawn_add_if_not_blocked(int pos, int from, std::vector *pns, std::array *board, Color color_of_piece, Color color_of_opposite, bool *is_not_blocked){ if (*is_not_blocked){ if ((*board)[pos] != PieceType::NONE || (*board)[pos] == PieceType::INV){ *is_not_blocked = false; } else { - pns->insert(make_move(from, pos)); + pns->push_back(make_move(from, pos)); } } } -void _get_all_moves_rook(int pos, std::unordered_set *pns, std::array* board, Color pc, Color rc){ +void _get_all_moves_rook(int pos, std::vector *pns, std::array* board, Color pc, Color rc){ for (int rk_off : ROOK_PIECE_OFFSETS){ bool* not_blocked = new bool(true); for (int offset=1; offset<8; offset++){ @@ -93,7 +93,7 @@ void _get_all_moves_rook(int pos, std::unordered_set *pns, std::array *pns, std::array* board, Color pc, Color rc){ +void _get_all_moves_bishop(int pos, std::vector *pns, std::array* board, Color pc, Color rc){ for (int bs_off : BISHOP_PIECE_OFFSETS){ bool* not_blocked = new bool(true); for (int offset=1; offset<8; offset++){ @@ -118,7 +118,7 @@ void _get_all_moves_bishop(int pos, std::unordered_set *pns, std::array *pns, std::array* board, Color pc, Color rc){ +void _get_all_moves_knight(int pos, std::vector *pns, std::array* board, Color pc, Color rc){ for (int kn_off : KNIGHT_PIECE_OFFSETS){ bool* not_blocked = new bool(true); _add_if_not_blocked(pos+kn_off, pos, pns, board, pc, rc); @@ -134,7 +134,7 @@ void _get_all_moves_knight(int pos, std::unordered_set *pns, std::array *pns, std::array* board, Color pc, Color rc){ +void _get_all_moves_king(int pos, std::vector *pns, std::array* board, Color pc, Color rc){ for (int kn_off : KING_PIECE_OFFSETS){ bool* not_blocked = new bool(true); _add_if_not_blocked(pos+kn_off, pos, pns, board, pc, rc); @@ -153,7 +153,7 @@ void _get_all_moves_king(int pos, std::unordered_set *pns, std::array *pns, std::array* board, Color pc, Color rc, int en_passant){ +void _get_all_moves_pawn(int pos, std::vector *pns, std::array* board, Color pc, Color rc, int en_passant){ // if it's white use different offsets, and pawn starting rank int offset2 = pc==Color::WHITE?-20:20; diff --git a/src/bitwise.h b/src/bitwise.h index 48618a8..7ae0d1e 100644 --- a/src/bitwise.h +++ b/src/bitwise.h @@ -2,7 +2,7 @@ #define BITWISE_H #include "constants.h" -#include +#include // Using macros for ease of use, can also use functons, but I don't see the point. diff --git a/src/functions.cpp b/src/functions.cpp index 3a99961..a405c68 100644 --- a/src/functions.cpp +++ b/src/functions.cpp @@ -49,13 +49,13 @@ Color rev_color(Color c){ return c==Color::WHITE?Color::BLACK:Color::WHITE; } -std::unordered_set get_possible_movers(Position pn, std::array board){ - std::unordered_set pns = {Position::A1}; +std::vector get_possible_movers(Position pn, std::array board){ + std::vector pns = {Position::A1}; return pns; } -std::unordered_set get_possible_moves(Position pn, std::array board){ - std::unordered_set pns = {Position::A1}; +std::vector get_possible_moves(Position pn, std::array board){ + std::vector pns = {Position::A1}; get_all_moves(pn, &board, &pns); return pns; } @@ -69,11 +69,11 @@ int get_pos_of(PieceType pt, std::array const *board){ return Position::NA; } -std::unordered_set get_poss_of(PieceType pt, std::array const *board){ - std::unordered_set results; +std::vector get_poss_of(PieceType pt, std::array const *board){ + std::vector results; for (int pn = Position::A8; pn!=Position::H1; pn++){ if ((*board)[pn] == pt){ - results.insert(pn); + results.push_back(pn); } } return results; @@ -88,7 +88,7 @@ void get_poss_of(PieceType pt, std::array* board, std::vector *board, std::unordered_set *pns){ +void filter_checked_moves(PieceType pt, std::array *board, std::vector *pns){ PieceType my_king = is_white(pt)?PieceType::W_KING:PieceType::B_KING; int my_king_pos = get_pos_of(my_king, board); int attackers = 0; @@ -110,7 +110,7 @@ void filter_checked_moves(PieceType pt, std::array *board, std:: std::vector psns; get_poss_of(other_p, &moved_board, &psns); for (auto psn : psns){ - std::unordered_set other_moves; + std::vector other_moves; get_all_moves(psn, &moved_board, &other_moves, false); // for every position the piece can mvoe to for (int cp : other_moves){ @@ -136,7 +136,7 @@ void filter_checked_moves(PieceType pt, std::array *board, std:: } } -void get_all_moves(int pos, std::array* board, std::unordered_set* moves, bool recursive, int en_passant){ +void get_all_moves(int pos, std::array* board, std::vector* moves, bool recursive, int en_passant){ PieceType pt = (*board)[pos]; Color color_of_piece = get_color(pt); Color color_of_opponent = rev_color(color_of_piece); @@ -174,8 +174,8 @@ void get_all_moves(int pos, std::array* board, std::unordered_se } } -std::unordered_set get_all_moves(int pos, std::array board, bool recursive, int en_passant){ - std::unordered_set moves; +std::vector get_all_moves(int pos, std::array board, bool recursive, int en_passant){ + std::vector moves; get_all_moves(pos, &board, &moves, recursive, en_passant); return moves; } diff --git a/src/functions.h b/src/functions.h index 0c15038..f5ac4cd 100644 --- a/src/functions.h +++ b/src/functions.h @@ -1,12 +1,12 @@ #include "constants.h" -#include +#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); +std::vector 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); @@ -32,18 +32,18 @@ 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); +void get_possible_movers(Position pn, std::array *pt,std::vector *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); +void get_possible_moves(Position pn, std::array *pt,std::vector *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); +void filter_checked_moves(int pos, std::array *board, std::vector *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); +void get_all_moves(int pos, std::array *pt,std::vector *moves, bool recursive=true, int en_passant=Position::NA); +std::vector 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. diff --git a/tests/B_test_boards.h b/tests/B_test_boards.h index d8eafb1..5cff8c2 100644 --- a/tests/B_test_boards.h +++ b/tests/B_test_boards.h @@ -1,4 +1,4 @@ -#include +#include #include const int B_QUEEN_POS = E4; @@ -17,7 +17,7 @@ const std::array B_QUEEN_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set B_QUEEN_ALL_MOVES = { +const std::vector B_QUEEN_ALL_MOVES = { A8, E8, B7, E7, H7, C6, E6, G6, @@ -44,7 +44,7 @@ const std::array B_BISHOP_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set B_BISHOP_ALL_MOVES = { +const std::vector B_BISHOP_ALL_MOVES = { H8, A7, G7, B6, F6, @@ -70,7 +70,7 @@ const std::array B_KNIGHT_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set B_KNIGHT_ALL_MOVES = { +const std::vector B_KNIGHT_ALL_MOVES = { C7, E7, B6, F6, B4, F4, @@ -93,7 +93,7 @@ const std::array B_ROOK_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set B_ROOK_ALL_MOVES = { +const std::vector B_ROOK_ALL_MOVES = { E8, E7, E6, A5, B5, C5, D5, F5, G5, H5, E4, E3, E2, E1 @@ -116,7 +116,7 @@ const std::array B_KING_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set B_KING_ALL_MOVES = { +const std::vector B_KING_ALL_MOVES = { B5, C5, D5, B4, D4, B3, C3, D3 @@ -139,7 +139,7 @@ const std::array B_PAWN_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set B_PAWN_ALL_MOVES = { +const std::vector B_PAWN_ALL_MOVES = { F3 }; const int B_KNIGHT_SIDE1_POS = B7; @@ -157,7 +157,7 @@ const std::array B_KNIGHT_SIDE1_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set B_KNIGHT_SIDE1_ALL_MOVES = { +const std::vector B_KNIGHT_SIDE1_ALL_MOVES = { D8, D6, A5, C5 @@ -177,7 +177,7 @@ const std::array B_KING_SIDE1_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set B_KING_SIDE1_ALL_MOVES = { +const std::vector B_KING_SIDE1_ALL_MOVES = { B8, A7,B7 }; @@ -197,6 +197,6 @@ const std::array B_PAWN_SIDE1_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set B_PAWN_SIDE1_ALL_MOVES = { +const std::vector B_PAWN_SIDE1_ALL_MOVES = { A6, A5 }; diff --git a/tests/W_test_boards.h b/tests/W_test_boards.h index 21eb95e..6372426 100644 --- a/tests/W_test_boards.h +++ b/tests/W_test_boards.h @@ -1,4 +1,4 @@ -#include +#include #include const int W_QUEEN_POS = E4; @@ -32,7 +32,7 @@ const std::array W_QUEEN_BOARD_BLOCKED = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set W_QUEEN_ALL_MOVES = { +const std::vector W_QUEEN_ALL_MOVES = { A8, E8, B7, E7, H7, C6, E6, G6, @@ -59,7 +59,7 @@ const std::array W_BISHOP_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set W_BISHOP_ALL_MOVES = { +const std::vector W_BISHOP_ALL_MOVES = { H8, A7, G7, B6, F6, @@ -100,13 +100,13 @@ const std::array W_KNIGHT_SIDE1_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set W_KNIGHT_SIDE1_ALL_MOVES = { +const std::vector W_KNIGHT_SIDE1_ALL_MOVES = { D8, D6, A5, C5 }; -const std::unordered_set W_KNIGHT_ALL_MOVES = { +const std::vector W_KNIGHT_ALL_MOVES = { C7, E7, B6, F6, B4, F4, @@ -129,7 +129,7 @@ const std::array W_ROOK_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set W_ROOK_ALL_MOVES = { +const std::vector W_ROOK_ALL_MOVES = { E8, E7, E6, A5, B5, C5, D5, F5, G5, H5, E4, E3, E2, E1 @@ -168,12 +168,12 @@ const std::array W_KING_SIDE1_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set W_KING_SIDE1_ALL_MOVES = { +const std::vector W_KING_SIDE1_ALL_MOVES = { B8, A7,B7 }; -const std::unordered_set W_KING_ALL_MOVES = { +const std::vector W_KING_ALL_MOVES = { B5, C5, D5, B4, D4, B3, C3, D3 @@ -196,7 +196,7 @@ const std::array W_PAWN_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set W_PAWN_ALL_MOVES = { +const std::vector W_PAWN_ALL_MOVES = { F5 }; @@ -215,4 +215,4 @@ const std::array W_PAWN_SIDE1_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set W_PAWN_SIDE1_ALL_MOVES; +const std::vector W_PAWN_SIDE1_ALL_MOVES; diff --git a/tests/custom_printing.cpp b/tests/custom_printing.cpp index fa9fd33..5d3dd89 100644 --- a/tests/custom_printing.cpp +++ b/tests/custom_printing.cpp @@ -1,7 +1,7 @@ #include "catch.hpp" #include #include -#include +#include // override default printing for Positions so it prints the value (e.g. 32), then, in parenthasies, the location (e.g. A4). // Example: A4(32) @@ -44,8 +44,8 @@ namespace Catch { }; // This overrides vectors of positions. I want it to print a board with the positions that are selected so we can see a representation of what positions are selected. template<> - struct StringMaker> { - static std::string convert(std::unordered_set const& uo_poss){ + struct StringMaker> { + static std::string convert(std::vector const& uo_poss){ std::vector poss(uo_poss.begin(), uo_poss.end()); std::stringstream ss; std::string files = " A B C D E F G H"; diff --git a/tests/main.cpp b/tests/main.cpp index e0d4aa0..f1adcc9 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -22,8 +22,8 @@ const std::array DUMB_MOVE_1 = { }; TEST_CASE("Test that the get_to_squares works, this is required!", "[get_to_squares]"){ - std::unordered_set to_squares = {Position::H1}; - std::unordered_set moves = {0b11000100000000}; + std::vector to_squares = {Position::H1}; + std::vector moves = {0b11000100000000}; REQUIRE(get_to_squares(moves) == to_squares); } @@ -107,7 +107,7 @@ TEST_CASE("Test that moves that put king in check are not returned", "[get_all_m CHECK(get_to_squares(get_all_moves(ROOK_CHECK_TEST_POS, ROOK_CHECK_TEST_BOARD)) == ROOK_CHECK_TEST_MOVES); CHECK(get_to_squares(get_all_moves(PAWN_CHECK_TEST_POS, PAWN_CHECK_TEST_BOARD)) == PAWN_CHECK_TEST_MOVES); auto pawn_diag_moves = get_all_moves(PAWN_DIAG_TEST1_POS, PAWN_DIAG_TEST1_BOARD); - std::unordered_set pawn_start_flags = {0, 1, 0}; + std::vector pawn_start_flags = {0, 1, 0}; CHECK(get_to_squares(pawn_diag_moves) == PAWN_DIAG_TEST1_MOVES); CHECK(get_pawn_start_flags(pawn_diag_moves) == pawn_start_flags); } diff --git a/tests/test_functions.cpp b/tests/test_functions.cpp index 0ebeeaa..4b2c538 100644 --- a/tests/test_functions.cpp +++ b/tests/test_functions.cpp @@ -1,55 +1,55 @@ #include "test_functions.h" #include -#include +#include #include -std::unordered_set get_to_squares(std::unordered_set moves){ - std::unordered_set transformed; +std::vector get_to_squares(std::vector moves){ + std::vector transformed; for (int mv : moves){ - transformed.insert(get_to_sq(mv)); + transformed.push_back(get_to_sq(mv)); } return transformed; } -std::unordered_set get_from_squared(std::unordered_set moves){ - std::unordered_set transformed; +std::vector get_from_squared(std::vector moves){ + std::vector transformed; for (int mv : moves){ - transformed.insert(get_from_sq(mv)); + transformed.push_back(get_from_sq(mv)); } return transformed; } -std::unordered_set get_captured_pieces(std::unordered_set moves){ - std::unordered_set transformed; +std::vector get_captured_pieces(std::vector moves){ + std::vector transformed; for (int mv : moves){ - transformed.insert(get_captured_pc(mv)); + transformed.push_back(get_captured_pc(mv)); } return transformed; } -std::unordered_set get_promoted_pieces(std::unordered_set moves){ - std::unordered_set transformed; +std::vector get_promoted_pieces(std::vector moves){ + std::vector transformed; for (int mv : moves){ - transformed.insert(get_promoted_to_pc(mv)); + transformed.push_back(get_promoted_to_pc(mv)); } return transformed; } -std::unordered_set get_en_passant_flags(std::unordered_set moves){ - std::unordered_set transformed; +std::vector get_en_passant_flags(std::vector moves){ + std::vector transformed; for (int mv : moves){ - transformed.insert(get_en_pass_flag(mv)); + transformed.push_back(get_en_pass_flag(mv)); } return transformed; } -std::unordered_set get_pawn_start_flags(std::unordered_set moves){ - std::unordered_set transformed; +std::vector get_pawn_start_flags(std::vector moves){ + std::vector transformed; for (int mv : moves){ std::cout << "MOVE: \n"; - transformed.insert(get_pawn_st_flag(mv)); + transformed.push_back(get_pawn_st_flag(mv)); } return transformed; } -std::unordered_set get_castle_flags(std::unordered_set moves){ - std::unordered_set transformed; +std::vector get_castle_flags(std::vector moves){ + std::vector transformed; for (int mv : moves){ - transformed.insert(get_castle_flag(mv)); + transformed.push_back(get_castle_flag(mv)); } return transformed; } diff --git a/tests/test_functions.h b/tests/test_functions.h index d427f0e..3bb71ea 100644 --- a/tests/test_functions.h +++ b/tests/test_functions.h @@ -1,12 +1,12 @@ #ifndef TEST_FUNCTIONS_H #define TEST_FUNCTOPMS_H -#include +#include -std::unordered_set get_from_squares(std::unordered_set moves); -std::unordered_set get_to_squares(std::unordered_set moves); -std::unordered_set get_captured_pieces(std::unordered_set moves); -std::unordered_set get_promoted_pieces(std::unordered_set moves); -std::unordered_set get_en_passant_flags(std::unordered_set moves); -std::unordered_set get_pawn_start_flags(std::unordered_set moves); -std::unordered_set get_castle_flags(std::unordered_set moves); +std::vector get_from_squares(std::vector moves); +std::vector get_to_squares(std::vector moves); +std::vector get_captured_pieces(std::vector moves); +std::vector get_promoted_pieces(std::vector moves); +std::vector get_en_passant_flags(std::vector moves); +std::vector get_pawn_start_flags(std::vector moves); +std::vector get_castle_flags(std::vector moves); #endif diff --git a/tests/valid_moves.h b/tests/valid_moves.h index ca759ae..a519e07 100644 --- a/tests/valid_moves.h +++ b/tests/valid_moves.h @@ -1,21 +1,21 @@ -#include +#include #include /// This is for possible moves on a default board -const std::unordered_set DEFAULT_B_A_PAWN_POSSIBLE_MOVES = { +const std::vector DEFAULT_B_A_PAWN_POSSIBLE_MOVES = { A6, A5 }; -const std::unordered_set DEFAULT_W_A_PAWN_POSSIBLE_MOVES = { +const std::vector DEFAULT_W_A_PAWN_POSSIBLE_MOVES = { A3, A4 }; -const std::unordered_set DEFAULT_W_R_KNIGHT_POSSIBLE_MOVES = { +const std::vector DEFAULT_W_R_KNIGHT_POSSIBLE_MOVES = { H3, F3 }; // EMPTY -const std::unordered_set DEFAULT_W_R_ROOK_POSSIBLE_MOVES = {}; +const std::vector DEFAULT_W_R_ROOK_POSSIBLE_MOVES = {}; -const std::unordered_set B_PAWNS_SQUARES = { +const std::vector B_PAWNS_SQUARES = { A7, B7, C7, D7, E7, F7, G7, H7 }; @@ -37,7 +37,7 @@ const std::array KNIGHT_BLOCKED1_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; // Should NOT inclde D7 -const std::unordered_set KNIGHT_BLOCKED1_MOVES = { +const std::vector KNIGHT_BLOCKED1_MOVES = { A6, C6 }; @@ -57,7 +57,7 @@ const std::array BISHOP_BLOCKED1_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; // Should NOT include A8, H8, G2, or H1 -const std::unordered_set BISHOP_BLOCKED1_MOVES = { +const std::vector BISHOP_BLOCKED1_MOVES = { B7, C6,E6, C4,E4, @@ -65,7 +65,7 @@ const std::unordered_set BISHOP_BLOCKED1_MOVES = { A2 }; // Should NOT include B2 (black queen) as it is obstructed by the bishop on D5 -const std::unordered_set BISHOP_BLOCKED1_CAN_MOVE_TO_B_KING = { +const std::vector BISHOP_BLOCKED1_CAN_MOVE_TO_B_KING = { D5 }; const int BISHOP_BLOCKED1_KING_POS = F3; @@ -87,7 +87,7 @@ const std::array ROOK_BLOCKED1_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; // Should NOT include E-H2 or B3-1 -const std::unordered_set ROOK_BLOCKED1_MOVES = { +const std::vector ROOK_BLOCKED1_MOVES = { B8, A7, C7, D7, B6,B5,B4 @@ -108,7 +108,7 @@ const std::array PAWN_DIAG_TEST1_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set PAWN_DIAG_TEST1_MOVES = { +const std::vector PAWN_DIAG_TEST1_MOVES = { D6, E6, E5 }; @@ -128,7 +128,7 @@ const std::array ROOK_CHECK_TEST_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set ROOK_CHECK_TEST_MOVES = { +const std::vector ROOK_CHECK_TEST_MOVES = { C5, E5 }; @@ -147,7 +147,7 @@ const std::array PAWN_CHECK_TEST_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set PAWN_CHECK_TEST_MOVES = {E6, E5}; +const std::vector PAWN_CHECK_TEST_MOVES = {E6, E5}; // These boards tests for en pessent squares. @@ -167,7 +167,7 @@ const std::array EN_PASSANT_TEST_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set EN_PASSANT_TEST_MOVES = { +const std::vector EN_PASSANT_TEST_MOVES = { E6, D6 }; @@ -186,4 +186,4 @@ const std::array NO_EN_PASSANT_TEST_BOARD = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; -const std::unordered_set NO_EN_PASSANT_TEST_MOVES = {D6}; +const std::vector NO_EN_PASSANT_TEST_MOVES = {D6};