1st commit
This commit is contained in:
commit
7d02d6c892
1 changed files with 41 additions and 0 deletions
41
casinx.py
Normal file
41
casinx.py
Normal 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()
|
Loading…
Reference in a new issue