Documentation ¶
Overview ¶
Package montecarlo implements truncated monte-carlo search during the regular game. In other words, "simming".
Index ¶
- Constants
- type InferenceMode
- type LogIteration
- type LogPlay
- type SimmedPlay
- type Simmer
- func (s *Simmer) EquityStats() string
- func (s *Simmer) Init(game *game.Game, eqCalcs []equity.EquityCalculator, leaves equity.Leaves, ...)
- func (s *Simmer) IsSimming() bool
- func (s *Simmer) Iterations() int
- func (s *Simmer) PrepareSim(plies int, plays []*move.Move) error
- func (s *Simmer) Ready() bool
- func (s *Simmer) Reset()
- func (s *Simmer) ScoreDetails() string
- func (s *Simmer) SetInferences(i [][]tilemapping.MachineLetter, mode InferenceMode)
- func (s *Simmer) SetKnownOppRack(r []tilemapping.MachineLetter)
- func (s *Simmer) SetLogStream(l io.Writer)
- func (s *Simmer) SetStoppingCondition(sc StoppingCondition)
- func (s *Simmer) SetThreads(threads int)
- func (s *Simmer) Simulate(ctx context.Context) error
- func (s *Simmer) TrimBottom(totrim int) error
- func (s *Simmer) WinningPlays() []*SimmedPlay
- type StoppingCondition
Constants ¶
View Source
const IterationsCutoff = 5000
View Source
const SimilarPlaysIterationsCutoff = 750
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InferenceMode ¶ added in v0.5.0
type InferenceMode int
const ( InferenceOff InferenceMode = iota InferenceCycle InferenceRandom )
type LogIteration ¶
type LogIteration struct { Iteration int `json:"iteration" yaml:"iteration"` Plays []LogPlay `json:"plays" yaml:"plays"` Thread int `json:"thread" yaml:"thread"` }
LogIteration is a struct meant for serializing to a log-file, for debug and other purposes.
type LogPlay ¶
type LogPlay struct { Play string `json:"play" yaml:"play"` Rack string `json:"rack" yaml:"rack"` Pts int `json:"pts" yaml:"pts"` // Leftover is the equity of the leftover tiles at the end of the sim. Leftover float64 `json:"left,omitempty" yaml:"left,omitempty"` // Although this is a recursive structure we don't really use it // recursively. WinRatio float64 `json:"win,omitempty" yaml:"win,omitempty"` Plies []LogPlay `json:"plies,omitempty" yaml:"plies,omitempty,flow"` }
LogPlay is a single play.
type SimmedPlay ¶
func (*SimmedPlay) Ignore ¶ added in v0.5.0
func (sp *SimmedPlay) Ignore()
func (*SimmedPlay) Move ¶ added in v0.5.0
func (s *SimmedPlay) Move() *move.Move
func (*SimmedPlay) String ¶
func (sp *SimmedPlay) String() string
type Simmer ¶
type Simmer struct {
// contains filtered or unexported fields
}
Simmer implements the actual look-ahead search
func (*Simmer) EquityStats ¶
func (*Simmer) Iterations ¶
func (*Simmer) PrepareSim ¶ added in v0.4.2
PrepareSim resets all the stats before a simulation.
func (*Simmer) ScoreDetails ¶
func (*Simmer) SetInferences ¶ added in v0.5.0
func (s *Simmer) SetInferences(i [][]tilemapping.MachineLetter, mode InferenceMode)
func (*Simmer) SetKnownOppRack ¶ added in v0.5.0
func (s *Simmer) SetKnownOppRack(r []tilemapping.MachineLetter)
func (*Simmer) SetLogStream ¶
func (*Simmer) SetStoppingCondition ¶ added in v0.5.0
func (s *Simmer) SetStoppingCondition(sc StoppingCondition)
func (*Simmer) SetThreads ¶
func (*Simmer) TrimBottom ¶ added in v0.4.2
func (*Simmer) WinningPlays ¶ added in v0.5.0
func (s *Simmer) WinningPlays() []*SimmedPlay
type StoppingCondition ¶ added in v0.5.0
type StoppingCondition int
const ( StopNone StoppingCondition = iota Stop95 Stop98 Stop99 )
Click to show internal directories.
Click to hide internal directories.