move

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 NewExchangeMove

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

NewExchangeMove creates an exchange.

func NewPassMove

func NewPassMove(leave alphabet.MachineWord) *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) Equity

func (m *Move) Equity() float64

Equity is the equity of this move.

func (*Move) Leave

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

func (*Move) Score

func (m *Move) Score() int

func (*Move) SetEquity

func (m *Move) SetEquity(e float64)

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

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

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

type MoveType

type MoveType uint8

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

const (
	MoveTypePlay MoveType = iota
	MoveTypeExchange
	MoveTypePass
	MoveTypePhonyTilesReturned

	MoveTypeEndgameTiles
	MoveTypeLostTileScore
)

Jump to

Keyboard shortcuts

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