Class RandomGenerator

java.lang.Object
sac.model.generators.RandomGenerator
All Implemented Interfaces:
Generator

public class RandomGenerator extends Object implements Generator
The generator classic Tetris would use. Random Generator generates a sequence of all seven one-sided tetrominoes (I, J, L, O, S, T, Z) permuted randomly, as if they were drawn from a bag.
Author:
Kai
  • Constructor Details

    • RandomGenerator

      public RandomGenerator()
      Initialize a random bag with size equal the number of possible piece types (7 in classic Tetris).
  • Method Details

    • nextPiece

      public Piece nextPiece()
      Specified by:
      nextPiece in interface Generator
      Returns:
      the next Piece generated by this generator
    • reset

      public void reset()
      Description copied from interface: Generator
      Reset this generator for new game.
      Specified by:
      reset in interface Generator