move

package
v0.4.4-alpha Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: GPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromBoardGameCoords added in v0.2.9

func FromBoardGameCoords(c string) (int, int, bool)

FromBoardGameCoords does the inverse operation of ToBoardGameCoords above.

func ToBoardGameCoords

func ToBoardGameCoords(row int, col int, vertical bool) string

ToBoardGameCoords onverts the row, col, and orientation of the play to a coordinate like 5F or G4.

Types

type Move

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

Move is a move. It can have a score, position, equity, etc. It doesn't have to be a scoring move.

func NewBonusScoreMove added in v0.2.11

func NewBonusScoreMove(t MoveType, tiles alphabet.MachineWord, score int) *Move

func NewExchangeMove

func NewExchangeMove(tiles alphabet.MachineWord, leave alphabet.MachineWord,
	alph *alphabet.Alphabet) *Move

NewExchangeMove creates an exchange.

func NewLostScoreMove added in v0.2.11

func NewLostScoreMove(t MoveType, tiles alphabet.MachineWord, score int) *Move

func NewPassMove

func NewPassMove(leave alphabet.MachineWord, alph *alphabet.Alphabet) *Move

NewPassMove creates a pass with the given leave.

func NewScoringMove

func NewScoringMove(score int, tiles alphabet.MachineWord,
	leave alphabet.MachineWord, vertical bool, tilesPlayed int,
	alph *alphabet.Alphabet, rowStart int, colStart int, coords string) *Move

NewScoringMove creates a scoring *Move and returns it.

func NewScoringMoveSimple

func NewScoringMoveSimple(score int, coords string, word string, leave string,
	alph *alphabet.Alphabet) *Move

NewScoringMoveSimple takes in user-visible strings. Consider moving to this (it is a little slower, though, so maybe only for tests)

func (*Move) Action

func (m *Move) Action() MoveType

func (*Move) Alphabet

func (m *Move) Alphabet() *alphabet.Alphabet

Alphabet is the alphabet used by this move

func (*Move) BoardCoords

func (m *Move) BoardCoords() string

func (*Move) CoordsAndVertical

func (m *Move) CoordsAndVertical() (int, int, bool)

func (*Move) Dupe added in v0.2.11

func (m *Move) Dupe() *Move

func (*Move) Equity

func (m *Move) Equity() float64

Equity is the equity of this move.

func (*Move) FullRack added in v0.3.0

func (m *Move) FullRack() string

FullRack returns the entire rack that the move was made from. This can be calculated from the tiles it uses and the leave.

func (*Move) HasDupe added in v0.2.11

func (m *Move) HasDupe() bool

func (*Move) Leave

func (m *Move) Leave() alphabet.MachineWord

func (*Move) Score

func (m *Move) Score() int

func (*Move) SetDupe added in v0.2.11

func (m *Move) SetDupe(o *Move)

func (*Move) SetEquity

func (m *Move) SetEquity(e float64)

SetEquity sets the equity of this move. It is calculated outside this package.

func (*Move) SetValuation added in v0.2.11

func (m *Move) SetValuation(v float32)

SetValuation sets the valuation of this move. It is calculated outside of this package.

func (*Move) SetVisited added in v0.2.11

func (m *Move) SetVisited(v bool)

func (*Move) ShortDescription

func (m *Move) ShortDescription() string

ShortDescription provides a short description, useful for logging or user display.

func (*Move) String

func (m *Move) String() string

String provides a string just for debugging purposes.

func (*Move) Tiles

func (m *Move) Tiles() alphabet.MachineWord

func (*Move) TilesPlayed

func (m *Move) TilesPlayed() int

TilesPlayed returns the number of tiles played by this move.

func (*Move) UniqueSingleTileKey

func (m *Move) UniqueSingleTileKey() int

func (*Move) Valuation added in v0.2.11

func (m *Move) Valuation() float32

Valuation is the "value" of this move. This is an internal value that is used in calculating endgames and other such metrics.

func (*Move) Visited added in v0.2.11

func (m *Move) Visited() bool

type MoveType

type MoveType uint8

MoveType is a type of move; a play, an exchange, pass, etc.

const (
	MoveTypePlay MoveType = iota
	MoveTypeExchange
	MoveTypePass
	MoveTypePhonyTilesReturned
	MoveTypeChallengeBonus

	MoveTypeEndgameTiles
	MoveTypeLostTileScore
	MoveTypeLostScoreOnTime
)

Jump to

Keyboard shortcuts

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