Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import random
# legende: # Fels . Boden T Troll ! trap
dungeon = """
###############################################
#......................bbb.....#.....#........#
#.............................................#
#.............................................#
###############################################
"""
kevin = "@"
kx = 1
ky = 1
dx = 0
dy = 0
lines = dungeon.split()
length = len(lines[1])
brote = 5
hunger = 0
while hunger < 100:
y = 0
for line in lines:
if y == ky:
print(line[0:kx]+kevin+line[kx+1:])
else:
print(line)
y+=1
print(length)
commando = input("hu:{} bro: {}?".format(hunger, brote))
dx = 0
dy = 0
if commando == "l":
dx = -1
hunger += 1
elif commando == "r":
dx = 1
hunger += 1
elif commando == "u":
dy = -1
hunger += 1
elif commando == "d":
dy = 1
hunger += 1
# ---- steigt kevin auf essen drauf? -----
ziel = lines[ky+dy][kx+dx]
if ziel == "b":
# kevin findet brot
brote += 1
lines[ky+dy] = lines[ky+dy][:kx+dx]+"."+lines[ky+dy][kx+dx+1:]
print("Kevin findet ein Brot!!!")
elif ziel == "s":
# kevin findet schokolade
print("Kevin findet Schokolade")
elif ziel == "#":
dx = 0
dy = 0
print("Aua! Nicht in die Wand laufen!")
# ---- kevin will in wand laufen? ---
# --- kevin bewegt sich
kx += dx
ky += dy
if commando == "iss":
if brote > 0:
brote -= 1
hunger -= 15
print("Kevin schmeckt sein Brot")
else:
print("Kevin würde gerne essen, hat aber kein Brot")
elif commando == "quit":
break
elif commando == "l" or commando == "r" or commando == "u" or commando == "d":
pass # movement
else:
print("Also wirklich, Kevin!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.