Bomberland
Bomberman-style multi-agent arena based on Coder One's Bomberland competition.
Overview
Bomberland is a grid-world arena where agents control several units, move around indestructible and destructible blocks, place timed bombs, and try to outscore the opponent through survival, damage, kills, and block destruction.
The upstream Bomberland project uses a TypeScript websocket engine and starter-kit agents. The CodeClash adapter keeps a pinned upstream checkout in the Docker image for provenance and starter-kit reference, while using a compact deterministic Python runtime for CodeClash tournament execution. This avoids requiring Docker Compose inside the arena container while preserving the same core agent shape: submitted code receives a game-state dictionary and returns one action per controlled unit.
Resources
Implementation
codeclash.arenas.bomberland.bomberland.BomberlandArena
BomberlandArena(config: dict, **kwargs)
Bases: CodeArena
Source code in codeclash/arenas/bomberland/bomberland.py
43 44 45 46 47 48 49 50 51 52 53 54 | |
name
class-attribute
instance-attribute
name: str = 'Bomberland'
submission
class-attribute
instance-attribute
submission: str = 'bomberland_agent.py'
description
class-attribute
instance-attribute
description: str = 'Bomberland is a Bomberman-style multi-agent arena based on Coder One\'s Bomberland competition.\n\nYour bot is a Python file named `bomberland_agent.py` that defines a callable named `next_actions`.\nThe callable receives a game-state dictionary and should return a dictionary mapping unit ids to actions:\n\n def next_actions(game_state):\n return {"unit_0": "up"}\n\nValid actions are `up`, `down`, `left`, `right`, `bomb`, `stay`, and `detonate` (to blow up one of\nyour own bombs early, e.g. the string `"detonate:x,y"` or `{"type": "detonate", "coordinates": [x, y]}`;\nbombs also explode automatically after their timer). Each round runs several deterministic seeded\ngames. Your units move on a destructible grid, place bombs, destroy blocks, damage opposing units,\nand score by survival, damage, kills, and block destruction. Bomb blasts (`x` entities) stay active\nbriefly and damage any unit standing on or moving into them.\n'
default_args
class-attribute
instance-attribute
default_args: dict = {'sims_per_round': 4, 'ticks': 80, 'width': 11, 'height': 11, 'unit_count': 3, 'agent_timeout': 0.25, 'validation_timeout': 5, 'timeout': 180}
validate_code
validate_code(agent: Player) -> tuple[bool, str | None]
Source code in codeclash/arenas/bomberland/bomberland.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
execute_round
execute_round(agents: list[Player]) -> None
Source code in codeclash/arenas/bomberland/bomberland.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
get_results
get_results(agents: list[Player], round_num: int, stats: RoundStats)
Source code in codeclash/arenas/bomberland/bomberland.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
Agent Interface
Your bot must be a Python file named bomberland_agent.py that defines next_actions.
def next_actions(game_state):
agent_id = game_state["connection"]["agent_id"]
unit_ids = game_state["agents"][agent_id]["unit_ids"]
return {unit_id: "stay" for unit_id in unit_ids}
Valid string actions are up, down, left, right, bomb, and stay. The runtime also accepts
dictionary move actions such as {"type": "move", "move": "up"} for compatibility with common
starter-kit styles.
Configuration Example
tournament:
rounds: 1
game:
name: Bomberland
sims_per_round: 2
args:
ticks: 40
width: 11
height: 11
unit_count: 3
players:
- agent: dummy
name: alpha
- agent: dummy
name: beta
Scoring
The arena runs sims_per_round deterministic seeded games. sims_per_round must be even so each
player receives both starting sides for paired seeds. Each player receives an average score computed
from surviving health, surviving units, enemy damage, kills, destroyed blocks, invalid actions, and
agent runtime errors.
Smoke Test
From the repository root, run the dummy-player example:
uv run codeclash run configs/examples/Bomberland__dummy__r1__s2.yaml -o /tmp/codeclash-bomberland-smoke
Use a fresh -o directory when rerunning the smoke check.
Expected shape:
- the command exits with status 0;
- both players pass submission validation;
- stdout includes
In round 0, the winner is ...andIn round 1, the winner is ...; - each round summary contains floating-point average scores for
alphaandbeta; - per-simulation details include
scores,stats,alive_units,alive_hp,ticks, andwinnerfields; - per-player
statsincludeagent_errorsandinvalid_actions; - the output directory contains
metadata.json,game.log,tournament.log, androunds/round_0.tar.gz/rounds/round_1.tar.gz.
The arena writes bomberland_results.json inside each round log with this shape:
{
"average_scores": {"alpha": 330.0, "beta": 330.0},
"total_scores": {"alpha": 660.0, "beta": 660.0},
"sims": 2,
"details": ["... per-simulation JSON strings ..."]
}
A representative metadata.json round contains a scores object with one floating-point average
score per player:
"scores": {
"alpha": 330.0,
"beta": 330.0
}
Exact values can change with arena configuration; the smoke check is meant to verify the Docker/runtime adapter path, player-name mapping, paired starting sides, and score/log artifact shape.
The exact tournament directory name includes a timestamp, so inspect the metadata with:
find /tmp/codeclash-bomberland-smoke -maxdepth 3 -name metadata.json -print