# cafe.thunderbird.daisy.match

> Published by [thunderbird.cafe](https://lexicon.garden/identity/did:plc:6vxjigxrqizmbo56gojxico3)

✓ This is the authoritative definition for this NSID.

## Description

Daisy, a two-player dice race (one die; roll or bank; a 1 loses the turn) played with web tiles at thunderbird.cafe/webtiles/daisy/. The dice are commit-reveal: anyone can re-check a match from its record.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:6vxjigxrqizmbo56gojxico3/cafe.thunderbird.daisy.match)
- [Documentation](https://lexicon.garden/lexicon/did:plc:6vxjigxrqizmbo56gojxico3/cafe.thunderbird.daisy.match/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:6vxjigxrqizmbo56gojxico3/cafe.thunderbird.daisy.match/examples)

## Definitions

### `cafe.thunderbird.daisy.match#link`

**Type**: `string`

A SHA-256 hash, as 64 lower-case hex characters.

**Constraints**: minLength: 64, maxLength: 64

### `cafe.thunderbird.daisy.match`

**Type**: `record`

One player's copy of a finished Daisy match. Each player saves their own; the record key is the match id (a TID made when the commitments are exchanged, just before the coin), so the two copies share it. A player against the bot saves alone.

**Key**: `tid`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `commitments` | `array` | Yes | Each player's commitment, in player order: the top of a SHA-256 hash chain made from a secret seed before the coin. |
| `createdAt` | `string` (datetime) | Yes |  |
| `ending` | `string` | Yes |  |
| `firstPlayer` | `integer` | Yes | Who the coin (roll 0) chose to start. |
| `forfeitReason` | `string` | No | Only for a forfeit: the loser let the turn timer run out, was away too long, or didn't reveal their link for a roll. |
| `house` | `ref` → `com.atproto.repo.strongRef` | No | The house tile that refereed the match, as pinned by both players' pages. |
| `lastReveals` | `array` | Yes | The last link each player revealed on that chain, in player order. Hashing forward from it rebuilds every earlier reveal up to the commitment, so the coin and every roll can be recomputed. |
| `matchId` | `string` | Yes | The match id, also this record's key (a TID). |
| `players` | `array` | Yes |  |
| `rechains` | `array` | No | Only when a chain ran out: the fresh chains that followed, in order. |
| `seat` | `integer` | Yes | Which player saved this record (1 or 2, an index into players). |
| `target` | `integer` | Yes | The score that wins, a house setting agreed before the coin. |
| `turns` | `array` | Yes | Every turn in play order. |
| `winner` | `integer` | Yes |  |

### `cafe.thunderbird.daisy.match#player`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `bot` | `boolean` | No | True when this seat was played by the table's bot. |
| `did` | `string` (did) | Yes |  |
| `glaze` | `string` | Yes |  |
| `handle` | `string` (handle) | Yes | The handle at the time of the match, for display; the did is what counts. |

### `cafe.thunderbird.daisy.match#rechain`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `commitments` | `array` | Yes |  |
| `fromRoll` | `integer` | Yes | The first roll this chain was used for (the coin is roll 0). |
| `lastReveals` | `array` | Yes |  |

### `cafe.thunderbird.daisy.match#turn`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `end` | `string` | Yes | bank: the turn's points were kept; bust: a 1 lost them; win: the target was reached; forfeit: the match ended here by forfeit. |
| `player` | `integer` | Yes |  |
| `rolls` | `array` | Yes | Every roll of the turn, in order. |

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "link": {
      "description": "A SHA-256 hash, as 64 lower-case hex characters.",
      "maxLength": 64,
      "minLength": 64,
      "type": "string"
    },
    "main": {
      "description": "One player's copy of a finished Daisy match. Each player saves their own; the record key is the match id (a TID made when the commitments are exchanged, just before the coin), so the two copies share it. A player against the bot saves alone.",
      "key": "tid",
      "record": {
        "properties": {
          "commitments": {
            "description": "Each player's commitment, in player order: the top of a SHA-256 hash chain made from a secret seed before the coin.",
            "items": {
              "ref": "#link",
              "type": "ref"
            },
            "maxLength": 2,
            "minLength": 2,
            "type": "array"
          },
          "createdAt": {
            "format": "datetime",
            "type": "string"
          },
          "ending": {
            "knownValues": [
              "won",
              "forfeit"
            ],
            "type": "string"
          },
          "firstPlayer": {
            "description": "Who the coin (roll 0) chose to start.",
            "maximum": 2,
            "minimum": 1,
            "type": "integer"
          },
          "forfeitReason": {
            "description": "Only for a forfeit: the loser let the turn timer run out, was away too long, or didn't reveal their link for a roll.",
            "knownValues": [
              "turn-timeout",
              "away",
              "no-reveal"
            ],
            "type": "string"
          },
          "house": {
            "description": "The house tile that refereed the match, as pinned by both players' pages.",
            "ref": "com.atproto.repo.strongRef",
            "type": "ref"
          },
          "lastReveals": {
            "description": "The last link each player revealed on that chain, in player order. Hashing forward from it rebuilds every earlier reveal up to the commitment, so the coin and every roll can be recomputed.",
            "items": {
              "ref": "#link",
              "type": "ref"
            },
            "maxLength": 2,
            "minLength": 2,
            "type": "array"
          },
          "matchId": {
            "description": "The match id, also this record's key (a TID).",
            "maxLength": 13,
            "minLength": 13,
            "type": "string"
          },
          "players": {
            "items": {
              "ref": "#player",
              "type": "ref"
            },
            "maxLength": 2,
            "minLength": 2,
            "type": "array"
          },
          "rechains": {
            "description": "Only when a chain ran out: the fresh chains that followed, in order.",
            "items": {
              "ref": "#rechain",
              "type": "ref"
            },
            "maxLength": 100,
            "type": "array"
          },
          "seat": {
            "description": "Which player saved this record (1 or 2, an index into players).",
            "maximum": 2,
            "minimum": 1,
            "type": "integer"
          },
          "target": {
            "description": "The score that wins, a house setting agreed before the coin.",
            "maximum": 1000,
            "minimum": 1,
            "type": "integer"
          },
          "turns": {
            "description": "Every turn in play order.",
            "items": {
              "ref": "#turn",
              "type": "ref"
            },
            "maxLength": 10000,
            "type": "array"
          },
          "winner": {
            "maximum": 2,
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "matchId",
          "seat",
          "target",
          "players",
          "firstPlayer",
          "commitments",
          "lastReveals",
          "turns",
          "winner",
          "ending",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "player": {
      "properties": {
        "bot": {
          "description": "True when this seat was played by the table's bot.",
          "type": "boolean"
        },
        "did": {
          "format": "did",
          "type": "string"
        },
        "glaze": {
          "knownValues": [
            "bone",
            "jade",
            "midnight",
            "glow",
            "brick",
            "marigold"
          ],
          "type": "string"
        },
        "handle": {
          "description": "The handle at the time of the match, for display; the did is what counts.",
          "format": "handle",
          "type": "string"
        }
      },
      "required": [
        "did",
        "handle",
        "glaze"
      ],
      "type": "object"
    },
    "rechain": {
      "properties": {
        "commitments": {
          "items": {
            "ref": "#link",
            "type": "ref"
          },
          "maxLength": 2,
          "minLength": 2,
          "type": "array"
        },
        "fromRoll": {
          "description": "The first roll this chain was used for (the coin is roll 0).",
          "minimum": 1,
          "type": "integer"
        },
        "lastReveals": {
          "items": {
            "ref": "#link",
            "type": "ref"
          },
          "maxLength": 2,
          "minLength": 2,
          "type": "array"
        }
      },
      "required": [
        "fromRoll",
        "commitments",
        "lastReveals"
      ],
      "type": "object"
    },
    "turn": {
      "properties": {
        "end": {
          "description": "bank: the turn's points were kept; bust: a 1 lost them; win: the target was reached; forfeit: the match ended here by forfeit.",
          "knownValues": [
            "bank",
            "bust",
            "win",
            "forfeit"
          ],
          "type": "string"
        },
        "player": {
          "maximum": 2,
          "minimum": 1,
          "type": "integer"
        },
        "rolls": {
          "description": "Every roll of the turn, in order.",
          "items": {
            "maximum": 6,
            "minimum": 1,
            "type": "integer"
          },
          "maxLength": 10000,
          "type": "array"
        }
      },
      "required": [
        "player",
        "rolls",
        "end"
      ],
      "type": "object"
    }
  },
  "description": "Daisy, a two-player dice race (one die; roll or bank; a 1 loses the turn) played with web tiles at thunderbird.cafe/webtiles/daisy/. The dice are commit-reveal: anyone can re-check a match from its record.",
  "id": "cafe.thunderbird.daisy.match",
  "lexicon": 1
}
```
