aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/Game.cpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-01-02 11:36:13 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2023-01-02 11:36:13 +0100
commit56252f2b6c42fe369a4b0c77287469c49c381943 (patch)
treed05886b62640695e756dc76cd5db5116124206a8 /src/game_tab/Game.cpp
parent73f7be6c0366fd4334e70d68f0376c64357edd80 (diff)
Improve UI
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();