github.com/gorgonia/agogo@v0.1.1/mcts/mcts.go (about)

     1  package mcts
     2  
     3  import "github.com/gorgonia/agogo/game"
     4  
     5  // type GameState interface {
     6  // 	game.State
     7  
     8  // 	// Go specific
     9  // 	Komi() float32
    10  // 	SuperKo() bool
    11  // 	IsEye(m game.PlayerMove) bool
    12  // }
    13  
    14  // Inferencer is essentially the neural network
    15  type Inferencer interface {
    16  	Infer(state game.State) (policy []float32, value float32)
    17  	// Log() string // in debug mode, the Log() method should return the neural network log
    18  }
    19  
    20  const (
    21  	Pass   game.Single = -1
    22  	Resign game.Single = -2
    23  
    24  	White game.Player = game.Player(game.White)
    25  	Black game.Player = game.Player(game.Black)
    26  
    27  	virtualLoss1       = 0x40400000 // 3 in float32
    28  	defaultMinPsaRatio = 0x40000000 // 2 in float32
    29  )
    30  
    31  // PassPreference
    32  type PassPreference int
    33  
    34  const (
    35  	DontPreferPass PassPreference = iota
    36  	PreferPass
    37  	DontResign
    38  	MAXPASSPREFERENCE
    39  )
    40  
    41  func init() {
    42  	if !Pass.IsPass() {
    43  		panic("Pass has  to be Pass")
    44  	}
    45  
    46  	if !Resign.IsResignation() {
    47  		panic("Resign  has to be Resign")
    48  	}
    49  }