diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2023-01-10 16:58:03 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2023-01-10 16:58:03 +0100 |
| commit | 779cf4f082343da894da89635127ae7bda22c657 (patch) | |
| tree | 3ab3c21287ea6f8a6582266e031b563ce1af25e2 | |
| parent | 6f48becb9186a399e3a4dddb778570e7057752c7 (diff) | |
Debug pawns promotion
| -rw-r--r-- | src/ChessArbiter.cpp | 4 | ||||
| -rw-r--r-- | tests/chessarbiter.cpp | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/ChessArbiter.cpp b/src/ChessArbiter.cpp index 2830bc1..593ece2 100644 --- a/src/ChessArbiter.cpp +++ b/src/ChessArbiter.cpp @@ -131,12 +131,12 @@ bool ChessArbiter::Play(const std::string &move, char promote) { if(moved.piece == 'p' && dst[1]=='1'){ board.RemovePiece(dst); board.AddPiece(tolower(promote),dst); - SAN+="="+toupper(promote); + SAN+="=";SAN.push_back(toupper(promote)); was_pawn_promotion=true; } else if(dst[1]=='8'){ board.RemovePiece(dst); board.AddPiece(toupper(promote),dst); - SAN+="="+toupper(promote); + SAN+="=";SAN.push_back(toupper(promote)); was_pawn_promotion=true; } } diff --git a/tests/chessarbiter.cpp b/tests/chessarbiter.cpp index 3ac95ca..a6ee016 100644 --- a/tests/chessarbiter.cpp +++ b/tests/chessarbiter.cpp @@ -485,12 +485,14 @@ TEST_CASE("Specific bugs found on a game", "[BugFixes]") { a.Play("d7d8"); CHECK(a.GetFEN() == "3Q4/k7/2p1ppp1/5qBp/5P1P/8/6PK/8 b - - 0 45"); CHECK(a.WasPawnPromotion()); + CHECK(a.GetSAN()=="d8=Q"); // BUG 3 (Promotion) a.Setup("8/k2P4/2p1ppp1/5qBp/5P1P/8/6PK/8 w - - 0 45"); a.Play("d7d8",'n'); CHECK(a.GetFEN() == "3N4/k7/2p1ppp1/5qBp/5P1P/8/6PK/8 b - - 0 45"); CHECK(a.WasPawnPromotion()); + CHECK(a.GetSAN()=="d8=N"); // BUG 4 (Promotion) char p=a.ParseSANPromotion("d8=Q"); |
