diff --git a/AI.py b/AI.py index 12003f0..1c91fb0 100644 --- a/AI.py +++ b/AI.py @@ -35,3 +35,6 @@ def turn(self, world): print("its turn 2!!!") world.put_unit(base_unit=world.get_me().hand[0], path=world.get_me().paths_from_player[0]) + def end(self, world, scores): + print("ending") + diff --git a/controller.py b/controller.py index f2ca6e0..df5ad09 100644 --- a/controller.py +++ b/controller.py @@ -38,6 +38,10 @@ def handle_message(self, message): elif message[ServerConstants.KEY_TYPE] == ServerConstants.MESSAGE_TYPE_SHUTDOWN: + # new_world = World(world=self.world) + # new_world._handle_turn_message(message[ServerConstants.KEY_INFO]["turnMessage"]) + # scores_map = new_world._handle_end_message(message[ServerConstants.KEY_INFO]["scores"]) + # self.client.end(new_world, scores_map) self.terminate() def launch_on_thread(self, action, world): diff --git a/world.py b/world.py index f808a16..965ffc8 100644 --- a/world.py +++ b/world.py @@ -581,3 +581,6 @@ def _get_paths_starting_with(self, first, paths): if c_path.cells[0] == first: ret.append(c_path) return ret + + def _handle_end_message(self, scores_list_msg): + return dict([(score["playerId"], score["score"]) for score in scores_list_msg])