aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/slots.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/casino/slots.go')
-rw-r--r--internal/casino/slots.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/casino/slots.go b/internal/casino/slots.go
index aba8f91..c519293 100644
--- a/internal/casino/slots.go
+++ b/internal/casino/slots.go
@@ -234,10 +234,15 @@ func ScaleToRTP(profile SlotProfile, target float64) SlotProfile {
return profile
}
scale := target / actual
+ // SlotProfile is a value API, but its slice and paytable maps are shared
+ // references. Clone both so tuning one machine cannot retune another.
+ profile.Symbols = append([]SlotSymbol(nil), profile.Symbols...)
for i := range profile.Symbols {
+ payouts := make(map[int]float64, len(profile.Symbols[i].Payout))
for length, payout := range profile.Symbols[i].Payout {
- profile.Symbols[i].Payout[length] = payout * scale
+ payouts[length] = payout * scale
}
+ profile.Symbols[i].Payout = payouts
}
profile.TargetRTP = target
return profile