Open now, until the end of 31 January 2027 (UTC). Every size started empty: the first grid sent for a size sets its record. Nobody knows the best answers, so every record here is new to mathematics. Found a bug? Tell us on Discord.
Contest · 30 October 2026 to 31 January 2027

Ant Escape.

Fill a grid with the numbers 0 to 3, then send an ant in from the left. Each number tells it how to turn. Keep it inside for as long as you can, on every grid from 10 × 10 to 34 × 34.

The rules

  • The ant walks on an n × n grid, and every cell holds a number from 0 to 3. When the ant enters a cell holding the number k, it makes k quarter-turns (90° each) clockwise, starting from the direction it was travelling: 0 to go straight, 1 to turn right, 2 to turn around, 3 to turn left.
  • Then the number on that cell goes up by one (3 goes back to 0), and the ant steps forward one cell. So the next time it visits, the same cell turns it a different way.
  • You choose the number in every cell, and the row where the ant walks in. It starts on the leftmost cell of that row, facing right, and the first thing it does is turn.
  • Your score for n is the number of steps the ant takes before it leaves the grid, counting the final step that takes it off the grid. More is better. The ant always gets out in the end: it can't get stuck in a loop.
  • Send the entry row (1 is the top row), a colon, then the cells row by row, each 0, 1, 2 or 3. The easiest way is the grid itself: 4:, then one line per row of the grid. Spaces and line breaks between cells don't matter, so all 100 digits of a 10 × 10 grid on one line works too.
  • Send a grid for each n from 10 to 34, as many times as you like: only your best grid for each n counts. Its score is your number of steps divided by the most steps anyone has found for that n, so the best grid scores 1. Your contest score is the total of your 25 scores, so a perfect score is 25. A size you skip scores 0. Ties go to whoever got there first.
  • Small grids, 1 × 1 to 9 × 9, are welcome too, but they don't count toward anyone's score. They have their own tab on the leaderboard, and they're there to record the best known for each size. Once more than one player reaches a small grid's record, it's shown as held by Multiple: there's no prize for getting there first. A record is marked proven once two independent searches, by different people with different code, agree that nothing better exists.
  • Two leaderboards: you choose one when you send your first grid. By Satellite: any method, AI included. By Lantern: no AI (what counts as AI). You take a short pledge, and if you finish near the top, you explain to the community how you did it. By Lantern entries count on both leaderboards. How the two leaderboards work.
  • Playing as a team? A team plays under one account and one leaderboard name, and one member sends the entries. Tick “We’re a team” on your account page and a team tag shows by your name. Each person plays in one place per contest: on one team, or on their own, not both. If any member uses AI, the whole team is By Satellite. The rules for teams.
  • No spoilers while it's open. Talk about the contest as much as you like, but don't share answers, detailed methods or code until it closes. What you can share.

How the scoring works, with three players. On 10 × 10, Ana’s best grid takes 200 steps, Ben’s 150 and Cleo’s 100. The most anyone has found is 200, so they score 1, 0.75 and 0.5. On 11 × 11, Ben has the record with 300 steps and Ana has 240, so Ben scores 1 and Ana 0.8; Cleo hasn’t sent one, so Cleo scores 0. The totals: Ana 1.8, Ben 1.75, Cleo 0.5. Now Cleo finds a 10 × 10 grid that takes 400 steps. That’s the new record, so Cleo scores 1 there, and Ana and Ben drop to 0.5 and 0.375. The totals become Ben 1.375, Ana 1.3, Cleo 1. Ben has passed Ana without sending anything: your score can go down when someone else finds something better.

Where this came from. Chris Langton invented his ant in 1986, in his paper “Studying artificial life with cellular automata”: it turns right on white, left on black, and flips the colour as it goes. Wikipedia has a good introduction to Langton’s ant. Greg Turk and Jim Propp gave the ant more colours, and A. K. Dewdney named the whole family turmites in his Scientific American column. Ours has four colours, and its numbers are simply how far it turns. The question this contest asks, how long an ant can be kept inside a box, comes from Kossi Roland Etse’s study of Langton’s ant (see also OEIS A282425). As far as Kossi Etse knows, nobody has studied the four-color version before, so every record here is new. Shut this ant in a box and it always escapes too, because every move can be undone: a walk that looped forever would have to lead back to the moment the ant walked in. How long can you keep it inside? Nobody knows.

For your own scripts. The best known for every size, with no grids, is at /api/contest/antescape/records (JSON), or add ?format=csv for a spreadsheet. Please use that rather than reading the leaderboard page: its format won’t change, and it updates every minute.

Tested by Dmitry Kamenetsky. Dmitry was the first to play Ant Escape, and he put it through its paces before launch. Many of his ideas are now part of it: sending grids one line per row, the Path and Visits views in the viewer, the Java and C++ scoring code, the satellite mark on the leaderboard, and the certificates in the Prizes. Thank you, Dmitry!

See how it works

The scoring code

As on the original site, here is the code that scores every entry, so you can check your own before you send it. It's written to be easy to read, not fast. Each version reads one entry per line and prints its score. We've checked all six against the site on over a thousand test grids, good and bad.