aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/types.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/casino/types.go')
-rw-r--r--internal/casino/types.go52
1 files changed, 49 insertions, 3 deletions
diff --git a/internal/casino/types.go b/internal/casino/types.go
index 1c4326a..c28b471 100644
--- a/internal/casino/types.go
+++ b/internal/casino/types.go
@@ -5,6 +5,7 @@ type GameName string
const (
GameSlots GameName = "slots"
GameBlackjack GameName = "blackjack"
+ GameBaccarat GameName = "baccarat"
)
type BlackjackConfig struct {
@@ -60,6 +61,32 @@ func (c BlackjackConfig) Normalize() BlackjackConfig {
return c
}
+// BaccaratConfig holds punto banco house rules: shoe composition and payout
+// multipliers. Banker wins pay BankerPayout:1 (a 5% commission game is 0.95);
+// tie wins pay TiePayout:1.
+type BaccaratConfig struct {
+ Decks int `yaml:"decks,omitempty"`
+ ShuffleAt float64 `yaml:"shuffle_at,omitempty"`
+ TiePayout float64 `yaml:"tie_payout,omitempty"`
+ BankerPayout float64 `yaml:"banker_payout,omitempty"`
+}
+
+func (c BaccaratConfig) Normalize() BaccaratConfig {
+ if c.Decks <= 0 {
+ c.Decks = 8
+ }
+ if c.ShuffleAt <= 0 || c.ShuffleAt >= 1 {
+ c.ShuffleAt = 0.25
+ }
+ if c.TiePayout <= 0 {
+ c.TiePayout = 8
+ }
+ if c.BankerPayout <= 0 {
+ c.BankerPayout = 0.95
+ }
+ return c
+}
+
type TableConfig struct {
ID string `yaml:"id"`
Game GameName `yaml:"game"`
@@ -68,6 +95,7 @@ type TableConfig struct {
MinBet int `yaml:"min_bet,omitempty"`
MaxBet int `yaml:"max_bet,omitempty"`
Blackjack BlackjackConfig `yaml:"blackjack,omitempty"`
+ Baccarat BaccaratConfig `yaml:"baccarat,omitempty"`
}
type MachineConfig struct {
@@ -146,6 +174,7 @@ const (
MenuSlotCommands MenuKind = "slot_commands"
MenuBlackjackBet MenuKind = "blackjack_bet"
MenuBlackjackTurn MenuKind = "blackjack_turn"
+ MenuBaccaratBet MenuKind = "baccarat_bet"
)
// MenuView carries a structured menu alongside its plain-text Message so the
@@ -170,6 +199,7 @@ type Event struct {
Public bool
Slot *SlotSnapshot
Blackjack *BlackjackSnapshot
+ Baccarat *BaccaratSnapshot
Menu *MenuView
}
@@ -178,7 +208,8 @@ type SlotSnapshot struct {
StoppedReels int
}
-type BlackjackCardView struct {
+// CardView renders one card for any card-based table game.
+type CardView struct {
Rank string
Suit string
Hidden bool
@@ -186,18 +217,33 @@ type BlackjackCardView struct {
type BlackjackPlayerView struct {
Name string
- Cards []BlackjackCardView
+ Cards []CardView
Score string
}
type BlackjackSnapshot struct {
- Dealer []BlackjackCardView
+ Dealer []CardView
DealerShownScore string
DealerScore string
DealerRevealed bool
Players []BlackjackPlayerView
}
+// BaccaratBetView lists one participant's wager on a baccarat outcome.
+type BaccaratBetView struct {
+ Name string
+ Spot string
+ Amount int
+}
+
+type BaccaratSnapshot struct {
+ Player []CardView
+ Banker []CardView
+ PlayerScore string
+ BankerScore string
+ Bets []BaccaratBetView
+}
+
type Participant struct {
Name string
Connected bool