Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
Action - interface representing entity that can be applied to a game state (generating the next game state)
func DefaultRolloutPolicy ¶
DefaultRolloutPolicy - default rollout policy, picks action randomly (w.r.t uniform random dist)
func MonteCarloTreeSearch ¶
func MonteCarloTreeSearch(state GameState, rolloutPolicy RolloutPolicy, simulations int) Action
MonteCarloTreeSearch - function starting Monte Carlo Tree Search over provided GameState using RolloutPolicy of your choice, repeating simulation requested amount of time
type GameState ¶
type GameState interface { EvaluateGame() (GameResult, bool) GetLegalActions() []Action IsGameEnded() bool NextToMove() int8 }
GameState - state of the game interface
type RolloutPolicy ¶
RolloutPolicy - function signature determining the next action during Monte Carlo Tree Search rollout
type TicTacToeBoardGameAction ¶
type TicTacToeBoardGameAction struct {
// contains filtered or unexported fields
}
TicTacToeBoardGameAction - action on a tic tac toe board game
func (TicTacToeBoardGameAction) ApplyTo ¶
func (a TicTacToeBoardGameAction) ApplyTo(s GameState) GameState
ApplyTo - TicTacToeBoardGameAction implementation of ApplyTo method of Action interface
type TicTacToeGameState ¶
type TicTacToeGameState struct {
// contains filtered or unexported fields
}
TicTacToeGameState - tic tac toe game state
func CreateTicTacToeInitialGameState ¶
func CreateTicTacToeInitialGameState(boardSize uint8) TicTacToeGameState
CreateTicTacToeInitialGameState - initializes tic tac toe game state
func (TicTacToeGameState) EvaluateGame ¶
func (s TicTacToeGameState) EvaluateGame() (result GameResult, ended bool)
EvaluateGame - TicTacToeGameState implementation of EvaluateGame method of GameState interface
func (TicTacToeGameState) GetLegalActions ¶
func (s TicTacToeGameState) GetLegalActions() []Action
GetLegalActions - TicTacToeGameState implementation of GetLegalActions method of GameState interface
func (TicTacToeGameState) IsGameEnded ¶
func (s TicTacToeGameState) IsGameEnded() bool
IsGameEnded - TicTacToeGameState implementation of IsGameEnded method of GameState interface
func (TicTacToeGameState) NextToMove ¶
func (s TicTacToeGameState) NextToMove() int8
NextToMove - TicTacToeGameState implementation of NextToMove method of GameState interface