• Sun. Dec 11th, 2022

Flappy bird in 228 bytes (improved!). GitHub Gist: instantly share code, notes, and snippets.

Nov 30, 2020

You can get another five bytes by moving the click event handler to an attribute:data:text/html,<body onload=”z=c.getContext`2d`;c.width=c.height=W=401,Q=z.fillRect.bind(z),N=M=>z.fillStyle=M;M=S=p=0;Y=E=200;setInterval(_=>{!p&&(p=W,P=E*Math.random()),N`red`,Q(0,0,W,W),Y-=M-=.5,p-=8,N`black`,Q(p,0,V=50,P),p<-V?p=0:Q(p,P+E,V,W),((Y<PY>P+E)&p<B)Y>W?(M=S=p=0,Y=E):z.fillText(S++,9,B);Q(0,Y,B,B)},B=24)”><canvas id=c onclick=M=9>
(You could even get another byte by adding that attribute without a space after the onload on body, but that changes the behavior slightly by extending the clickable area.)