#riichi #game #lookup-tables #tenhou #mahjong #majsoul

bin+lib riichi-decomp-table

Lookup Table Generation for riichi-decomp

1 unstable release

0.1.0 Oct 8, 2022

#8 in #riichi

41 downloads per month
Used in 2 crates (via riichi-decomp)

MIT license

19KB
347 lines

Lookup Table Generation for riichi-decomp

This crate is NOT intended as a public interface. riichi-decomp should be used instead.

This crate contains algorithms for generating two lookup tables (LUTs). These LUTs speed up decomposition of a waiting hand into "standard" or "regular" form, i.e. not Seven Pairs or Thirteen Orphans. Separating the generation from the main crate makes it possible to call it at compile time through build.rs.

The Tables

For a more detailed explanation, please refer to the source.

"C-Table": Single-suit, 3N+2, Complete

  • Key: octal-packed single-suit tile count histogram; 27 bits in a u32. (this is basically one element of TileSet34::packed from riichi-elements).
  • Value: at most 4 "alternatives", each containing up to 4 groups, with the (optional) pair implied. This is encoded as a nested 4 x 4 x 4-bit array (single-suit hand groups can be encoded in 4 bits) using nanovec::NanoStackBit and nanovec::NanoArrayBit.

"W-Table": Single-suit, 3N+1, Waiting

Dependencies

~1.4–2MB
~40K SLoC