From 7b6db255cca5833e57a5ae77791daf49cff2de89 Mon Sep 17 00:00:00 2001 From: Tait Hoyem <44244401+TTWNO@users.noreply.github.com> Date: Thu, 2 May 2019 19:33:57 +0000 Subject: [PATCH] Start refactor of get_all_moves_as_if. Goal: remove all_moves_functions.cpp --- src/all_moves_functions.cpp | 33 ++-------- src/bitwise.h | 46 ++++++++------ src/bitwise_constants.cpp | 16 ----- src/constants.h | 18 +++--- src/functions.cpp | 122 ++++++++++++++++++++++++++++++++++-- tests/valid_moves.h | 24 +++---- 6 files changed, 169 insertions(+), 90 deletions(-) delete mode 100644 src/bitwise_constants.cpp diff --git a/src/all_moves_functions.cpp b/src/all_moves_functions.cpp index bec21a7..b219897 100644 --- a/src/all_moves_functions.cpp +++ b/src/all_moves_functions.cpp @@ -3,10 +3,10 @@ #include #include -const std::array ROOK_PIECE_OFFSETS = {-1, -10, 1, 10}; -const std::array BISHOP_PIECE_OFFSETS = {-11, -9, 9, 11}; -const std::array KNIGHT_PIECE_OFFSETS = {-12, -21, -19, -8, 8, 12, 19, 21}; -const std::array KING_PIECE_OFFSETS = {-11, -10, -9, 9, 10, 11}; +const std::vector ROOK_PIECE_OFFSETS = {-1, -10, 1, 10}; +const std::vector BISHOP_PIECE_OFFSETS = {-11, -9, 9, 11}; +const std::vector KNIGHT_PIECE_OFFSETS = {-12, -21, -19, -8, 8, 12, 19, 21}; +const std::vector KING_PIECE_OFFSETS = {-11, -10, -9, 9, 10, 11}; inline Position _pair_to_pos_unsafe(int x, int y){ @@ -121,31 +121,6 @@ void _pawn_add_if_not_blocked(int pos, int from, std::vector& pns, const st } } - -void _get_all_moves_rook(int pos, std::vector& pns, const 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++){ - _add_if_not_blocked(pos+(rk_off*offset), pos, pns, board, pc, rc, not_blocked); - } - } -} - -void _get_all_moves_bishop(int pos, std::vector& pns, const 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++){ - _add_if_not_blocked(pos+(bs_off*offset), pos, pns, board, pc, rc, not_blocked); - } - } -} - -void _get_all_moves_knight(int pos, std::vector& pns, const std::array& board, Color pc, Color rc){ - for (int kn_off : KNIGHT_PIECE_OFFSETS){ - _add_if_not_blocked(pos+kn_off, pos, pns, board, pc, rc); - } -} - void _get_all_moves_king(int pos, std::vector& pns, const std::array& board, Color pc, Color rc, int castle_perms){ for (int kn_off : KING_PIECE_OFFSETS){ _add_if_not_blocked(pos+kn_off, pos, pns, board, pc, rc); diff --git a/src/bitwise.h b/src/bitwise.h index 19d9da2..ebcff61 100644 --- a/src/bitwise.h +++ b/src/bitwise.h @@ -25,37 +25,47 @@ * 0010 0000 0000 0000 0000 0000 0000 -> check flag (& 0x2000000) * */ -/* OLD, DO NOT USE -#define FROMSQ(m) ((m) & 0x3f) -#define TOSQ(m) ((m>>6) & 0x3f) -#define CAPT(m) ((m>>12) & 0xf ) -#define PROM(m) ((m>>16) & 0xf ) -#define ENPASS(m) ((m>>20) & 0x1 ) -#define PAWNST(m) ((m>>21) & 0x1 ) -#define CAST(m) ((m>>22) & 0x1 ) -*/ - -// Redefine as functions for fun :shrug: +// No offset becuase at beginning of int +#define FROM_MASK 0x7F + +#define TO_MASK 0x7F +#define TO_SHIFT 7 + +#define CAPTURED_MASK 0xF +#define CAPTURED_SHIFT 14 + +#define PROMOTED_MASK 0xF +#define PROMOTED_SHIFT 18 + +#define EN_PASS_MASK 0x1 +#define EN_PASS_SHIFT 22 + +#define PAWN_ST_MASK 0x1 +#define PAWN_ST_SHIFT 23 + +#define CASTLE_MASK 0x1 +#define CASTLE_SHIFT 24 + inline int get_from_sq(int mv){ - return (mv & 0x7f); + return (mv & FROM_MASK); } inline int get_to_sq(int mv){ - return ((mv >> 7) & 0x7f); + return ((mv >> TO_SHIFT) & TO_MASK); } inline int get_captured_pc(int mv){ - return ((mv >> 14) & 0xf); + return ((mv >> CAPTURED_SHIFT) & CAPTURED_MASK); } inline int get_promoted_to_pc(int mv){ - return ((mv >> 18) & 0xf); + return ((mv >> PROMOTED_SHIFT) & PROMOTED_MASK); } inline int get_en_pass_flag(int mv){ - return ((mv >> 22) & 0x1); + return ((mv >> EN_PASS_SHIFT) & EN_PASS_MASK); } inline int get_pawn_st_flag(int mv){ - return ((mv >> 23) & 0x1); + return ((mv >> PAWN_ST_SHIFT) & PAWN_ST_MASK); } inline int get_castle_flag(int mv){ - return ((mv >> 24) & 0x1); + return ((mv >> CASTLE_SHIFT) & CASTLE_MASK); } inline int get_check_flag(int mv){ return ((mv >> 25) & 0x1); diff --git a/src/bitwise_constants.cpp b/src/bitwise_constants.cpp deleted file mode 100644 index 0727647..0000000 --- a/src/bitwise_constants.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "bitwise_constants.h" -#include -#include - -int main(){ - for (int y=0;y<12;y++){ - for (int x=0;x<10;x++){ - int cord = (y*10) + x; - int val = DEFAULT_BOARD[cord]; - val==-1?std::cout << '!':std::cout << CHESS_CHARS[val]; - std::cout << std::hex << y << "," << x << " "; - } - std::cout << std::endl; - } - return 0; -} diff --git a/src/constants.h b/src/constants.h index 4a4f37b..62c5e43 100644 --- a/src/constants.h +++ b/src/constants.h @@ -7,8 +7,8 @@ enum Color { NO_COLOR, - WHITE, - BLACK + BLACK, + WHITE }; enum CastlePerms { @@ -22,7 +22,7 @@ enum PieceType { INV=-1, NONE, B_PAWN, B_KNIGHT, B_BISHOP, B_ROOK, B_QUEEN, B_KING, - W_PAWN, W_KNIGHT, W_BISHOP, W_ROOK, W_QUEEN, W_KING + W_PAWN, W_KNIGHT, W_BISHOP, W_ROOK, W_QUEEN, W_KING, }; namespace Pieces{ @@ -109,21 +109,21 @@ const std::array BOARD_COLORS = { NO_COLOR,NO_COLOR,NO_COLOR,NO_COLOR,NO_COLOR,NO_COLOR,NO_COLOR,NO_COLOR,NO_COLOR,NO_COLOR }; -const std::array CHESS_CHARS = { +const std::array CHESS_CHARS = { ' ', 'P', 'N', 'B', 'R', 'Q', 'K', - 'p', 'n', 'b', 'r', 'q', 'k' + 'p', 'n', 'b', 'r', 'q', 'k', }; // This returns the same letter weather the team is black or white -const std::array CHESS_CHARS_INSENSITIVE = { +const std::array CHESS_CHARS_INSENSITIVE = { " ", "P", "N", "B", "R", "Q", "K", - "P", "N", "B", "R", "Q", "K" + "P", "N", "B", "R", "Q", "K", }; -const std::array FANCY_CHESS_CHARS = { +const std::array FANCY_CHESS_CHARS = { " ", "♟", "♞", "♝", "♜", "♛", "♚", - "♙", "♘", "♗", "♖", "♕", "♔" + "♙", "♘", "♗", "♖", "♕", "♔", }; #endif diff --git a/src/functions.cpp b/src/functions.cpp index 8d7b5cc..e93f3fe 100644 --- a/src/functions.cpp +++ b/src/functions.cpp @@ -12,6 +12,74 @@ #include #include +/* + * + * These functions use an int to pass a lot of information. + * The notation is like this: + * 0000 0000 0000 0000 0111 1111 -> position of piece + * 0000 0000 0000 0111 1000 0000 -> piece type + * 0000 0000 0111 1000 0000 0000 -> piece of opposite type (eg. opposite of W_KING, is B_KING; B_ROOK, W_ROOK etc...) + * 0000 0000 1000 0000 0000 0000 -> team of the piece (1=white, 0=black) + * 0111 1111 0000 0000 0000 0000 -> new position (if applicable) + * +**/ + +/* + * These functions also use an int for king info. This is so: + * a) I don't have to recompute the info each time I nedd it in a functoin. + * b) So that I don't have the overhead of a struct. (I know, "micro optimizations are the root of all evil", I can't help myself) + * The notation is as follows: + * 0000 0000 0000 0000 0111 1111 -> position of piece + * 0000 0000 0000 0111 1000 0000 -> piece type + * 0000 0011 1111 1000 0000 0000 -> opposite piece position + * 0011 1100 0000 0000 0000 0000 -> piece of opposite type + * 0100 0000 0000 0000 0000 0000 -> team of the piece (1=white, 0=black) + */ + +inline int get_piece_pos(int pieceinfo){ + return (pieceinfo & 0x7f); +} +inline int get_piece_type(int pieceinfo){ + return ((pieceinfo << 7) & 0xf); +} +inline int get_opposite_piece_type(int pieceinfo){ + return ((pieceinfo << 11) & 0xf); +} +// TO find out if white/black use: +// get_team_of_piece_type == Color::WHITE/BLACK +inline int get_team_of_piece_type(int pieceinfo){ + return ((pieceinfo << 15) & 0x1); +} +inline int get_new_position_of_piece(int pieceinfo){ + return ((pieceinfo << 16) & 0xf); +} + + +/* Move ints contain a lot of information as well. However, these are DIFFERENt from the other dense ints. Moves are universalyl passed by reference (&) to a vector of ints, whereas the above is passed only is 1 int by itself. + * Here is the notation for moves (although it is obscured by the make_move(), get_to/from_sq(), get_captured_pc() etc... functions. + * + * From (Position): 7 bits (2^7 == 128) possibilities + * To (Position): same as above + * Captured piece, if any: 4 bits (16) possibilities + * Promoted to, if any: 4 bits (16) possibilities + * en passant flag: 1 bit + * pawn starting move flag: 1 bit + * castle move flag: 1 bit + * + * 0000 0000 0000 0000 0000 0111 1111 -> From square position (& 0x7F) + * 0000 0000 0000 0011 1111 1000 0000 -> To square position (>> 7 & 0x7F) + * 0000 0000 0011 1100 0000 0000 0000 -> captured piece, if any (>> 14 & 0xF) + * 0000 0011 1100 0000 0000 0000 0000 -> if prmoted, what to? (>> 18 & 0xF) + * 0000 0100 0000 0000 0000 0000 0000 -> en passant (>> 22 &0x1) + * 0000 1000 0000 0000 0000 0000 0000 -> pawn starting move (>> 23 &0x1) + * 0001 0000 0000 0000 0000 0000 0000 -> castle move (>> 24 0x1) + * 0010 0000 0000 0000 0000 0000 0000 -> check flag (>> 25 &0x1) + * */ + +//const std::array ROOK_PIECE_OFFSETS = {-1, -10, 1, 10}; +//const std::array BISHOP_PIECE_OFFSETS = {-11, -9, 9, 11}; +const std::vector QUEEN_PIECE_OFFSETS = {-1, -10, 1, 10, -11, -9, 9, 11}; + Rank get_rank(int pos){ int rank = 0; while (pos >= 0){ @@ -49,6 +117,7 @@ Color rev_color(Color c){ return c==Color::WHITE?Color::BLACK:Color::WHITE; } PieceType rev_color(PieceType pt){ + //return static_cast((~pt) & 0xf); for (int i=0; i!=Pieces::WHITE.size(); i++){ if (pt == Pieces::WHITE[i]){ return Pieces::BLACK[i]; @@ -124,6 +193,10 @@ bool king_checked(const std::array& board, Color color_of_king){ void add_checked_flags(PieceType pt, const std::array& board, std::vector& pns){ PieceType other_king = is_white(pt)?PieceType::B_KING:PieceType::W_KING; int other_king_pos = get_pos_of(other_king, board); + // If the other team doesn't have a king, don't add any checked flags + if (other_king_pos == Position::NA){ + return; + } for (auto move_pn=pns.begin(); move_pn!=pns.end();){ std::array moved_board; dumb_move(*move_pn, board, moved_board); @@ -139,6 +212,10 @@ void filter_checked_moves(PieceType pt, const std::array& board, PieceType my_king = is_white(pt)?PieceType::W_KING:PieceType::B_KING; int my_king_pos = get_pos_of(my_king, board); bool remove_all_castles = false; + // If this team doesn't have a king, don't do anything, jsut return. + if (my_king_pos == Position::NA){ + return; + } for (auto p_pn= pns.begin(); p_pn!=pns.end();){ if (get_castle_flag(*p_pn) == 1){ // If removing all castle flags is triggered @@ -197,26 +274,58 @@ void filter_checked_moves(PieceType pt, const std::array& board, } } +void _get_all_moves_as_if_ray_type(int pos, std::vector offsets, std::vector& moves, const std::array& board, Color color_of_piece, Color color_of_opponent){ + for (int offset : offsets){ + for (int times = 1; times < 8; ++times){ + int true_offset = pos+(offset*times); + if (get_color(board[true_offset]) == color_of_opponent){ + moves.push_back(make_move(pos, true_offset, board[true_offset])); + break; + } else if (get_color(board[true_offset]) == color_of_piece || + board[true_offset] == PieceType::INV){ + break; + } else { + moves.push_back(make_move(pos, true_offset, board[true_offset])); + } + } + } +} + +void _get_all_moves_as_if_not_ray(int pos, std::vector offsets, std::vector& moves, const std::array& board, Color color_of_piece, Color color_of_opponent){ + for (int offset : offsets){ + int true_offset = pos+offset; + if (board[true_offset] == PieceType::NONE || + get_color(board[true_offset]) == color_of_opponent){ + moves.push_back(make_move(pos, true_offset, board[true_offset])); + } + } +} + void get_all_moves_as_if(int pos, PieceType pt, const std::array& board, std::vector& moves, bool recursive, int en_passant, int castle_perms){ + int piece_info = 0; Color color_of_piece = get_color(pt); Color color_of_opponent = rev_color(color_of_piece); switch(pt){ case PieceType::B_QUEEN: case PieceType::W_QUEEN: - _get_all_moves_rook(pos, moves, board, color_of_piece, color_of_opponent); - _get_all_moves_bishop(pos, moves, board, color_of_piece, color_of_opponent); + _get_all_moves_as_if_ray_type(pos, QUEEN_PIECE_OFFSETS, moves, board, color_of_piece, color_of_opponent); + //_get_all_moves_rook(pos, moves, board, color_of_piece, color_of_opponent); + //_get_all_moves_bishop(pos, moves, board, color_of_piece, color_of_opponent); break; case PieceType::B_ROOK: case PieceType::W_ROOK: - _get_all_moves_rook(pos, moves, board, color_of_piece, color_of_opponent); + _get_all_moves_as_if_ray_type(pos, ROOK_PIECE_OFFSETS, moves, board, color_of_piece, color_of_opponent); + //_get_all_moves_rook(pos, moves, board, color_of_piece, color_of_opponent); break; case PieceType::B_BISHOP: case PieceType::W_BISHOP: - _get_all_moves_bishop(pos, moves, board, color_of_piece, color_of_opponent); + _get_all_moves_as_if_ray_type(pos, BISHOP_PIECE_OFFSETS, moves, board, color_of_piece, color_of_opponent); + //_get_all_moves_bishop(pos, moves, board, color_of_piece, color_of_opponent); break; case PieceType::B_KNIGHT: case PieceType::W_KNIGHT: - _get_all_moves_knight(pos, moves, board, color_of_piece, color_of_opponent); + _get_all_moves_as_if_not_ray(pos, KNIGHT_PIECE_OFFSETS, moves, board, color_of_piece, color_of_opponent); + //_get_all_moves_knight(pos, moves, board, color_of_piece, color_of_opponent); break; case PieceType::B_KING: case PieceType::W_KING: @@ -362,7 +471,7 @@ std::string to_notation(int move, const std::array& board){ std::stringstream promotion; auto other_pieces = is_white(piecetype)?Pieces::BLACK:Pieces::WHITE; - if (captured_piece != 0){ + if (captured_piece != PieceType::NONE){ capture_character = "x"; // Comment #6 // if a pawn is capturing, have the disambiguation be the pawn's file @@ -431,3 +540,4 @@ void remove_chars_from_string(std::string &str, std::string charsToRemove ) { str.erase( remove(str.begin(), str.end(), charsToRemove.at(i)), str.end() ); } } + diff --git a/tests/valid_moves.h b/tests/valid_moves.h index 38f2d57..71ea472 100644 --- a/tests/valid_moves.h +++ b/tests/valid_moves.h @@ -501,7 +501,7 @@ const std::array KING_CHECK_TEST_BOARD = { INV, NONE, NONE, NONE, W_KING, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, B_ROOK, NONE, NONE, B_KING, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, - INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, + INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, W_KING, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, @@ -542,7 +542,7 @@ const std::array EN_PASSANT_CHECK_BOARD = { INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, - INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, + INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, B_KING, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; @@ -556,7 +556,7 @@ const std::array EN_PASSANT_CHECK_MOVED_BOARD = { INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, - INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, + INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, B_KING, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; @@ -574,9 +574,9 @@ const std::array EN_PASSANT_CHECK_BOARD1 = { INV, NONE, NONE, NONE, NONE, W_PAWN, B_PAWN, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, + INV, NONE, NONE, W_KING, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, - INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, - INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, + INV, B_KING, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; @@ -588,9 +588,9 @@ const std::array EN_PASSANT_CHECK_MOVED_BOARD1 = { INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, + INV, NONE, NONE, W_KING, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, - INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, - INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, + INV, B_KING, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; @@ -600,7 +600,7 @@ const int EN_PASSANT_CHECK_POS2 = C3; const std::array EN_PASSANT_CHECK_BOARD2 = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, - INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, + INV, W_KING, NONE, NONE, NONE, NONE, NONE, B_KING, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, @@ -614,7 +614,7 @@ const std::array EN_PASSANT_CHECK_BOARD2 = { const std::array EN_PASSANT_CHECK_MOVED_BOARD2 = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, - INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, + INV, W_KING, NONE, NONE, NONE, NONE, NONE, B_KING, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, @@ -631,7 +631,7 @@ const int EN_PASSANT_CHECK_POS3 = E3; const std::array EN_PASSANT_CHECK_BOARD3 = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, - INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, + INV, NONE, NONE, B_KING, NONE, W_KING, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, @@ -645,7 +645,7 @@ const std::array EN_PASSANT_CHECK_BOARD3 = { const std::array EN_PASSANT_CHECK_MOVED_BOARD3 = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, - INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, + INV, NONE, NONE, B_KING, NONE, W_KING, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, @@ -787,7 +787,7 @@ const std::array PAWN_PROM_BLANK_BOARD = { INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, INV, INV, NONE, B_ROOK, NONE, NONE, NONE, NONE, NONE, NONE, INV, - INV, NONE, NONE, NONE, NONE, NONE, NONE, W_KING, NONE, INV, + INV, NONE, NONE, NONE, NONE, B_KING, NONE, W_KING, NONE, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV };