protected override double Playout(MCTreeSearchNode <TState, TAction> leafNode) { TState playoutFinalState = PlayoutGenerator.Generate(leafNode.State); TPlayer winner = playoutFinalState.GetWinner(); return(winner == null ? 0.5 : leafNode.State.CurrentPlayer.Equals(winner) ? 0 : 1); }
protected override double Playout(MCTreeSearchNode <TState, TAction> leafNode, out IEnumerable <Tuple <TAction, TState> > path) { path = PlayoutGenerator.GeneratePath(leafNode.State); TState playoutFinalState = path.Any() ? path.Last().Item2 : leafNode.State; TPlayer winner = playoutFinalState.GetWinner(); return(winner == null ? 0.5 : leafNode.State.CurrentPlayer.Equals(winner) ? 0 : 1); }
protected override MCTreeSearchNode <TState, TAction> SelectExpanded(MCTreeSearchNode <TState, TAction> node) { return(Random.Next(node.Children).Value); }
protected override MCTreeSearchNode <TState, TAction> CreateNode(MCTreeSearchNode <TState, TAction> parentNode, TState gameState, TAction action) { return(new MCTreeSearchNode <TState, TAction>(parentNode, gameState, action)); }