cambridge/tetris/randomizers/randomizer.lua
Ishaan Bhardwaj 1fdd091456 Ruleset and randomizer refactoring (Read comments)
You can now specify an arbitrary number of pieces for a ruleset.
The randomizers will adjust accordingly.
Expect a pento ruleset in the modpack soon!
Also, gamemode skin selection has been refactored.
2021-01-06 22:53:44 -05:00

25 lines
412 B
Lua

local Object = require 'libs.classic'
local Randomizer = Object:extend()
function Randomizer:new()
self.possible_pieces = 7
self:initialize()
end
function Randomizer:nextPiece()
return self:generatePiece()
end
function Randomizer:initialize()
-- do nothing
end
local shapes = {"I", "J", "L", "O", "S", "T", "Z"}
function Randomizer:generatePiece()
return shapes[math.random(7)]
end
return Randomizer