lbatchelor
Joined 10 years ago
Joined 10 years ago
If anyone's interested, I've tried to annotate a fair amount of the tricks I've used so far: https://github.com/lukebatchelor/url-snake/blob/main/golf/de...
let e=document.body,t="Space: start/reset. Arrows: Move<div><canvas id=a><style>#a{border:solid}{background:tan}</style>",r=40,n=400,o,d=[[4,3]],s=d[0],c="#000",p=(e="red",t=n,a=0,l=a)=>{C[f="fillStyle"]=e,C.fillRect(ar,lr,t,t)},h=(e,t=n/2,a=t,l="center")=>{C[f]=c,C.textAlign=l,C.fillText(e,t,a)};e.innerHTML=t,C=a.getContext`2d`,a.height=a.width=n,C.font="30px f",e.onkeyup=({which:e})=>{36<e&&e<41?H=e-38:32!=e||o||(o=1,d=[[4,3]],H=2,S=0)},setInterval(i=>{if(o){let[e,t]=d[0],a=e+H%2,l=t+(H-1)%2,n=([e,t])=>e==a&&t==l;if(d.pop(),a<0||9<a||l<0||9<l||d.some(n))return o=0,p(),h`:(`;d=[[a,l],...d],n(s)&&(d[++S]=d[S-1],s=[(D=new Date)%10,DS%10]),p`tan`,d.map(e=>p(c,r,...e)),p(i,r,...s),h(S,9,30,"left")}},n);
I could host my own shortener to do it, but it feels like that is cheating the spirit of the challenge.
I'll keep playing with it though, add touch device controls, maybe a site to allow generating different versions of the url (different colours, sizes, game over messages, etc).
https://docs.google.com/spreadsheets/d/1T3bv8ThluHc18ghI8u9m...
Thank you for the inspiration!
Massive shout out to Barld Boot who's tic tac toe implementation I based this off! https://medium.com/@bakeds/play-tic-tac-toe-with-the-help-of...
- that the code is 100% mit licensed (it's not)
- that this is in any way gdpr compliant (there are literal rules around this)
- that your data is encrypted and private (it isn't encrypted? Unless being written in Italian is encryption now?)
- that they'll have 99.9% uptime (there is no SLA for vercel hobby tiers)
- "No middlemen. No third-party storage. Every submission lives in your GitHub..." (that is the very definition of third-party storage and a middleman)