From: zharkovstas Date: Sat, 18 May 2019 21:29:01 +0000 (+0500) Subject: Return route after finish X-Git-Url: https://git.xn--bdkaa.com/?a=commitdiff_plain;h=bdb0c9511b1a87088d602b95ce214fcd1ce494ce;p=where-are-you.py.git Return route after finish --- diff --git a/app.py b/app.py index 9b05865..a2290f5 100644 --- a/app.py +++ b/app.py @@ -25,6 +25,7 @@ class Game: self.distance = None self.tips = [] self.shown_tips = [] + self.route = [current_coordinates] def move(self, direction, value=move_distance): if direction == 'north': @@ -36,6 +37,8 @@ class Game: elif direction == 'west': self.current_coordinates = self.current_coordinates[0], move_coordinate(self.current_coordinates[1], -value) + self.route.append(self.current_coordinates) + def add_tips(game): radius = 0.0025 @@ -268,7 +271,8 @@ def finish_game(game_id): return { "right_coordinates": game.current_coordinates, "distance": d, - "address": get_text_by_coordinates(game.current_coordinates) + "address": get_text_by_coordinates(game.current_coordinates), + "route": game.route } @get('/')