Protocols
The following protocols are available globally.
-
Policy for more direct control over a strategy’s execution
See moreDeclaration
Swift
public protocol TreeSearchPolicy
-
A lightweight player descriptor.
Example:
enum ChessPlayer: Strategist.Player { case White case Black }
Declaration
Swift
public protocol Player: Equatable {}
-
A lightweight move descriptor.
Example:
struct ChessMove: Strategist.Move { let origin: (UInt8, UInt8) let destination: (UInt8, UInt8) }
Declaration
Swift
public protocol Move: Hashable {}
-
A representation of a game’s state.
Requires
Must be immutable & have value semantics.Note
Depending on the game’s nature it may be appropriate to model the game’s state as a history of moves, in addition to a simple snapshot.Snapshot Only:
enum ChessPlayer: Strategist.Player { case White case Black } enum ChessPiece { case King, Queen, Rook, Bishop, Knight, Pawn } struct ChessGame: Strategist.State { let board: [ChessPiece?] let player: ChessPlayer? }
Snapshot + History:
See moreenum GoPlayer: Strategist.Player { case White case Black } enum GoStone { case White, Black } struct GoGame: Strategist.Game { let board: [GoStone?] let moves: [GoMove] let player: GoPlayer? }
Declaration
Swift
public protocol Game: Equatable
-
A representation of a game with support for rewinding.
Requires
Must be immutable & have value semantics.Declaration
Swift
public protocol ReversibleGame: Game
-
Protocol to be implemented for strategy algorithms.
Requires
Must be immutable & have value semantics.Declaration
Swift
public protocol Strategy
-
Heuristic used for scoring moves based on the statistics obtained from previous Monte Carlo simulations.
See moreDeclaration
Swift
public protocol ScoringHeuristic
-
Policy for more direct control over a strategy’s execution
See moreDeclaration
Swift
public protocol MonteCarloTreeSearchPolicy: TreeSearchPolicy, ScoringHeuristic