Documentation ¶
Overview ¶
Package alphabeta implements an endgame solver using depth-limited minimax with alpha-beta pruning.
Index ¶
- Constants
- Variables
- type GameNode
- type Solver
- func (s *Solver) Init(m1 movegen.MoveGenerator, m2 movegen.MoveGenerator, game *game.Game, ...) error
- func (s *Solver) RootNode() *GameNode
- func (s *Solver) SetComplexEvaluator(i bool)
- func (s *Solver) SetIterativeDeepening(i bool)
- func (s *Solver) SetPruningDisabled(i bool)
- func (s *Solver) Solve(ctx context.Context, plies int) (float32, []*move.Move, error)
Constants ¶
View Source
const ( // Infinity is 10 million. Infinity = 10000000 // TwoPlyOppSearchLimit is how many plays to consider for opponent // for the evaluation function. TwoPlyOppSearchLimit = 50 // FutureAdjustment potentially weighs the value of future points // less than present points, to allow for the possibility of being // blocked. We just make it 1 because our 2-ply evaluation function // is reasonably accurate. FutureAdjustment = float32(1) )
View Source
const PerTurnPenalty = float32(0.001)
Variables ¶
View Source
var ErrNoEndgameSolution = errors.New("no endgame solution found")
Functions ¶
This section is empty.
Types ¶
type GameNode ¶ added in v0.3.0
type GameNode struct {
// contains filtered or unexported fields
}
a game node has to have enough information to allow the game and turns to be reconstructed.
type Solver ¶
type Solver struct {
// contains filtered or unexported fields
}
Solver implements the minimax + alphabeta algorithm.
func (*Solver) Init ¶
func (s *Solver) Init(m1 movegen.MoveGenerator, m2 movegen.MoveGenerator, game *game.Game, cfg *config.Config) error
Init initializes the solver
func (*Solver) SetComplexEvaluator ¶ added in v0.4.9
func (*Solver) SetIterativeDeepening ¶
func (*Solver) SetPruningDisabled ¶ added in v0.3.0
Click to show internal directories.
Click to hide internal directories.