Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (15 sloc) 553 Bytes
"""Classes: TetrisPieceFactory."""
import random
from src.layouts import Layouts
from src.tetris_piece import TetrisPiece
from src.immutable import Immutable
class TetrisPieceFactory(Immutable):
"""Manufactures instances of TetrisPiece."""
def __init__(self): # noqa: D107
super(TetrisPieceFactory, self).__init__()
def get_random_piece_at_position(self, position):
"""Get a random TetrisPiece with given position."""
return TetrisPiece(
random.choice(Layouts.ALL),
position
)
You can’t perform that action at this time.