# Reference patch — 03-gravity

The answer key for how the reference absorbs this change, and the thing that makes
`budget.json` reproducible. **Never shipped to the candidate.**

1. **Overlay** `../contract-delta/Entry.java` onto `contract/Entry.java`. Contract files are
   given, so nothing here is charged.
2. **Add** `GravityGrid.java` (in this directory) to `reference/src/`. New file, so
   `measureChange` charges nothing for it.
3. **Add one method** to `reference/src/TicTacToeFactory.java`, `gravity(int, int)`, mirroring
   `of(int, int)` but building a `GravityGrid` instead of a `StandardGrid`. `edits.json` beside
   this file is the same edit in machine-readable form.

## Measurement

`reference_diff = 8` (8 added, 0 removed, one file touched: `TicTacToeFactory.java`; `GravityGrid.java`
is new and free), so `diff_budget = max(3, 8 + ceil(8/2)) = 12`.

Both suites are green after the patch: the curveball suite **7 tests, 7 passed**, and the base
suite **17 tests, 17 passed** — the standard game builds a `StandardGrid` exactly as it always
did.

## Where the requirement landed, and where it did not

- **`TicTacToe`, `WinRule` and `TurnOrder` were not opened.** `TicTacToe.play` only ever asks its
  `Grid` where a placement landed and checks a line through *that* cell — it never assumed the
  landing cell was the one it asked for. `WinRule` scans from whatever cell it is told a mark
  landed on, gravity or not. Neither class knows gravity exists.
- **`StandardGrid` was not opened either.** `GravityGrid` is a sibling of it, not a subclass:
  both implement `Grid` from nothing but the interface, so getting the drop rule right could not
  accidentally depend on `StandardGrid`'s internals, and a bug in one cannot leak into the other.
- **What moved, and why it is small anyway:** `TicTacToeFactory.gravity` repeats the same
  `winLength` validation `of` already has. A shared private `validate(size, winLength)` helper
  would remove that repetition at the cost of also becoming an edit to an existing method rather
  than a pure addition — a fair trade either way, and the budget's slack absorbs either choice.
  What the eight lines do **not** include is a single line of board-storage, line-scanning or
  turn-taking logic, which is the actual claim `Grid` being an interface is making.
