2020-11-11 21:24:56 -06:00
|
|
|
local Randomizer = require 'tetris.randomizers.randomizer'
|
|
|
|
|
|
|
|
local Bag5Randomizer = Randomizer:extend()
|
|
|
|
|
|
|
|
function Bag5Randomizer:initialize()
|
|
|
|
self.bag = {"I", "J", "L", "O", "T"}
|
|
|
|
end
|
|
|
|
|
|
|
|
function Bag5Randomizer:generatePiece()
|
|
|
|
if next(self.bag) == nil then
|
|
|
|
self.bag = {"I", "J", "L", "O", "T"}
|
|
|
|
end
|
2023-06-14 00:06:16 -05:00
|
|
|
local x = love.math.random(table.getn(self.bag))
|
2020-11-11 21:24:56 -06:00
|
|
|
return table.remove(self.bag, x)
|
|
|
|
end
|
|
|
|
|
|
|
|
return Bag5Randomizer
|