move

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: GPL-3.0 Imports: 7 Imported by: 2

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 MinimallyEqual added in v0.8.7

func MinimallyEqual(m1 *Move, m2 *Move) bool

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 tilemapping.MachineWord, score int) *Move

func NewChallengeMove added in v0.4.5

func NewChallengeMove(leave tilemapping.MachineWord, alph *tilemapping.TileMapping) *Move

NewChallengeMove creates a challenge with the given leave.

func NewExchangeMove

func NewExchangeMove(tiles tilemapping.MachineWord, leave tilemapping.MachineWord,
	alph *tilemapping.TileMapping) *Move

NewExchangeMove creates an exchange.

func NewLostScoreMove added in v0.2.11

func NewLostScoreMove(t MoveType, rack tilemapping.MachineWord, score int) *Move

func NewPassMove

func NewPassMove(leave tilemapping.MachineWord, alph *tilemapping.TileMapping) *Move

NewPassMove creates a pass with the given leave.

func NewScoringMove

func NewScoringMove(score int, tiles tilemapping.MachineWord,
	leave tilemapping.MachineWord, vertical bool, tilesPlayed int,
	alph *tilemapping.TileMapping, rowStart int, colStart int) *Move

NewScoringMove creates a scoring *Move and returns it.

func NewScoringMoveSimple

func NewScoringMoveSimple(score int, coords string, word string, leave string,
	alph *tilemapping.TileMapping) *Move

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

func NewUnsuccessfulChallengePassMove added in v0.4.5

func NewUnsuccessfulChallengePassMove(leave tilemapping.MachineWord, alph *tilemapping.TileMapping) *Move

func (*Move) Action

func (m *Move) Action() MoveType

func (*Move) Alphabet

func (m *Move) Alphabet() *tilemapping.TileMapping

Alphabet is the alphabet used by this move

func (*Move) BingoPlayed added in v0.4.9

func (m *Move) BingoPlayed() bool

func (*Move) BoardCoords

func (m *Move) BoardCoords() string

func (*Move) CoordsAndVertical

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

func (*Move) CopyFrom added in v0.4.9

func (m *Move) CopyFrom(other *Move)

CopyFrom performs a copy of other.

func (*Move) Equals added in v0.4.10

func (m *Move) Equals(o *Move, alsoCheckTransposition, ignoreLeave bool) bool

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) Leave

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

func (*Move) LeaveString added in v0.4.5

func (m *Move) LeaveString() string

func (*Move) MoveTypeString added in v0.4.5

func (m *Move) MoveTypeString() string

func (*Move) PlayLength added in v0.8.7

func (m *Move) PlayLength() int

func (*Move) Score

func (m *Move) Score() int

func (*Move) Set added in v0.4.9

func (m *Move) Set(tiles tilemapping.MachineWord, leave tilemapping.MachineWord, score int,
	rowStart, colStart, tilesPlayed int, vertical bool, action MoveType,
	alph *tilemapping.TileMapping)

func (*Move) SetAction added in v0.4.9

func (m *Move) SetAction(action MoveType)

func (*Move) SetAlphabet added in v0.4.9

func (m *Move) SetAlphabet(alph *tilemapping.TileMapping)

func (*Move) SetEmpty added in v0.4.9

func (m *Move) SetEmpty()

func (*Move) SetEquity

func (m *Move) SetEquity(e float64)

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

func (*Move) SetLeave added in v0.5.0

func (m *Move) SetLeave(leave tilemapping.MachineWord)

func (*Move) SetScore added in v0.8.6

func (m *Move) SetScore(s int)

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() tilemapping.MachineWord

func (*Move) TilesPlayed

func (m *Move) TilesPlayed() int

TilesPlayed returns the number of tiles played by this move.

func (*Move) TilesString added in v0.4.5

func (m *Move) TilesString() string

func (*Move) TilesStringExchange added in v0.6.0

func (m *Move) TilesStringExchange() string

type MoveType

type MoveType uint8

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

const (
	MoveTypePlay MoveType = iota
	MoveTypeExchange
	MoveTypePass
	MoveTypeChallenge
	MoveTypePhonyTilesReturned
	MoveTypeChallengeBonus
	MoveTypeUnsuccessfulChallengePass

	MoveTypeEndgameTiles
	MoveTypeLostTileScore
	MoveTypeLostScoreOnTime

	MoveTypeUnset
)

Jump to

Keyboard shortcuts

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