Skip to content

Add LightCycles arena (Tron light-cycles) - #117

Merged
john-b-yang merged 3 commits into
mainfrom
light-cycles
Jul 9, 2026
Merged

john-b-yang merged 3 commits into
mainfrom
light-cycles

Conversation

@john-b-yang

Copy link
Copy Markdown
Contributor

Summary

Adds LightCycles, a Tron light-cycles arena. Players drive cycles around a bordered grid leaving solid trails; every tick all cycles move one cell simultaneously, and you crash (are eliminated) if you move into a wall/border, a rock, any trail (yours or an opponent's), or the same cell as another cycle (head-on/swap). Last cycle riding wins; all-crash-same-tick is a draw; at the tick cap the most territory (trail cells) wins.

The game engine lives in its own repo (cloned by the Dockerfile, matching the other arenas): CodeClash-ai/LightCycles.

Bot API

def get_move(obs: dict) -> str:   # "N" | "S" | "E" | "W"

obs gives full deterministic state each tick: tick/max_ticks, width/height, you (id), players ({id, x, y, dir, alive}), and grid (grid[y][x] = player id >=0, -1 empty, or -2 rock). Reversing into your own neck / invalid / crashing / slow moves fall back to continuing straight.

Features

  • Deterministic + replayable, seeded per sim (start positions/directions and rock layout vary per seed).
  • Rock obstacles placed with 180° rotational symmetry, spawn clearance, and a connectivity check so nobody starts boxed in (ROCK_DENSITY knob; 0 = open board). Obstacles are true to the 2009 Waterloo/Google Tron challenge's walled maps.
  • N-player capable (2-player default, cycles placed on a circle).
  • Replay renderer — rebuilds trails from head history, draws bright heads + crash markers + gray rocks, and reports per-sim winners via peek_winner (also surfaced in the shared replay index).
  • Space-maximizing starter bot (flood-fill) + README documenting the API.

Testing

  • Deterministic (same seed → identical games); starter beats a naive bot 20–0 / 15–0; 4-player free-for-all works.
  • Rock layouts verified symmetric + connected + spawn-clear.
  • Full codeclash run configs/test/lightcycles.yaml end-to-end (Docker build, sim, scoring, replay) passes.
Thin arena wrapper cloning CodeClash-ai/LightCycles, replay renderer (trail
accumulation + head/crash markers, per-sim winner via peek_winner), registration,
and test config.
…in _round_message)

The commit-label refactor added Player._round_message reading config['commit_label'],
which PvP/ladder set but single-player did not, breaking test_single_player_battlesnake.
@john-b-yang
john-b-yang merged commit a264955 into main Jul 9, 2026
5 checks passed
@john-b-yang
john-b-yang deleted the light-cycles branch July 9, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant