ritchie/elements/tile_set34
Histogram for all 34 kinds of tiles.
Types
Values
pub fn add(set: TileSet34, t: tile.Tile, delta: Int) -> TileSet34
Adds a delta (may be negative) to a tile’s count. Panics on under/overflow.
pub fn count(set: TileSet34, t: tile.Tile) -> Int
Returns how many of the given tile are in the set.
pub fn from_bit_array(bits: BitArray) -> Result(TileSet34, Nil)
Wrap an existing bit array. Must be exactly 34 bytes.
pub fn from_list(counts: List(Int)) -> Result(TileSet34, Nil)
Builds a tile set from a list of all counts, each in 0..=255.
pub fn from_tiles(tiles: List(tile.Tile)) -> TileSet34
Counts every tile in the list, and returns it as a tile set.
pub fn set_count(
set: TileSet34,
t: tile.Tile,
n: Int,
) -> TileSet34
Replaces the count for a tile. Panics if n isn’t in 0..=255.
pub fn to_list(set: TileSet34) -> List(Int)
Returns all counts as a list, in encoding order.
pub fn to_string(set: TileSet34) -> String
Renders as four comma-terminated groups: manzu, pinzu, souzu, honors
e.g. "300000000,000000000,000000000,0000000,"