mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-12-22 23:49:02 -06:00
1fdd091456
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.
25 lines
412 B
Lua
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
|