From 869e500da83564adda7a40eb0dee7efbb8ff909c Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 10 Jan 2021 11:03:12 -0500 Subject: [PATCH] Shirase Rotation System --- tetris/rulesets/shirase.lua | 72 +++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tetris/rulesets/shirase.lua diff --git a/tetris/rulesets/shirase.lua b/tetris/rulesets/shirase.lua new file mode 100644 index 0000000..016cef2 --- /dev/null +++ b/tetris/rulesets/shirase.lua @@ -0,0 +1,72 @@ +local SRS = require 'tetris.rulesets.standard_exp' + +local Shirase = SRS:extend() + +Shirase.name = "Shirase RS" +Shirase.hash = "Shirase" +Shirase.world = false + +Shirase.colourscheme = { + I = "R", + J = "R", + L = "R", + O = "R", + S = "R", + T = "R", + Z = "R" +} + +Shirase.block_offsets = { + I={ + { {x=-2, y=0}, {x=-1, y=0}, {x=0, y=0}, {x=1, y=0} }, + { {x=1, y=-2}, {x=1, y=-1}, {x=1, y=0}, {x=1, y=1} }, + { {x=0, y=1}, {x=1, y=1}, {x=2, y=1}, {x=3, y=1} }, + { {x=0, y=0}, {x=0, y=1}, {x=0, y=2}, {x=0, y=3} }, + }, + J={ + { {x=-1, y=-1}, {x=-1, y=0}, {x=0, y=0}, {x=1, y=0} }, + { {x=1, y=-2}, {x=2, y=-2}, {x=1, y=-1}, {x=1, y=0} }, + { {x=1, y=0}, {x=2, y=0}, {x=3, y=0}, {x=3, y=1} }, + { {x=1, y=0}, {x=1, y=1}, {x=0, y=2}, {x=1, y=2} }, + }, + L={ + { {x=1, y=-1}, {x=-1, y=0}, {x=0, y=0}, {x=1, y=0} }, + { {x=1, y=-2}, {x=1, y=-1}, {x=1, y=0}, {x=2, y=0} }, + { {x=1, y=0}, {x=2, y=0}, {x=3, y=0}, {x=1, y=1} }, + { {x=0, y=0}, {x=1, y=0}, {x=1, y=1}, {x=1, y=2} }, + }, + O={ + { {x=-1, y=-1}, {x=0, y=-1}, {x=-1, y=0}, {x=0, y=0} }, + { {x=0, y=-2}, {x=1, y=-2}, {x=0, y=-1}, {x=1, y=-1} }, + { {x=1, y=-1}, {x=2, y=-1}, {x=1, y=0}, {x=2, y=0} }, + { {x=0, y=0}, {x=1, y=0}, {x=0, y=1}, {x=1, y=1} }, + }, + S={ + { {x=0, y=-1}, {x=1, y=-1}, {x=-1, y=0}, {x=0, y=0} }, + { {x=1, y=-2}, {x=1, y=-1}, {x=2, y=-1}, {x=2, y=0} }, + { {x=2, y=0}, {x=3, y=0}, {x=1, y=1}, {x=2, y=1} }, + { {x=0, y=0}, {x=0, y=1}, {x=1, y=1}, {x=1, y=2} }, + }, + T={ + { {x=0, y=-1}, {x=-1, y=0}, {x=0, y=0}, {x=1, y=0} }, + { {x=1, y=-2}, {x=1, y=-1}, {x=2, y=-1}, {x=1, y=0} }, + { {x=1, y=0}, {x=2, y=0}, {x=3, y=0}, {x=2, y=1} }, + { {x=1, y=0}, {x=0, y=1}, {x=1, y=1}, {x=1, y=2} }, + }, + Z={ + { {x=-1, y=-1}, {x=0, y=-1}, {x=0, y=0}, {x=1, y=0} }, + { {x=2, y=-2}, {x=1, y=-1}, {x=2, y=-1}, {x=1, y=0} }, + { {x=1, y=0}, {x=2, y=0}, {x=2, y=1}, {x=3, y=1} }, + { {x=1, y=0}, {x=0, y=1}, {x=1, y=1}, {x=0, y=2} }, + } +} + +function Shirase:onPieceDrop(piece) piece.lock_delay = 0 end +function Shirase:onPieceMove(piece) piece.lock_delay = 0 end +function Shirase:onPieceRotate(piece) piece.lock_delay = 0 end + +function Shirase:getDefaultOrientation() + return math.random(4) +end + +return Shirase \ No newline at end of file