HyperToken¶
HyperToken is a TypeScript toolkit for card and board games that humans, LLMs, and reinforcement-learning agents can all play. Model cards or pieces as tokens, decks or piles as stacks, and boards or zones as spaces. Write the legal moves and rules once, then connect the players you want.
Stacks and cards are a nod to HyperCard, the original inspiration. HyperToken provides game building blocks, not a visual editor or a graphics engine.
Three ways to play¶
| Player | Start here |
|---|---|
| Human | Run npm run blackjack or npm run cuttle in a terminal, or try their browser examples. |
| LLM | Start the Model Context Protocol server and ask your MCP client to play Blackjack or Cuttle with its tools. |
| RL agent | Use a Gym- or PettingZoo-style environment with numeric observations, legal-action masks, and rewards. Run in TypeScript or connect from Python to a supported game. |
Start with the Quick Start, then try the custom game recipe or pick a game from the examples. The concepts guide explains how to model game pieces, turns, and rules.
Advanced: state, sync & multiplayer¶
The Engine keeps state in an Automerge document. You can save and resume, replay recorded actions with controlled inputs, fork for AI lookahead or what-if analysis, or connect peers with relay-assisted sync. Sync makes peers agree on document contents, not whether a move was legal. Use an authoritative server when you need rules enforced across untrusted clients or need to keep information private.