tiles

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(bag *ipc.Bag, letter tilemapping.MachineLetter) int

func Draw

func Draw(bag *ipc.Bag, n int, ml []tilemapping.MachineLetter) error

Draw draws n tiles from the bag into the passed-in ml MachineLetter array. The receiving array must be properly sized! The bag will be modified.

func DrawAtMost

func DrawAtMost(bag *ipc.Bag, n int, ml []tilemapping.MachineLetter) (int, error)

DrawAtMost draws at most n tiles from the bag. It can draw fewer if there are fewer tiles than n, and even draw no tiles at all :o This is a zero-alloc draw into the passed-in slice.

func Exchange

func Exchange(bag *ipc.Bag, letters []tilemapping.MachineLetter, ml []tilemapping.MachineLetter) error

Exchange exchanges the junk in your rack with new tiles.

func InBag

func InBag(bag *ipc.Bag) int

func PutBack

func PutBack(bag *ipc.Bag, letters []tilemapping.MachineLetter)

PutBack puts the tiles back in the bag.

func RemoveTiles

func RemoveTiles(bag *ipc.Bag, letters []tilemapping.MachineLetter) error

func Sort

func Sort(bag *ipc.Bag)

Sort sorts the bag. Normally there is no need to do this, since we always draw randomly from the bag, but this can be used for determinism (for example in tests)

func TileBag

TileBag returns a list of bytes rather than MachineLetters to keep it as compatible with the protobuf object as possible. A byte is just an unsigned MachineLetter, but bit-identical.

Types

This section is empty.

Jump to

Keyboard shortcuts

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