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.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/game_tab/Game.cpp b/src/game_tab/Game.cpp
index fdc754a..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();
@@ -142,6 +150,12 @@ void Game::Next() {
}
}
+HalfMove *Game::GetNextMove(){
+ if(current!=nullptr)
+ return current->GetMainline();
+ return moves;
+}
+
void Game::SetCurrent(HalfMove *m) { current = m; }
std::string Game::GetFen() {