2020-08-21 02:04:08 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-08-21 02:04:08 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-08-14 17:39:32 +03:00
|
|
|
#include "MCTSTree.h"
|
2020-08-21 02:04:08 +03:00
|
|
|
#include <LibChess/Chess.h>
|
|
|
|
#include <LibChess/UCIEndpoint.h>
|
|
|
|
|
|
|
|
class ChessEngine : public Chess::UCI::Endpoint {
|
|
|
|
C_OBJECT(ChessEngine)
|
|
|
|
public:
|
2022-03-24 05:58:03 +03:00
|
|
|
virtual ~ChessEngine() override = default;
|
2020-08-21 02:04:08 +03:00
|
|
|
|
2021-11-01 01:38:04 +03:00
|
|
|
virtual void handle_uci() override;
|
2022-04-01 20:58:27 +03:00
|
|
|
virtual void handle_position(Chess::UCI::PositionCommand const&) override;
|
|
|
|
virtual void handle_go(Chess::UCI::GoCommand const&) override;
|
2021-11-01 01:38:04 +03:00
|
|
|
|
|
|
|
private:
|
2022-03-24 05:58:03 +03:00
|
|
|
ChessEngine() = default;
|
2020-08-21 02:04:08 +03:00
|
|
|
ChessEngine(NonnullRefPtr<Core::IODevice> in, NonnullRefPtr<Core::IODevice> out)
|
|
|
|
: Endpoint(in, out)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Chess::Board m_board;
|
2022-08-14 17:39:32 +03:00
|
|
|
Optional<MCTSTree> m_last_tree;
|
2020-08-21 02:04:08 +03:00
|
|
|
};
|