gomcts: github.com/int8/gomcts Index | Files

package gomcts

import "github.com/int8/gomcts"


Package Files

games.go mcts.go policies.go tictactoe.go tree.go utils.go

type Action Uses

type Action interface {
    ApplyTo(GameState) GameState

Action - interface representing entity that can be applied to a game state (generating the next game state)

func DefaultRolloutPolicy Uses

func DefaultRolloutPolicy(state GameState) Action

DefaultRolloutPolicy - default rollout policy, picks action randomly (w.r.t uniform random dist)

func MonteCarloTreeSearch Uses

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 GameResult Uses

type GameResult float64

GameResult - number representing a game result

type GameState Uses

type GameState interface {
    EvaluateGame() (GameResult, bool)
    GetLegalActions() []Action
    IsGameEnded() bool
    NextToMove() int8

GameState - state of the game interface

type RolloutPolicy Uses

type RolloutPolicy func(GameState) Action

RolloutPolicy - function signature determining the next action during Monte Carlo Tree Search rollout

type TicTacToeBoardGameAction Uses

type TicTacToeBoardGameAction struct {
    // contains filtered or unexported fields

TicTacToeBoardGameAction - action on a tic tac toe board game

func (TicTacToeBoardGameAction) ApplyTo Uses

func (a TicTacToeBoardGameAction) ApplyTo(s GameState) GameState

ApplyTo - TicTacToeBoardGameAction implementation of ApplyTo method of Action interface

type TicTacToeGameState Uses

type TicTacToeGameState struct {
    // contains filtered or unexported fields

TicTacToeGameState - tic tac toe game state

func CreateTicTacToeInitialGameState Uses

func CreateTicTacToeInitialGameState(boardSize uint8) TicTacToeGameState

CreateTicTacToeInitialGameState - initializes tic tac toe game state

func (TicTacToeGameState) EvaluateGame Uses

func (s TicTacToeGameState) EvaluateGame() (result GameResult, ended bool)

EvaluateGame - TicTacToeGameState implementation of EvaluateGame method of GameState interface

func (TicTacToeGameState) GetLegalActions Uses

func (s TicTacToeGameState) GetLegalActions() []Action

GetLegalActions - TicTacToeGameState implementation of GetLegalActions method of GameState interface

func (TicTacToeGameState) IsGameEnded Uses

func (s TicTacToeGameState) IsGameEnded() bool

IsGameEnded - TicTacToeGameState implementation of IsGameEnded method of GameState interface

func (TicTacToeGameState) NextToMove Uses

func (s TicTacToeGameState) NextToMove() int8

NextToMove - TicTacToeGameState implementation of NextToMove method of GameState interface

Package gomcts imports 3 packages (graph). Updated 2018-04-22. Refresh now. Tools for package owners.