# games.cavu.tier-madness.move

> Published by [chris.pardy.family](https://lexicon.garden/identity/did:plc:dp7v5b5kejmmzzpwmqyf5wj6)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:dp7v5b5kejmmzzpwmqyf5wj6/games.cavu.tier-madness.move)
- [Documentation](https://lexicon.garden/lexicon/did:plc:dp7v5b5kejmmzzpwmqyf5wj6/games.cavu.tier-madness.move/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:dp7v5b5kejmmzzpwmqyf5wj6/games.cavu.tier-madness.move/examples)

## Definitions

### `games.cavu.tier-madness.move#double`

**Type**: `object`

The item the player doubles: bonus if it matches the group's tier, penalty if not. Absent when the player didn't double.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `item` | `string` | No |  |

### `games.cavu.tier-madness.move`

**Type**: `record`

One secret move by a player, written (by the game server, on the player's behalf, or by the player) to the round's secret space (skey `{game}-r{round}`). Only the game server can read it until that round's reveal, when the game's players can too (round 0, the category vote, opens at game end). Its CID is published as a games.cavu.tier-madness.commitment (same rkey) in the game's commitment space, so the move can't be changed later. The nonce stops anyone from guessing a low-entropy move (e.g. a tier) by hashing every possibility.

**Key**: `tid`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `action` | `union` | Yes |  |
| `createdAt` | `string` (datetime) | Yes |  |
| `game` | `string` | Yes | The game's id. |
| `nonce` | `string` | Yes | Random, at least 128 bits (base64url). |
| `round` | `integer` | Yes | Round number; 0 is the pre-game category vote. |

### `games.cavu.tier-madness.move#place`

**Type**: `object`

Placing the index'th dealt card: a rating, embedded rather than written as a garden.lexicon.dazzling-boarfish.rating.rate record. Its scale is the game record's and its prompt is the round's. Placements are final once committed.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `index` | `integer` | Yes | Deal order, from 0. |
| `item` | `ref` → `games.cavu.tier-madness.defs#item` | Yes | The full card as dealt, so a game can be replayed from moves alone. |
| `subject` | `ref` → `garden.lexicon.dazzling-boarfish.rating.rate#subjectUri` | Yes | What's rated: the card's source (its Wikipedia article). |
| `value` | `ref` → `garden.lexicon.dazzling-boarfish.rating.scale#ordinalValue` | Yes | The tier, as a value on the game's scale. |

### `games.cavu.tier-madness.move#swap`

**Type**: `object`

The round's one swap: two items in different tiers trade places. Empty when the player skipped it.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `items` | `array` | Yes |  |

### `games.cavu.tier-madness.move#vote`

**Type**: `object`

Secret pre-game vote for favourite categories. Carries the full ballot shown, so the vote can be replayed on its own.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `ballot` | `array` | Yes | Every category offered, in the order shown. |
| `categories` | `array` | Yes | The ones this player picked (a subset of ballot). |

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "double": {
      "description": "The item the player doubles: bonus if it matches the group's tier, penalty if not. Absent when the player didn't double.",
      "properties": {
        "item": {
          "maxLength": 300,
          "type": "string"
        }
      },
      "type": "object"
    },
    "main": {
      "description": "One secret move by a player, written (by the game server, on the player's behalf, or by the player) to the round's secret space (skey `{game}-r{round}`). Only the game server can read it until that round's reveal, when the game's players can too (round 0, the category vote, opens at game end). Its CID is published as a games.cavu.tier-madness.commitment (same rkey) in the game's commitment space, so the move can't be changed later. The nonce stops anyone from guessing a low-entropy move (e.g. a tier) by hashing every possibility.",
      "key": "tid",
      "record": {
        "properties": {
          "action": {
            "refs": [
              "#vote",
              "#place",
              "#swap",
              "#double"
            ],
            "type": "union"
          },
          "createdAt": {
            "format": "datetime",
            "type": "string"
          },
          "game": {
            "description": "The game's id.",
            "maxLength": 64,
            "type": "string"
          },
          "nonce": {
            "description": "Random, at least 128 bits (base64url).",
            "maxLength": 64,
            "minLength": 16,
            "type": "string"
          },
          "round": {
            "description": "Round number; 0 is the pre-game category vote.",
            "maximum": 20,
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "game",
          "round",
          "nonce",
          "action",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "place": {
      "description": "Placing the index'th dealt card: a rating, embedded rather than written as a garden.lexicon.dazzling-boarfish.rating.rate record. Its scale is the game record's and its prompt is the round's. Placements are final once committed.",
      "properties": {
        "index": {
          "description": "Deal order, from 0.",
          "maximum": 19,
          "minimum": 0,
          "type": "integer"
        },
        "item": {
          "description": "The full card as dealt, so a game can be replayed from moves alone.",
          "ref": "games.cavu.tier-madness.defs#item",
          "type": "ref"
        },
        "subject": {
          "description": "What's rated: the card's source (its Wikipedia article).",
          "ref": "garden.lexicon.dazzling-boarfish.rating.rate#subjectUri",
          "type": "ref"
        },
        "value": {
          "description": "The tier, as a value on the game's scale.",
          "ref": "garden.lexicon.dazzling-boarfish.rating.scale#ordinalValue",
          "type": "ref"
        }
      },
      "required": [
        "item",
        "subject",
        "value",
        "index"
      ],
      "type": "object"
    },
    "swap": {
      "description": "The round's one swap: two items in different tiers trade places. Empty when the player skipped it.",
      "properties": {
        "items": {
          "items": {
            "maxLength": 300,
            "type": "string"
          },
          "maxLength": 2,
          "minLength": 0,
          "type": "array"
        }
      },
      "required": [
        "items"
      ],
      "type": "object"
    },
    "vote": {
      "description": "Secret pre-game vote for favourite categories. Carries the full ballot shown, so the vote can be replayed on its own.",
      "properties": {
        "ballot": {
          "description": "Every category offered, in the order shown.",
          "items": {
            "maxLength": 300,
            "type": "string"
          },
          "maxLength": 20,
          "minLength": 1,
          "type": "array"
        },
        "categories": {
          "description": "The ones this player picked (a subset of ballot).",
          "items": {
            "maxLength": 300,
            "type": "string"
          },
          "maxLength": 3,
          "minLength": 1,
          "type": "array"
        }
      },
      "required": [
        "ballot",
        "categories"
      ],
      "type": "object"
    }
  },
  "id": "games.cavu.tier-madness.move",
  "lexicon": 1
}
```
