1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:57:34 +00:00

LibChess: Add the ucinewgame command

This command is sent from the GUI to tell the engine that the next
position will be from a different game.
This commit is contained in:
Tim Ledbetter 2023-04-26 19:00:48 +01:00 committed by Andreas Kling
parent 7e6341587b
commit 18735960de
4 changed files with 30 additions and 0 deletions

View file

@ -348,4 +348,17 @@ ErrorOr<String> QuitCommand::to_string() const
return "quit\n"_short_string;
}
ErrorOr<NonnullOwnPtr<UCINewGameCommand>> UCINewGameCommand::from_string(StringView command)
{
auto tokens = command.split_view(' ');
VERIFY(tokens[0] == "ucinewgame");
VERIFY(tokens.size() == 1);
return adopt_nonnull_own_or_enomem(new (nothrow) UCINewGameCommand);
}
ErrorOr<String> UCINewGameCommand::to_string() const
{
return "ucinewgame\n"_string;
}
}