aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/Game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game_tab/Game.cpp')
-rw-r--r--src/game_tab/Game.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/game_tab/Game.cpp b/src/game_tab/Game.cpp
index 8ab67cb..53be08f 100644
--- a/src/game_tab/Game.cpp
+++ b/src/game_tab/Game.cpp
@@ -92,6 +92,14 @@ void Game::SetMoveAsMainline(HalfMove *m) {
}
}
+bool Game::IsCheckmate(bool forBlack){
+ arbiter.Setup(GetFen());
+ if(forBlack){
+ return arbiter.IsBlackTurn() && arbiter.IsCheckMate();
+ }
+ return !arbiter.IsBlackTurn() && arbiter.IsCheckMate();
+}
+
bool Game::Play(std::string move) {
wxLogDebug("Playing move %s", move);
std::string fen = GetFen();