]> git.xn--bdkaa.com Git - where-are-you.py.git/commitdiff
Return route after finish
authorzharkovstas <zharkovstas@skbkontur.ru>
Sat, 18 May 2019 21:29:01 +0000 (02:29 +0500)
committerzharkovstas <zharkovstas@skbkontur.ru>
Sat, 18 May 2019 22:14:57 +0000 (03:14 +0500)
app.py

diff --git a/app.py b/app.py
index 9b05865bd92d1a5088fa764acbc6f6a860af65cc..a2290f5a756f8f32ad0fc51252dca92c0fbb88c2 100644 (file)
--- 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('/')