Documentation ¶
Overview ¶
Package movegen contains all the move-generating functions. It makes heavy use of the GADDAG. Implementation notes: - Is the specification in the paper a bit buggy? Basically, if I assume an anchor is the leftmost tile of a word, the way the algorithm works, it will create words blindly. For example, if I have a word FIRE on the board, and I have the letter E on my rack, and I specify F as the anchor, it will create the word EF! (Ignoring the fact that IRE is on the board) You can see this by just stepping through the algorithm. It seems that anchors can only be on the rightmost tile of a word
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GordonGenerator ¶ added in v0.2.0
type GordonGenerator struct {
// contains filtered or unexported fields
}
GordonGenerator is the main move generation struct. It implements Steven A. Gordon's algorithm from his paper "A faster Scrabble Move Generation Algorithm"
func NewGordonGenerator ¶ added in v0.2.0
func NewGordonGenerator(gd *gaddag.SimpleGaddag, board *board.GameBoard, ld *alphabet.LetterDistribution) *GordonGenerator
NewGordonGenerator returns a Gordon move generator.
func (*GordonGenerator) GenAll ¶ added in v0.2.0
func (gen *GordonGenerator) GenAll(rack *alphabet.Rack, addExchange bool)
GenAll generates all moves on the board. It assumes anchors have already been updated, as well as cross-sets / cross-scores.
func (*GordonGenerator) Plays ¶ added in v0.2.0
func (gen *GordonGenerator) Plays() []*move.Move
Plays returns the generator's generated plays.
func (*GordonGenerator) SetSortingParameter ¶ added in v0.2.0
func (gen *GordonGenerator) SetSortingParameter(s SortBy)
SetSortingParameter tells the play sorter to sort by score, equity, or perhaps other things. This is useful for the endgame solver, which does not care about equity.