Veit F. bcb5465247 feat: implement foundational poker table with game engine and UI
Add complete Texas Hold'em poker gameplay including:
- Pure function game engine (deck, dealing, betting, showdown)
- Hand evaluator supporting all 10 poker hand ranks
- Animated card components with 3D flip transitions
- CSS Grid oval poker table layout for up to 9 seats
- Player seat components with chip tracking and turn indicators
- Bet controls with conditional button visibility
- Basic AI opponents with random valid action selection
- Turn advancement, all-in auto-advance, and dealer rotation

Sync delta specs to main specs: poker-table, card-components,
game-engine, player-state.
2026-05-17 17:28:38 +02:00

65 lines
3.0 KiB
Markdown

## ADDED Requirements
### Requirement: Player seat model
Each player seat SHALL be represented by a model containing: ID, name, chip count, current bet, status (active/folded/all-in), hole cards, and position index.
#### Scenario: Player initialized with starting stack
- **WHEN** a new game is created
- **THEN** each player seat has the configured starting chip count and active status
#### Scenario: Folded player marked correctly
- **WHEN** a player folds during a hand
- **THEN** their status changes to folded and they cannot take further actions that hand
#### Scenario: All-in player tracked separately
- **WHEN** a player bets all remaining chips
- **THEN** their status changes to all-in and they are excluded from further betting but remain active for showdown
### Requirement: Dealer position tracking
The game state SHALL track the current dealer button position as an index that rotates clockwise after each hand.
#### Scenario: Dealer starts at random position
- **WHEN** a new game session begins
- **THEN** the initial dealer position is set to a random seat index
#### Scenario: Dealer rotates clockwise
- **WHEN** a hand completes
- **THEN** the dealer position advances by one seat in clockwise order (wrapping from last seat to first)
### Requirement: Action history recording
The game state SHALL maintain an action history log for each hand, recording player actions with timestamps.
#### Scenario: Actions recorded during betting
- **WHEN** a player takes an action (check, call, raise, fold, all-in)
- **THEN** the action is appended to the current hand's action history with the player ID and action type
#### Scenario: History cleared between hands
- **WHEN** a new hand begins
- **THEN** the previous hand's action history is archived and a new empty history is created
### Requirement: Chip balance updates
Player chip counts SHALL be updated atomically when bets are placed, pots are awarded, or blinds are posted.
#### Scenario: Chips deducted on bet
- **WHEN** a player places a bet amount
- **THEN** their chip count decreases by the bet amount and the pot increases accordingly
#### Scenario: Chips awarded on win
- **WHEN** a player wins the pot
- **THEN** their chip count increases by the full pot amount and the pot resets to zero
#### Scenario: Blinds deducted automatically
- **WHEN** a new hand begins
- **THEN** the small blind amount is deducted from the small blind player's chips and the big blind amount from the big blind player's chips
### Requirement: Current turn tracking
The game state SHALL track which player ID has the current turn to act, enabling the UI to highlight the active player.
#### Scenario: Turn starts left of dealer pre-flop
- **WHEN** a hand begins dealing
- **THEN** the first action turn is assigned to the player one seat left of the dealer button (after big blind)
#### Scenario: Turn advances to next active player
- **WHEN** a player completes their action
- **THEN** the turn advances to the next active (non-folded, non-all-in) player in clockwise order