TP3 afficher_jeu Plus performant
This commit is contained in:
parent
01489692ad
commit
bd2f00543a
|
@ -301,16 +301,18 @@ def afficher_jeu(jeu):
|
||||||
"""
|
"""
|
||||||
if jeu['plateau']['larg'] > 30:
|
if jeu['plateau']['larg'] > 30:
|
||||||
return
|
return
|
||||||
|
s = ''
|
||||||
for x in range(1, jeu['plateau']['larg']+1):
|
for x in range(1, jeu['plateau']['larg']+1):
|
||||||
for y in range(1, jeu['plateau']['haut']+1):
|
for y in range(1, jeu['plateau']['haut']+1):
|
||||||
if (x, y) in jeu['coups_joues']:
|
if (x, y) in jeu['coups_joues']:
|
||||||
if (x, y) in jeu['plateau']:
|
if (x, y) in jeu['plateau']:
|
||||||
print('o', end=' ')
|
s += 'o '
|
||||||
else:
|
else:
|
||||||
print('x', end=' ')
|
s += 'x '
|
||||||
else:
|
else:
|
||||||
print('.', end=' ')
|
s += '. '
|
||||||
print()
|
s += '\n'
|
||||||
|
print(s)
|
||||||
|
|
||||||
def lire_un_tir(nom):
|
def lire_un_tir(nom):
|
||||||
"""
|
"""
|
||||||
|
|
Reference in a new issue