A classic 4-point Setback (Pitch) card game built as an R Shiny app with family cookout AI personas.
Setback is a trick-taking card game played in 2v2 partnerships. Each hand has four points up for grabs:
- High - Highest claude card played
- Low - Lowest claude card played
- Jack - Who captures the Jack of claude
- Game - Highest card-point total from tricks won (A=4, K=3, Q=2, J=1, 10=10)
Players bid for the right to name claude (the suit), then play 6 tricks. Miss your bid and you get "set back." First team to 11 wins.
Your opponents aren't just algorithms - they're family:
- Uncle Earl (West) - Loud, proud, and convinced he's the best card player at the table
- Auntie Dee (North, your partner) - Your hype woman who celebrates every good play
- Cousin Ray (East) - Barely says a word, but when he does, it stings
Phases 1-5 complete: full game logic, AI opponents, CSS card rendering, and interactive click-based gameplay. 184 tests passing.
- Sidebar scoring breakdown shows exactly how H/L/J/G points are counted after each hand
- AI protects 10-value cards (worth 10 game points - huge for the Game point)
- Family personas react with context-sensitive dialogue throughout play
- R Shiny - Game UI and reactive state management
- bslib - Dark theme with Bootstrap 5
- Pure CSS - Card rendering with Unicode suits (no image dependencies)
- JS setTimeout - Precise AI turn timing (no polling)
shiny::runApp()setback/
app.R # Main Shiny app - UI + server (~470 lines)
R/
game_engine.R # Deck, dealing, trick resolution
bidding.R # Auction bidding with dealer-match
scoring.R # H/L/J/G scoring with setback penalties
game_state.R # State machine (deal->bid->pitch->play->score)
ai_strategy.R # AI bidding + card play with 10-card protection
ai_personas.R # Uncle Earl, Auntie Dee, Cousin Ray dialogue
ui_helpers.R # HTML generation for cards, scoreboard, log
www/
cards.css # Pure CSS card rendering
game.css # Table layout, sidebar, animations
game.js # Click handlers, AI delay, trick animations
tests/
test_game_engine.R # 61 tests
test_bidding.R # 46 tests
test_scoring.R # 37 tests
test_ai_strategy.R # 40 tests
Built with Claude Code as a demonstration of AI-assisted game development. See build-log.md for the full development story.
Jasmine Daly (@dalyanalytics)