mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-23 05:59:02 -06:00
18 lines
405 B
Lua
18 lines
405 B
Lua
|
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
|
||
|
local x = math.random(table.getn(self.bag))
|
||
|
return table.remove(self.bag, x)
|
||
|
end
|
||
|
|
||
|
return Bag5Randomizer
|