{"name":"random walk II alt","description":"-- random walk ii alt\n-- alexthescott\n-- 9/27/21 7:34pm\n\n-- new seed every day of the year\nsrand(31*stat(81)+stat(82))\n\n--b&w or w&b\nif rnd()<0.5 then\n\tpal({0,7},1)\nelse\n\tpal({7,0},1)\nend\n\nfunction new_obj(x,y)\n\tobj={}\n\tobj.points={}\n\tobj.points[1]={x=x,y=y}\n\tobj.points[2]={x=x+6,y=y}\n\tobj.points[3]={x=x+6,y=y+6}\n\tobj.points[4]={x=x,y=y+6}\n\tobj.a=0\n\t\n\tobj.draw=function(self)\n\t\tlocal p=self.points\n\t\tif obj.a==0 then\n\t\t\tline(p[1].x,p[1].y,p[2].x,p[2].y,1)\n\t\t\tline(p[2].x,p[2].y,p[3].x,p[3].y,1)\n\t\t\tline(p[3].x,p[3].y,p[4].x,p[4].y,1)\n\t\t\tline(p[4].x,p[4].y,p[1].x,p[1].y,1)\n\t\telse\n\t\tlocal p=p[1]\n\t\t\trectfill(p.x,p.y,p.x+6,p.y+6,1)\n\t\tend\n\tend\n\t\n\tobj.set_off=function()\n\t\tobj.a=0\n\tend\n\t\n\tobj.set_on=function()\n\t\tobj.a=0.5\n\tend\n\t\n\treturn obj\nend\n\nfunction new_grid()\n\tgrid={}\n\tgrid.objs={}\n\tgrid.point={x=1+rnd(16)\\1,y=1+rnd(16)\\1}\n\tgrid.temp_p={x=-1,y=-1}\n\tfor x=1,15 do\n\t\trow={}\n\t\tfor y=1,15 do\n\t\t\tlocal nx=2+(x-1)*9\n\t\t\tlocal ny=2+(y-1)*9\n\t\t\tadd(row,new_obj(nx,ny))\n\t\tend\n\t\t add(grid.objs,row)\n\tend\n\t\n\tgrid.draw=function(self)\n\t\tlocal p=self.point\n\t\tlocal spot=self.objs[p.x][p.y]\n\t\t\n\t\tlocal x=1\n\t\tfor row in all(self.objs) do\n\t\t\tlocal y=1\n\t\t\tfor obj in all(row) do\n\t\t\t\tif (self.point.x==x and\n\t\t\t\t\tself.point.y==y) or\n\t\t\t\t\t(self.temp_p.x==x and\n\t\t\t\t\tself.temp_p.y==y) then\n\t\t\t\t\t\tobj:set_on()\n\t\t\t\telse\n\t\t\t\t\tobj:set_off()\n\t\t\t\tend\n\t\t\t\tobj:draw()\n\t\t\t\ty+=1\n\t\t\tend\n\t\t\tx+=1\n\t\tend\n\tend\n\t\n grid.step=function(self)\n\t\tr=rnd()\n\t\tlocal x=0\n\t\tlocal y=0\n\t\tif r<=0.25 then\n\t\t\tx=1\n\t\telseif r<=0.50 then\n\t\t\ty=1\n\t\telseif r<=0.75 then\n\t\t x=-1\n\t\telse\n\t\t\ty=-1\n\t\tend\n\t\t\n\t\tself.point.x+=x\n\t\tself.point.y+=y\n\t\t\n\t\tif self.point.x>#self.objs-1 then\n\t\t\tself.point.x=1\n\t\telseif self.point.x<1 then\n\t\t\tself.point.x=#self.objs-1\n\t\tend\n\t\t\n\t\tif self.point.y>#self.objs-1 then\n\t\t\tself.point.y=1\n\t\telseif self.point.y<1 then\n\t\t\tself.point.y=#self.objs-1\n\t\tend\n\tend\n\t\n\treturn grid\nend\n\nfunction burn()\n\tfor i=0,64 do\n\t\tx=rnd(128)\n\t\ty=rnd(128)\n\t\t\n\t\tpset(x,y,2)\n\tend\nend\n\ng=new_grid()\nfc=0\n_set_fps(60)\n\nmonth=stat(81)\nday=stat(82)\n\ncls(2)\n::♥::\nif t()<2 then\n\tprint(\"random walk ii\",36,59,1)\n\tprint(month..\"/\"..day,55,65)\nelseif t()==2 then\n\tcls(2)\nelse\n\tburn()\n\tg:draw()\n\t\n\tif btnp(❎) or btnp(🅾️)then\n\t\tlocal p={}\n\t\tp={x=1+rnd(15)\\1,y=1+rnd(15)\\1}\n\t\tg.temp_p=p\n\tend\n\t\n\tfc+=1\n\tif fc%4==0 then\n\t\tg:step()\n\tend\n\t\n\tif fc%1200==0 then\n\t\tsrand(31*stat(81)+stat(82))\n\t\tfc=0\n\tend\nend\nflip()\ngoto ♥","tags":["pico-8","pico8"],"symbol":"OBJKT","artifactUri":"ipfs://Qmd5aZtodCB44zRz9o6Zn8RdPZN7DzRpcMJN1r1BAPp77R","displayUri":"ipfs://QmW3B4KG5rnSmQrZvnYsw1Kp4PA8Ed1bCFtMknJj5BmMb9","thumbnailUri":"ipfs://QmNrhZHUaEqxhyLfqoq1mtHSipkWHeT31LNHb1QEbDHgnc","creators":["tz1St3n29AbYXZXV8W1BG41qYzz86J2CFAW7"],"formats":[{"uri":"ipfs://Qmd5aZtodCB44zRz9o6Zn8RdPZN7DzRpcMJN1r1BAPp77R","mimeType":"application/x-directory"}],"decimals":0,"isBooleanAmount":false,"shouldPreferSymbol":false}