← PROJECTS / 01
LIVE

Texas 42

A server-authoritative build of the classic four-player domino trick game. You and your partner bid and play a hand against two AI opponents that can never see your dominoes, because the server never sends them.

1 · PLAYER INTENTCLIENT
socket.emit('action', {
type: 'PLAY_DOMINO',
domino: { t: 6, b: 4 },
})
2 · SERVER RESOLVESAUTHORITATIVE
Rules engine checks the play is legal
Correct turn, follows suit or trump, tile is actually in hand
Trick winner and points settle, hand ends the moment it's decided
handDecided() stops play once the bid is mathematically made or set
42
POINTS PER HAND
39
TEST CASES VITEST
3
AI OPPONENTS SERVER-SIDE
CLIENT
Personal project
PLATFORM
Fastify + Socket.IO server, React + Vite web client
ROLE
Designer + builder
TEAM
Solo
CLIENT
Read-only table
React renders a PlayerView; opponent hands are never sent to the browser
SERVER
GameRoom + rules engine
Fastify + Socket.IO holds the one GameState and runs all four seats
AI
Three heuristic seats
Bidding, trump, and play decided from the same public state a human sees
packages/engine is a pure, dependency-free rules engine with its own Vitest suite and a deterministic seeded RNG, so the rules can be tested without a server or a socket in the loop. packages/shared holds the WebSocket and REST contracts both sides agree to. apps/server wraps the engine in a GameRoom that runs all four seats, paces AI turns to feel human, and streams incremental events (bid placed, trick resolved, hand scored) to the client instead of just diffing state at the end.
Texas 42's bidding overlay mid-hand, showing Uncle Si and Willie's bids, the player's own legal-bid ladder up to 2 Marks, and the full seven-domino hand dealt to the player.
SCREENSHOT: BIDDING OVERLAY WITH LEGAL BIDS AND YOUR HAND

Getting the rules right was necessary but not sufficient. The engine originally played out all seven tricks of every hand even after the bidding team had mathematically already made or been set on their bid, which is correct but wastes the one moment a hand is actually decided. Fixing it meant writing a handDecided() check that has to treat a points bid and a mark bid differently: a points bid is set the instant the target becomes unreachable, a mark bid is set the instant the opponents take a single point, since a mark requires sweeping all 42.

The other two fixes that shipped alongside it were smaller but just as easy to miss during a single-player build: a select-then-confirm double tap on every domino that nobody wants once they're actually playing, and a Socket.IO path and asset base that only broke once the app moved off localhost and onto a subpath behind nginx.

Fastify + Socket.IO
server + game loop
React + Vite + Tailwind
web client
Zustand + Framer Motion
client state + table animation
TypeScript + Vitest
rules engine + tests
Need a real-time system that has to get the rules exactly right?
Thirty minutes, no pitch. We'll figure out where the trust boundary needs to sit.