2020-11-11 21:24:56 -06:00
|
|
|
local Randomizer = require 'tetris.randomizers.randomizer'
|
|
|
|
|
|
|
|
local SegaRandomizer = Randomizer:extend()
|
|
|
|
|
|
|
|
function SegaRandomizer:initialize()
|
|
|
|
self.bag = {"I", "J", "L", "O", "S", "T", "Z"}
|
|
|
|
self.sequence = {}
|
|
|
|
for i = 1, 1000 do
|
2023-06-14 00:06:16 -05:00
|
|
|
self.sequence[i] = self.bag[love.math.random(table.getn(self.bag))]
|
2020-11-11 21:24:56 -06:00
|
|
|
end
|
|
|
|
self.counter = 0
|
|
|
|
end
|
|
|
|
|
|
|
|
function SegaRandomizer:generatePiece()
|
|
|
|
self.counter = self.counter + 1
|
|
|
|
return self.sequence[self.counter % 1000 + 1]
|
|
|
|
end
|
|
|
|
|
|
|
|
return SegaRandomizer
|