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