Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def afficher_damier_ascii(dico):
- res = f'Légende: 1={dico["joueurs"][0]["nom"]}, 2={dico["joueurs"][1]["nom"]}' + '\n' + ' ' + '-'*35 + '\n'
- for y in range(18, 1, -1):
- if y % 2 == 0:
- res += str(int(y / 2)) + ' | '
- for x in range(0, 8, 1):
- if dico["joueurs"][0]["pos"] == [x+1,y / 2]:
- res += '1 '
- elif dico["joueurs"][1]["pos"] == [x+1,y / 2]:
- res += '2 '
- else:
- res += '. '
- for x in range(8, 9, 1):
- if dico["joueurs"][0]["pos"] == [x+1,y]:
- res += '1 ' + '|'
- elif dico["joueurs"][1]["pos"] == [x+1,y]:
- res += '2 ' + '|'
- else:
- res += '. ' + '|'
- else:
- res += '\n' + ' |'
- for x in range(1, 10):
- if x != 9:
- murs_présent = False
- for mur_horizontal in dico["murs"]["horizontaux"]:
- if [x-1, (y + 1) // 2] == mur_horizontal or mur_horizontal == [x, (y + 1) // 2]:
- murs_présent = True
- if murs_présent == True:
- res += '-' * 4
- else:
- res += ' ' * 4
- else:
- res += ' |' + '\n'
- res += '\n' + '--|-----------------------------------' + '\n' + ' | 1 2 3 4 5 6 7 8 9'
- return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement