This is my first snake game!
set display mode 400,300,32:hide mouse:sync on:sync rate 0
begin:
x=4:y=4:xx=1:yy=0:l=10:z=0:c=0
dim a(500):dim b(500):ink rgb(0,0,200),0:for x=0 to 2:for y=0 to 2
line x,y,x+396,y:line x,y,x,y+297:line x,y+297,x+396,y+297:line x+396,y,x+396,y+297:next x
next y:gosub make_dot:do:if rightkey():xx=1:yy=0:endif:if leftkey():xx=-1:yy=0:endif
if upkey():yy=-1:xx=0:endif:if downkey():yy=1:xx=0:endif:z=z+1:if z>l then z=1
a(z)=x:b(z)=y:x=x+xx*3:y=y+yy*3
if point(x,y):if rgbb(point(x,y))=200 or rgbg(point(x,y))=200:goto die:endif:if rgbg(point(x,y))=100 then gosub make_dot
endif:ink rgb(0,200,0),0:box x,y,x+2,y+2:ink 0,0:if a(z+1)0 and b(z+1)0 then box a(z+1),b(z+1),a(z+1)+2,b(z+1)+2
if z=l:box a(1),b(1),a(1)+2,b(1)+2:endif:sync:loop
make_dot:
l=l+10:ink rgb(200,100,0),0
redo:
ex=rnd(128)*3+3:ey=rnd(95)*3+3:if point(ex,ey) or ex=x and ey=y:goto redo:endif
ink rgb(200,100,0),0:box ex,ey,ex+2,ey+2:return
die:
cls:ink rgb(200,0,0),0:set text font "Space Toaster":set text size 50:center text 200,100,"Score:"+str$((l-20)/10)
ink rgb(100,0,0),0:center text 200,180,"Try Again?"
do:if inkey$()="y":cls:goto begin:endif:if inkey$()="n":end:endif:sync:loop