size = 35
sw = 10
sh = 20
piece(0,0,0)=0: piece(0,1,0)=1: piece(0,2,0)=1: piece(0,3,0)=0
piece(0,0,1)=0: piece(0,1,1)=1: piece(0,2,1)=1: piece(0,3,1)=0
piece(1,0,0)=1: piece(1,1,0)=1: piece(1,2,0)=1: piece(1,3,0)=1
piece(1,0,1)=0: piece(1,1,1)=0: piece(1,2,1)=0: piece(1,3,1)=0
piece(2,0,0)=0: piece(2,1,0)=0: piece(2,2,0)=1: piece(2,3,0)=1
piece(2,0,1)=0: piece(2,1,1)=1: piece(2,2,1)=1: piece(2,3,1)=0
piece(3,0,0)=0: piece(3,1,0)=1: piece(3,2,0)=1: piece(3,3,0)=0
piece(3,0,1)=0: piece(3,1,1)=0: piece(3,2,1)=1: piece(3,3,1)=1
piece(4,0,0)=0: piece(4,1,0)=1: piece(4,2,0)=1: piece(4,3,0)=1
piece(4,0,1)=0: piece(4,1,1)=0: piece(4,2,1)=1: piece(4,3,1)=0
piece(5,0,0)=0: piece(5,1,0)=1: piece(5,2,0)=1: piece(5,3,0)=1
piece(5,0,1)=0: piece(5,1,1)=1: piece(5,2,1)=0: piece(5,3,1)=0
piece(6,0,0)=0: piece(6,1,0)=1: piece(6,2,0)=1: piece(6,3,0)=1
piece(6,0,1)=0: piece(6,1,1)=0: piece(6,2,1)=0: piece(6,3,1)=1
piece_color
(0) = _rgb(0,200,0)piece_color
(1) = _rgb(200,0,0)piece_color
(2) = _rgb(156,85,211)piece_color
(3) = _rgb(219,112,147)piece_color
(4) = _rgb(0,100,250)piece_color
(5) = _rgb(230,197,92)piece_color
(6) = _rgb(0,128,128)
redraw = -1
speed = 10
lines = 0
pause = 0
putpiece = 0
startx = (sw - 4)/2
px = startx
py = 1
rot = 0
if valid
(pn
, px
, py
+ 1, rot
) then py
= py
+ 1 else putpiece
= -1
redraw = -1
if valid
(pn
, px
, py
, rot
) then n = place(pn, px, py, rot)
lines = lines + n
px = startx
py = 0
rot = 0
putpiece = 0
redraw = -1
board(x, y) = 0
lines = 0
line (0,0)-(sw
*size
, sh
*size
),_rgb(0,0,0),bf
line (x
*size
, y
*size
)-step(size
-2, size
-2), piece_color
(board
(x
, y
)-1), bf
line (x
*size
, y
*size
)-step(size
-2, size
-2), _rgb(50,50,50), b
rotate xx, yy, x, y, pn, rot
if piece
(pn
, x
, y
) then line ((px
+ xx
)*size
, (py
+ yy
)*size
)-step(size
-2, size
-2), piece_color
(pn
), bf
redraw = 0
if valid
(pn
, px
, py
, (rot
+ 1) mod 4) then rot
= (rot
+ 1) mod 4 pause = 0
px = px - xx + 1
if valid
(pn
, px
- 1, py
, rot
) then px
= px
- 1 pause = 0
px = xx - 1
if valid
(pn
, px
+ 1, py
, rot
) then px
= px
+ 1 pause = 0
py = yy - 1
putpiece = -1
if valid
(pn
, px
, py
+ 1, rot
) then py
= py
+ 1 pause = 0
board(x, y) = 0
px = startx
py = 0
rot = 0
putpiece = 0
lines = 0
speed = speed + 1
speed = speed - 1
redraw = -1
sub rotate
(xx
, yy
, x
, y
, pn
, rot
) rot_new = 0
rot_new = rot
xx = x
yy = y
xx = y + 2
yy = 2 - x
xx = 4 - x
yy = 1 - y
xx = 2 - y
yy = x - 1
rotate xx, yy, x, y, pn, rot
if (px
+ xx
>= sw
) or (px
+ xx
< 0) then valid = 0
valid = 0
if board
(px
+ xx
, py
+ yy
) then valid = 0
valid = -1
lines = 0
rotate xx, yy, x, y, pn, rot
if py
+ yy
>= 0 then if piece
(pn
, x
, y
) then board
(px
+ xx
, py
+ yy
) = pn
+ 1
'clear lines
clr = -1
clr = 0
lines = lines + 1
board(x, yy) = board(x, yy-1)
place = lines