Quote the real price when a call exceeds the stack

Facing more than you have left is a call for your whole stack — commit() clamps
the commitment — so labelling it "Call 35" when only 20 can be paid promised a
price the player could neither make nor owed. It now reads "All in 20".

The ViewModel also submits the clamped amount rather than relying on the engine
to fix it up, so the action sent never disagrees with the label shown.

Verified by reverting: both new label tests fail.

Tests: 141 -> 144 (64 engine JVM, 64 Android host, 16 app).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jay
2026-07-25 21:53:25 -04:00
parent f0c8a7c430
commit 4f1ef45dd7
3 changed files with 62 additions and 2 deletions
@@ -153,7 +153,10 @@ class PokerViewModel : ViewModel() {
fun checkOrCall(token: Long) {
val o = offer.value ?: return
if (o.token != token) return
submit(token, if (o.canCheck) Action(ActionType.CHECK) else Action(ActionType.CALL, o.toCall))
// Send what the button promised. The engine would clamp an oversized call
// anyway, but the submitted action should not disagree with the label.
val cost = minOf(o.toCall, o.stack)
submit(token, if (o.canCheck) Action(ActionType.CHECK) else Action(ActionType.CALL, cost))
}
fun raiseTo(token: Long, amount: Int) = submit(token, Action(ActionType.RAISE, amount))