# Build a game. Bring everyone to the table.

A TypeScript SDK for games that humans, agents, and tests can all play.

A game is an ordinary TypeScript module. Its rules, legal choices, hidden information, and completion live together. The browser table is one way to play it.

## Your first move

```sh
npm install --save-exact @tabletopwithfriends/sdk@0.1.0
npm install --save-dev --save-exact @tabletopwithfriends/cli@0.1.0
npx twf create my-game
cd my-game
npm install
npx twf dev
```

The SDK does not require a browser, server, or cloud account. The CLI adds a local table, headless playtesting, and deployment tools.

## A small game, completely defined

```ts
import { defineGame } from '@tabletopwithfriends/sdk'

export const game = defineGame({
  id: 'first-to-five',
  state: { count: 0 },
  actions: {
    increment(draft) { draft.count += 1 },
  },
  end: ({ state }) => state.count >= 5,
})
```

This is already inspectable and playable to completion. Add components and a scene when you are ready to give it a physical table.

## One definition, every player

**Author** the state and rules in TypeScript. **Playtest** with deterministic seeds and discoverable actions. **Deploy** an immutable release. Every room keeps the code and artwork it started with.