#!/usr/bin/python3 from random import randint from time import sleep 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 clear(): if os.name == "nt": os.system("cls") else: os.system("clear") def prints(): tren = "+-----------+" halb = int(x/2)-5 space = str(" "*halb) pr = f"{space}| " 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[:-halb-4]) print(space+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 printl(): print(" "*(int(x/2)-8),"+-+-+ Casinx +-+-+\n") 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)]) 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() blink("-"," ",10)