mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 17:39:03 -06:00
20 lines
476 B
Lua
20 lines
476 B
Lua
|
-- for the pre-packaged/example challenge tetrs
|
||
|
|
||
|
local Randomizer = require 'tetris.randomizers.randomizer'
|
||
|
|
||
|
local Bag7NoIRandomizer = Randomizer:extend()
|
||
|
|
||
|
function Bag7NoIRandomizer:initialize()
|
||
|
self.bag = {"J", "L", "O", "S", "T", "Z"}
|
||
|
end
|
||
|
|
||
|
function Bag7NoIRandomizer:generatePiece()
|
||
|
if next(self.bag) == nil then
|
||
|
self.bag = {"J", "L", "O", "S", "T", "Z"}
|
||
|
end
|
||
|
local x = math.random(table.getn(self.bag))
|
||
|
return table.remove(self.bag, x)
|
||
|
end
|
||
|
|
||
|
return Bag7NoIRandomizer
|