1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
package casino
import (
"fmt"
"strings"
)
// VideoPokerConfig is the authored cabinet/payout pair plus the rest of the
// cabinet settings. Cabinet and Payout are authored settings; the remaining
// fields identify the selected game and its resolved schedule; schedules are
// never separate games.
type VideoPokerConfig struct {
Cabinet string `yaml:"cabinet,omitempty"`
Payout string `yaml:"payout,omitempty"`
Variant string `yaml:"-"`
PayTable string `yaml:"-"`
Feature string `yaml:"-"`
}
const (
CabinetClassic = "classic"
CabinetUXSingle = "ultimate_x_single"
CabinetUXMulti = "ultimate_x_multi"
CabinetSuperTimesPay = "super_times_pay"
CabinetHotRoll = "hot_roll"
)
func cabinetFeature(c string) string {
switch c {
case CabinetUXSingle, CabinetUXMulti:
return PokerUltimateX
case CabinetSuperTimesPay:
return PokerSuperTimesPay
case CabinetHotRoll:
return PokerHotRoll
}
return ""
}
var cabinetVariantAliases = map[string]string{
"jacks": "jacks_or_better", "jacks_or_better": "jacks_or_better", "jacks or better": "jacks_or_better",
"bonus": "bonus_poker", "bonus_poker": "bonus_poker", "bonus poker": "bonus_poker",
"deluxe": "bonus_poker_deluxe", "bonus_poker_deluxe": "bonus_poker_deluxe", "bonus poker deluxe": "bonus_poker_deluxe",
"double": "double_bonus", "double_bonus": "double_bonus", "double bonus": "double_bonus",
"ddb": "double_double_bonus", "double_double_bonus": "double_double_bonus", "double double bonus": "double_double_bonus",
"deuces": "deuces_wild", "deuces_wild": "deuces_wild", "deuces wild": "deuces_wild",
"joker": "joker_poker", "joker_poker": "joker_poker", "joker poker": "joker_poker",
}
var cabinetGames = map[string][]string{
CabinetClassic: {"jacks_or_better", "bonus_poker", "bonus_poker_deluxe", "double_bonus", "double_double_bonus", "deuces_wild", "joker_poker"},
CabinetUXSingle: {"jacks_or_better", "bonus_poker", "bonus_poker_deluxe", "double_bonus", "double_double_bonus", "deuces_wild", "joker_poker"},
// Bonus Poker has only two verified multi-line schedules; omit rather than
// inventing a third quality tier.
CabinetUXMulti: {"jacks_or_better", "bonus_poker_deluxe", "double_bonus", "double_double_bonus", "deuces_wild", "joker_poker"},
CabinetSuperTimesPay: {"jacks_or_better", "bonus_poker", "double_bonus", "double_double_bonus", "deuces_wild"},
CabinetHotRoll: {"jacks_or_better", "double_double_bonus"},
}
// Each tuple is low, normal, full. These are named published schedules, not
// interpolated payouts. Full means the highest offered on this cabinet, not
// a promise of identical RTP across games.
var cabinetSchedules = map[string]map[string][3]string{
CabinetClassic: {
"jacks_or_better": {"7/5", "8/5", "9/6"},
"bonus_poker": {"6/5", "7/5", "8/5"},
"bonus_poker_deluxe": {"8/5", "9/5", "9/6"},
"double_bonus": {"9/6/4", "9/7", "10/7"},
"double_double_bonus": {"8/5", "9/6", "10/6"},
"deuces_wild": {"20/12/10/4/4/3", "25/15/9/4/4/3", "25/15/9/5/3/2"},
"joker_poker": {"50/15/7/5/3", "50/16/7/5/3", "50/17/7/5/3"},
},
CabinetUXSingle: {
"jacks_or_better": {"8/5", "8/6", "9/6"},
"bonus_poker": {"6/5", "7/5", "8/5"},
"bonus_poker_deluxe": {"8/5", "8/6", "9/6"},
"double_bonus": {"9/6/4", "9/6/5", "9/7"},
"double_double_bonus": {"8/5", "9/5", "9/6"},
"deuces_wild": {"25/16/13/4/3/2", "20/12/10/4/4/3", "25/15/9/4/4/3"},
"joker_poker": {"50/15/7/5/3", "50/16/7/5/3", "50/17/7/5/3"},
},
CabinetUXMulti: {
"jacks_or_better": {"7/5", "8/5", "8/6"},
"bonus_poker_deluxe": {"7/5", "8/5", "8/6"},
"double_bonus": {"9/5/4", "9/6/4", "9/6/5"},
"double_double_bonus": {"8/5", "9/5", "9/6"},
"deuces_wild": {"25/16/13/4/3/2", "20/12/10/4/4/3", "25/15/9/4/4/3"},
"joker_poker": {"50/15/7/5/3", "50/16/7/5/3", "50/17/7/5/3"},
},
CabinetSuperTimesPay: {
"jacks_or_better": {"7/5", "8/5", "9/6"},
"bonus_poker": {"6/5", "7/5", "8/5"},
"double_bonus": {"9/6/4", "9/6/5", "9/7"},
"double_double_bonus": {"8/5", "8/6", "9/6"},
"deuces_wild": {"20/12/10/4/4/3", "25/15/9/4/4/3", "25/15/9/5/3/2"},
},
CabinetHotRoll: {
"jacks_or_better": {"8/5", "9/5", "9/6"},
"double_double_bonus": {"8/5", "9/5", "9/6"},
},
}
func CabinetHandCounts(cabinet, variant string) []int {
switch cabinet {
case CabinetUXSingle:
return []int{1}
case CabinetUXMulti, CabinetHotRoll:
return []int{3, 5, 10}
case CabinetSuperTimesPay:
return []int{1, 3, 5, 10}
}
if variant == "jacks_or_better" {
return []int{1, 3, 5, 10, 25, 50, 100}
}
return []int{1}
}
func variantTitle(v string) string {
switch v {
case "jacks_or_better":
return "Jacks or Better"
case "bonus_poker":
return "Bonus Poker"
case "bonus_poker_deluxe":
return "Bonus Poker Deluxe"
case "double_bonus":
return "Double Bonus"
case "double_double_bonus":
return "Double Double Bonus"
case "deuces_wild":
return "Deuces Wild"
case "joker_poker":
return "Joker Poker (Kings or Better)"
}
return v
}
func (c VideoPokerConfig) CabinetName() string {
c = c.Normalize()
switch c.Cabinet {
case CabinetUXSingle:
return "Ultimate X Single Line"
case CabinetUXMulti:
return "Ultimate X Multi-Hand"
case CabinetSuperTimesPay:
return "Super Times Pay"
case CabinetHotRoll:
return "Hot Roll"
}
return "Classic Video Poker"
}
// CabinetAliases lists the single-token names that address this cabinet type
// in the play menu, beyond the room's own table id. "video poker" itself means
// the classic cabinet so a lone lounge stays reachable without a specific
// machine name.
func (c VideoPokerConfig) CabinetAliases() []string {
switch c.Normalize().Cabinet {
case CabinetUXSingle:
return []string{"ux", "ultimate_x", "ultimate_x_single"}
case CabinetUXMulti:
return []string{"uxm", "ultimate_x_multi", "ultimate_x_multi_hand"}
case CabinetSuperTimesPay:
return []string{"stp", "super_times", "super_times_pay"}
case CabinetHotRoll:
return []string{"hr", "hot_roll"}
}
return []string{"vp", "poker", "classic", "video_poker"}
}
func (c VideoPokerConfig) CabinetLabel() string {
c = c.Normalize()
return c.CabinetName() + " / " + c.Payout + " pay"
}
func (c VideoPokerConfig) Normalize() VideoPokerConfig {
if c.Cabinet == "" {
c.Cabinet = CabinetClassic
}
if c.Payout == "" {
c.Payout = "full"
}
if c.Variant == "" {
c.Variant = "jacks_or_better"
}
if alias, ok := cabinetVariantAliases[c.Variant]; ok {
c.Variant = alias
}
c.Feature = cabinetFeature(c.Cabinet)
ix := -1
switch c.Payout {
case "low":
ix = 0
case "normal":
ix = 1
case "full":
ix = 2
}
// Explicit schedules are used by evaluator tests. Authored configurations
// and game selection always resolve from the cabinet-wide tier.
if c.PayTable == "" && ix >= 0 {
if schedules, ok := cabinetSchedules[c.Cabinet][c.Variant]; ok {
c.PayTable = schedules[ix]
}
}
return c
}
func (c VideoPokerConfig) Validate() error {
rawFeature := c.Feature
c = c.Normalize()
if _, ok := cabinetGames[c.Cabinet]; !ok {
return fmt.Errorf("unknown video poker cabinet %q", c.Cabinet)
}
if rawFeature != "" && rawFeature != c.Feature {
return fmt.Errorf("video poker feature does not match cabinet")
}
if c.Payout != "low" && c.Payout != "normal" && c.Payout != "full" {
return fmt.Errorf("video poker payout must be low, normal or full")
}
schedules, ok := cabinetSchedules[c.Cabinet][c.Variant]
if !ok {
return fmt.Errorf("unsupported game %q on %s", c.Variant, c.Cabinet)
}
expected := (VideoPokerConfig{Cabinet: c.Cabinet, Payout: c.Payout, Variant: c.Variant}).Normalize()
if c.PayTable != expected.PayTable {
return fmt.Errorf("schedule %q does not match cabinet tier (%v)", c.PayTable, schedules)
}
if _, ok := pokerPayTable(c); !ok {
return fmt.Errorf("unsupported schedule %q", c.PayTable)
}
return nil
}
func (c VideoPokerConfig) VariantOptions() []string {
return append([]string(nil), cabinetGames[c.Normalize().Cabinet]...)
}
func (c VideoPokerConfig) GameLabel() string {
c = c.Normalize()
return variantTitle(c.Variant) + " / " + c.PayTable
}
func (c VideoPokerConfig) GameChoices() string { return strings.Join(c.VariantOptions(), ", ") }
type PokerPayRow struct {
Name string
Coins [5]int
NextAward int
}
|