summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChessArbiter.cpp4
-rw-r--r--tests/chessarbiter.cpp2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/ChessArbiter.cpp b/src/ChessArbiter.cpp
index 67dfb36..9351ab9 100644
--- a/src/ChessArbiter.cpp
+++ b/src/ChessArbiter.cpp
@@ -113,8 +113,10 @@ bool ChessArbiter::Play(std::string move) {
if (dst == fen.en_passant) {
if (fen.player) {
board.RemovePiece(dst[0] + std::string() + (char)(dst[1] + 1));
+ capture = 'P';
} else {
board.RemovePiece(dst[0] + std::string() + (char)(dst[1] - 1));
+ capture = 'p';
}
}
newFen.halfmove = 0; // Pawn moves reset half moves
@@ -435,7 +437,7 @@ std::string ChessArbiter::ParseSAN(std::string SANMove) {
// Pawn moves
if (std::islower(SANMove[0])) {
piece = 'P';
- hint=SANMove[0];
+ hint = SANMove[0];
// Not a capture
if (SANMove[1] != 'x') {
dst = SANMove.substr(0, 2);
diff --git a/tests/chessarbiter.cpp b/tests/chessarbiter.cpp
index 94d4dae..0682979 100644
--- a/tests/chessarbiter.cpp
+++ b/tests/chessarbiter.cpp
@@ -406,12 +406,14 @@ TEST_CASE("SimpleEnPassant", "[SimpleEnPassant]") {
CHECK(a.Play("e5f6"));
CHECK(a.GetFEN() ==
"rnbqkbnr/ppppp1pp/5P2/8/8/8/PPPP1PPP/RNBQKBNR b KQkq - 0 2");
+ CHECK(a.GetCapture() == 'p');
// Black capture
a.Setup("rnbqkbnr/ppppp1pp/8/8/4Pp2/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1");
CHECK(a.Play("f4e3"));
CHECK(a.GetFEN() ==
"rnbqkbnr/ppppp1pp/8/8/8/4p3/PPPP1PPP/RNBQKBNR w KQkq - 0 2");
+ CHECK(a.GetCapture() == 'P');
// Check en_passant is set
a.Setup(