diff --git a/src/ChessArbiter.cpp b/src/ChessArbiter.cpp index db1830c..d64ac83 100644 --- a/src/ChessArbiter.cpp +++ b/src/ChessArbiter.cpp @@ -57,8 +57,8 @@ bool ChessArbiter::Play(std::string move) { } // Perform the move - if ((moved.piece == 'k' || moved.piece == 'K') && move == "e8g8" || - move == "e8c8" || move == "e1g1" || move == "e1c1") { + if ((moved.piece == 'k' || moved.piece == 'K') && (move == "e8g8" || + move == "e8c8" || move == "e1g1" || move == "e1c1")) { if (move == "e8g8") { board.Move("e8g8"); board.Move("h8f8"); diff --git a/tests/chessarbiter.cpp b/tests/chessarbiter.cpp index c5f34ea..2e65ae5 100644 --- a/tests/chessarbiter.cpp +++ b/tests/chessarbiter.cpp @@ -470,3 +470,12 @@ TEST_CASE("ParseSAN", "[ParseSAN]") { a.Setup("1r4k1/4pp1p/6pb/1p3b2/P1P5/5P2/2P3PP/1K1R3R w - - 0 23"); CHECK(a.ParseSAN("cxb5") == "c4b5"); } + +TEST_CASE("Specific bugs found on a game", "[BugFixes]") { + ChessArbiter a; + + // BUG 1 + a.Setup("1k3r1r/npqbbp2/4p1p1/p2pPnNp/1P3B1P/P1PB4/5PPQ/RN2R1K1 w - - 1 19"); + a.Play("e1c1"); + CHECK(a.GetFEN() == "1k3r1r/npqbbp2/4p1p1/p2pPnNp/1P3B1P/P1PB4/5PPQ/RNR3K1 b - - 2 19"); +} \ No newline at end of file