Skip to content

Commit 412ec7f

Browse files
committed
Add Halite configs v0
1 parent c744dca commit 412ec7f

38 files changed

Lines changed: 1752 additions & 8 deletions

File tree

codeclash/games/halite/halite.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from codeclash.games.game import CodeGame, RoundStats
1313

1414
HALITE_LOG = "sim_{idx}.log"
15-
HALITE_SUBMISSION = "submission"
1615
HALITE_HIDDEN_EXEC = ".codeclash_exec"
1716

1817
# Command to be run in each agent's `submission/` folder to compile agent
@@ -36,20 +35,21 @@
3635

3736
class HaliteGame(CodeGame):
3837
name: str = "Halite"
39-
description: str = f"""Halite is a multi-player turn-based strategy game where bots compete on a rectangular grid to capture territory and accumulate strength.
38+
description: str = """Halite is a multi-player turn-based strategy game where bots compete on a rectangular grid to capture territory and accumulate strength.
4039
Players control pieces that can move across the map to conquer neutral and enemy territory, with each cell providing production that increases the strength of pieces occupying it.
4140
The goal is to control the most territory by the end of the game through strategic expansion, consolidation of forces, and tactical combat decisions.
4241
4342
You have the choice of writing your Halite bot in one of four programming languages: C, C++, OCaml, or Rust.
4443
Example implementations can be found under the `airesources/` folder.
45-
Your submission should be stored in the `{HALITE_SUBMISSION}/` folder. This folder currently contains an example C bot, but feel free to use any of the supported languages.
44+
Your submission should be stored in the `submission/` folder. This folder currently contains an example C bot, but feel free to use any of the supported languages.
4645
Please make sure your main file is named `main.<ext>`, where `<ext>` is the appropriate file extension for your chosen programming language.
4746
You may include additional files as needed, but please ensure:
4847
1. The `submission/` folder contains only files relevant to your bot.
4948
2. The `submission/` folder ONLY contains a single bot (no multiple bots in one submission).
5049
3. Your bot can be compiled. See `runGame.sh` under the corresponding `submission/<language>/` folder to see how we will compile and run your bot.
5150
"""
5251
default_args: dict = {}
52+
submission: str = "submission"
5353

5454
def __init__(self, config, **kwargs):
5555
super().__init__(config, **kwargs)
@@ -123,7 +123,7 @@ def get_results(self, agents: list[Player], round_num: int, stats: RoundStats):
123123
def validate_code(self, agent: Player) -> tuple[bool, str | None]:
124124
# Check that there is a *single* file called "main.<ext>" in the submission folder
125125
# and that <ext> is one of the supported file types
126-
sub_path = Path(agent.environment.config.cwd) / HALITE_SUBMISSION
126+
sub_path = Path(agent.environment.config.cwd) / self.submission
127127
ls_output = agent.environment.execute("ls", cwd=sub_path)["output"]
128128
main_files = [
129129
fname
@@ -144,15 +144,15 @@ def validate_code(self, agent: Player) -> tuple[bool, str | None]:
144144
try:
145145
compile_response = agent.environment.execute(compile_cmd, timeout=15, cwd=sub_path)
146146
except subprocess.TimeoutExpired:
147-
return False, f"Compilation failed (ran {compile_cmd} inside {HALITE_SUBMISSION}): timed out"
147+
return False, f"Compilation failed (ran {compile_cmd} inside {self.submission}): timed out"
148148
if compile_response["returncode"] != 0:
149149
return (
150150
False,
151-
f"Compilation failed (ran {compile_cmd} inside {HALITE_SUBMISSION}): {compile_response['output']}",
151+
f"Compilation failed (ran {compile_cmd} inside {self.submission}): {compile_response['output']}",
152152
)
153153

154154
# Check that submission runs in competition
155-
executable = MAP_FILE_TYPE_TO_RUN[main_ext].format(path=HALITE_SUBMISSION, name="main")
155+
executable = MAP_FILE_TYPE_TO_RUN[main_ext].format(path=self.submission, name="main")
156156
run_cmd = f"./environment/halite {shlex.join([executable, executable])}"
157157
try:
158158
run_response = agent.environment.execute(run_cmd, timeout=15)
@@ -162,6 +162,6 @@ def validate_code(self, agent: Player) -> tuple[bool, str | None]:
162162
return False, f"Submission failed to run (ran {run_cmd}): {run_response['output']}"
163163

164164
# Record command to run executable to hidden file
165-
executable_comp = MAP_FILE_TYPE_TO_RUN[main_ext].format(path=f"/{agent.name}/{HALITE_SUBMISSION}", name="main")
165+
executable_comp = MAP_FILE_TYPE_TO_RUN[main_ext].format(path=f"/{agent.name}/{self.submission}", name="main")
166166
agent.environment.execute(f'echo "{executable_comp}" > {HALITE_HIDDEN_EXEC}')
167167
return True, None
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
tournament:
2+
rounds: 15
3+
game:
4+
name: Halite
5+
sims_per_round: 250
6+
args: {}
7+
players:
8+
- agent: mini
9+
name: claude-sonnet-4-20250514
10+
config:
11+
agent: !include mini/default.yaml
12+
model:
13+
model_name: '@anthropic/claude-sonnet-4-20250514'
14+
model_class: portkey
15+
model_kwargs:
16+
temperature: 0.2
17+
max_tokens: 4096
18+
- agent: mini
19+
name: claude-sonnet-4-5-20250929
20+
config:
21+
agent: !include mini/default.yaml
22+
model:
23+
model_name: '@anthropic/claude-sonnet-4-5-20250929'
24+
model_class: portkey
25+
model_kwargs:
26+
temperature: 0.2
27+
max_tokens: 4096
28+
prompts:
29+
game_description: |-
30+
You are a software developer ({{player_id}}) competing in a coding game called Halite.
31+
Halite is a multi-player turn-based strategy game where bots compete on a rectangular grid to capture territory and accumulate strength.
32+
Players control pieces that can move across the map to conquer neutral and enemy territory, with each cell providing production that increases the strength of pieces occupying it.
33+
The goal is to control the most territory by the end of the game through strategic expansion, consolidation of forces, and tactical combat decisions.
34+
35+
You have the choice of writing your Halite bot in one of four programming languages: C, C++, OCaml, or Rust.
36+
Example implementations can be found under the `airesources/` folder.
37+
Your submission should be stored in the `submission/` folder. This folder currently contains an example C bot, but feel free to use any of the supported languages.
38+
Please make sure your main file is named `main.<ext>`, where `<ext>` is the appropriate file extension for your chosen programming language.
39+
You may include additional files as needed, but please ensure:
40+
1. The `submission/` folder contains only files relevant to your bot.
41+
2. The `submission/` folder ONLY contains a single bot (no multiple bots in one submission).
42+
3. Your bot can be compiled. See `runGame.sh` under the corresponding `submission/<language>/` folder to see how we will compile and run your bot.
43+
44+
45+
The game is played in 15 rounds. For every round, you (and your competitors) edit program code that controls your bot. This is round {{round}}.
46+
After you and your competitor finish editing your codebases, the game is run automatically.
47+
48+
Your task: improve the bot in `submission`, located in {{working_dir}}.
49+
{{working_dir}} is your codebase, which contains both your both and supporting assets.
50+
All of your commands will be executed in the {{working_dir}} directory (see notes below).
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
tournament:
2+
rounds: 15
3+
game:
4+
name: Halite
5+
sims_per_round: 250
6+
args: {}
7+
players:
8+
- agent: mini
9+
name: claude-sonnet-4-20250514
10+
config:
11+
agent: !include mini/default.yaml
12+
model:
13+
model_name: '@anthropic/claude-sonnet-4-20250514'
14+
model_class: portkey
15+
model_kwargs:
16+
temperature: 0.2
17+
max_tokens: 4096
18+
- agent: mini
19+
name: gemini-2.5-pro
20+
config:
21+
agent: !include mini/default.yaml
22+
model:
23+
model_name: '@google/gemini-2.5-pro'
24+
model_class: portkey
25+
model_kwargs:
26+
temperature: 0.2
27+
prompts:
28+
game_description: |-
29+
You are a software developer ({{player_id}}) competing in a coding game called Halite.
30+
Halite is a multi-player turn-based strategy game where bots compete on a rectangular grid to capture territory and accumulate strength.
31+
Players control pieces that can move across the map to conquer neutral and enemy territory, with each cell providing production that increases the strength of pieces occupying it.
32+
The goal is to control the most territory by the end of the game through strategic expansion, consolidation of forces, and tactical combat decisions.
33+
34+
You have the choice of writing your Halite bot in one of four programming languages: C, C++, OCaml, or Rust.
35+
Example implementations can be found under the `airesources/` folder.
36+
Your submission should be stored in the `submission/` folder. This folder currently contains an example C bot, but feel free to use any of the supported languages.
37+
Please make sure your main file is named `main.<ext>`, where `<ext>` is the appropriate file extension for your chosen programming language.
38+
You may include additional files as needed, but please ensure:
39+
1. The `submission/` folder contains only files relevant to your bot.
40+
2. The `submission/` folder ONLY contains a single bot (no multiple bots in one submission).
41+
3. Your bot can be compiled. See `runGame.sh` under the corresponding `submission/<language>/` folder to see how we will compile and run your bot.
42+
43+
44+
The game is played in 15 rounds. For every round, you (and your competitors) edit program code that controls your bot. This is round {{round}}.
45+
After you and your competitor finish editing your codebases, the game is run automatically.
46+
47+
Your task: improve the bot in `submission`, located in {{working_dir}}.
48+
{{working_dir}} is your codebase, which contains both your both and supporting assets.
49+
All of your commands will be executed in the {{working_dir}} directory (see notes below).
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
tournament:
2+
rounds: 15
3+
game:
4+
name: Halite
5+
sims_per_round: 250
6+
args: {}
7+
players:
8+
- agent: mini
9+
name: claude-sonnet-4-20250514
10+
config:
11+
agent: !include mini/default.yaml
12+
model:
13+
model_name: '@anthropic/claude-sonnet-4-20250514'
14+
model_class: portkey
15+
model_kwargs:
16+
temperature: 0.2
17+
max_tokens: 4096
18+
- agent: mini
19+
name: glm-4-5
20+
config:
21+
agent: !include mini/default.yaml
22+
model:
23+
model_name: '@fireworks/accounts/fireworks/models/glm-4-5'
24+
model_class: portkey
25+
litellm_model_name_override: deepinfra/zai-org/GLM-4.5
26+
prompts:
27+
game_description: |-
28+
You are a software developer ({{player_id}}) competing in a coding game called Halite.
29+
Halite is a multi-player turn-based strategy game where bots compete on a rectangular grid to capture territory and accumulate strength.
30+
Players control pieces that can move across the map to conquer neutral and enemy territory, with each cell providing production that increases the strength of pieces occupying it.
31+
The goal is to control the most territory by the end of the game through strategic expansion, consolidation of forces, and tactical combat decisions.
32+
33+
You have the choice of writing your Halite bot in one of four programming languages: C, C++, OCaml, or Rust.
34+
Example implementations can be found under the `airesources/` folder.
35+
Your submission should be stored in the `submission/` folder. This folder currently contains an example C bot, but feel free to use any of the supported languages.
36+
Please make sure your main file is named `main.<ext>`, where `<ext>` is the appropriate file extension for your chosen programming language.
37+
You may include additional files as needed, but please ensure:
38+
1. The `submission/` folder contains only files relevant to your bot.
39+
2. The `submission/` folder ONLY contains a single bot (no multiple bots in one submission).
40+
3. Your bot can be compiled. See `runGame.sh` under the corresponding `submission/<language>/` folder to see how we will compile and run your bot.
41+
42+
43+
The game is played in 15 rounds. For every round, you (and your competitors) edit program code that controls your bot. This is round {{round}}.
44+
After you and your competitor finish editing your codebases, the game is run automatically.
45+
46+
Your task: improve the bot in `submission`, located in {{working_dir}}.
47+
{{working_dir}} is your codebase, which contains both your both and supporting assets.
48+
All of your commands will be executed in the {{working_dir}} directory (see notes below).
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
tournament:
2+
rounds: 15
3+
game:
4+
name: Halite
5+
sims_per_round: 250
6+
args: {}
7+
players:
8+
- agent: mini
9+
name: claude-sonnet-4-20250514
10+
config:
11+
agent: !include mini/default.yaml
12+
model:
13+
model_name: '@anthropic/claude-sonnet-4-20250514'
14+
model_class: portkey
15+
model_kwargs:
16+
temperature: 0.2
17+
max_tokens: 4096
18+
- agent: mini
19+
name: gpt-5-mini
20+
config:
21+
agent: !include mini/default.yaml
22+
model:
23+
model_name: '@openai/gpt-5-mini'
24+
model_class: portkey
25+
prompts:
26+
game_description: |-
27+
You are a software developer ({{player_id}}) competing in a coding game called Halite.
28+
Halite is a multi-player turn-based strategy game where bots compete on a rectangular grid to capture territory and accumulate strength.
29+
Players control pieces that can move across the map to conquer neutral and enemy territory, with each cell providing production that increases the strength of pieces occupying it.
30+
The goal is to control the most territory by the end of the game through strategic expansion, consolidation of forces, and tactical combat decisions.
31+
32+
You have the choice of writing your Halite bot in one of four programming languages: C, C++, OCaml, or Rust.
33+
Example implementations can be found under the `airesources/` folder.
34+
Your submission should be stored in the `submission/` folder. This folder currently contains an example C bot, but feel free to use any of the supported languages.
35+
Please make sure your main file is named `main.<ext>`, where `<ext>` is the appropriate file extension for your chosen programming language.
36+
You may include additional files as needed, but please ensure:
37+
1. The `submission/` folder contains only files relevant to your bot.
38+
2. The `submission/` folder ONLY contains a single bot (no multiple bots in one submission).
39+
3. Your bot can be compiled. See `runGame.sh` under the corresponding `submission/<language>/` folder to see how we will compile and run your bot.
40+
41+
42+
The game is played in 15 rounds. For every round, you (and your competitors) edit program code that controls your bot. This is round {{round}}.
43+
After you and your competitor finish editing your codebases, the game is run automatically.
44+
45+
Your task: improve the bot in `submission`, located in {{working_dir}}.
46+
{{working_dir}} is your codebase, which contains both your both and supporting assets.
47+
All of your commands will be executed in the {{working_dir}} directory (see notes below).
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
tournament:
2+
rounds: 15
3+
game:
4+
name: Halite
5+
sims_per_round: 250
6+
args: {}
7+
players:
8+
- agent: mini
9+
name: claude-sonnet-4-20250514
10+
config:
11+
agent: !include mini/default.yaml
12+
model:
13+
model_name: '@anthropic/claude-sonnet-4-20250514'
14+
model_class: portkey
15+
model_kwargs:
16+
temperature: 0.2
17+
max_tokens: 4096
18+
- agent: mini
19+
name: gpt-5
20+
config:
21+
agent: !include mini/default.yaml
22+
model:
23+
model_name: '@openai/gpt-5'
24+
model_class: portkey
25+
prompts:
26+
game_description: |-
27+
You are a software developer ({{player_id}}) competing in a coding game called Halite.
28+
Halite is a multi-player turn-based strategy game where bots compete on a rectangular grid to capture territory and accumulate strength.
29+
Players control pieces that can move across the map to conquer neutral and enemy territory, with each cell providing production that increases the strength of pieces occupying it.
30+
The goal is to control the most territory by the end of the game through strategic expansion, consolidation of forces, and tactical combat decisions.
31+
32+
You have the choice of writing your Halite bot in one of four programming languages: C, C++, OCaml, or Rust.
33+
Example implementations can be found under the `airesources/` folder.
34+
Your submission should be stored in the `submission/` folder. This folder currently contains an example C bot, but feel free to use any of the supported languages.
35+
Please make sure your main file is named `main.<ext>`, where `<ext>` is the appropriate file extension for your chosen programming language.
36+
You may include additional files as needed, but please ensure:
37+
1. The `submission/` folder contains only files relevant to your bot.
38+
2. The `submission/` folder ONLY contains a single bot (no multiple bots in one submission).
39+
3. Your bot can be compiled. See `runGame.sh` under the corresponding `submission/<language>/` folder to see how we will compile and run your bot.
40+
41+
42+
The game is played in 15 rounds. For every round, you (and your competitors) edit program code that controls your bot. This is round {{round}}.
43+
After you and your competitor finish editing your codebases, the game is run automatically.
44+
45+
Your task: improve the bot in `submission`, located in {{working_dir}}.
46+
{{working_dir}} is your codebase, which contains both your both and supporting assets.
47+
All of your commands will be executed in the {{working_dir}} directory (see notes below).
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
tournament:
2+
rounds: 15
3+
game:
4+
name: Halite
5+
sims_per_round: 250
6+
args: {}
7+
players:
8+
- agent: mini
9+
name: claude-sonnet-4-20250514
10+
config:
11+
agent: !include mini/default.yaml
12+
model:
13+
model_name: '@anthropic/claude-sonnet-4-20250514'
14+
model_class: portkey
15+
model_kwargs:
16+
temperature: 0.2
17+
max_tokens: 4096
18+
- agent: mini
19+
name: grok-code-fast-1
20+
config:
21+
agent: !include mini/default.yaml
22+
model:
23+
model_name: '@x-ai/grok-code-fast-1'
24+
model_class: portkey
25+
litellm_model_name_override: xai/grok-code-fast-1
26+
model_kwargs:
27+
temperature: 0.2
28+
prompts:
29+
game_description: |-
30+
You are a software developer ({{player_id}}) competing in a coding game called Halite.
31+
Halite is a multi-player turn-based strategy game where bots compete on a rectangular grid to capture territory and accumulate strength.
32+
Players control pieces that can move across the map to conquer neutral and enemy territory, with each cell providing production that increases the strength of pieces occupying it.
33+
The goal is to control the most territory by the end of the game through strategic expansion, consolidation of forces, and tactical combat decisions.
34+
35+
You have the choice of writing your Halite bot in one of four programming languages: C, C++, OCaml, or Rust.
36+
Example implementations can be found under the `airesources/` folder.
37+
Your submission should be stored in the `submission/` folder. This folder currently contains an example C bot, but feel free to use any of the supported languages.
38+
Please make sure your main file is named `main.<ext>`, where `<ext>` is the appropriate file extension for your chosen programming language.
39+
You may include additional files as needed, but please ensure:
40+
1. The `submission/` folder contains only files relevant to your bot.
41+
2. The `submission/` folder ONLY contains a single bot (no multiple bots in one submission).
42+
3. Your bot can be compiled. See `runGame.sh` under the corresponding `submission/<language>/` folder to see how we will compile and run your bot.
43+
44+
45+
The game is played in 15 rounds. For every round, you (and your competitors) edit program code that controls your bot. This is round {{round}}.
46+
After you and your competitor finish editing your codebases, the game is run automatically.
47+
48+
Your task: improve the bot in `submission`, located in {{working_dir}}.
49+
{{working_dir}} is your codebase, which contains both your both and supporting assets.
50+
All of your commands will be executed in the {{working_dir}} directory (see notes below).

0 commit comments

Comments
 (0)