Skip to content

Instantly share code, notes, and snippets.

@wilbefast
Last active August 29, 2015 14:05
Show Gist options
  • Save wilbefast/0312a3802fb457ff92d5 to your computer and use it in GitHub Desktop.
Save wilbefast/0312a3802fb457ff92d5 to your computer and use it in GitHub Desktop.
Tetrominoes in Lua, for use with some kind of parser
-- O shape
local tetro_O = "**--"..
"**--"..
"----"..
"----"
-- J shape
local tetro_J1 = "-*--"..
"-*--"..
"**--"..
"----"
local tetro_J2 = "***-"..
"--*-"..
"----"..
"----"
local tetro_J3 = "**--"..
"*---"..
"*---"..
"----"
local tetro_J4 = "*---"..
"***-"..
"----"..
"----"
-- L shape
local tetro_L1 = "*---"..
"*---"..
"**--"..
"----"
local tetro_L2 = "--*-"..
"***-"..
"----"..
"----"
local tetro_L3 = "**--"..
"-*--"..
"-*--"..
"----"
local tetro_L4 = "***-"..
"*---"..
"----"..
"----"
-- I shape
local tetro_I1 = "*---"..
"*---"..
"*---"..
"*---"
local tetro_I2 = "****"..
"----"..
"----"..
"----"
-- S shape
local tetro_S1 = "-*--"..
"**--"..
"*---"..
"----"
local tetro_S2 = "**--"..
"-**-"..
"----"..
"----"
-- Z shape
local tetro_Z1 = "*---"..
"**--"..
"-*--"..
"----"
local tetro_Z2 = "-**-"..
"**--"..
"----"..
"----"
-- T shape
local tetro_T1 = "*---"..
"**--"..
"*---"..
"----"
local tetro_T2 = "-*--"..
"***-"..
"----"..
"----"
local tetro_T3 = "-*--"..
"**--"..
"-*--"..
"----"
local tetro_T4 = "***-"..
"-*--"..
"----"..
"----"
-- pack and export
return
{
O = { tetro_O },
J = { tetro_J1, tetro_J2, tetro_J3, tetro_J4},
L = { tetro_L1, tetro_L2, tetro_L3, tetro_L4},
I = { tetro_I1, tetro_I2},
S = { tetro_S1, tetro_S2},
Z = { tetro_Z1, tetro_Z2},
T = { tetro_T1, tetro_T2, tetro_T3, tetro_T4},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment