Make big numbers readable, and make the export add up #46

Merged
jheaps merged 1 commits from feature/casino-holdem-resilience into master 2026-09-01 09:30:03 -06:00
Owner

Seeded a table that looks like a real game — "Mike from work", "Jean-Philippe", stacks from $12 to $3,200,000 — and measured what the layout actually does with it. Stacked on #45.

".00" was costing a third of a seat puck

Every amount rendered with two forced decimal places. Measured, the trailing .00 is ~22px, against the 64px a seat puck has to show a stack in. So $1,250,000.00 needed 102px of a 64px box — and because a number has no spaces to break on, it neither wrapped nor ellipsised. It drew straight out over the seat next to it.

Money now shows cents only when there are cents. A chip game deals in whole numbers nearly all the time, and $12 says exactly what $12.00 said in half the width.

Before After
Tournament stack $1,250,000.00 (102px) $1,250,000 (80px)
Typical amount $450.00 (58px) $450 (36px)
Quarter-blind game $0.25 $0.25 — untouched

Checked against a live 25c/50c table: $12.25, $0.50 to call, $0.75 pot all read exactly as before, mixed with $15 where the amount is whole.

80px is still wider than the 64px puck, so long amounts step the font down — which keeps every digit. Abbreviating to $1.25M would have fit more comfortably and was the obvious move, but a dealer reading a rounded stack off the felt is a worse failure than a small one, and the exact figure is the entire point of the tool. Measured after: every stack paints inside its own puck, nothing spills onto a neighbour.

Because Money.format is the single formatter all 47 call sites go through, this lands on seat pucks, action bar, pot breakdown, seat menu, standings and history at once — the payoff from consolidating it in #43.

The CSV export couldn't be added up

The file exists so a house manager or a disputed chip count has something that outlives the tab. Every money column in it was written as text: "$1,250,000.00".

The commas were quoted correctly, so the file always parsed — it just imported as strings, so the one thing anyone opens it to do, total a column, needed every cell cleaned first.

Before:  1,"9/1/2026, 3:52 AM","$1,250,000.00","Alexandra: $1,250,000.00"
After:   1,"9/1/2026, 3:52 AM",1250000.00,"Alexandra: $1,250,000"

Money columns are bare numbers now — no symbol, no separators. The columns meant for humans stay human: names are still names, payouts still read like a sentence, and a name with a comma ("Smith, John") is still quoted properly.

Validation

12 new tests (88 total, all passing) — including the case that would be ruined by dropping cents unconditionally, and a quote-aware CSV parser to confirm every money cell parses as a number (my first version split on commas and tripped over the timestamp column, which legitimately contains one).

Playwright: tournament table at 390x844 measuring painted text width against each puck's box (0 spilling, 0 over-box, down from 4), a 25c/50c table to confirm cents survive, and the occlusion sweep from #45 re-run at 9 seats, 10 seats and tournament stacks — still clean, no regression from the font changes. No console errors.

Seeded a table that looks like a real game — "Mike from work", "Jean-Philippe", stacks from $12 to $3,200,000 — and measured what the layout actually does with it. Stacked on #45. ## ".00" was costing a third of a seat puck Every amount rendered with two forced decimal places. Measured, the trailing `.00` is **~22px**, against the **64px** a seat puck has to show a stack in. So `$1,250,000.00` needed **102px of a 64px box** — and because a number has no spaces to break on, it neither wrapped nor ellipsised. It drew straight out **over the seat next to it**. Money now shows cents only when there are cents. A chip game deals in whole numbers nearly all the time, and `$12` says exactly what `$12.00` said in half the width. | | Before | After | | --- | --- | --- | | Tournament stack | `$1,250,000.00` (102px) | `$1,250,000` (80px) | | Typical amount | `$450.00` (58px) | `$450` (36px) | | Quarter-blind game | `$0.25` | `$0.25` — untouched | Checked against a live 25c/50c table: `$12.25`, `$0.50` to call, `$0.75` pot all read exactly as before, mixed with `$15` where the amount is whole. 80px is still wider than the 64px puck, so long amounts step the font down — which keeps **every digit**. Abbreviating to `$1.25M` would have fit more comfortably and was the obvious move, but a dealer reading a *rounded* stack off the felt is a worse failure than a small one, and the exact figure is the entire point of the tool. Measured after: every stack paints inside its own puck, nothing spills onto a neighbour. Because `Money.format` is the single formatter all **47 call sites** go through, this lands on seat pucks, action bar, pot breakdown, seat menu, standings and history at once — the payoff from consolidating it in #43. ## The CSV export couldn't be added up The file exists so a house manager or a disputed chip count has something that outlives the tab. Every money column in it was written as **text**: `"$1,250,000.00"`. The commas were quoted correctly, so the file always *parsed* — it just imported as strings, so the one thing anyone opens it to do, total a column, needed every cell cleaned first. ``` Before: 1,"9/1/2026, 3:52 AM","$1,250,000.00","Alexandra: $1,250,000.00" After: 1,"9/1/2026, 3:52 AM",1250000.00,"Alexandra: $1,250,000" ``` Money columns are bare numbers now — no symbol, no separators. The columns meant for humans stay human: names are still names, payouts still read like a sentence, and a name with a comma (`"Smith, John"`) is still quoted properly. ## Validation 12 new tests (**88 total, all passing**) — including the case that would be ruined by dropping cents unconditionally, and a quote-aware CSV parser to confirm every money cell parses as a number (my first version split on commas and tripped over the timestamp column, which legitimately contains one). Playwright: tournament table at 390x844 measuring painted text width against each puck's box (0 spilling, 0 over-box, down from 4), a 25c/50c table to confirm cents survive, and the occlusion sweep from #45 re-run at 9 seats, 10 seats and tournament stacks — still clean, no regression from the font changes. No console errors.
jheaps changed target branch from feature/casino-holdem-messy-tables to master 2026-09-01 09:30:01 -06:00
jheaps added 1 commit 2026-09-01 09:30:01 -06:00
Seeded a table that looks like a real game — "Mike from work", "Jean-Philippe",
stacks from $12 to $3,200,000 — and measured what the layout does with it.

".00" was costing a third of a seat puck

Every amount rendered with two forced decimal places. Measured, the trailing
".00" is ~22px, against the 64px a seat puck has to show a stack in. So
"$1,250,000.00" needed 102px of a 64px box — and because a number has no spaces
to break on, it neither wrapped nor ellipsised. It drew straight out over the
seat next to it.

Money now shows cents only when there are cents. A chip game deals in whole
numbers nearly all the time, and "$12" says exactly what "$12.00" said in half
the width. A quarter-blind game is untouched: $0.25, $12.50 and $0.75 pots all
still read as before, checked against a 25c/50c table.

That alone took "$1,250,000.00" down to "$1,250,000" — 102px to 80px, still
wider than the 64px puck. The remaining overflow is handled by stepping the font
down on long amounts, which keeps every digit. Abbreviating to "$1.25M" would
have fit more comfortably and was the obvious move, but a dealer reading a
rounded stack off the felt is a worse failure than a small one, and the exact
figure is the entire point of the tool. Measured after: every stack now paints
inside its own puck, nothing spills onto a neighbour.

Because Money.format is the single formatter all 47 call sites go through, this
lands on the seat pucks, action bar, pot breakdown, seat menu, standings and
history at once — the payoff from consolidating it earlier.

The CSV export couldn't be added up

The file exists so a house manager or a disputed chip count has something that
outlives the tab, and every money column in it was written as text:
"$1,250,000.00". The commas were quoted correctly so the file always parsed —
it just imported as strings, so the one thing anyone opens it to do, total a
column, needed every cell cleaned first.

Money columns now go in as bare numbers (1250000.00) with no symbol and no
separators. The columns meant for humans stay human: names are still names,
payouts still read "Alexandra: $1,250,000", and a name with a comma in it is
still quoted.

12 new tests (88 total, all passing), including the case that would be ruined by
dropping cents unconditionally, and a proper quote-aware CSV parser to check
every money cell parses as a number.

Re-ran the occlusion sweep from the previous round at 9 seats, 10 seats and
tournament stacks: still clean, no regression from the font changes.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015bnp7xKUPFFSpwkYNFaPgb
jheaps merged commit f464e6f2e2 into master 2026-09-01 09:30:03 -06:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jheaps/JoshHeaps.Net#46