# cafe.thunderbird.contagion.game

> One finished game of Contagion (a push-your-luck dice web tile, from House Dice), saved by its player to their own account. Written by the host page the game ran in, which fills in the game's address and version from the tile it actually ran. Anyone can check it: give the tile's engine.wasm the essentials (mode, day or seed, moves) and it must answer with exactly the other fields (its standard question, std_check_daily or std_check_free).

- Kind: record
- Record key: tid
- Authority: contagion.thunderbird.cafe
- Lexicon: 1
- Published by [thunderbird.cafe](https://lexicon.garden/identity/did:plc:6vxjigxrqizmbo56gojxico3), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:6vxjigxrqizmbo56gojxico3/cafe.thunderbird.contagion.game)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:6vxjigxrqizmbo56gojxico3/cafe.thunderbird.contagion.game/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:6vxjigxrqizmbo56gojxico3/cafe.thunderbird.contagion.game/analytics)

## Record (`cafe.thunderbird.contagion.game`)

Type: record · key tid

### Properties

- `createdAt` (string · datetime, required): When the game was saved.
- `day` (string): A daily game's day, YYYY-MM-DD (the America/Denver calendar day). Its dice come from the seed the engine works out for it (seed_for_day).
  - Constraints: minLength: 10, maxLength: 10
- `ending` (string, required): How the game ended: bank (the player banked); emptied (a keep set aside the last dice); stuck (a roll left nothing that could be kept: 1 if contained, otherwise 0, no bonuses).
  - Constraints: knownValues: bank | emptied | stuck
- `engine` (string · cid): The CID of the engine (the tile's /engine.wasm) that checked the game, when the host ran it.
- `exhaustionBonus` (boolean, required): A keep emptied the grid, and contained (+1).
- `fullSetBonus` (boolean, required): All three resource types kept, and contained (+3).
- `game` (ref, required): The Contagion tile that played the game: its ing.dasl.masl record's address and exact version.
  - Reference: `com.atproto.repo.strongRef`
- `grid` (array, required): The grid at the end, 16 cells row by row from the top left: the face of a die still on it, or empty.
  - Constraints: minLength: 16, maxLength: 16
  - `items` (string)
    - Constraints: enum: empty | defense | home | hospital | water
- `kept` (ref, required): How many dice of each face were set aside.
  - Reference: `#kept`
- `mode` (string, required): daily: the day's dice, the same for everyone (carries day, never seed). free: free play, dice from its own seed (carries seed, never day).
  - Constraints: knownValues: daily | free
- `moves` (array, required): Every move in order (the opening roll isn't one): a keep (defense, home, hospital or water), then roll or bank. The engine numbers these words 0 to 5 in the order listed here, so a host turns each word into its position in this list before asking the engine.
  - Constraints: minLength: 0, maxLength: 32
  - `items` (string)
    - Constraints: enum: roll | bank | defense | home | hospital | water
- `pass` (boolean, required): Contained: defense at least as many as contamination.
- `resourceCount` (integer, required): Home, hospital and water dice kept (the real count, also when not contained).
  - Constraints: minimum: 0, maximum: 16
- `score` (integer, required): The score: if contained, the resources kept, +3 for all three resource types, +1 for emptying the grid, at least 1 (a stuck game scores 1); otherwise 0.
  - Constraints: minimum: 0, maximum: 20
- `seed` (integer): A free-play game's seed.
  - Constraints: minimum: 0, maximum: 4294967295

## #kept (`cafe.thunderbird.contagion.game#kept`)

Type: object

### Properties

- `contamination` (integer, required)
  - Constraints: minimum: 0, maximum: 16
- `defense` (integer, required)
  - Constraints: minimum: 0, maximum: 16
- `home` (integer, required)
  - Constraints: minimum: 0, maximum: 16
- `hospital` (integer, required)
  - Constraints: minimum: 0, maximum: 16
- `water` (integer, required)
  - Constraints: minimum: 0, maximum: 16

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "kept": {
      "properties": {
        "contamination": {
          "maximum": 16,
          "minimum": 0,
          "type": "integer"
        },
        "defense": {
          "maximum": 16,
          "minimum": 0,
          "type": "integer"
        },
        "home": {
          "maximum": 16,
          "minimum": 0,
          "type": "integer"
        },
        "hospital": {
          "maximum": 16,
          "minimum": 0,
          "type": "integer"
        },
        "water": {
          "maximum": 16,
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "contamination",
        "defense",
        "home",
        "hospital",
        "water"
      ],
      "type": "object"
    },
    "main": {
      "description": "One finished game of Contagion (a push-your-luck dice web tile, from House Dice), saved by its player to their own account. Written by the host page the game ran in, which fills in the game's address and version from the tile it actually ran. Anyone can check it: give the tile's engine.wasm the essentials (mode, day or seed, moves) and it must answer with exactly the other fields (its standard question, std_check_daily or std_check_free).",
      "key": "tid",
      "record": {
        "properties": {
          "createdAt": {
            "description": "When the game was saved.",
            "format": "datetime",
            "type": "string"
          },
          "day": {
            "description": "A daily game's day, YYYY-MM-DD (the America/Denver calendar day). Its dice come from the seed the engine works out for it (seed_for_day).",
            "maxLength": 10,
            "minLength": 10,
            "type": "string"
          },
          "ending": {
            "description": "How the game ended: bank (the player banked); emptied (a keep set aside the last dice); stuck (a roll left nothing that could be kept: 1 if contained, otherwise 0, no bonuses).",
            "knownValues": [
              "bank",
              "emptied",
              "stuck"
            ],
            "type": "string"
          },
          "engine": {
            "description": "The CID of the engine (the tile's /engine.wasm) that checked the game, when the host ran it.",
            "format": "cid",
            "type": "string"
          },
          "exhaustionBonus": {
            "description": "A keep emptied the grid, and contained (+1).",
            "type": "boolean"
          },
          "fullSetBonus": {
            "description": "All three resource types kept, and contained (+3).",
            "type": "boolean"
          },
          "game": {
            "description": "The Contagion tile that played the game: its ing.dasl.masl record's address and exact version.",
            "ref": "com.atproto.repo.strongRef",
            "type": "ref"
          },
          "grid": {
            "description": "The grid at the end, 16 cells row by row from the top left: the face of a die still on it, or empty.",
            "items": {
              "enum": [
                "empty",
                "defense",
                "home",
                "hospital",
                "water"
              ],
              "type": "string"
            },
            "maxLength": 16,
            "minLength": 16,
            "type": "array"
          },
          "kept": {
            "description": "How many dice of each face were set aside.",
            "ref": "#kept",
            "type": "ref"
          },
          "mode": {
            "description": "daily: the day's dice, the same for everyone (carries day, never seed). free: free play, dice from its own seed (carries seed, never day).",
            "knownValues": [
              "daily",
              "free"
            ],
            "type": "string"
          },
          "moves": {
            "description": "Every move in order (the opening roll isn't one): a keep (defense, home, hospital or water), then roll or bank. The engine numbers these words 0 to 5 in the order listed here, so a host turns each word into its position in this list before asking the engine.",
            "items": {
              "enum": [
                "roll",
                "bank",
                "defense",
                "home",
                "hospital",
                "water"
              ],
              "type": "string"
            },
            "maxLength": 32,
            "minLength": 0,
            "type": "array"
          },
          "pass": {
            "description": "Contained: defense at least as many as contamination.",
            "type": "boolean"
          },
          "resourceCount": {
            "description": "Home, hospital and water dice kept (the real count, also when not contained).",
            "maximum": 16,
            "minimum": 0,
            "type": "integer"
          },
          "score": {
            "description": "The score: if contained, the resources kept, +3 for all three resource types, +1 for emptying the grid, at least 1 (a stuck game scores 1); otherwise 0.",
            "maximum": 20,
            "minimum": 0,
            "type": "integer"
          },
          "seed": {
            "description": "A free-play game's seed.",
            "maximum": 4294967295,
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "game",
          "mode",
          "moves",
          "ending",
          "kept",
          "pass",
          "score",
          "resourceCount",
          "fullSetBonus",
          "exhaustionBonus",
          "grid",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    }
  },
  "id": "cafe.thunderbird.contagion.game",
  "lexicon": 1
}
```
