Added the lost Konoha mode from TGM4

This commit is contained in:
Ishaan Bhardwaj
2020-10-05 22:17:15 -04:00
parent a534331b11
commit f1ad1f0ea4
6 changed files with 420 additions and 33 deletions

24
tetris/randomizers/bag5alt.lua Executable file
View File

@@ -0,0 +1,24 @@
local Randomizer = require 'tetris.randomizers.randomizer'
local Bag5AltRandomizer = Randomizer:extend()
function Bag5AltRandomizer:initialize()
self.bag = {"I", "J", "L", "O", "T"}
self.prev = "O"
end
function Bag5AltRandomizer:generatePiece()
if next(self.bag) == nil then
self.bag = {"I", "J", "L", "O", "T"}
end
local x = math.random(table.getn(self.bag))
local temp = table.remove(self.bag, x)
if temp == self.prev then
local y = math.random(table.getn(self.bag))
temp = table.remove(self.bag, y)
end
self.prev = temp
return temp
end
return Bag5AltRandomizer