Queue

Queue

class tetris_gymnasium.components.tetromino_queue.TetrominoQueue(randomizer: Randomizer, size=4)[source]

The TetrominoQueue stores all incoming tetrominoes in a queue.

The sequence of pieces is generated by a Randomizer, which can be customized by the user.

Parameters:
  • randomizer – The randomizer that generates the tetrominoes sequence.

  • size – The number of tetrominoes to store. Defaults to 4.

Methods

TetrominoQueue.reset(seed=None)[source]

Reset the queue to its initial state.

Parameters:

seed – The seed to use for the randomizer. Defaults to None.

TetrominoQueue.get_next_tetromino()[source]

Gets the next tetromino from the queue and generates a new one.

Generating a new Tetromino makes sure that the queue will always be full.

TetrominoQueue.get_queue()[source]

Get all tetrominoes currently in the queue.