Skip to content

Commit c74d869

Browse files
committed
Prompt rendering working
1 parent ddca6b7 commit c74d869

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

codeclash/agents/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from codeclash.agents.dummy import Dummy
33
from codeclash.agents.minisweagent import MiniSWEAgent
44
from codeclash.agents.utils import GameContext
5+
from codeclash.constants import DIR_WORK
56
from codeclash.games.abstract import CodeGame
67

78

@@ -21,11 +22,10 @@ def get_agent(config: dict, prompts: dict, game: CodeGame) -> Player:
2122
GameContext(
2223
id=game.game_id,
2324
name=game.name,
24-
num_players=len(game.config["players"]),
25-
player_ids=[p["name"] for p in game.config["players"]],
2625
player_id=config["name"],
2726
prompts=prompts,
2827
round=1,
2928
rounds=game.rounds,
29+
working_dir=str(DIR_WORK),
3030
),
3131
)

codeclash/agents/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class GameContext:
3131
prompts: dict
3232
round: int
3333
rounds: int
34+
working_dir: str
3435

3536
def render_and_set_prompts(self):
3637
"""Render and set prompts using the current game context."""

configs/battlesnake.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ players:
1515
prompts:
1616
game_description: |
1717
You are a software developer ({{player_id}}) competing in a coding game called BattleSnake.
18-
Your bot (`main.py`) controls a snake on a grid-based board. Snakes collect food, avoid collisions, and try to outlast their opponents.
19-
- Round: {{round}} / {{rounds}}
20-
- Opponents: {{player_ids}}
21-
- Goal: Win the next round.
18+
Your bot (`main.py`) controls a snake on a grid-based board.
19+
Snakes collect food, avoid collisions, and try to outlast their opponents.
20+
- Round: {{round}}/{{rounds}}
21+
- Goal: Improve your bot, win the next round.
2222
23-
Your task: improve the bot in `main.py`, located in {{working_dir}}, the codebase containing both your bot and supporting assets.
23+
Your task: improve the bot in `main.py`, located in {{working_dir}}.
24+
{{working_dir}} is your codebase, which contains both your bot and supporting assets.
2425
2526
The details of the game are fully available within this codebase.
2627
- `docs/`: Game documentation

0 commit comments

Comments
 (0)