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
|
# decompose le mouvement
|
||||||
try: # on recupere le 1er caractere (la direction)
|
try: # on recupere le 1er caractere (la direction)
|
||||||
direction = move[0]
|
direction = move[0]
|
||||||
except IndexError as except_detail:
|
except IndexError:
|
||||||
print("IndexError: «{}»".format(except_detail))
|
return 0
|
||||||
# return 0
|
except TypeError:
|
||||||
except TypeError as except_detail:
|
return 0
|
||||||
print("TypeError: «{}»-«{}»".format(except_detail, move))
|
|
||||||
# return 0
|
|
||||||
|
|
||||||
if len(move[1:]) > 0: # on recupere les caractere suivants (dist)
|
if len(move[1:]) > 0: # on recupere les caractere suivants (dist)
|
||||||
try:
|
try:
|
||||||
|
@ -159,8 +157,6 @@ class Map:
|
||||||
|
|
||||||
steps = 0
|
steps = 0
|
||||||
# direction non conforme
|
# direction non conforme
|
||||||
# FIXME: UnboundLocalError: local variable 'direction' \
|
|
||||||
# referenced before assignment
|
|
||||||
if direction not in DIRECTIONS:
|
if direction not in DIRECTIONS:
|
||||||
move_status = 0
|
move_status = 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user