Skip to content

dalyanalytics/setback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

High, Low, Jack, Claude

A classic 4-point Setback (Pitch) card game built as an R Shiny app with family cookout AI personas.

The Game

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.

The Cookout

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

Current Status

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

Tech Stack

  • 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)

Running

shiny::runApp()

Project Structure

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

Built with Claude Code as a demonstration of AI-assisted game development. See build-log.md for the full development story.

Author

Jasmine Daly (@dalyanalytics)

About

Setback/Pitch Game for rainbowR 2026 Conference

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published