1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:17:46 +00:00

ChessEngine: Don't throw away useful branches from last tree

Computation from last turn might have produced some nodes that are still
accurate. Keeping them should make the engine a bit smarter.
This commit is contained in:
Lucas CHOLLET 2022-08-14 16:39:32 +02:00 committed by Andreas Kling
parent 351fc0cce2
commit d5979516b4
4 changed files with 52 additions and 7 deletions

View file

@ -20,6 +20,7 @@ public:
};
MCTSTree(Chess::Board const& board, MCTSTree* parent = nullptr);
MCTSTree(MCTSTree&&);
MCTSTree& select_leaf();
MCTSTree& expand();
@ -28,7 +29,11 @@ public:
void apply_result(int game_score);
void do_round();
Chess::Move best_move() const;
Optional<MCTSTree&> child_with_move(Chess::Move);
MCTSTree& best_node();
Chess::Move last_move() const;
double expected_value() const;
double uct(Chess::Color color) const;
bool expanded() const;