weird tetris

< > arrow keys to move pieces

i had to remove the bit of code that clears lines because it made it easier to fit the code, and because i think it's near impossible? let me know if i'm wrong.

code:

::i::
s,z,q=0,pset,pget
poke(0x5f2c,3)
cls()
rect(4,4,59,59,6)
::n::
s+=1
h,x,y,p,c=false,30,5,{},ceil(rnd(14))+1
for i=0,11 do
p[i]=flr(rnd(2))
end
p[4]=1
::l::
rect(5,16,58,16,1)
for i=0,11 do
if (p[i]==1) z(x+i%3,y+flr(i/3),0)
end
y+=1a=0
if(btn(⬅️))a=-1
if(btn(➡️))a=1
for i=0,11 do
if (p[i]==1 and q(x+i%3+a,y+flr(i/3))>1)a=0
end
x+=a
for i=0,11 do
if p[i]==1 then
if(q(x+i%3,y+flr(i/3)+1)>1)h=true
z(x+i%3,y+flr(i/3),c)
end
end
if h then
if (y<17)goto o else goto n
end
flip()
goto l
::o::
cls()
?"game over\nscore: "..s.."\n❎->",4,3
if(btn(❎))goto i
flip()
goto o

Published 28 days ago
StatusReleased
PlatformsHTML5
Rating
(2)
AuthorBeep Yeah!
GenrePuzzle
Made withPICO-8

Comments

Log in with itch.io to leave a comment.

This is like some kind of art piece.
Endless incoherent nonsense is thrown at you faster than you can process, and there's no actual way to get rid of any of it, you just pile it up as much as possible until your die...

(+1)

There's definetly some more characters to be squeezed out here by just removing some of the whitespace and linebreaks. I managed to cut 18 characters off your code and not removing any logic, so there may be space for line clearing yet!

I was making my own version of tetris but it looks like I won't have space for the full game, here's what I have for line clearing though, it should work quite nicely for your version too;


::c::
for y=63,4,-1 do
l=true
for x=0,63 do
l=l and pget(x,y)>0
end
if(l)memcpy(24576+64,24576,y*64)goto c
end
end

Basically, start from the bottom of the screen and work up, check each pixel from left to right, if not black, keep l to be true. If l is true after checking the whole line, copy the screen data from the top down to the line we just checked down by 1 line and start the check again (we might have multiple completed lines and continuing in the current loop might miss them!).

Anyway, excellent game, love the idea!

Hope to see you for TTJ5!

Yeah, once I got under the character limit, I stopped trying to optimize. That line-clearing code is much much cleaner than what I had:

for j=17,58 do
for i=5,58 do
if(q(i,j)==0)break
if i==58 then
s+=50
rect(5,j,58,j,0)
for u=j,18,-1 do
for w=5,58 do
z(w,u,q(w,u-1))
z(w,u-1,0)
end
end
end
end
end

(+1)

145 :)