aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/plinko.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/casino/plinko.go')
-rw-r--r--internal/casino/plinko.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/casino/plinko.go b/internal/casino/plinko.go
index 867978a..bcfae83 100644
--- a/internal/casino/plinko.go
+++ b/internal/casino/plinko.go
@@ -29,6 +29,12 @@ func validatePlinko(c TableConfig) error {
if math.IsNaN(r) || math.IsInf(r, 0) || r < 31 || r > 100 {
return fmt.Errorf("plinko rtp must be between 31 and 100 percent")
}
+ // The one-decimal paytable rounding can push the realized expert return
+ // above 100%. Reject any target whose expert paytable pays more than it
+ // takes, so the house never runs a losing plinko board.
+ if ret := plinkoReturn(3, r); ret > 1.0 {
+ return fmt.Errorf("plinko rtp %.1f makes the expert paytable return %.3f%%; lower it", r, 100*ret)
+ }
if c.MaxPlayers > 1 {
return fmt.Errorf("plinko has one seat")
}