# The round

> Reference for the context object round() receives: the content item, show, chat, phone, house, timer, close and reveal.

`round(ctx)` gets one context object. The game area is 1792 by 524 pixels on the 1920 by 1080 stage; the runtime draws the header, the join code, the timer and the scoreboard around it.

```js
async round({ item, content, round, stage, show, chat, phone, house, timer, close, reveal, sleep, players, util }) {}
```

## Content

| Field | What it is |
|---|---|
| `item` | This round's content item |
| `content` | All items, for example to pick decoy answers |
| `round` | `{ index, total }` |
| `stage` | The game area element |

## show

| Method | What it does |
|---|---|
| `show.html(html)` | Replaces the game area and returns it |
| `show.image(src, { zoom })` | A photo, optionally zoomed in. Returns a handle with `zoomOut({ seconds, to })` |
| `show.hint(text)` | A hint chip under the game area, mirrored to phones |
| `show.status(text)` | The status chip, top right, like "Type your guess in chat" |
| `show.toast(text)` | A short message on stream |

## chat, phone and house

| Method | What it does |
|---|---|
| `chat.expect(answers, opts)` | Loose matching and scoring in one line |
| `chat.onAnswer(fn)` | Every guess from chat and phones: `fn(player, text, meta)` |
| `chat.vote(options)` | A numbered vote. Returns a poll |
| `chat.teams(teams)` | Team words. Returns teams with `onPull(fn)` and `counts()` |
| `phone.prompt({ text, image, input, options })` | What phone players see this round |
| `house.answer(correct, opts)` / `house.vote(index, opts)` | The house player, for quiet rounds |
| `chat.sample(words, { rate })` | Lab only: what the pretend viewers type all round, for games with their own commands. A list, or `fn(bot)` |

## Flow

| Call | What it does |
|---|---|
| `timer(seconds, at)` | The countdown. `at` runs callbacks at given seconds. The host can end it early |
| `close()` | Stops taking answers, after waiting for the slowest platform |
| `reveal(answer, { sub, label, seconds })` | Closes if needed, then shows the answer card with who got it |
| `sleep(ms)` | A pause the host can skip. Returns at once after the host presses End |
| `players()` | Everyone playing |
| `ending()` | True once the host pressed End. A long game's loop should wrap up and return |
| `load()` | Progress saved on an earlier stream, or `null`. For games with `saves: true` |
| `save(data)` | Saves progress: plain JSON, at most 256 KB. Returns `false` if it is too big |

## util

`util.shuffle()`, `util.pick()`, a seeded `util.rng(seed)`, `util.hash()`, `util.clamp()`, `util.esc()` for safe HTML, and `util.sleep()`.
