self.tips = []
self.shown_tips = []
- def move(self, direction, value=100):
+ def move(self, direction, value=300):
if direction == 'north':
self.current_coordinates = move_coordinate(self.current_coordinates[0], value), self.current_coordinates[1]
elif direction == 'south':
return 'зданием'
+def convert_direction(direction):
+ if direction == 'north':
+ return 'север'
+ if direction == 'south':
+ return 'юг'
+ if direction == 'east':
+ return 'восток'
+ if direction == 'west':
+ return 'запад'
+ return ''
+
+
def show_tips(game, count):
not_shown_tips = [tip for tip in game.tips if tip not in game.shown_tips]
add_tips(game)
- game.shown_tips.append('Вы переместились на 100 м на ' + direction)
+ game.shown_tips.append('Вы переместились на 100 м на ' + convert_direction(direction))
show_tips(game, 1)
w.set_lang('ru')
+cache = dict()
+
def parse_summary(query='str'):
- #print('query: ' + query)
+ if query in cache:
+ return cache[query]
+
try:
summary = w.summary(query)
full_description = re.split(r'\) —', summary)[1]
description = re.split(r'\.', full_description)[0]
+
+ cache[query] = (True, description.strip())
+
return True, description.strip()
except Exception:
+ cache[query] = (False, '')
return False, ''
+
if __name__ == '__main__':
print(parse_summary('Бебеля'))