board

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CrosswordGameLayout      = "CrosswordGame"
	SuperCrosswordGameLayout = "SuperCrosswordGame"
)
View Source
const VsMatt = `` /* 807-byte string literal not displayed */

VsMatt was a game I played against Matt Graham, 2018 Lake George tourney

View Source
const VsOxy = `` /* 777-byte string literal not displayed */

Variables

View Source
var (
	// CrosswordGameBoard is a board for a fun Crossword Game, featuring lots
	// of wingos and blonks.
	CrosswordGameBoard []string
	// SuperCrosswordGameBoard is a board for a bigger Crossword game, featuring
	// even more wingos and blonks.
	SuperCrosswordGameBoard []string
)
View Source
var CacheKeyPrefix = "boardlayout:"
View Source
var (
	ColorSupport = os.Getenv("LIWORDS_DISABLE_COLOR") != "on"
)

Functions

func CacheLoadFunc

func CacheLoadFunc(cfg *wglconfig.Config, key string) (interface{}, error)

CacheLoadFunc is the function that loads an object into the global cache.

func ErrorIfIllegalPlay

func ErrorIfIllegalPlay(board *ipc.GameBoard, row, col int, vertical bool,
	word []tilemapping.MachineLetter) error

func FormedWords

func FormedWords(board *ipc.GameBoard, row, col int, vertical bool, mls []tilemapping.MachineLetter) ([]tilemapping.MachineWord, error)

FormedWords returns an array of all machine words formed by this move. The move is assumed to be of type Play

func GetLetter

func GetLetter(board *ipc.GameBoard, row, col int) tilemapping.MachineLetter

func HasLetter

func HasLetter(board *ipc.GameBoard, row, col int) bool

func NewBoard

func NewBoard(bl *BoardLayout) *ipc.GameBoard

func PlayMove

func PlayMove(board *ipc.GameBoard, layoutName string, dist *tilemapping.LetterDistribution,
	mls []tilemapping.MachineLetter, row, col int, vertical bool) (int32, error)

PlayMove plays the move on the board and returns the score of the move.

func PosExists

func PosExists(board *ipc.GameBoard, row, col int) bool

func ToFEN

func ToFEN(board *ipc.GameBoard, dist *tilemapping.LetterDistribution) string

func ToUserVisibleString

func ToUserVisibleString(board *ipc.GameBoard, layoutName string, rm *tilemapping.TileMapping) (string, error)

func UnplaceMoveTiles

func UnplaceMoveTiles(board *ipc.GameBoard, mls []tilemapping.MachineLetter, row, col int, vertical bool) error

UnplaceMoveTiles unplaces the tiles -- that is, removes them from the board

Types

type BoardLayout

type BoardLayout struct {
	Rows   int
	Cols   int
	Layout []byte
}

func GetBoardLayout

func GetBoardLayout(name string) (*BoardLayout, error)

func NamedBoardLayout

func NamedBoardLayout(name string) (*BoardLayout, error)

type BonusSquare

type BonusSquare byte
const (
	EmptySpace BonusSquare = 0
	Bonus2LS   BonusSquare = 2
	Bonus3LS   BonusSquare = 3
	Bonus4LS   BonusSquare = 4
	Bonus2WS   BonusSquare = 12
	Bonus3WS   BonusSquare = 13
	Bonus4WS   BonusSquare = 14
)

Jump to

Keyboard shortcuts

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