Documentation ¶
Index ¶
- Constants
- Variables
- func CountThreats(c *bitboard.Constants, p *tak.Position) (wp, wt, bp, bt int)
- func EvaluateWinner(_ *bitboard.Constants, p *tak.Position) int64
- func ExplainScore(m *MinimaxAI, out io.Writer, p *tak.Position)
- type EvaluationFunc
- type Feature
- type MinimaxAI
- func (m *MinimaxAI) Analyze(ctx context.Context, p *tak.Position) ([]tak.Move, int64, Stats)
- func (ai *MinimaxAI) AnalyzeAll(ctx context.Context, p *tak.Position) ([][]tak.Move, int64, Stats)
- func (m *MinimaxAI) Evaluate(p *tak.Position) int64
- func (ai *MinimaxAI) GetMove(ctx context.Context, p *tak.Position) tak.Move
- type MinimaxConfig
- type OpeningBook
- type OpeningPlayer
- type RandomAI
- type Stats
- type TakPlayer
- type Weights
Constants ¶
View Source
const ( MaxEval int64 = 1 << 30 MinEval = -MaxEval WinThreshold = 1 << 29 WinBase = (WinThreshold + MaxEval) / 2 ForcedWin = 1 << 20 )
Variables ¶
View Source
var DefaultWeights []Weights
Functions ¶
Types ¶
type EvaluationFunc ¶
func MakeEvaluator ¶
func MakeEvaluator(size int, w *Weights) EvaluationFunc
type Feature ¶
type Feature int
const ( Tempo Feature = iota TopFlat Standing Capstone HardTopCap CapMobility FlatCaptives_Soft FlatCaptives_Hard StandingCaptives_Soft StandingCaptives_Hard CapstoneCaptives_Soft CapstoneCaptives_Hard Liberties GroupLiberties Groups Groups_1 Groups_2 Groups_3 Groups_4 Groups_5 Groups_6 Groups_7 Groups_8 Potential Threat EmptyControl FlatControl Center CenterControl ThrowMine ThrowTheirs ThrowEmpty Terminal_Plies Terminal_Flats Terminal_Reserves Terminal_OpponentReserves MaxFeature )
type MinimaxAI ¶
type MinimaxAI struct { Cfg MinimaxConfig // contains filtered or unexported fields }
func NewMinimax ¶
func NewMinimax(cfg MinimaxConfig) *MinimaxAI
func (*MinimaxAI) AnalyzeAll ¶
type MinimaxConfig ¶
type MinimaxConfig struct { Size int Depth int MaxEvals uint64 Debug int Seed int64 // How much memory to allocate to the transposition // table. Negative means don't use a table. TableMem int64 RandomizeWindow int64 RandomizeScale int64 NoSort bool NoNullMove bool NoExtendForces bool NoReduceSlides bool MultiCut bool Evaluate EvaluationFunc DedupSymmetry bool CutLog string }
func (*MinimaxConfig) MakePrecise ¶
func (cfg *MinimaxConfig) MakePrecise()
MakePrecise modifies a MinimaxConfig to produce a MinimaxAI that will always produce accurate game-theoretic evaluations – i.e. it disables all heuristic searches that cannot prove the correctness of their results.
In general, such configurations should be slower and weaker players, but can be useful for constructing or solving puzzles, debugging, or analyzing unusual positions.
type OpeningBook ¶
type OpeningBook struct {
// contains filtered or unexported fields
}
func BuildOpeningBook ¶
func BuildOpeningBook(size int, lines []string) (*OpeningBook, error)
type OpeningPlayer ¶
type OpeningPlayer struct {
// contains filtered or unexported fields
}
type Stats ¶
type Stats struct { Depth int Canceled bool Elapsed time.Duration Generated uint64 Evaluated uint64 Scout uint64 Terminal uint64 Visited uint64 CutNodes uint64 NullSearch uint64 NullCut uint64 Cut0 uint64 Cut1 uint64 CutSearch uint64 ReSearch uint64 AllNodes uint64 TTHits uint64 TTShortcut uint64 Extensions uint64 ReducedSlides uint64 MCSearch uint64 MCCut uint64 }
type TakPlayer ¶
func WithOpeningBook ¶
func WithOpeningBook(ai TakPlayer, ob *OpeningBook) TakPlayer
type Weights ¶
type Weights [MaxFeature]int64
func (*Weights) MarshalJSON ¶
func (*Weights) UnmarshalJSON ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.