strategy

package
v0.4.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LeaveFilename         = "leaves.olv"
	PEGAdjustmentFilename = "preendgame.json"
)
View Source
const MaxRepresentedWinSpread = 300

Variables

This section is empty.

Functions

func LeaveCacheLoadFunc added in v0.4.5

func LeaveCacheLoadFunc(cfg *config.Config, key string) (interface{}, error)

func PEGCacheLoadFunc added in v0.4.5

func PEGCacheLoadFunc(cfg *config.Config, key string) (interface{}, error)

func WinPCTLoadFunc added in v0.4.10

func WinPCTLoadFunc(cfg *config.Config, key string) (interface{}, error)

Types

type BlankLeaves added in v0.4.5

type BlankLeaves struct{}

func (*BlankLeaves) LeaveValue added in v0.4.5

func (b *BlankLeaves) LeaveValue(leave alphabet.MachineWord) float64

type ExhaustiveLeaveStrategy

type ExhaustiveLeaveStrategy struct {
	// contains filtered or unexported fields
}

ExhaustiveLeaveStrategy should apply an equity calculation for all leaves exhaustively.

func NewExhaustiveLeaveStrategy added in v0.2.11

func NewExhaustiveLeaveStrategy(lexiconName string,
	alph *alphabet.Alphabet, cfg *config.Config, leaveFilename, pegfile string) (
	*ExhaustiveLeaveStrategy, error)

func (ExhaustiveLeaveStrategy) Equity added in v0.2.11

func (els ExhaustiveLeaveStrategy) Equity(play *move.Move, board *board.GameBoard,
	bag *alphabet.Bag, oppRack *alphabet.Rack) float64

func (ExhaustiveLeaveStrategy) LeaveValue added in v0.4.0

func (els ExhaustiveLeaveStrategy) LeaveValue(leave alphabet.MachineWord) float64

type Leaves added in v0.4.5

type Leaves interface {
	LeaveValue(leave alphabet.MachineWord) float64
}

type NoLeaveStrategy

type NoLeaveStrategy struct{}

NoLeaveStrategy does not take leave into account at all.

func NewNoLeaveStrategy added in v0.4.2

func NewNoLeaveStrategy() *NoLeaveStrategy

func (*NoLeaveStrategy) Equity

func (nls *NoLeaveStrategy) Equity(play *move.Move, board *board.GameBoard,
	bag *alphabet.Bag, oppRack *alphabet.Rack) float64

func (*NoLeaveStrategy) LeaveValue added in v0.4.0

func (nls *NoLeaveStrategy) LeaveValue(leave alphabet.MachineWord) float64

type OldLeaves added in v0.4.5

type OldLeaves struct {
	// contains filtered or unexported fields
}

func ReadOldLeaves added in v0.4.5

func ReadOldLeaves(file io.Reader) (*OldLeaves, error)

func (*OldLeaves) LeaveValue added in v0.4.5

func (olv *OldLeaves) LeaveValue(leave alphabet.MachineWord) float64

func (*OldLeaves) Len added in v0.4.5

func (olv *OldLeaves) Len() int

Not very useful, but it's used for logging.

type Strategizer

type Strategizer interface {
	// Equity is a catch-all term for most post-score adjustments that
	// need to be made. It includes first-turn placement heuristic,
	// leave calculations, any pre-endgame timing heuristics, and more.
	Equity(play *move.Move, board *board.GameBoard, bag *alphabet.Bag,
		oppRack *alphabet.Rack) float64

	LeaveValue(leave alphabet.MachineWord) float64
}

Strategizer is in charge of picking plays using strategy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL