Play game
Snake Cave's itch.io pageCompressed Bytes used
1023
Source Code (OPTIONAL)
--jusa
a=176he=100h=3f=1g=0d={{0}}k={{0}}t={{4,8,190}}e={}r=0::q::
if(#d[f]<196)add(d[f],flr(rnd(6)))add(k[f],0)goto q
if#t<f+1 then
add(d,{})add(k,{})add(e,{flr(rnd(4)+1),flr(rnd(11)+2)})
while e[f][1]==t[f][1]do e[f][1]=flr(rnd(4)+1)end
if(e[f][1]==1)e[f][3]=e[f][2]t[f+1]={4,e[f][2],e[f][3]+182}l=t[f][2]-1 n3=e[f][3]+(l*14)n2=e[f][2]>t[f][2]and 3 or 2
if(e[f][1]==2)e[f][3]=1+((e[f][2]-1)*14)t[f+1]={3,e[f][2],e[f][3]+13}l=t[f][2]n3=e[f][3]+l n2=e[f][2]>t[f][2]and 4 or 1
if(e[f][1]==3)e[f][3]=e[f][2]*14 t[f+1]={2,e[f][2],e[f][3]-13}l=14-t[f][2]n3=e[f][3]-l n2=e[f][2]>t[f][2]and 4 or 1
if(e[f][1]==4)e[f][3]=e[f][2]+182 t[f+1]={1,e[f][2],e[f][3]-182}l=14-t[f][2]n3=e[f][3]-(l*14)n2=e[f][2]>t[f][2]and 3 or 2
m=t[f][1]==1 and e[f][2]-1 or t[f][1]==2 and e[f][2] or t[f][1]==3 and 14-e[f][2] or t[f][1]==4 and 14-e[f][2]
if(e[f][1]+t[f][1]==5)l=6 m=6
n=1+abs(e[f][2]-t[f][2])
o={{l,e[f][1],e[f][3]},{n,n2,n3},{m,t[f][1],t[f][3]}}
for o in all(o)do
for h=0,o[1]do
p=o[2]==1 and o[3]+(h*14)or o[2]==2 and o[3]+h or o[2]==3 and o[3]-h or o[2]==4 and o[3]-(h*14)
d[f][p]=1
if(h==1)x=p
a=x
end
end
end
k[f][a]=1
for i=1,14 do
d[f][i]=2
d[f][1+((i-1)*14)]=2
d[f][(i*14)]=2
d[f][i+182]=2
d[f][e[f][3]]=7
for j=1,14 do
y=d[f][i+((j-1)*14)]
if k[f][i+((j-1)*14)]!=0 and r<2 then
rectfill(118,110-he,124,110,11)
c=y==5 and 0 or y==2 and 5 or y!=5 and 4
rectfill(i*8-5,j*8,i*8+3,(j*8)+8,c)
if(y==2)rect(3+i*8,j*8,i*8-5,j*8+8,6)
pr=k[f][i+((j-1)*14)]==1 and "웃" or y==3 and "∧" or y==4 and "◆" or ""
c=y==3 and 11 or y==4 and 12 or k[f][i+((j-1)*14)]==1 and 9 or ""
?pr,i*8-4,j*8+2,c
end
end
end
u={}
if r==1 then
for i=1,196 do
if(d[f][i]==3)add(u,i)
end
for i in all(u)do
v=flr(rnd(4)+1)
z=v==1 and i-14 or v==2 and i+14 or v==3 and i+1 or v==4 and i-1 or i
if(d[f][z]>1)z=i
if(k[f][z]==1)d[f][i]=3 d[f][z]=1 he-=10?"\aa'-1"
d[f][i]=1
d[f][z]=3
end
if(d[f][a]!=3)r=0
end
b=btnp()pl=a
if r<1 then
a+=(b\2%2-b%2) or 0
a+=(b\8%2-b\4%2)*14 or 0
k[f][pl]=2
k[f][a+1]=2
k[f][a-1]=2
k[f][a+14]=2
k[f][a-14]=2
k[f][a+13]=2
k[f][a-13]=2
k[f][a+15]=2
k[f][a-15]=2
if(d[f][pl]==7)g+=100f+=1 goto q
if(d[f][a]==5 or he<0)h-=1 he=100 a=x
if(d[f][a]==4)g+=25 d[f][a]=1?"\ag+#g",0,0
if(d[f][a]==3)g+=4 d[f][a]=1 h+=rnd(9)>8 and 1 or 0?"\ae+#g",0,0
if(d[f][a]==2)a=pl
if(b>0)r+=1
if(h<0)r=3
end
?"\fdlvl\f7:"..f.." \fascore\f7:"..g.." \f9웃\f7:"..h,0,0
?"⁶1⁶c"
goto q
Leave a comment
Log in with itch.io to leave a comment.
Comments
This is neat - lots going on here.
Had fun exporting a few caves (my best score was 703)
Nice one!