From c6ee83e51a1075191183cd4be283a55e925d253a Mon Sep 17 00:00:00 2001 From: BigGamerGary Date: Tue, 3 Feb 2026 18:46:51 +1000 Subject: [PATCH] Transposed wheels in machine str --- src/py/slots/Slots.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/py/slots/Slots.py b/src/py/slots/Slots.py index c71df0a..da0f275 100644 --- a/src/py/slots/Slots.py +++ b/src/py/slots/Slots.py @@ -18,16 +18,29 @@ class SlotMachine(): def __str__(self): string = "" - for wheel in self.wheels: - string += str(wheel) + "\n" + # Create an empty matrix with the sole purpose of transposing it + matrix = [[],[],[]] + + for i, wheel in enumerate(self.wheels): + for icon in wheel.icons: + matrix[i].append(icon) + + # Use Zip function to aggregate unpacked matrix (*matrix unpacks it) + matrix = zip(*matrix) + + for row in matrix: + for icon in row: + string += str(icon) + " " + string += "\n" + return string def main(): - # machine = SlotMachine() - # print(machine) - # machine.spin(randomness=1) - # print(machine) + machine = SlotMachine() + print(machine) + machine.spin() + print(machine) pass if __name__ == "__main__":