Expand description
Domain logic types and helpers.
Structs§
- Available
Game - A game that is visible in the public lobby and can be joined. These only get created with respect to a given user, i.e. they are “available” to that user. Either the user is the host, or participating in the game, or they can join as a guest.
- Card
- A playing card consisting of a
Faceand aSuit. - Dealer
- Represents the dealer player in a two-player game.
- Discarding
- Represents the game state during the discarding phase, where players select cards to contribute to the crib.
- Finished
- Represents the terminal state of a completed game.
- Game
- Represents a game with a host, optional guest (i.e. no one has joined and game is deemed to be in the lobby), name, and current state.
- GameId
- Unique identifier for a game instance.
- Game
Services - No external services required.
- Pegging
- Represents pegging information for a specific player during scoring.
- Pending
- Represents players who are to acknowledge the current game phase before the game can proceed to the next phase.
- Play
- Represents a single play in the pegging phase of the game.
- Play
State - Represents the current state of play during the pegging phase.
- Player
- Represents a player in the game.
- Playing
- Represents the state of a game during the playing phase.
- Points
- Represents a point value in the game.
- Pone
- Represents the pone (non-dealer) player in a two-player game.
- Position
- Represents a player’s position in the game.
- Rank
- A card rank used for ordering/comparison.
- Roles
- Represents the roles assigned to players in a round.
- Score
Item - Represents a single scoring event in the game.
- Score
Sheet - A collection of scoring items accumulated for a hand, crib, or play phase.
- Scoreboard
- Represents the scoreboard.
- Starting
- Represents the state of the game during the starting phase, before the deal is assigned and initial hands are dealt.
- UserId
- Identifier for a user/account.
- Value
- Point value of a card.
Enums§
- Availability
- How a game appears in the public lobby / matchmaking pool.
- Cards
Error - Errors that occur when manipulating cards in piles, hands, crib, etc.
- Domain
Error - Domain-specific errors that represent invalid game actions.
- Face
- The face of a playing card (Ace through King).
- Game
Command - Commands that drive the game state machine.
- Game
Event - Domain events which represent the single source of truth for game history and are persisted in the event store. The current game state is derived by folding them in order.
- GoStatus
- Represents the status of a “go” during pegging.
- Phase
- Current phase of the Cribbage game.
- Score
Kind - Represents the kind of scoring event that occurred during play.
- Score
Phase - Represents the distinct phases of the game.
- Suit
- The four suits in a standard French playing card deck.
Constants§
- PLAYER0
- The first player (index 0).
- PLAYER1
- The second player (index 1).
- PLAYERS
- An array of all players in the game.
Traits§
- HasCrib
- Trait for game states that contain a crib.
- HasCuts
ForDeal - Trait for game states that track the “cut for deal” phase.
- HasDeck
- The main draw pile / stock.
- HasHands
- Trait for game states that have player hands.
- HasPegging
- Trait for types that contain pegging information.
- HasPending
- Trait for game states that track player acknowledgments.
- HasPlay
State - Trait for types that expose a
PlayState. - HasRoles
- Trait for types that contain player roles.
- HasScoreboard
- Trait for types that expose a
Scoreboard. - HasStarter
Cut - Trait for game states that have a starter card.
Type Aliases§
- Crib
- The crib is the special pile of cards discarded cards that belongs to the dealer and is scored at the end of the pegging phase.
- Cuts
ForDeal - The two cards cut by the players to determine who deals first.
- Deck
- The deck contains all cards at the start of the game and is drawn from during dealing and for the starter cut.
- Hand
- A hand is the set of cards a player holds privately during play. 6 cards dealt then 4 after discarding to the crib.
- Hands
- Fixed-size array holding all players’ hands.
- Positions
- Represents the positions of both players in the game.
- Scoring
Crib - A strongly typed alias for scoring operations related to the crib.
- Scoring
Dealer - A strongly typed alias for scoring operations associated with the dealer.
- Scoring
Pone - A strongly typed alias for scoring operations associated with the pone.
- Starter
Cut - The card turned up after the deal as the “starter”.