Welcome to the team that runs the community pooled cash drawing. CodeIssuer assigns 5-digit entry codes and scores positional matches against the winning code; payouts.distribute splits the pot by match-count tiers. All…
Welcome to the team that runs the community pooled cash drawing. CodeIssuer assigns 5-digit entry codes and scores positional matches against the winning code; payouts.distribute splits the pot by match-count tiers. All money is integer cents.
There are two tickets below. Fix as many as you can in 35 minutes. Each ticket is checked separately, so a fully fixed ticket counts even if the other one is not done.
"00042", 0 is "00000").Two problems with entry codes have been reported. Codes render without zero padding ("42" instead of "00042"), so "00000" cannot even be represented. And match counting compares the set of digits rather than their positions, so unrelated codes score as near-winners.
"54321" vs "12345") counts as one match.Do not change the payout distribution as part of this ticket.
The pot is paying out more than it holds. Every tier is paid independently, so a jackpot (5-match) winner does not consume the pot, and tier splits silently drop remainder cents.
Do not change code generation or match scoring as part of this ticket.
codes.py (CodeIssuer with issue and match_count, and the Entry type) and payouts.py (pot_cents and distribute). The shipped regression tests are in tests/visible/; every one of them fails until the bugs are fixed.pytest tests/visible.Adapted from treasure567/bloomberg-practice (round-1/halcyon @ 8de07d5), used with the author's permission.
Visible test command
pytest tests/visibleThe repository’s own tests. Run all tests includes them, and so does every submission.
Repository
pooled-draw-codes-and-payouts
Changes under src/ are evaluated.