# TimeGo

TimeGo uses one planar Go board and one placement history that players can rewrite. A time move changes when a stone was placed, then replays the consequences. Either player can spend a turn using **Lock** to protect the shared past.

Open [TimeGo](../timego.html), or choose the [interactive tutorial](../timego-learn.html) for seven short 4 × 4 exercises, from placing a stone to time travel and scoring. Tutorial exercises never replace or alter your saved game. The new-game menu offers 4 × 4 and 5 × 5 boards; the engine and validated records also support 2 × 2 and 3 × 3. A1 is the bottom-left intersection. Black starts, and actual turns alternate.

## Two records with different jobs

The **current placement order**, written `H`, contains only stone placements, each recorded as a color and intersection. Its first `m` placements form the locked prefix. Both start empty. Replaying `H` from the empty board determines the present stones and each living stone's current birth index.

The **turn record** contains every action actually taken: placements, time moves, Lock and passes. It determines the next player, consecutive passes, and the repetition record that survives changes to `H`. Reconstructed placement colors need not alternate; actual players always do. Changing the past does not grant extra turns.

Birth indices refer to the current placement order, and may change after a time move. They are not permanent stone IDs or turn numbers. In the interface, placements are numbered from **1**. Engine actions and JSON use indices from **0**: source `21`, target `19` means moving placement 22 to immediately before placement 20.

## Actions

Each turn consists of exactly one action.

### Place

Place your stone on an empty intersection and append its placement to `H`. Orthogonally adjacent stones of one color form a group; distinct empty neighboring intersections are its liberties. Remove opposing groups with no liberties, then reject the move if the new friendly group has no liberty. Suicide is illegal. Also apply both repetition rules below.

### Time

Choose one of your own stones that is alive now. If its current birth index is `i`, choose an earlier gap `j` satisfying `m ≤ j < i`. Its birth must be outside the locked prefix. The first unlocked birth has no earlier permitted gap.

1. Remove that placement from its old position in `H` and insert it at gap `j`, at **the same intersection and with the same color**. This moves the birth; it does not duplicate or move the stone across the board.
2. Keep the placements before `j` unchanged. The arrival must be legal under occupancy, capture, suicide and chronological superko. If arrival is illegal, reject the entire action.
3. Replay the other old placements from `j` onward in their previous relative order. Omit an old placement if it is now occupied, suicide, or a chronological repetition. Omitted placements are permanently absent from the new `H`; they are not dormant events that can reactivate later.
4. Reject the whole action if its resulting `(H, m)` repeats an actually visited pair. Otherwise install the reconstructed board and history and give the other player a turn.

The locked prefix and every board reached within it remain unchanged. Captures in the open suffix can reverse, so previously captured stones can return. The traveler may itself die during replay. Departure eligibility is checked before the action; the traveler need not survive its consequences. A time move that changes `H` but leaves the present board unchanged is legal if both repetition checks pass.

Choose **Time** beside the board, then select your own ringed stone. The interface checks its nearest earlier arrival automatically. Use the arrival slider, nearby placement buttons, or exact placement selector to explore other points in the unlocked past. Each valid arrival shows the **possible present** after all consequences have replayed, with counts of restored stones, captured stones and cancelled placements. An invalid arrival clears the draft and explains why it is illegal. These controls only preview: **Play time move** commits the action, while **Choose another stone** or **Cancel preview** returns to the actual board. The area panel continues to show the actual board before travel.

**Compare** optionally shows the original and rewritten boards together; they stack on narrow screens. At the final outcome, comparison shows the actual board before travel beside the possible present. **Watch replay** follows the consequences from the earlier arrival through the final outcome. Pause, resume, scrub, or step through the replay; **Result** returns to the final outcome. Each replayed placement can be compared with its original version, with relevant groups and their empty liberties marked. The arrival compares the board immediately before and after insertion. Changing the arrival, navigating manually, opening a dialog, or leaving the preview pauses playback. The interface respects reduced-motion preferences.

Crosses mark cancelled placements; preview snapshots cannot be played on. The summary describes the final outcome of the whole time move, while each step explains its local consequences. The causal replay shows automatic consequences, not additional turns. A cancelled birth and a captured stone are different events.

### Lock

Lock is legal only when `m < length(H)`. It sets `m = length(H)`, changes no stones, **spends the whole turn**, and resets consecutive passes. The boundary binds both players. Locking an already fully locked history is illegal.

Existing births can no longer travel. Later births may travel only within the new suffix. Locked stones can still be captured by later play: their past is protected, not their future survival. Lock does not clear either repetition record. A captured birth absent at the locked boundary cannot be restored by changing later placements; a later stone at the same intersection has a new birth.

### Pass

Pass changes neither `H` nor `m` and hands over the turn. Two consecutive actual passes end the game. Any legal placement, time move or Lock resets the pass count. In particular, Lock is not a pass.

## Two repetition rules

