Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"Bash(go build:*)",
"Bash(task:*)",
"Bash(uv run pytest:*)",
"Bash(uv run ty:*)",
"Bash(uv run ruff:*)",
"Bash(tree:*)"
]
}
Expand Down
2 changes: 0 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ tasks:
- bot2:lint
- bot2:format
- bot2:typecheck
- bot2:test:unit

#
# backend (golang) tasks
Expand Down Expand Up @@ -164,7 +163,6 @@ tasks:
cmds:
- task: be:build
- task: be:vet
- task: be:test

be:run:
dir: backend
Expand Down
8 changes: 5 additions & 3 deletions bot2/src/bot/bots/neural_net_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,15 @@ class NeuralNetBotRunner:

def __init__(
self,
client: GameClient,
network: ActorCriticNetwork,
client: GameClient | None = None,
config: NeuralNetBotConfig | None = None,
) -> None:
"""Initialize the bot runner.

Args:
client: GameClient for server communication
network: Trained ActorCriticNetwork for inference
client: GameClient for server communication (can be set later)
config: Optional configuration for the neural net bot
"""
self.client = client
Expand All @@ -318,8 +318,10 @@ async def on_game_state(self, state: GameState) -> None:
state: Current game state from the server

Raises:
ValueError: If the client's player_id is not set
ValueError: If the client is not set or client's player_id is not set
"""
if self.client is None:
raise ValueError("Client must be set before calling on_game_state")
if self.bot is None:
if self.client.player_id is None:
raise ValueError(
Expand Down
8 changes: 5 additions & 3 deletions bot2/src/bot/bots/rule_based_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,13 @@ class RuleBasedBotRunner:

def __init__(
self,
client: GameClient,
client: GameClient | None = None,
config: RuleBasedBotConfig | None = None,
) -> None:
"""Initialize the bot runner.

Args:
client: The game client for server communication.
client: The game client for server communication (can be set later).
config: Optional configuration for the rule-based bot.
"""
self.client = client
Expand All @@ -405,8 +405,10 @@ async def on_game_state(self, state: GameState) -> None:
state: The current game state from the server.

Raises:
ValueError: If the client's player_id is not set.
ValueError: If the client is not set or client's player_id is not set.
"""
if self.client is None:
raise ValueError("Client must be set before calling on_game_state")
if self.bot is None:
if self.client.player_id is None:
raise ValueError(
Expand Down
2 changes: 1 addition & 1 deletion bot2/src/bot/gym/opponent_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async def start(self, room_code: str, room_password: str = "") -> None:
)

# Initialize the bot runner
self._runner = RuleBasedBotRunner(self._client, self.config)
self._runner = RuleBasedBotRunner(client=self._client, config=self.config)
self._running = True

self._logger.info(
Expand Down
12 changes: 12 additions & 0 deletions bot2/src/bot/service/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
"""Bot service layer - WebSocket connectivity and bot lifecycle management."""

from bot.service.bot_manager import (
BotConfig,
BotInfo,
BotManager,
SpawnBotRequest,
SpawnBotResponse,
)
from bot.service.websocket_bot import (
BotRunnerProtocol,
WebSocketBotClient,
Expand All @@ -10,4 +17,9 @@
"BotRunnerProtocol",
"WebSocketBotClient",
"WebSocketBotClientConfig",
"BotConfig",
"BotInfo",
"BotManager",
"SpawnBotRequest",
"SpawnBotResponse",
]
Loading
Loading