Reading the event log

The raw record, and what the scorer took back.

The event log is everything the scorer did, in the order they did it. That includes the things they undid. A correction deletes nothing from it, so you have to apply the corrections yourself.

Apply rewinds first, then replacements. In the other order you bring back a play the scorer took off the board.

Do you need this at all?

Probably not. The plays read and the box score read are already corrected: the plays a scorer took back are gone from them and every replacement is already applied. Read those unless you are rebuilding the game yourself.

This log is for a consumer that wants the game as it was kept — who fixed what, and when.

The two kinds of correction

A rewind.to entry takes the game back to a point. It carries throughSequence, and everything recorded after that number, up to the rewind itself, is off the board. The scorer then rescores from there.

There is one exception. A correction belongs to the entry it replaces, not to the moment it was recorded. So a correction to an entry at or before throughSequence stays, even though its own number is higher. A scorer who changed a hit to an error in the second inning, and later went back to a play in the fifth, keeps the error.

A supersedes number on an entry says this entry replaces an earlier one. The earlier entry stays in the list. You drop it, and the new entry takes its place in the order of the game. A correction can itself be replaced; follow the chain to the newest one.

When a coach starts the game over

One act empties the log. A coach can start a game over, which removes every entry and sets the game back to scheduled. Only the lineups come back, as new entries, and the numbers begin again at 0. If you keep entries by their number, check the status of the game first. When a game you saw as live or final is scheduled again, or the newest number is lower than one you hold, discard what you kept and read the log again from the start.

The order, worked through

Five entries. Entry 43 rewinds the game through entry 41, which voids entry 42. Entry 45 is a correction that replaces entry 42 — the entry the rewind already voided. The app refuses a correction like that today, so you will seldom meet one. Apply the order anyway: it is the order the product itself uses, and it is right for every log.

  { sequence: 41, event: { type: 'plate_appearance.completed', … } }
  { sequence: 42, event: { type: 'plate_appearance.completed', … } }
  { sequence: 43, event: { type: 'rewind.to', throughSequence: 41 } }
  { sequence: 44, event: { type: 'plate_appearance.completed', … } }
  { sequence: 45, event: { type: 'plate_appearance.completed', … }, supersedes: 42 }
What each order leaves
OrderWhat is leftVerdict
Rewinds first, then replacements41, 43, 44Correct.
Replacements first, then rewinds41, 43, 44, 45Wrong: an extra plate appearance.

Rewinds first: entry 42 is voided, so entry 45 has nothing left to replace and goes with it. You are left with the two plate appearances the scorer meant to keep, 41 and 44.

Now the exception, with a different log of three entries. Entry 41 is a plate appearance. Entry 42 is a correction that replaces entry 41. Entry 43 rewinds the game through entry 41. Entry 42 has a number above 41, but it belongs to entry 41, and the rewind keeps entry 41. So entry 42 stays, and entry 41 reads as the correction says.

Replacements first: entry 45 takes entry 42’s place in the log. The rewind then finds no entry 42 to void, and entry 45’s own number is above the rewind, so it survives. You are left with a plate appearance the scorer took off the board, wearing a new number — one more at bat than the game had.

One more rule, and it is the cheap one: read type first and skip a type you do not know. The list of types only ever gains members, and a new one must never break a consumer that has not heard of it.

A real log

This is the recorded answer for one game, exactly as the read returns it. Every entry carries its sequence, the moment it was recorded, and which scorer recorded it — numbered 1, 2, 3 in the order they appear. It names nobody: we do not publish who kept the book.

{
  "events": [
    {
      "event": {
        "awayLineup": [],
        "homeLineup": [],
        "startedAt": 0,
        "type": "game.started"
      },
      "recordedAt": 0,
      "scorer": 1,
      "sequence": 0
    },
    {
      "event": {
        "half": "top",
        "inning": 1,
        "type": "half_inning.started"
      },
      "recordedAt": 0,
      "scorer": 1,
      "sequence": 1
    },
    {
      "event": {
        "pitcher": "p1",
        "side": "home",
        "type": "pitching_change"
      },
      "recordedAt": 0,
      "scorer": 1,
      "sequence": 2
    },
    {
      "event": {
        "batter": "a1",
        "movements": [
          {
            "cause": "batted_ball",
            "from": "batter",
            "runner": "a1",
            "to": 1
          }
        ],
        "outcome": "single",
        "type": "plate_appearance.completed"
      },
      "recordedAt": 0,
      "scorer": 1,
      "sequence": 3
    },
    {
      "event": {
        "batter": "a1",
        "movements": [
          {
            "cause": "batted_ball",
            "from": "batter",
            "runner": "a1",
            "to": 2
          }
        ],
        "outcome": "double",
        "type": "plate_appearance.completed"
      },
      "recordedAt": 0,
      "scorer": 1,
      "sequence": 4,
      "supersedes": 3
    }
  ],
  "version": "v1",
  "generatedAt": 0
}

This game was kept before the app recorded fielders. A newer game carries more: a finished turn at bat, a runner put out and a runner who moved can each carry fielding, which names the positions that made the outs, the assists and the errors. A ball in play, and a foul, can carry the hit position: where the ball went. The Reference lists each of these fields.

The field-by-field description of every entry is on the Reference page, under the events read.