-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathmain.py
More file actions
21 lines (17 loc) · 758 Bytes
/
main.py
File metadata and controls
21 lines (17 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import itertools
import datetime
import sys
from spirecomm.communication.coordinator import Coordinator
from spirecomm.ai.agent import SimpleAgent
from spirecomm.spire.character import PlayerClass
if __name__ == "__main__":
agent = SimpleAgent()
coordinator = Coordinator()
coordinator.signal_ready()
coordinator.register_command_error_callback(agent.handle_error)
coordinator.register_state_change_callback(agent.get_next_action_in_game)
coordinator.register_out_of_game_callback(agent.get_next_action_out_of_game)
# Play games forever, cycling through the various classes
for chosen_class in itertools.cycle(PlayerClass):
agent.change_class(chosen_class)
result = coordinator.play_one_game(chosen_class)