Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PyramidState:
- def __init__(self, pyramid):
- self.pyramid = pyramid
- self.empty = [5 - len(self.pyramid[0]), 5 - len(self.pyramid[1]), 3 - len(self.pyramid[2])]
- def __str__(self):
- return f"Current pyramid: {self.pyramid}\nCurrently empty slots: {self.empty}"
- def append(self, card, board_index):
- if self.empty[board_index] > 0:
- self.pyramid[board_index].append(card)
- self.empty = [5 - len(self.pyramid[0]), 5 - len(self.pyramid[1]), 3 - len(self.pyramid[2])]
- else:
- raise IndexError("Selected board has no empty slots")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement