monico18/T21
T21 — a fast, terminal Blackjack game written in Zig with single-player logic, clean terminal UI, and cross-platform.
cfa6311448755cf18684c09697d20b7a7622e578T21 is a small terminal-based Blackjack (21) game written in Zig. It supports standard Blackjack gameplay and includes a split feature (you can split a pair into two hands). The UI uses the vaxis/vxfw terminal UI framework.
From the repository root:
# Build in debug mode (default)
zig build
Several release artifacts are published on GitHub Releases (example names):
T21-linux-<version>.debT21-macos-<version>.dmgT21-archlinux-<version>.tar.gz (contains PKGBUILD, README, LICENSE)Build from the repo and run the binary directly:
# build (from project root)
zig build
# run the built binary
./zig-out/bin/T21
Download the T21-archlinux-<version>.tar.gz from the Releases page, extract it and build with makepkg:
tar xzf T21-archlinux-<version>.tar.gz
cd T21-archlinux-<version>
# builds and installs the package (requires base-devel)
makepkg -si
Download T21-linux-<version>.deb from Releases and install with apt or dpkg:
# recommended (resolves deps):
sudo apt install ./T21-linux-<version>.deb
# or using dpkg directly:
sudo dpkg -i T21-linux-<version>.deb
sudo apt-get install -f # fix missing dependencies, if any
Download T21-macos-<version>.dmg, mount it and copy the T21 binary or app bundle to /Applications or run it in-place:
# mount the dmg (macOS)
hdiutil attach T21-macos-<version>.dmg
# after mounting, copy the app or binary from the mounted volume to /Applications
cp -R /Volumes/T21/T21.app /Applications/
# eject when done
hdiutil detach /Volumes/T21
Built packages and release archives are attached to the project's GitHub Releases for each release tag. Look for artifacts named T21-*-<version>* on the Releases page.
src/game/ — game model: hand.zig, player.zig, state.zig, rules.zig, deck.zig, card.zig.src/ui/ — UI screens and widgets (table.zig, results.zig, widgets/...).LICENSE — GNU General Public License v2 applied to the repository.There are a few unit tests for game logic in src/game (if present). Run them with:
zig test src/game
This project is licensed under the GNU General Public License v2 (GPLv2).
See the LICENSE file in the project root for the full text.
Add unit tests that assert per-hand outcomes for split scenarios (happy/edge cases).
Implement split-ace special rules (only one card dealt to each ace split by default).
Add color styling to the results screen (green for wins, red for losses).
Polish UI layout and accessibility (focus handling, on-screen help text).
Contributions welcome. Please open issues or pull requests. By contributing you agree to license your contribution under the project's GPLv2 license.