Almost done with Sakura

This commit is contained in:
Ishaan Bhardwaj
2021-01-03 23:18:57 -05:00
parent 1a68cd8fce
commit 57bd6a8286
4 changed files with 35 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
local Randomizer = require 'tetris.randomizers.randomizer'
local Sequence = Randomizer:extend()
function Sequence:initialize()
self.sequence = "IJLOT"
self.counter = 0
end
function Sequence:generatePiece()
local piece = string.sub(self.sequence, self.counter + 1, self.counter + 1)
self.counter = (self.counter + 1) % string.len(self.sequence)
return piece
end
return Sequence