feat: auto cash-out targets, 1% house edge, terminal aesthetic

Auto cash-out closes a position at exactly the chosen target rather than
the next tick's multiplier, and fires whenever the target is at or below
the crash point. This is the feature that makes the game playable over a
network, where manual timing is at the mercy of latency.

House edge drops from 2% to 1% across crash and scratch. Scratch prize
tables retuned so the published 99% RTP is exact.

Adds docs/API.md: the client uses no private endpoints, so anyone can
write a bot against the same API.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
drjones
2026-08-05 16:24:31 +00:00
parent dee3becd47
commit 48a9120fe4
14 changed files with 997 additions and 266 deletions

View File

@@ -2,18 +2,41 @@ mode: set
github.com/drjones/quantum-arcade/pkg/fair/fair.go:37.33,39.45 2 1
github.com/drjones/quantum-arcade/pkg/fair/fair.go:39.45,42.63 1 0
github.com/drjones/quantum-arcade/pkg/fair/fair.go:44.2,44.10 1 1
github.com/drjones/quantum-arcade/pkg/fair/fair.go:48.49,48.76 1 0
github.com/drjones/quantum-arcade/pkg/fair/fair.go:48.49,48.76 1 1
github.com/drjones/quantum-arcade/pkg/fair/fair.go:51.38,51.52 1 1
github.com/drjones/quantum-arcade/pkg/fair/fair.go:54.34,54.71 1 0
github.com/drjones/quantum-arcade/pkg/fair/fair.go:54.34,54.71 1 1
github.com/drjones/quantum-arcade/pkg/fair/fair.go:57.43,57.75 1 1
github.com/drjones/quantum-arcade/pkg/fair/fair.go:62.66,65.2 2 1
github.com/drjones/quantum-arcade/pkg/fair/fair.go:70.44,72.29 2 1
github.com/drjones/quantum-arcade/pkg/fair/fair.go:72.29,79.3 4 1
github.com/drjones/quantum-arcade/pkg/fair/fair.go:80.2,82.12 3 1
github.com/drjones/quantum-arcade/pkg/fair/fair.go:88.75,97.2 8 1
github.com/drjones/quantum-arcade/pkg/fair/fair.go:110.74,115.29 4 0
github.com/drjones/quantum-arcade/pkg/fair/fair.go:115.29,117.3 1 0
github.com/drjones/quantum-arcade/pkg/fair/fair.go:118.2,126.3 2 0
github.com/drjones/quantum-arcade/pkg/fair/fair.go:110.74,115.29 4 1
github.com/drjones/quantum-arcade/pkg/fair/fair.go:115.29,117.3 1 1
github.com/drjones/quantum-arcade/pkg/fair/fair.go:118.2,126.3 2 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:41.40,46.2 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:49.69,51.16 2 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:51.16,53.3 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:54.2,55.43 2 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:55.43,56.67 1 0
github.com/drjones/quantum-arcade/pkg/identity/identity.go:59.2,66.38 5 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:71.70,73.16 2 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:73.16,75.3 1 0
github.com/drjones/quantum-arcade/pkg/identity/identity.go:76.2,77.53 2 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:77.53,79.3 1 0
github.com/drjones/quantum-arcade/pkg/identity/identity.go:81.2,84.8 4 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:84.8,86.3 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:87.2,90.33 3 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:90.33,92.3 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:93.2,93.42 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:93.42,95.3 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:96.2,96.12 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:100.39,102.33 2 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:102.33,103.27 1 0
github.com/drjones/quantum-arcade/pkg/identity/identity.go:103.27,105.4 1 0
github.com/drjones/quantum-arcade/pkg/identity/identity.go:110.58,112.51 2 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:112.51,114.3 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:115.2,115.34 1 1
github.com/drjones/quantum-arcade/pkg/fixed/fixed.go:34.25,35.30 1 1
github.com/drjones/quantum-arcade/pkg/fixed/fixed.go:35.30,36.87 1 1
github.com/drjones/quantum-arcade/pkg/fixed/fixed.go:38.2,38.25 1 1
@@ -55,29 +78,6 @@ github.com/drjones/quantum-arcade/pkg/fixed/fixed.go:129.2,129.10 1 1
github.com/drjones/quantum-arcade/pkg/fixed/fixed.go:132.27,134.17 2 1
github.com/drjones/quantum-arcade/pkg/fixed/fixed.go:134.17,136.3 1 1
github.com/drjones/quantum-arcade/pkg/fixed/fixed.go:137.2,137.10 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:41.40,46.2 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:49.69,51.16 2 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:51.16,53.3 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:54.2,55.43 2 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:55.43,56.67 1 0
github.com/drjones/quantum-arcade/pkg/identity/identity.go:59.2,66.38 5 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:71.70,73.16 2 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:73.16,75.3 1 0
github.com/drjones/quantum-arcade/pkg/identity/identity.go:76.2,77.53 2 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:77.53,79.3 1 0
github.com/drjones/quantum-arcade/pkg/identity/identity.go:81.2,84.8 4 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:84.8,86.3 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:87.2,90.33 3 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:90.33,92.3 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:93.2,93.42 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:93.42,95.3 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:96.2,96.12 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:100.39,102.33 2 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:102.33,103.27 1 0
github.com/drjones/quantum-arcade/pkg/identity/identity.go:103.27,105.4 1 0
github.com/drjones/quantum-arcade/pkg/identity/identity.go:110.58,112.51 2 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:112.51,114.3 1 1
github.com/drjones/quantum-arcade/pkg/identity/identity.go:115.2,115.34 1 1
github.com/drjones/quantum-arcade/pkg/sim/crash.go:25.30,25.69 1 1
github.com/drjones/quantum-arcade/pkg/sim/crash.go:36.40,59.24 7 1
github.com/drjones/quantum-arcade/pkg/sim/crash.go:59.24,61.3 1 0
@@ -109,6 +109,44 @@ github.com/drjones/quantum-arcade/pkg/sim/rng.go:47.35,53.2 5 1
github.com/drjones/quantum-arcade/pkg/sim/rng.go:56.31,67.2 10 1
github.com/drjones/quantum-arcade/pkg/sim/rng.go:69.36,69.73 1 1
github.com/drjones/quantum-arcade/pkg/sim/rng.go:73.30,75.2 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:66.34,68.31 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:68.31,70.3 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:71.2,71.24 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:71.24,74.3 1 0
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:75.2,75.12 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:79.34,81.31 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:81.31,88.22 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:88.22,90.4 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:91.3,91.27 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:93.2,93.13 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:98.41,100.31 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:100.31,102.3 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:103.2,103.28 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:107.62,114.31 4 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:114.31,116.24 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:116.24,118.9 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:122.2,129.3 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:142.60,144.23 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:144.23,146.3 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:147.2,152.38 3 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:152.38,155.26 3 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:155.26,158.4 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:162.2,162.23 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:162.23,163.21 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:163.21,164.12 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:166.3,167.57 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:167.57,168.43 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:168.43,170.13 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:172.4,172.38 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:172.38,174.13 2 0
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:176.4,176.9 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:178.3,179.17 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:181.2,181.14 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:221.37,222.28 1 0
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:222.28,223.17 1 0
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:223.17,225.4 1 0
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:227.2,227.24 1 0
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:233.122,237.2 3 1
github.com/drjones/quantum-arcade/pkg/room/room.go:103.67,113.2 1 1
github.com/drjones/quantum-arcade/pkg/room/room.go:118.54,124.20 5 1
github.com/drjones/quantum-arcade/pkg/room/room.go:124.20,129.3 4 1
@@ -189,44 +227,6 @@ github.com/drjones/quantum-arcade/pkg/room/room.go:427.3,427.31 1 1
github.com/drjones/quantum-arcade/pkg/room/room.go:430.2,441.50 2 1
github.com/drjones/quantum-arcade/pkg/room/room.go:441.50,444.3 2 1
github.com/drjones/quantum-arcade/pkg/room/room.go:445.2,445.10 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:66.34,68.31 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:68.31,70.3 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:71.2,71.24 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:71.24,74.3 1 0
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:75.2,75.12 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:79.34,81.31 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:81.31,88.22 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:88.22,90.4 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:91.3,91.27 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:93.2,93.13 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:98.41,100.31 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:100.31,102.3 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:103.2,103.28 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:107.62,114.31 4 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:114.31,116.24 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:116.24,118.9 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:122.2,129.3 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:142.60,144.23 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:144.23,146.3 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:147.2,152.38 3 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:152.38,155.26 3 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:155.26,158.4 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:162.2,162.23 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:162.23,163.21 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:163.21,164.12 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:166.3,167.57 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:167.57,168.43 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:168.43,170.13 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:172.4,172.38 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:172.38,174.13 2 0
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:176.4,176.9 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:178.3,179.17 2 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:181.2,181.14 1 1
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:221.37,222.28 1 0
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:222.28,223.17 1 0
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:223.17,225.4 1 0
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:227.2,227.24 1 0
github.com/drjones/quantum-arcade/pkg/scratch/scratch.go:233.122,237.2 3 1
github.com/drjones/quantum-arcade/pkg/ledger/ledger.go:50.38,50.68 1 1
github.com/drjones/quantum-arcade/pkg/ledger/ledger.go:57.108,58.24 1 1
github.com/drjones/quantum-arcade/pkg/ledger/ledger.go:58.24,60.3 1 0