jonnify·codemojex /codemojex/rooms-and-modes/the-emoji-set

Codemojex · C2.2

The emoji set.

An emoji set is a sprite sheet plus the subset of cells a room exposes. It is the keyboard a player taps — and it is the space the secret is drawn from. A code is XXYY: column, then row, two digits each, addressing one cell on the sheet exactly as the frontend renders it.

Grounding — Codemojex.EmojiSet (xy/1 · code/2 · bg_position/2) · priv/repo/seeds.exs · the emoji-codes story.

The code decoder — a code is column XX, then row YY
code
cell size
0 3 column XX 0 5 row YY a bijection — code/2 is the inverse of xy/1 keyboard (6×6)
0305 → column 3, row 5. bg_position at 144px = (-432, -720). code/2 is the inverse of xy/1.
§1

The code

emoji_set.ex

Column then row, two digits each. The pair round-trips, the whole grid expands row-major, and the pixel offset is (-x·cell_size, -y·cell_size) — the same arithmetic the frontend uses to place the cell.

iex · Codemojex.EmojiSet session
iex> Codemojex.EmojiSet.xy("0305")
{3, 5}
iex> Codemojex.EmojiSet.code(3, 5)
"0305"
iex> set = Codemojex.EmojiSet.new("demo", 6, 6, cell_size: 144)
iex> Codemojex.EmojiSet.bg_position(set, "0305")
{-432, -720}
iex> length(Codemojex.EmojiSet.all_cells(6, 6))
36
§2

The two seeded sheets

seeds.exs

The EMS set carries the sprite grid (cols, rows, cell_size, sprite_url) and the exposed codes — the full keyboard. The sheet is addressed by a plain sprite_url asset path, not a branded id. Two sets are seeded, each measured from the real PNG at cell size 72.

priv/repo/seeds.exs source
# grids measured from the PNGs under docs/codemojex/emoji-sets/
EmojiSet.new("emoji-set-01", 10, 15, cell_size: 72,
             sprite_url: "/emoji-sets/01-emoji-set.png")   # 720×1080 → 150 cells
EmojiSet.new("emoji-set-02", 10, 21, cell_size: 72,
             sprite_url: "/emoji-sets/02-emoji-set.png")   # 720×1512 → 210 cells
§3

The reduced golden subset

rooms.ex

A classic game snapshots the full keyboard. A golden game can shrink it: when the room sets cell_count: N, snapshot_cells/2 draws a fresh randomized N-cell subset, and the six-code secret is drawn only from that snapshot.

The keyboard the secret is drawn from — full, or a reduced snapshot
full keyboard 150 cells · emoji-set-01 secret drawn from every cell snapshot_cells(set, 24) reduced snapshot cell_count: 24 the six-code secret
full keyboard → with no cell_count, the game snapshots every cell — emoji-set-01’s 150. The six-code secret is drawn from the whole keyboard.

The player-facing snapshot/1 carries only the keyboard — codes, sprite_url, cell_size, cols, rows, count — and nothing the secret could be derived from.

§4

References

sources · related

Sources

Related