@cardgamesplay/sixty-six
v0.1.0
Published
Browser-based Sixty-Six card game in TypeScript with smart AI, i18n, and responsive UI.
Maintainers
Readme
@cardgamesplay/sixty-six
A browser-based Sixty-Six card game built with TypeScript, Vite, and vanilla DOM. It includes full game rules (marriages, trump exchange, stock closing), multiple AI levels, responsive UI, synthesised audio, and internationalisation support for 16 languages.
🎮 Play the live demo at cardgamesplay.com
Features
- Full Sixty-Six gameplay loop with trick-taking, trump suit, stock drawing, and deal/match progression
- Complete special actions: declare marriage, exchange trump nine, and close stock
- Deal scoring logic for reached-66, all-cards-played, and closer-failed outcomes
- Match formats: best of 1, best of 3, best of 5, and infinite
- Three AI difficulties: easy, medium, and expert
- Responsive game board with card animations and trick area transitions
- Scoreboard with card points, game points, and match wins
- Settings panel with difficulty, match format, and player/bot naming
- Pause and fullscreen support
- Synthesised sound effects via Web Audio API (no external SFX files)
- SVG card rendering with Unicode/CSS fallback when SVG assets are unavailable
- Internationalisation (i18n) for 16 locales with RTL support for Arabic
- Language selector with localStorage persistence and cross-tab language sync
- Console play utility for local AI/manual debugging
- Auto-play simulation script for AI-vs-AI analysis
Project Structure
├── src/
│ ├── index.ts # App bootstrap and game wiring
│ ├── base.css # Shared game styles
│ ├── game/
│ │ ├── types.ts # Core types, constants, and interfaces
│ │ ├── deck.ts # 24-card deck creation + shuffle
│ │ ├── gameEngine.ts # Core rules, legal moves, trick/deal/match flow
│ │ ├── ai.ts # Easy/Medium/Expert move strategies
│ │ ├── scoring.ts # Deal game-point scoring helpers
│ │ └── *.test.ts # Unit + property-based tests
│ ├── ui/
│ │ ├── renderer.ts # DOM renderer + animations + responsive layout
│ │ ├── scoreboard.ts # Scoreboard updates and match status display
│ │ ├── settingsPanel.ts # Settings modal and local persistence
│ │ ├── langSelector.ts # Header language selector component
│ │ ├── audio.ts # Synthesised Web Audio effects
│ │ └── *.test.ts # UI tests
│ └── i18n/
│ ├── index.ts # Locale registry, switching, DOM application
│ ├── en.ts # Canonical locale shape
│ └── {bg,de,es,fr,hi,it,ja,ko,pl,pt,ru,tr,vi,zh,ar}.ts
├── index.html # Standalone dev shell
├── dev-entry.ts # Dev entry imports
├── dev.css # Dev-only style additions
├── console-sixty-six.mjs # Terminal-based runner for gameplay testing
├── autoplay-sixty-six.mjs # AI-vs-AI auto-play simulation
├── vite.config.ts # Vite config
├── vitest.config.ts # Vitest config (happy-dom)
├── tsconfig.json # TypeScript config (dev)
├── tsconfig.build.json # TypeScript config (build/declarations)
└── package.jsonGetting Started
Prerequisites
- Node.js >= 18
- npm (or compatible package manager)
Install
npm installDevelopment
npm run devStarts a Vite dev server and runs the standalone shell at index.html.
Build
npm run buildBuilds TypeScript declarations and bundles the library output into dist/.
Test
npm testRuns Vitest suites with happy-dom, including engine, AI, scoring, i18n, audio, renderer, and settings tests.
Script Reference
npm run dev: start local development servernpm run build: compile declarations and bundle ESM outputnpm run test: run all testsnpm run console:play: run CLI-based Sixty-Six in Node.js
Optional simulation utility:
node autoplay-sixty-six.mjsGame Rules (Sixty-Six)
- The game uses a 24-card deck (9, J, Q, K, 10, A in each suit).
- Each player is dealt 6 cards in two rounds of 3 cards.
- The next card is turned face-up as trump; remaining cards form the stock.
- Lead and follow cards determine trick winner by suit/trump and rank order.
- Card points are counted by trick captures; first to 66 card points wins the deal.
- A marriage (King + Queen of same suit) can be declared when leading for bonus points.
- The trump nine can be exchanged with the face-up trump card under legal conditions.
- The stock may be closed strategically, forcing stricter follow rules.
- Deal game points are awarded based on loser points/tricks and close-stock outcomes.
Internationalisation
The UI supports 16 locales:
- English (
en) - Bulgarian (
bg) - Spanish (
es) - French (
fr) - German (
de) - Italian (
it) - Portuguese (
pt) - Russian (
ru) - Chinese (
zh) - Japanese (
ja) - Korean (
ko) - Arabic (
ar, RTL) - Hindi (
hi) - Vietnamese (
vi) - Polish (
pl) - Turkish (
tr)
Language preference is persisted via localStorage and synchronized across tabs.
npm Package
Package name: @cardgamesplay/sixty-six
npm publish --access publicThe package is configured with npm discoverability metadata (keywords, homepage, repository, bugs URL, and Node engine requirements).
Links
License
Licensed under the MIT License.
