engine fertig jetzt fehlt noch er spiel aufbau

This commit is contained in:
Michael S. 2023-11-29 20:14:13 +01:00
parent 19ec652ddf
commit 121edd44a5

View file

@ -1,26 +1,33 @@
#!/usr/bin/python3 #!/usr/bin/python3
from random import randint from random import randint
from time import sleep from time import sleep
from os import get_terminal_size import os
x,y = get_terminal_size().columns,get_terminal_size().lines x,y = os.get_terminal_size().columns,os.get_terminal_size().lines
## variablen ## variablen
start_coins = 20
zeichen = "%-+#$~" zeichen = "%-+#$~"
slots = [["a","b","c"], #slot 1 slots = [["a","b","c"], #slot 1
["2","#","2"], #slot 2 ["2","#","2"], #slot 2
["3","3","3"]] #slot 3 ["3","3","3"]] #slot 3
## funtionen ## funtionen
def pslots(): def clear():
if os.name == "nt":
os.system("cls")
else:
os.system("clear")
def prints():
tren = "+-----------+" tren = "+-----------+"
halb = int(x/2)-5 halb = int(x/2)-5
space = "-"*halb space = str(" "*halb)
pr = f"{space}| " pr = f"{space}| "
for b in range(0,3): for a in range(0,len(slots)):
for a in range(0,3): for b in range(0,len(slots[0])):
pr += slots[a][b]+" " pr += slots[b][a]+" "
pr += f"|\n{space}| " pr += f"|\n{space}| "
print(space+tren) print(space+tren)
print(pr[:-(space[:-3])]) print(pr[:-halb-4])
print(space+tren) print(space+tren)
def roll_slot(slots,slot=int,new_zeichen=str): def roll_slot(slots,slot=int,new_zeichen=str):
@ -30,6 +37,9 @@ def roll_slot(slots,slot=int,new_zeichen=str):
back[0] = new_zeichen back[0] = new_zeichen
slots[slot] = back slots[slot] = back
return slots return slots
def printl():
print(" "*(int(x/2)-8),"+-+-+ Casinx +-+-+\n")
def roll_all(): def roll_all():
brems_speed = 1 brems_speed = 1
speed = 0.001 speed = 0.001
@ -38,8 +48,28 @@ def roll_all():
roll_slot(slots,0,zeichen[randint(0,len(zeichen)-1)]) roll_slot(slots,0,zeichen[randint(0,len(zeichen)-1)])
roll_slot(slots,1,zeichen[randint(0,len(zeichen)-1)]) roll_slot(slots,1,zeichen[randint(0,len(zeichen)-1)])
roll_slot(slots,2,zeichen[randint(0,len(zeichen)-1)]) roll_slot(slots,2,zeichen[randint(0,len(zeichen)-1)])
pslots() clear()
print(speed,brems_speed) printl()
prints()
speed += 0.06 speed += 0.06
def blink(z=str,z2=str,time=str):
def b(z,z2):
for a in range(len(slots)):
for b in range(len(slots[0])):
if slots[a][b] == z:
slots[a][b] = z2
for a in range(0,time):
b(z,z2)
prints()
sleep(0.2)
clear()
b(z2,z)
prints()
sleep(0.2)
clear()
##programmschleife ##programmschleife
roll_all()
roll_all()
blink("-"," ",10)