- Have the highest score when the game ends.
A higher resolution is required to access the IDE
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
This is a league based challenge.
Goal
Control your elemental tribe, hunt your prey, avoid your predator, and capture more enemies than your opponents to win the battlefield!
Rules
The game is played by 3 players on a square grid. Each player controls a tribe of elementals.
Each tribe has one element:
W : 💧 WaterF : 🔥 FireP : 🌿 Plant
The tribes follow a cyclic relationship:
- 💧 Water captures 🔥 Fire.
- 🔥 Fire captures 🌿 Plant.
- 🌿 Plant captures 💧 Water.
🗺️ Map
The map is a square grid made of the following cells:
. : an empty walkable cell.# : a wall.W ,F ,P : the camps of the three tribes.
Camps are walkable cells. Walls are not walkable.
All border cells of the grid are walls.
🎬 Actions
Each turn, output at least one command. Commands are separated by semicolons (
id MOVE x y : orders your elemental id to move one step toward the target cell (x, y).id WAIT : orders your elemental id to stay in place.MSG [text] : displays a global message under your score. It does not target an elemental. The latest message remains visible until it is replaced. If no text is provided, the message is cleared.
You may provide commands for only some of your elementals. Elementals without a command will wait.
If multiple commands target the same elemental in one turn, only the first is applied and the others are ignored.
↪️ Movement
A
Movement is 4-directional only (north, east, south, west); diagonal moves are not allowed.
If multiple shortest paths exist, the first step is chosen using this fixed priority order: north, then east, then south, then west.
If the target cannot be reached, the elemental stays in place.
Elementals can move through camps and through other elementals. Only walls block movement.
⚔️ Captures
After all players' moves have been processed, all captures are resolved simultaneously.
If an elemental shares a cell with one or more elementals of its predator tribe, it is captured.
A captured elemental becomes a prisoner and is moved to the camp of the tribe that captured it.
Each captured elemental gives 1 point to the capturing tribe. Points are permanent, but a player who times out or outputs an invalid command loses the game regardless of the points they have earned.
Multiple elementals can stand on the same cell. A stack is not stronger than a single elemental: one predator is enough to capture all prey elementals on the cell.
If all three tribes are present on the same cell, the three tribes capture each other simultaneously.
Nothing special happens when a prey elemental enters an enemy camp: camps do not capture by themselves. Captures only occur when predator and prey elementals share the same cell.
🔓 Prisoners
A prisoner cannot move.
Prisoners do not participate in captures. They are ignored during capture resolution.
⛔ Game End
The game ends when one of the following happens:
- At least one player has all of their elementals imprisoned after turn resolution.
- 200 turns have passed.
- A player times out or outputs an invalid command.
- Your program times out, crashes, or outputs an invalid command.
Technical Details
- All players receive the full map and the full list of elementals.
- All tribes have exactly one camp and the same number of elementals.
- Elemental identifiers are unique within a tribe.
- Several elementals may occupy the same cell.
- If a tribe is fully imprisoned, the game ends immediately and players are ranked by cumulative captures.
- In the settings, you can enable grid display to show cell coordinates on hover.
Click to expand
Game Protocol
Line 1: myTribe, your tribe (
Line 2: mapSize (integer), the size of the square map.
Next mapSize lines: one row of the map, containing mapSize characters.
. : empty walkable cell.# : wall.W ,F ,P : tribe camps.
Line 1: three space-separated integers: scoreW scoreF scoreP, the current scores of Water (W), Fire (F), and Plant (P) tribes.
Line 2: elementalsCount (integer), the total number of elementals in the game.
Next elementalsCount lines: the following space-separated values for each elemental:
- elementalId (integer): the identifier of this elemental, unique within its tribe.
- tribe: the elemental's tribe (
W ,F orP ). - x (integer): X coordinate,
0 is the left edge. - y (integer): Y coordinate,
0 is the top edge. - prisoner:
1 if this elemental is prisoner,0 otherwise.
A single line containing at least one command and at most elementalsCount commands.
id MOVE x y : move elemental id one step toward the target cell (x, y).id WAIT : keep elemental id in place.MSG [text] : display a global message under your score. It does not target an elemental. The latest message remains visible until it is replaced. If no text is provided, the message is cleared.
Commands must be separated by semicolons (
Example:
0 MOVE 5 3;1 WAIT;2 MOVE 7 4
elementalsCount =
Response time for the first turn ≤
Response time per turn ≤

- Control multiple elementals.
- Release imprisoned elementals.
- Larger maps with more elementals per tribe.
Story
In a world shaped by primal forces, three elemental tribes wage an endless war for dominance. The Water, Fire, and Plant clans are bound by an ancient cycle of power, where each element can overpower another but is also vulnerable in turn.
Driven by instinct and survival, these elementals roam the battlefield, capturing enemies and rescuing allies to strengthen their ranks. Only the most cunning leader will master this delicate balance of aggression and caution.
Will you harness the cycle… or be consumed by it?
A higher resolution is required to access the IDE