summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChessArbiter.cpp7
-rw-r--r--tests/chessarbiter.cpp6
2 files changed, 12 insertions, 1 deletions
diff --git a/src/ChessArbiter.cpp b/src/ChessArbiter.cpp
index 30fc078..29b17c7 100644
--- a/src/ChessArbiter.cpp
+++ b/src/ChessArbiter.cpp
@@ -488,7 +488,12 @@ std::string ChessArbiter::ParseSAN(const std::string &SANMove) {
std::string current_src = move.substr(0, 2);
std::string current_dst = move.substr(2, 2);
if (current_dst == dst) {
- src_candidates.push_back(current_src);
+ // Now ensure that move can be played
+ INIT_BACKUP();
+ if(Play(current_src+current_dst)){
+ src_candidates.push_back(current_src);
+ }
+ RESTORE_BACKUP();
}
}
diff --git a/tests/chessarbiter.cpp b/tests/chessarbiter.cpp
index 2b6bdec..a2b3fc0 100644
--- a/tests/chessarbiter.cpp
+++ b/tests/chessarbiter.cpp
@@ -502,4 +502,10 @@ TEST_CASE("Specific bugs found on a game", "[BugFixes]") {
CHECK(p == 'R');
p=a.ParseSANPromotion("c1=R");
CHECK(p == 'R');
+
+ // Bug 5 (Pin piece: the Knight on c3 cannot move so the only legal move for a white Knight is g1e2)
+ a.Setup("r1bqk2r/pp1n1p2/3p4/1BpP2pp/1b2n2P/2N1P1B1/PP3PP1/R2QK1NR w KQkq - 3 12");
+ CHECK(a.ParseSAN("Ne2") == "g1e2");
+ a.Play("g1e2");
+ CHECK(a.GetFEN() == "r1bqk2r/pp1n1p2/3p4/1BpP2pp/1b2n2P/2N1P1B1/PP2NPP1/R2QK2R b KQkq - 4 12");
} \ No newline at end of file