The Ruleset

Game rules

01 — The board

The game is played on a rectangular grid of four tile types:

  • Plains — empty passable tiles you spread onto. Moving onto a neutral plain simply makes it yours.
  • Mountains — impassable and permanent. Moves into a mountain are invalid.
  • Castlesplayer-built structures (see Building castles). A standing castle produces army for its owner like a general and can be captured in combat. Maps start with no castles — every castle on the board was built by someone. (Type 3 in the bot observation.)
  • Generals — each player's home base. Lose yours and the game is over.

Map generation

Every match is played on a freshly generated map with these parameters:

ParameterValue
Board sizerectangular — each side drawn independently in 18–21 per game
Mountainsabout 20–24% of the board (66–105 tiles)
Castlesnone at the start — castles are built by the players
Generalsat least 17 BFS steps apart over plain tiles
Connectivitya passable path between the generals is guaranteed

Maps are random per game — seeds are not reused, so bots can't be tuned to known layouts.

Reading the engine source? mountain_density_range = (0.24, 0.26) is sampled before generation carves 9–11 mountain tiles into castle sites (removed again under this ruleset) — what's left on the board is the 66–105 above.

02 — Turns & moves

Corner cases

Both moves happen on the same turn, but one resolves fully before the other. Priority, highest first — a tie on one rule falls through to the next:

  1. Chasing — your move targets the cell the opponent's move starts from. You catch them before they leave.
  2. Reinforcing — your move lands on a cell you own. E.g. they move to capture your general while you move a unit back into it: the reinforcement lands first and the defense holds.
  3. Smaller army — otherwise, the move from the smaller cell resolves first.
  • Both generals captured on the same turn → the match is a draw.

Note: a recent generals.io update resolves simultaneous general captures by swapping the two players' land and armies. This competition keeps the older rule — it's a draw.

03 — Building castles

There are no neutral castles to capture — you build your own. A build is a full action (it replaces your move that turn) and permanently turns one of your plain cells into a castle.

Distance to your nearest structureSurchargePrice
adjacent+1247
2+1045
3+843
4+641
5+439
6+237
7 or more+035

Surcharges stack: squeezing a castle between your general and another castle, both at distance 2, costs 35 + 10 + 10 = 55. Prices are live — every castle you gain, built or captured, raises your own prices near it. Enemy structures never affect what you pay.

Corner cases
  • Builds resolve before either player's move each turn.
  • You can only build on your own cells, and prices depend only on your own structures — the two players' builds can never conflict.
  • A castle captured from the enemy is yours from then on: it produces for you and counts toward your build prices.
  • Castles are permanent — they never revert to plains, they only change owners.

The extended action space

An action is still one line of five integers, <pass> <row> <col> <dir> <split> — the first field now has three values:

04 — Army growth

05 — Combat & capture

Moving onto a cell an opponent owns starts a combat: the two armies subtract, and the attacker takes the cell only with strictly more army, keeping the difference. On an exact tie the defender keeps the cell.

Castles defend like any owned cell — there are no neutral garrisons. Capture an enemy castle and it produces for you.

Capturing the enemy general wins instantly.

06 — Visibility

The competition is played with fog of war — exactly like the original generals.io. Each bot sees only the cells next to tiles it owns; the rest of the board is hidden. Tiles you've scouted fade back into fog once you move away, and you can't see an enemy's army or moves outside your vision. Scouting, remembering the map, and inferring where the enemy is are part of the game.

07 — How a game ends

08 — Match constraints

Matches run on our infrastructure under these limits:

For the bot interface, starter agents, and how to submit, see Get started.