\ snake supported by a queue of emoji \ 🐀🐁🐂🐃🐄🐅🐆🐇🐈🐉🐊🐋🐌🐍 const qlength=20; var qx{qlength},qy{qlength},qemoji{qlength},tail,head, next; procedure enqueue(x,y); \ queues the next emoji and its coordinates begin qemoji{tail}:=next; next:=next+1; if next>emojicount then next:=1; qx{tail}:=x; qy{tail}:=y; tail:=tail+1; if tail=qlength then tail:=0; if tail=head then begin head:=head+1; if head=qlength then head:=0 end end; procedure draw; \ draw all emojis in queue var i; begin if tail#head then begin i:=head; call cvclear; while i#tail do begin call emojidraw(qemoji{i},qx{i},qy{i},20); i:=i+1; if i=qlength then i:=0 end end end; procedure laserpoint; \ Line to the emoji closest to the cursor var i,mindist,minindex; procedure updatemin; \ checks queue element i for being closer var xdiff,ydiff,dist; begin xdiff:=cvx-qx{i}; ydiff:=cvy-qy{i}; dist:=xdiff*xdiff+ydiff*ydiff; if dist0 then \ wait for cursor to be over canvas if tail#head then begin mindist:=999999; i:=head; while i#tail do begin call updatemin; i:=i+1; if i=qlength then i:=0 end; \ redraw canvas and draw line from cursor to closest call draw; call cvline(cvx,cvy,qx{minindex},qy{minindex}) end; call wait(10); end; call draw end; \ laserpoint begin next:=1; call cvasclick; while 1=1 do begin call cvclear; while cvx<0 do call wait(10); tail:=0; head:=0; while cvx>-1 do begin if cvclickx>-1 then begin call laserpoint; call cvasclick; \ to set up next stall call wait(500) \ users are not real smooth with clicks end; call enqueue(cvx,cvy); call draw; call wait(200) end end end.