1st commit

This commit is contained in:
Michael S. 2023-11-29 17:21:27 +01:00
commit 7d02d6c892

41
casinx.py Normal file
View file

@ -0,0 +1,41 @@
#!/usr/bin/python3
from random import randint
from time import sleep
## variablen
zeichen = "%-+#$~"
slots = [["a","b","c"], #slot 1
["2","#","2"], #slot 2
["3","3","3"]] #slot 3
## funtionen
def pslots():
tren = "+-----------+"
pr = "| "
for b in range(0,3):
for a in range(0,3):
pr += slots[a][b]+" "
pr += "|\n| "
print(tren)
print(pr[:-4])
print(tren)
def roll_slot(slots,slot=int,new_zeichen=str):
back = slots[slot]
back[2] = back[1]
back[1] = back[0]
back[0] = new_zeichen
slots[slot] = back
return slots
def roll_all():
brems_speed = 1
speed = 0.001
while not brems_speed <= speed:
sleep(speed)
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)
speed += 0.06
##programmschleife
roll_all()