BUG Modif des tests et de la boucle de traitement du mouvt:|TP_3.9
This commit is contained in:
parent
7888a87d91
commit
71d6e7cb90
|
@ -1,4 +1,4 @@
|
||||||
O1234
|
01234
|
||||||
abcde
|
abcde
|
||||||
ABCDE
|
ABCDE
|
||||||
zyXwv
|
zyXwv
|
|
@ -19,6 +19,7 @@ MAZE_ELEMENTS = {'wall': 'O', # elements dispo dans le labyrinthe
|
||||||
'exit': 'U',
|
'exit': 'U',
|
||||||
'robo': 'X',
|
'robo': 'X',
|
||||||
'trace': ' '}
|
'trace': ' '}
|
||||||
|
# Issue possible d'un mouvement, garder le OK toujours en fin de liste
|
||||||
MOVE_STATUS = ['bad', 'wall', 'exit', 'door', 'ok']
|
MOVE_STATUS = ['bad', 'wall', 'exit', 'door', 'ok']
|
||||||
|
|
||||||
ERR_ = "#!@?# Oups… "
|
ERR_ = "#!@?# Oups… "
|
||||||
|
|
13
roboc/map.py
13
roboc/map.py
|
@ -60,13 +60,14 @@ class Map:
|
||||||
>>> MiniMap.move_to("4")
|
>>> MiniMap.move_to("4")
|
||||||
0
|
0
|
||||||
>>> MiniMap.move_to("e1")
|
>>> MiniMap.move_to("e1")
|
||||||
2
|
4
|
||||||
>>> MiniMap.map_print()
|
>>> MiniMap.map_print()
|
||||||
000
|
OOO
|
||||||
XU
|
O X
|
||||||
000
|
OOO
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, map_file):
|
def __init__(self, map_file):
|
||||||
"""
|
"""
|
||||||
Initialisation de la carte utilise
|
Initialisation de la carte utilise
|
||||||
|
@ -152,9 +153,8 @@ class Map:
|
||||||
move_status = 0
|
move_status = 0
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# import pdb; pdb.set_trace()
|
|
||||||
# pour chaque pas on recupere la position suivante
|
# pour chaque pas on recupere la position suivante
|
||||||
while steps < goal or move_status != 4:
|
while steps < goal or move_status not in range(MOVE_STATUS.index('ok')):
|
||||||
steps += 1
|
steps += 1
|
||||||
if direction == DIRECTIONS[0]: # nord
|
if direction == DIRECTIONS[0]: # nord
|
||||||
next_position = self._robo_position - self._column_nb
|
next_position = self._robo_position - self._column_nb
|
||||||
|
@ -172,6 +172,7 @@ class Map:
|
||||||
raise NotImplementedError(ERR_)
|
raise NotImplementedError(ERR_)
|
||||||
|
|
||||||
# verifie quelle est la case du prochain pas
|
# verifie quelle est la case du prochain pas
|
||||||
|
# import pdb; pdb.set_trace()
|
||||||
next_char = self._data_text[next_position]
|
next_char = self._data_text[next_position]
|
||||||
if next_char == MAZE_ELEMENTS['wall']:
|
if next_char == MAZE_ELEMENTS['wall']:
|
||||||
move_status = 1
|
move_status = 1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user