# Guesses, votes and teams

> The three ways players answer a StreamArena game, and the phone prompt that mirrors them for phone players.

Players answer a StreamArena game in one of three ways: a guess (free text), a vote (a number) or a team word. A game declares which ones it uses in `inputs`, and the first one sets the "how to play" line on stream.

| Input | Viewers type | Use it for |
|---|---|---|
| `guess` | Free text, like `dune` | Naming a film, a photo, an emoji puzzle |
| `vote` | A number, like `1` or `2` | Two or three options, one right answer |
| `team` | A team word, like `!cats` | Two or more sides racing each other |

## Guesses

`chat.expect(answers)` is the one-line version: loose matching, faster answers score more, the first right answer gets a bonus, and each player scores once.

```js
chat.expect(item.title, { points: 1000, min: 200, first: 250 })
```

For your own rules, use `chat.onAnswer()` and mark winners with `player.correct(points)`:

```js
chat.onAnswer((player, text, { at, platform, secret }) => {
  if (text.matches(item.answers)) player.correct(1000 - at * 40)
})
```

## Votes

`chat.vote(options)` returns a poll with live bars. Players type 1, 2 or 3, or tap on their phone, and the last vote counts. Call `close()` before `poll.score()`, so late YouTube votes still count.

```js
async round({ item, show, chat, phone, house, timer, close, reveal }) {
  const opts = [item.a, item.b]
  const poll = chat.vote(opts).render(show.html('<div class="tally"></div>'))
  phone.prompt({ text: item.q, input: 'vote', options: opts })
  house.vote(item.answer)

  await timer(20)
  await close()
  poll.score(item.answer, { points: 500, fast: 300 })
  await reveal(opts[item.answer])
}
```

## Teams

`chat.teams()` takes the team words, and `onPull()` fires on every counted message. Each player counts at most once every half second.

```js
async round({ chat, timer, reveal }) {
  const teams = chat.teams([
    { id: 'cats', words: ['cats', '!cats'] },
    { id: 'dogs', words: ['dogs', '!dogs'] },
  ])
  teams.onPull((team) => moveRope(team.id))
  await timer(45)
  const c = teams.counts()
  await reveal(c.cats > c.dogs ? 'Cats win' : 'Dogs win')
}
```

## Phones

`phone.prompt()` sets what phone players see this round. It defaults to the game's first input.

```js
phone.prompt({ text: 'Which is older?', input: 'vote', options: ['Statue of Liberty', 'Eiffel Tower'] })
```
