Skip to content

Commit

Permalink
client end added!
Browse files Browse the repository at this point in the history
  • Loading branch information
HamidrezaKmK committed Feb 4, 2020
1 parent df32ca8 commit 7baf803
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions AI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

4 changes: 4 additions & 0 deletions controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions world.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

0 comments on commit 7baf803

Please sign in to comment.