0
nur versuchen, einfache Karte zu tun und sind in der Karte eine Abspielgerätort Funktion, aber Spieler werden nicht angezeigt (Karte leer ist)einfache Karte in Python mit Funktion
Hier sind meine Code. Bitte helfen zu lösen. Dank
import random
CELLS = [(0, 0), (1, 0), (2, 0), (3, 0), (4, 0),
(0, 1), (1, 1), (2, 1), (3, 1), (4, 1),
(0, 2), (1, 2), (2, 2), (3, 2), (4, 2),
(0, 3), (1, 3), (2, 3), (3, 3), (4, 3),
(0, 4), (1, 4), (2, 4), (3, 4), (4, 4)]
def get_locations():
return random.sample(CELLS, 1)
player = get_locations()
def draw_map(player):
print(" _" * 5)
tile = "|{}"
for cell in CELLS:
x, y = cell
if x < 4:
line_end = ""
if cell == player:
output = tile.format("X")
else:
output = tile.format("_")
else:
line_end = "\n"
if cell == player:
output = tile.format("X|")
else:
output = tile.format("_|")
print(output, end=line_end)
draw_map(player)
Vielen Dank, vermerkt. Vielen Dank noch einmal –