strategy

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package strategy encapsulates all strategic concerns for crossword game. This includes for example equity calculations, first-turn placement heuristics, and more. It shouldn't be placed in the movegen package as that package is solely for generating moves.

Index

Constants

This section is empty.

Variables

View Source
var DataDir = os.Getenv("DATA_DIR")

Functions

This section is empty.

Types

type ExhaustiveLeaveStrategy

type ExhaustiveLeaveStrategy struct{}

ExhaustiveLeaveStrategy should apply an equity calculation for all leaves exhaustively.

type NoLeaveStrategy

type NoLeaveStrategy struct{}

NoLeaveStrategy does not take leave into account at all.

func (*NoLeaveStrategy) Equity

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

type SimpleSynergyStrategy

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

SimpleSynergyStrategy uses a strategy borne of a simple synergy calculation, based on a few million computer vs computer games. The details of this calculation are in the /notebooks directory in this repo.

func NewSimpleSynergyStrategy

func NewSimpleSynergyStrategy(bag *alphabet.Bag, lexiconName string,
	alph *alphabet.Alphabet, leaveFilename string) *SimpleSynergyStrategy

func (SimpleSynergyStrategy) Equity

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

func (*SimpleSynergyStrategy) Init

func (sss *SimpleSynergyStrategy) Init(lexiconName string, alph *alphabet.Alphabet,
	leavefile string) error

Init initializes the strategizer, by doing things such as loading parameters from disk.

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
}

Strategizer is an interface used by the movegen (and possibly other places) to apply strategical calculations.

type SynergyAndEV

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

SynergyAndEV encapsulates synergy, and, well, EV.

type SynergyLeaveMap

type SynergyLeaveMap map[string]SynergyAndEV

SynergyLeaveMap gets created from a csv file of leaves. See the notebooks directory for generation code.

Jump to

Keyboard shortcuts

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