# app.knightsky.game

> A player's mutable copy of a chess game. Without challenge this record is an invitation; with challenge it accepts the referenced invitation. Update the same record key after each move or resignation.

- Kind: record
- Record key: tid
- Authority: knightsky.app
- Lexicon: 1
- Published by [knightsky.app](https://lexicon.garden/identity/did:plc:4jwu5r3kihk5btmr7nqtvt2r), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:4jwu5r3kihk5btmr7nqtvt2r/app.knightsky.game)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:4jwu5r3kihk5btmr7nqtvt2r/app.knightsky.game/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:4jwu5r3kihk5btmr7nqtvt2r/app.knightsky.game/analytics)

## Record (`app.knightsky.game`)

Type: record · key tid

### Properties

- `challenge` (ref): Present only on the accepting player's record. Identifies the challenger's app.knightsky.game record and its CID at acceptance; retain this reference unchanged on later updates.
  - Reference: `com.atproto.repo.strongRef`
- `color` (string, required): The record owner's color, not the opponent's color.
  - Constraints: enum: white | black
- `fen` (string, required): The six-field FEN after replaying pgn, or the standard initial position before any moves. Clients must validate it with the chess engine and compare it with the replayed position.
  - Constraints: minLength: 1, maxLength: 256
- `opponent` (string · did, required): DID of the opposing player. The record owner's DID is taken from the repository, not this field.
- `pgn` (string, required): Full mainline move history in PGN from the standard initial position. An empty string is allowed before the first move. Clients must replay and validate the moves rather than trust this text.
  - Constraints: maxLength: 262144
- `status` (string, required): Resigned means this record's owner has resigned. Active means no resignation by this owner; checkmate and automatic draws are derived by the engine from the accepted history.
  - Constraints: enum: active | resigned

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "A player's mutable copy of a chess game. Without challenge this record is an invitation; with challenge it accepts the referenced invitation. Update the same record key after each move or resignation.",
      "key": "tid",
      "record": {
        "properties": {
          "challenge": {
            "description": "Present only on the accepting player's record. Identifies the challenger's app.knightsky.game record and its CID at acceptance; retain this reference unchanged on later updates.",
            "ref": "com.atproto.repo.strongRef",
            "type": "ref"
          },
          "color": {
            "description": "The record owner's color, not the opponent's color.",
            "enum": [
              "white",
              "black"
            ],
            "type": "string"
          },
          "fen": {
            "description": "The six-field FEN after replaying pgn, or the standard initial position before any moves. Clients must validate it with the chess engine and compare it with the replayed position.",
            "maxLength": 256,
            "minLength": 1,
            "type": "string"
          },
          "opponent": {
            "description": "DID of the opposing player. The record owner's DID is taken from the repository, not this field.",
            "format": "did",
            "type": "string"
          },
          "pgn": {
            "description": "Full mainline move history in PGN from the standard initial position. An empty string is allowed before the first move. Clients must replay and validate the moves rather than trust this text.",
            "maxLength": 262144,
            "type": "string"
          },
          "status": {
            "description": "Resigned means this record's owner has resigned. Active means no resignation by this owner; checkmate and automatic draws are derived by the engine from the accepted history.",
            "enum": [
              "active",
              "resigned"
            ],
            "type": "string"
          }
        },
        "required": [
          "opponent",
          "color",
          "pgn",
          "fen",
          "status"
        ],
        "type": "object"
      },
      "type": "record"
    }
  },
  "id": "app.knightsky.game",
  "lexicon": 1
}
```
