Documentation ¶
Index ¶
- func Count(bag *ipc.Bag, letter tilemapping.MachineLetter) int
- func Draw(bag *ipc.Bag, n int, ml []tilemapping.MachineLetter) error
- func DrawAtMost(bag *ipc.Bag, n int, ml []tilemapping.MachineLetter) (int, error)
- func Exchange(bag *ipc.Bag, letters []tilemapping.MachineLetter, ...) error
- func InBag(bag *ipc.Bag) int
- func PutBack(bag *ipc.Bag, letters []tilemapping.MachineLetter)
- func RemoveTiles(bag *ipc.Bag, letters []tilemapping.MachineLetter) error
- func Sort(bag *ipc.Bag)
- func TileBag(d *tilemapping.LetterDistribution) *ipc.Bag
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 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 ¶
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 ¶
func TileBag(d *tilemapping.LetterDistribution) *ipc.Bag
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.