Skip to content

Commit de29b49

Browse files
committed
Ref: Rename CodeGame.config to CodeGame.game_config
1 parent 9ca5509 commit de29b49

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

codeclash/games/abstract.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def __init__(self, config: dict):
3030
"""Artifact objects that we might want to clean up after the game."""
3131
self.scoreboard: list[tuple[int, str]] = []
3232
"""List of (round number, winner (player id))"""
33-
self.config: dict = config["game"]
34-
self.rounds: int = self.config.get("rounds", 1)
33+
self.game_config: dict = config["game"]
34+
self.rounds: int = self.game_config.get("rounds", 1)
3535
self.round: int = 0
3636
self.game_id: str = f"{self.name}{time.strftime('%y%m%d%H%M%S')}"
3737
self.log_env: Path = (DIR_WORK / DIR_LOGS / self.game_id).resolve()
@@ -86,7 +86,7 @@ def get_metadata(self) -> dict:
8686
return {
8787
"name": self.name,
8888
"scoreboard": self.scoreboard,
89-
"config": self.config,
89+
"config": self.game_config,
9090
"game_id": self.game_id,
9191
}
9292

codeclash/games/battlecode/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self, config):
1212
super().__init__(config)
1313
assert len(config["players"]) == 2, "BattleCode is a two-player game"
1414
self.run_cmd_round: str = "python run.py run"
15-
for arg, val in self.config.get("args", {}).items():
15+
for arg, val in self.game_config.get("args", {}).items():
1616
if isinstance(val, bool):
1717
if val:
1818
self.run_cmd_round += f" --{arg}"

codeclash/games/battlesnake/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class BattleSnakeGame(CodeGame):
1212
def __init__(self, config):
1313
super().__init__(config)
1414
self.run_cmd_round: str = "./battlesnake play"
15-
for arg, val in self.config.get("args", {}).items():
15+
for arg, val in self.game_config.get("args", {}).items():
1616
if isinstance(val, bool):
1717
if val:
1818
self.run_cmd_round += f" --{arg}"

codeclash/games/corewar/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CoreWarGame(CodeGame):
1010
def __init__(self, config):
1111
super().__init__(config)
1212
self.run_cmd_round: str = "./src/pmars"
13-
for arg, val in self.config.get("args", {}).items():
13+
for arg, val in self.game_config.get("args", {}).items():
1414
if isinstance(val, bool):
1515
if val:
1616
self.run_cmd_round += f" -{arg}"

codeclash/games/robocode/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class RoboCodeGame(CodeGame):
1111
def __init__(self, config):
1212
super().__init__(config)
1313
self.run_cmd_round: str = "./robocode.sh"
14-
for arg, val in self.config.get("args", {}).items():
14+
for arg, val in self.game_config.get("args", {}).items():
1515
if isinstance(val, bool):
1616
if val:
1717
self.run_cmd_round += f" -{arg}"
@@ -27,7 +27,7 @@ def _get_battle_config(self) -> str:
2727
},
2828
"battleField": {"width": 800, "height": 600},
2929
}
30-
user_battle_config = self.config.get("battle", {})
30+
user_battle_config = self.game_config.get("battle", {})
3131

3232
def merge_dicts(default, user):
3333
for key, value in user.items():

0 commit comments

Comments
 (0)