def construct_simulation_runner(self, avatars, locations): self.avatar_manager = DummyAvatarManager(avatars) self.avatar_manager.avatars_by_id = dict(enumerate(avatars)) self.game_state = MockGameState(InfiniteMap(), self.avatar_manager) self.simulation_runner = ConcurrentSimulationRunner( game_state=self.game_state, communicator=MockCommunicator()) for index, location in enumerate(locations): self.simulation_runner.add_avatar(index, location)
def __init__(self, worker_manager_class, game_state_generator, django_api_url, port): super(GameRunner, self).__init__() self.worker_manager = worker_manager_class(port=port) self.game_state = game_state_generator(AvatarManager()) self.communicator = DjangoCommunicator(django_api_url=django_api_url, completion_url=django_api_url + 'complete/') self.simulation_runner = ConcurrentSimulationRunner( communicator=self.communicator, game_state=self.game_state) self._end_turn_callback = lambda: None
def __init__( self, game_state_generator, communicator: DjangoCommunicator, port, worker_manager_class=WorkerManager, ): super(GameRunner, self).__init__() self.worker_manager = worker_manager_class(port=port) self.game_state = game_state_generator(AvatarManager()) self.communicator = communicator self.simulation_runner = ConcurrentSimulationRunner( communicator=self.communicator, game_state=self.game_state) self._end_turn_callback = lambda: None
def __init__( self, game_state_generator, communicator: DjangoCommunicator, port, turn_collector: "TurnCollector", ): super(GameRunner, self).__init__() self.game_state: "GameState" = game_state_generator(AvatarManager()) self.communicator = communicator self.simulation_runner = ConcurrentSimulationRunner( communicator=self.communicator, game_state=self.game_state) self.turn_collector = turn_collector self.turn_collector.new_turn(self.game_state.turn_count) self._end_turn_callback = lambda: None