{
  "openapi": "3.1.1",
  "info": {
    "title": "Arcade Replay Score Checker API",
    "version": "1.0.0",
    "summary": "Re-run a Pixelpier replay on the real game engine and check the score it really reaches.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://pixelpierreplaycheck.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Re-run a Pixelpier replay on the real game engine and check the score it really reaches.",
        "description": "Every Pixelpier game is deterministic: the same seed and the same button presses always give the same game. Paste a replay (exported from the high-score list) and the checker plays it again on the game engine — Blockfall, Rockstorm, Coilrun, Brickwave, Jellyraid, Shellhop, Pearlrun, Pier Rally — and returns the final score, level, lives, play time and a fingerprint of the final game state. Give a claimed score to see whether it matches.\n\nMethodology:\n- The replay is validated (format, game id, rules version, seed, difficulty, start level, inputs as [ticks ≥ 1, mask 0–255] runs, at most one hour of ticks).\n- The game engine is created from the seed and options and stepped once per tick (1/60 s) with the recorded button mask; it stops when the game ends.\n- The engines use seeded random numbers kept in the game state and only exactly rounded arithmetic, so the browser and the server reach the same state; the hash is FNV-1a over the canonical JSON of the final state.\n\nProves what a replay scores, not who played it.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "pixelpier_replay_check",
        "x-owner-app": "pixelpier",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PixelpierReplayCheckInput"
              },
              "examples": {
                "example1": {
                  "summary": "30 seconds of Coilrun",
                  "value": {
                    "replay": "{\"format\":\"pixelpier-replay\",\"version\":1,\"game\":\"coilrun\",\"rules\":1,\"seed\":7,\"difficulty\":\"normal\",\"startLevel\":1,\"inputs\":[[80,0],[1,8],[63,0],[1,2],[55,0],[1,4],[95,0],[1,1],[143,0],[1,4],[23,0],[1,2],[95,0],[1,8],[7,0],[1,2],[47,0],[1,4],[15,0],[1,1],[31,0],[1,8],[7,0],[1,1],[7,0],[1,8],[47,0],[1,1],[79,0],[1,8],[63,0],[1,1],[63,0],[1,4],[95,0],[1,2],[55,0],[1,4],[23,0],[1,2],[39,0],[1,8],[55,0],[1,2],[23,0],[1,8],[39,0],[1,1],[104,0],[1,4],[76,0],[1,2],[153,0],[1,8],[41,0],[1,2],[6,0],[1,8],[27,0],[1,1],[55,0],[1,4],[27,0],[1,1],[6,0],[1,8],[23,0]]}"
                  }
                },
                "example2": {
                  "summary": "Check a claimed score",
                  "value": {
                    "replay": "{\"format\":\"pixelpier-replay\",\"version\":1,\"game\":\"coilrun\",\"rules\":1,\"seed\":7,\"difficulty\":\"normal\",\"startLevel\":1,\"inputs\":[[80,0],[1,8],[63,0],[1,2],[55,0],[1,4],[95,0],[1,1],[143,0],[1,4],[23,0],[1,2],[95,0],[1,8],[7,0],[1,2],[47,0],[1,4],[15,0],[1,1],[31,0],[1,8],[7,0],[1,1],[7,0],[1,8],[47,0],[1,1],[79,0],[1,8],[63,0],[1,1],[63,0],[1,4],[95,0],[1,2],[55,0],[1,4],[23,0],[1,2],[39,0],[1,8],[55,0],[1,2],[23,0],[1,8],[39,0],[1,1],[104,0],[1,4],[76,0],[1,2],[153,0],[1,8],[41,0],[1,2],[6,0],[1,8],[27,0],[1,1],[55,0],[1,4],[27,0],[1,1],[6,0],[1,8],[23,0]]}",
                    "claimedScore": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PixelpierReplayCheckResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "PixelpierReplayCheckInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "replay": {
            "title": "Replay (JSON from Pixelpier)",
            "description": "Format \"pixelpier-replay\" version 1: game, rules, seed, difficulty, startLevel and inputs as runs of [ticks, buttons]. Up to 60 minutes of play.",
            "type": "string",
            "maxLength": 600000,
            "default": "{\"format\":\"pixelpier-replay\",\"version\":1,\"game\":\"coilrun\",\"rules\":1,\"seed\":7,\"difficulty\":\"normal\",\"startLevel\":1,\"inputs\":[[80,0],[1,8],[63,0],[1,2],[55,0],[1,4],[95,0],[1,1],[143,0],[1,4],[23,0],[1,2],[95,0],[1,8],[7,0],[1,2],[47,0],[1,4],[15,0],[1,1],[31,0],[1,8],[7,0],[1,1],[7,0],[1,8],[47,0],[1,1],[79,0],[1,8],[63,0],[1,1],[63,0],[1,4],[95,0],[1,2],[55,0],[1,4],[23,0],[1,2],[39,0],[1,8],[55,0],[1,2],[23,0],[1,8],[39,0],[1,1],[104,0],[1,4],[76,0],[1,2],[153,0],[1,8],[41,0],[1,2],[6,0],[1,8],[27,0],[1,1],[55,0],[1,4],[27,0],[1,1],[6,0],[1,8],[23,0]]}"
          },
          "claimedScore": {
            "title": "Claimed score (optional)",
            "type": "integer",
            "minimum": 0,
            "maximum": 100000000
          }
        },
        "required": []
      },
      "PixelpierReplayCheckResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "game",
              "name",
              "rules",
              "seed",
              "difficulty",
              "startLevel",
              "ticks",
              "seconds",
              "score",
              "level",
              "lives",
              "over",
              "hash",
              "counters",
              "claimedScore",
              "claimMatches"
            ],
            "properties": {
              "game": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "rules": {
                "type": "integer"
              },
              "seed": {
                "type": "integer"
              },
              "difficulty": {
                "type": "string"
              },
              "startLevel": {
                "type": "integer"
              },
              "ticks": {
                "type": "integer"
              },
              "seconds": {
                "type": "number"
              },
              "score": {
                "type": "integer"
              },
              "level": {
                "type": "integer"
              },
              "lives": {
                "type": "integer"
              },
              "over": {
                "type": "boolean"
              },
              "hash": {
                "type": "string"
              },
              "counters": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer"
                }
              },
              "claimedScore": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "claimMatches": {
                "type": [
                  "boolean",
                  "null"
                ]
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}