Module tile_set

Module tile_set 

Source
Expand description

Unordered multi- and single-sets of tiles (histograms).

These can be used to represent any unordered set of tiles, such as a closed hand, a full winning hand, all waiting tiles of a waiting hand, and tiles discarded by a player.

  • TileSet37: multi-set; treats “red 5” tiles separately from “normal 5” (34 + 3 = 37 kinds)
  • TileSet34: multi-set; treats “red 5” tiles the same as “normal 5” (34 kinds)
  • TileMask34: single-set counting unique tiles; treats “red 5” tiles the same as “normal 5” (34 kinds)

As the names suggest, the specific encoding of Tile is assumed.

Both TileSet37 and TileSet34 can be indexed with Tile (red or normal, 37 or 34), without first converting to encoding. A TileSet37 can be converted to a TileSet34 with red 5’s folded into normal 5’s. Any multi-set can be converted to a TileMask34.

Structs§

TileMask34
1-bit-per-tile version of TileSet34, i.e. non-multi set, set of tile kinds.
TileSet34
Histogram for all 34 kinds of normal tiles (red 5’s are treated as normal 5’s). Can be directly indexed with Tile.
TileSet37
Histogram for all 37 kinds of tiles (including reds). Can be directly indexed with Tile.