Wheel spin testing

This commit is contained in:
2026-02-04 22:38:18 +10:00
parent e544b505f5
commit 41f5f8e2b8

View File

@@ -1,5 +1,6 @@
from Wheel import Wheel
from random import random
from time import sleep
class SlotMachine():
def __init__(self, screen_w=3, screen_h=3):
@@ -9,7 +10,7 @@ class SlotMachine():
wheel = Wheel(size=screen_h)
self.wheels.append(wheel)
def spin(self, wSpins=3):
def spin(self, wSpins=1):
for _ in range(wSpins):
for wheel in self.wheels:
wheel.spin()
@@ -38,13 +39,23 @@ class SlotMachine():
def main():
machine = SlotMachine()
win = False
result = []
machine.spin(wSpins=3)
while win == False:
machine.spin()
result = machine.wheels
first_icon = result[0].icons[1]
if all(wheel.icons[1] == first_icon for wheel in result):
win = True
print(machine)
machine.spin(wSpins=1)
print(machine)
machine.spin(wSpins=1)
print(machine)
machine.spin(wSpins=1)
print(machine)
sleep(1)
print("Woohoo!")
pass