MonteCarloTreeSearchPolicy
public protocol MonteCarloTreeSearchPolicy: TreeSearchPolicy, ScoringHeuristic
Policy for more direct control over a strategy’s execution
-
Whether the strategy should abort a given simulation.
Declaration
Swift
func hasReachedMaxSimulationDepth(depth: Int) -> Bool
-
Whether the strategy should execute another simulation.
Declaration
Swift
func shouldContinueSimulations(game: Game, simulationCount: Int) -> Bool
-
Whether the strategy should collapse a given tree into a single leaf node.
Declaration
Swift
func shouldCollapseTree(stats: TreeStats, subtrees: Int, depth: Int) -> Bool
-
Heuristic used for scoring a given move.
Declaration
Swift
func scoreMove(stats: TreeStats, parentPlays: Int) -> Score
-
Calculate reward from an evaluation.
Example:
func reward(evaluation: Evaluation<Game.Score>) -> Int { switch evaluation { case .Victory: return 1 case .Defeat: return 0 default: return 0 } }
Declaration
Swift
func reward(evaluation: Evaluation<Game.Score>) -> Int
-
Heuristic used for choosing game state subtree to further explore.
Declaration
Swift
func explorationMove<M: GeneratorType where M.Element == (Game.Move, TreeStats)>(availableMoves: M, explorationDepth: Int, plays: Int, randomSource: RandomSource) -> Game.Move?
-
Heuristic used for choosing game state subtree to further explore.
Declaration
Swift
func simulationMove<M: GeneratorType where M.Element == Game.Move>(availableMoves: M, simulationDepth: Int, randomSource: RandomSource) -> Game.Move?