Ajout val de retour sur traitement des directions
Mauvais choix, l'impression n'apporte rien et l'abscence de retour manque pour la suite. Retour d'une erreur: "undLocalError: local variable 'direction' referenced before assignment"
This commit is contained in:
parent
7ab70178e9
commit
4ec037b3ad
12
roboc/map.py
12
roboc/map.py
|
@ -141,12 +141,10 @@ class Map:
|
|||
# decompose le mouvement
|
||||
try: # on recupere le 1er caractere (la direction)
|
||||
direction = move[0]
|
||||
except IndexError as except_detail:
|
||||
print("IndexError: «{}»".format(except_detail))
|
||||
# return 0
|
||||
except TypeError as except_detail:
|
||||
print("TypeError: «{}»-«{}»".format(except_detail, move))
|
||||
# return 0
|
||||
except IndexError:
|
||||
return 0
|
||||
except TypeError:
|
||||
return 0
|
||||
|
||||
if len(move[1:]) > 0: # on recupere les caractere suivants (dist)
|
||||
try:
|
||||
|
@ -159,8 +157,6 @@ class Map:
|
|||
|
||||
steps = 0
|
||||
# direction non conforme
|
||||
# FIXME: UnboundLocalError: local variable 'direction' \
|
||||
# referenced before assignment
|
||||
if direction not in DIRECTIONS:
|
||||
move_status = 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue