2020-11-12 22:11:11 -06:00
|
|
|
local Randomizer = require 'tetris.randomizers.randomizer'
|
|
|
|
|
|
|
|
local NES = Randomizer:extend()
|
|
|
|
|
|
|
|
function NES:initialize()
|
|
|
|
self.history = 0
|
|
|
|
self.shapes = {"I", "J", "L", "O", "S", "T", "Z"}
|
|
|
|
end
|
|
|
|
|
|
|
|
function NES:generatePiece()
|
2023-06-14 00:06:16 -05:00
|
|
|
local x = love.math.random(8)
|
2020-11-12 22:11:11 -06:00
|
|
|
if x == 8 or x == self.history then
|
2023-06-14 00:06:16 -05:00
|
|
|
x = love.math.random(7)
|
2020-11-12 22:11:11 -06:00
|
|
|
end
|
|
|
|
self.history = x
|
|
|
|
return self.shapes[x]
|
|
|
|
end
|
|
|
|
|
|
|
|
return NES
|