diff --git a/util/PieceGenerator.py b/util/PieceGenerator.py index 876e847..18008d3 100644 --- a/util/PieceGenerator.py +++ b/util/PieceGenerator.py @@ -3,12 +3,21 @@ import random from entity.Piece import Piece from util.ConfigurationManager import ConfigurationManager +""" + TODO Add link that goes through random piece generation +""" class PieceGenerator: + __pieces = [] + @classmethod def get_piece(cls, position): - piece = Piece(cls.__get_piece_shape(), position, cls.__get_piece_color()) - return piece + + if len(cls.__pieces) == 0: + for _ in range(7): + cls.__pieces.append(Piece(cls.__get_piece_shape(), position, cls.__get_piece_color())) + + return cls.__pieces.pop() def __get_piece_shape(): random_number = random.randint(0, 6)