A JavaScript UNO card game implementation with bot players, pluggable strategies, CLI simulation, and web UI.
Note
This project was vibe-coded largely over two hours in one sitting, on YouTube livestream
Play UNO in your browser with an interactive web interface.
# Install dependencies
npm install
# Start development server
npm run devThen open http://localhost:5173 in your browser.
# Build optimized production bundle
npm run build
# Preview production build
npm run previewThe production build outputs to dist/ with optimized assets (~55KB gzipped). The preview server runs on http://localhost:4173.
- Spectator Mode: Watch bots play automatically
- Human Player Mode: Play against bots with full UI interaction
- 2-6 Players: Configurable player count with flexible positioning
- Wild Card Selection: Color picker modal for wild cards
- Special Cards: Skip, Reverse, Draw Two/Four with visual indicators
- Animation Controls: Toggle between instant and smooth animations
- Game Statistics: Winner display and Play Again functionality
# Run all E2E tests
npm run test:e2e
# Run against production build
BASE_URL=http://localhost:4173 npm run test:e2eRun headless game simulations from the command line.
# Run a 2-player game
node simulate.js
# Run with 4 players
node simulate.js --players 4
# Verbose output showing each turn
node simulate.js --players 4 --verbose
# Run with multiple games
node simulate.js --count 10npm testsrc/game/- Core game logic (Card, Deck, Player, Game, Rules)src/strategies/- Bot AI strategies (BasicStrategy)src/report/- Game statistics and reportingsimulate.js- CLI entry pointtest/unit/- Unit tests for all componentstest/integration/- Full game simulation testsreports/- Generated JSON reports from simulations
Game Rules:
- 2-6 players, 7 cards dealt to each
- Match by color or value
- Action cards: Skip, Reverse, Draw Two, Wild, Wild Draw Four
- Stacking: +2 stacks on +2 only, +4 stacks on +4 only (no cross-stacking)
- Win by emptying your hand
Architecture:
- ES modules (Node.js)
- Strategy pattern for bot AI (easily extensible)
- Event-driven game loop for observability
- Automatic deck reshuffling when draw pile exhausted
- Full test coverage with Node.js built-in test runner
Reports:
Generated after each game in reports/report.json with:
- Turn count and duration
- Winner
- Per-player stats (cards played/drawn, UNOs called, action/wild cards played)
See rules.md for complete UNO rules including stacking mechanics and edge cases.