ChessEngine: Reset the engine state on receiving a ucinewgame command

This commit is contained in:
Tim Ledbetter 2023-04-26 19:02:42 +01:00 committed by Andreas Kling
parent 18735960de
commit 536f6b8b34
2 changed files with 7 additions and 0 deletions

View file

@ -74,3 +74,9 @@ void ChessEngine::handle_unexpected_eof()
if (on_quit)
on_quit(EPIPE);
}
void ChessEngine::handle_ucinewgame()
{
m_board = Chess::Board();
m_last_tree = {};
}

View file

@ -19,6 +19,7 @@ public:
virtual void handle_position(Chess::UCI::PositionCommand const&) override;
virtual void handle_go(Chess::UCI::GoCommand const&) override;
virtual void handle_quit() override;
virtual void handle_ucinewgame() override;
virtual void handle_unexpected_eof() override;
Function<void(int)> on_quit;