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__":