tBlackjack featured image

tBlackjack

Published on March 11, 2025

Terminal blackjack you can launch in seconds with a polished Ink UI and friendly table chatter.

NPM Version
NPM Downloads
GitHub Stars

πŸš€ What is tBlackjack?

tBlackjack started as a weekend experiment to see how far Ink and ink-playing-cards could push terminal UX, and it evolved into a blackjack table that feels at home in your shell. The game handles the full dealing loop, dealer AI, and table talk so players can fire it up with npx and jump straight into a round.

✨ Key Features

Core Gameplay

  • 🎴 Standard blackjack flow with soft-17 handling and ace scoring backed by evaluateHand.
  • ⚑️ Responsive Ink interface that adjusts cleanly across terminals thanks to modular components in src/components.
  • ♠️ Rich card rendering powered by ink-playing-cards, the card toolkit that inspired the project.

Table Feedback & Personality

  • πŸ’¬ Friendly status copy in DealerMessages explains what the dealer just didβ€”bust, blackjack, or soft stand.
  • πŸ—£οΈ GameStats adds subtle β€œthinking” indicators while the dealer plays so you’re never wondering why the action paused.
  • 🎬 Shuffle warnings fire automatically when the deck drops below 25% remaining (DECK_RESHUFFLE_THRESHOLD in Game.tsx).

Session Tracking

  • πŸ“Š GameStatisticsDisplay keeps running totals for wins, busts, blackjacks, and best hand value.
  • πŸ”„ Toggle the HUD with TAB to surface stats only when you want them.
  • πŸƒ Reset logic uses the shared DeckProvider so every new game starts fresh without manual shuffles.

Developer Ergonomics

  • 🧩 Components such as App, Game, and Welcome are split out for quick experimentation with new screens or controls.
  • πŸ§ͺ Snapshot coverage in src/test/app.test.tsx guards the Ink layout.
  • 🚚 Published as a CLI via src/cli.tsx so you can ship updates with npm.

🎯 Perfect For

  • Terminal tinkerers who want a casino-grade side quest during a build.
  • Ink developers exploring complex, stateful UIs without leaving the shell.
  • Teams demoing ink-playing-cards in a real game loop.
  • Streamers looking for an easy crowd-pleaser between pull requests.

βš™οΈ Quick Start

Bash
npx tblackjack

# or install globally
npm install -g tblackjack
tblackjack

πŸ“Š Impact & Proof

  • πŸ§ͺ Automated snapshots plus deterministic hand evaluation keep scoring predictable, even when the deck shoes get thin.
  • 🧰 Runs anywhere Node 18+ is available; exercised locally across macOS Terminal, iTerm2, and Hyper during development.
  • πŸ” Doubles as a living showcase for ink-playing-cards, so any improvement to the library lands here too.

Ready to take a seat? Fire up npx tblackjack, watch the dealer flip that first card, and let me know what feels missing.