From 7d02d6c89221aac2b0b43a84f5c67002cc0aab01 Mon Sep 17 00:00:00 2001 From: megamichi Date: Wed, 29 Nov 2023 17:21:27 +0100 Subject: [PATCH] 1st commit --- casinx.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 casinx.py diff --git a/casinx.py b/casinx.py new file mode 100644 index 0000000..cf38fbf --- /dev/null +++ b/casinx.py @@ -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() \ No newline at end of file