| Rule | What must not repeat | Where it is checked |
| --- | --- | --- |
| Chronological positional superko | A complete board coloring, without birth IDs or player to move | Every placement within the reconstructed `H`, including the initial empty board and all locked-prefix boards |
| Actual-play repetition | The complete ordered placement list `H` together with locked-prefix length `m` | Every non-pass result against every pair previously reached in actual play, including the initial pair |

The second key excludes turn numbers, pass counts, arbitrary identities and the number of times Lock has been used. Both placement order and boundary matter even when the visible board is identical. Ordinary passes are exempt from this second prohibition. Neither passes nor Lock erase its record.

During replay, chronological superko is checked against the preceding boards of the **new** reconstructed history. It is not a ban on every board ever displayed in actual play. The separate `(H, m)` rule protects actual-play repetition.

## Ending and score

After two consecutive passes, score the actual board:

- Each surviving stone scores one point for its color.
- Each connected empty region scores for its sole neighboring color, if it touches exactly one color. Regions touching both colors or neither color are neutral.
- Add the game's komi to White's score. The larger score wins; equal scores draw.

There is no prisoner ledger and no presumed-dead removal. Play out disputed groups before passing. New games and the tutorial use **zero komi**, a provisional value with no established fairness calibration. Imported records may use komi in multiples of 0.5 whose absolute value does not exceed the board area.

The spatial superko and area-scoring baseline follows [Tromp's Logical Rules](https://tromp.github.io/go.html). TimeGo differs by prohibiting suicide and adding mutable history, Lock and actual-play repetition; it is not an implementation of unmodified Tromp–Taylor Go.

## Finite rules, practical limits

For `N` intersections there are at most `3^N` board colorings. Chronological superko therefore bounds `H` by `3^N − 1` placements. The placement alphabet and possible locked boundaries are finite, so there are finitely many `(H, m)` pairs. Non-pass actions cannot revisit them; only one consecutive pass can separate non-pass actions before the next pass ends play. Thus every legal play sequence is finite.

This argument is not a useful runtime or game-length bound: many different histories can produce the same board. Neither the proof nor a tactical lesson establishes balanced or optimal play.

The application accepts at most **1,024 actual actions per line** and **2 MiB per imported JSON document**. These are storage and processing limits, not game rules or adjudication. Reaching the action limit disables further play; it does not score, truncate, or invent a result. Export the complete game before starting another. Reviewing and exporting the retained record remain available.

## Save, review and provenance

TimeGo has its own browser autosave, separate from the other games. Conflicting tabs pause saving. Invalid saved data remain preserved and downloadable; replacing them requires an explicit action. Export whenever safe browser saving is unavailable.

JSON documents use schema `time-go-game`, version `1`, rules `timego-shared-lock-v1`. They contain board size, komi, the complete actual action list with player colors, the viewed cursor, and a final-position checkpoint. Coordinates use `point = row × size + column`, with row and column starting at zero at A1. Actions are:

| Action | Data fields, in addition to recorded `player` |
| --- | --- |
| Placement | `type: "place"`, `point` |
| Time | `type: "time"`, `source`, `target` |
| Lock | `type: "lock"` |
| Pass | `type: "pass"` |

Import replays every action from the empty board and checks players, legality and the final checkpoint. It reconstructs `H`, the locked boundary, birth indices, chronological boards, actual visited pairs, turn, pass count and result. A diagram of the present board cannot substitute for this provenance. The checkpoint detects inconsistency; it is not a cryptographic signature.

Review preserves the future line, and export includes that future even when the cursor is earlier. Playing from an earlier cursor requires confirmation and replaces only the later actual turns. The branch uses repetition history up to that cursor, not the discarded future. Export first to retain both continuations.

## Local practice opponent

The opponent runs in a local module worker and uses the same engine and complete replay record as human play. It considers placement, time, Lock and pass. It uses no trained model or board-only transposition cache. Evaluation estimates current material, liberties and area; this is a heuristic, not a solved value.

Default search limits are two plies, a six-action root beam, at most 192 root and 96 reply candidates per position, and at most 1,200 legality probes including rejected actions. A 900 ms soft budget stops further probes. A separate 2,500 ms worker deadline terminates the computation, including record reconstruction. Time candidates interleave eligible living births and prioritize nearby arrivals and the locked boundary; long histories are sampled, never shortened for legality. Lock, time and pass candidates retain representation in the beam when available. A deeper iteration is used only after every selected root candidate has completed the same bounded reply scan.

Candidate sampling and shallow search can miss tactics and longer plans. Playing strength is uncalibrated. Two independently specified local survival fixtures check that the opponent can select a needed time defense and a needed Lock; they do not establish general playing strength or balance.

Changing a position, cancelling, or disposing the opponent terminates its worker. Before applying a reply, the host checks the complete document, cursor and revision and revalidates the action against the current native state. Review requires explicit approval before the computer can replace the future. Timeouts and errors leave the position unchanged and permit retry or human continuation.
