feat: improve the way that pieces get generated
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user