summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-01-10 17:13:23 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2023-01-10 17:13:23 +0100
commit6ebd96825576b2da8e8acf2ac85d0b82a7531424 (patch)
tree7af1484cbf3a4b6529cabcbd94f0ed1d320c3f2c
parentdb78ff212da7abed937b03b120b1cf1afba2f37f (diff)
Add # sign to SAN moves when player is checkmate
-rw-r--r--src/ChessArbiter.cpp6
-rw-r--r--tests/chessarbiter.cpp5
2 files changed, 9 insertions, 2 deletions
diff --git a/src/ChessArbiter.cpp b/src/ChessArbiter.cpp
index fdda48d..8612fc4 100644
--- a/src/ChessArbiter.cpp
+++ b/src/ChessArbiter.cpp
@@ -178,8 +178,10 @@ bool ChessArbiter::Play(const std::string &move, char promote) {
return (false);
}
- // Don't forget the plus sign on the SAN move
- if(IsCheck(fen.player)){
+ // Don't forget the plus and # sign on the SAN moves
+ if(IsCheckMate()){
+ SAN+="#";
+ } else if(IsCheck(fen.player)){
SAN+="+";
}
diff --git a/tests/chessarbiter.cpp b/tests/chessarbiter.cpp
index 931b545..1c013cc 100644
--- a/tests/chessarbiter.cpp
+++ b/tests/chessarbiter.cpp
@@ -524,4 +524,9 @@ TEST_CASE("Specific bugs found on a game", "[BugFixes]") {
a.Play("d6d3");
CHECK(!a.IsCheck(false));
CHECK(a.GetSAN()=="Qd3");
+
+ // Bug 7 SAN move that lead to checkmate must have a # sign on the SAN moves
+ a.Setup("rnb1k1nr/pppp1ppp/4P3/8/1b3B2/1Nq5/PPP1PPPP/R2KNB1R b kq - 16 12");
+ a.Play("c3e1");
+ CHECK(a.GetSAN()=="Qxe1#");
} \ No newline at end of file