Cribbage Daily
The Inspiration
I love Cribbage and daily puzzle games like Wordle. So I thought: what if everyone got the same Cribbage hand each day and competed to make the best discard?
Reddit's Devvit platform lets you build interactive games right in Reddit posts, making it perfect for a daily community challenge.
What I Learned
- Building on Reddit's Devvit: Creating web apps that run inside Reddit posts
- Cribbage Scoring: Implementing the complex rules (fifteens, runs, pairs, flushes, nobs)
- Pure CSS Cards: Drawing all 52 cards using only CSS since I couldn't host images
- TypeScript: Managing types across client and server code
- Daily Puzzles: Making sure everyone sees the same hand based on the date
How I Built It
The Core Parts
1. Card Display
- Cards are stored as simple strings like
"12d"(Queen of Diamonds) - CSS classes render each card visually
- Players click to select 2 cards to discard
2. Scoring Engine
The ScoreCalculator handles all Cribbage rules:
- Fifteens (cards that sum to 15)
- Runs (3+ consecutive cards)
- Pairs (matching ranks)
- Flushes (4-5 same suit)
- Nobs (Jack of starter suit)
3. Daily Hands Instead of random hands, I picked interesting "ambiguous" hands where the best discard isn't obvious. The date determines which hand everyone gets.
4. Architecture
- Client shows cards and handles clicks (TypeScript)
- Server calculates scores and tracks results (Devvit)
- Shared code defines the API between them
Challenges
Making It Work on Reddit Reddit's embedded view has limitations - no external images, restricted API access. I solved this with pure CSS cards and a clean client-server split.
Getting the Scoring Right Cribbage has subtle rules (like flushes scoring differently in the crib). I tested against online calculators and fixed edge cases.
TypeScript Setup Getting separate configs for client, server, and shared code took time but caught tons of bugs.
Fair Puzzles Everyone needs the same hand regardless of timezone. I use a curated list and pick based on day number, not random generation.
What's Next
- Global leaderboards for daily/weekly/monthly scores
- Stats tracking and streaks
- Show the optimal discard after you play
- Multiplayer Cribbage matches
Conclusion
This project proved that classic card games can thrive in modern social platforms. The best part? Seeing players debate strategy in the comments each day.
Built with Devvit, TypeScript, and lots of Cribbage
Log in or sign up for Devpost to join the conversation.