mirror of
https://github.com/SashLilac/cambridge.git
synced 2025-05-13 20:21:25 -05:00
Implemented challenges!!!!!
This commit is contained in:
19
tetris/randomizers/bag7noI.lua
Normal file
19
tetris/randomizers/bag7noI.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
-- 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
|
||||
Reference in New Issue
Block a user