diff --git a/engine/src/generate.cpp b/engine/src/generate.cpp index de0cbc667..b96f86c7e 100644 --- a/engine/src/generate.cpp +++ b/engine/src/generate.cpp @@ -281,7 +281,7 @@ namespace wisdom appendMove (knight_move); } - auto + auto eligibleEnPassantColumn (const Board& board, int row, int column, Color who) -> optional { @@ -581,4 +581,19 @@ namespace wisdom return non_checks; } + auto + needPawnPromotion (int row, Color who) + -> bool + { + assert (isColorValid (who)); + switch (who) + { + case Color::White: + return 0 == row; + case Color::Black: + return 7 == row; + default: + throw Error { "Invalid color in needPawnPromotion()" }; + } + } } diff --git a/engine/src/generate.hpp b/engine/src/generate.hpp index 2bdfe185e..4911e5fc5 100644 --- a/engine/src/generate.hpp +++ b/engine/src/generate.hpp @@ -15,21 +15,9 @@ namespace wisdom generateLegalMoves (const Board& board, Color who) -> MoveList; - [[nodiscard]] inline auto + [[nodiscard]] auto needPawnPromotion (int row, Color who) - -> bool - { - assert (isColorValid (who)); - switch (who) - { - case Color::White: - return 0 == row; - case Color::Black: - return 7 == row; - default: - throw Error { "Invalid color in needPawnPromotion()" }; - } - } + -> bool; // Return en passant column if the board is the player is eligible. [[nodiscard]] auto