blackjack

package
v0.0.0-...-b977382 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BetModifier float64 = 1.5
	Hearts      Suit    = "Hearts"
	Spades      Suit    = "Spades"
	Diamonds    Suit    = "Diamonds"
	Clubs       Suit    = "Clubs"

	PlayerBust Result = "Player Bust"
	Under      Result = "Under"
	Blackjack  Result = "Player Blackjack"

	DealerWin  Status = "Dealer Win"
	PlayerWin  Status = "Player win"
	Draw       Status = "Draw"
	InProgress Status = "In-Progress"

	Ace   Rank = "Ace"
	Two   Rank = "Two"
	Three Rank = "Three"
	Four  Rank = "Four"
	Five  Rank = "Five"
	Six   Rank = "Six"
	Seven Rank = "Seven"
	Eight Rank = "Eight"
	Nine  Rank = "Nine"
	Ten   Rank = "Ten"
	Jack  Rank = "Jack"
	Queen Rank = "Queen"
	King  Rank = "King"
)

Variables

This section is empty.

Functions

func HandleBlackJack

func HandleBlackJack(s *discordgo.Session, m *discordgo.MessageCreate)

Types

type Action

type Action struct {
	Action PlayOption
	Result Result
	Status Status
}

type Card

type Card struct {
	Rank    Rank
	Suit    Suit
	Points  int
	Visible bool
}

type GameState

type GameState struct {
	PlayerId   string
	Deck       []Card
	DealerHand []Card
	PlayerHand []Card
	Pot        int
	Status     Status
}

func LoadOrCreateGameState

func LoadOrCreateGameState(playerId string) GameState

func SetupNewGame

func SetupNewGame(playerId string) GameState

func StartGame

func StartGame(playerId string) GameState

type PlayOption

type PlayOption string
const (
	Bet   PlayOption = "bet"
	Hit   PlayOption = "hit"
	Stand PlayOption = "stand"
)

Blackjack possible arguments

type Rank

type Rank string

type Result

type Result string

type Status

type Status string

func PlayTurn

func PlayTurn(actionStr string, game *GameState) (Status, error)

type Suit

type Suit string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL