Added basic wheel functionality

This commit is contained in:
2026-02-02 22:42:08 +10:00
parent d72a6ef6f2
commit a5d86f822c
2 changed files with 28 additions and 0 deletions

6
src/py/slots/Slots.py Normal file
View File

@@ -0,0 +1,6 @@
from Wheel import Wheel
class SlotMachine():
def __init__(self):
jackpot = 0
wheel = Wheel()

22
src/py/slots/Wheel.py Normal file
View File

@@ -0,0 +1,22 @@
class Wheel():
def __init__(self, size=3):
self.size=size
self.icons = list(range(size))
def roll(self, offset=1):
new_icons = list(range(self.size))
for i, icon in enumerate(self.icons):
new_icons[(i + offset) % len(new_icons)] = icon
self.icons = new_icons
def main():
wheel = Wheel(size=10)
print(wheel.icons)
wheel.roll(offset=3)
print(wheel.icons)
if __name__ == "__main__":
main()