Mastodon

About

"Inelegant Efficiency" is a term I use for putting the maximum amount of ingenuity, into the smallest space.

I will probably write a booklet on my golfing techniques at some point...


Dwitter

An excuse to code something in 140 characters of JavaScript. Some folk, myself included, "cheat" by compressing their code with a Dwitter compressor.

My work has won 3 awards, to date.

Here is the more general definition of the term Code Golf

  • Race track
    for(F=255,L=8e4;U=L%F,V=L/F,L--;)P=F/(V-79),N=(U/F-.5)*P-.05*S(t)*P*P,N*=N,D=S(P+F*t+V/9)>0,T=V<92?23:N>4?12:N>2?48+15*D:N<.01&&!D?63:21,x.fillStyle=R(T*5,T%16*20,T%4*85),x.fillRect(U*9,V*3,9,3)
    
  • Flocking algorithm
    if(!t)for(F=[],i=27;i--;)F[i]={X:i*i,Y:i*9,U:i,V:0};t=t*99%999;c.width|=r=v=>v<9?v:9;s=p=>r(t{with(f){E=(B=(A=t-X)*A+(D=(C=t-Y)*C))/B;x.fillRect(X+=U+=s(X),Y+=V+=s(Y),9,9)}}) 
    
  • Pixel Shader
    M=t?M+1:0;for(F=255,P=F*F;--P;x.fillStyle=c,x.fillRect(X*8,y*5,8,5))for(X=P%F,y=P/F,c=0,D=9;!c;++D)v=X-D,c=v<0?(((y*D&F)+y+X&F)==0)?R(F,F,F):R(C,y,y):(K=(y*D>>8|v*D>>8)&D+M,K&16?R(K*=4,K,K):0)
    
  • Game of Life
    c.width|=0;t?0:g=0,l=15;for(h=[i=(N=75)*N];i--;x.fillRect(i%N*l,l*~j-1000,(h[i]=g?p-5?p==6:g[i]:new Date&1)*l,l))for(z=p=9;z--;p-=g[~j%N*N+~(-i-z/3-N)%N])j=-(i/N+z%3)-N;g=h
    
  • Cellular Automation
    r=typeof r=='undefined'?1:r;s=9;j=1;for(n=i=0;i<32;j*=2);(j&r)&&x.fillRect(i*s,t*600,s,s),;n|=126&1<<((r&1<<++i?4:0)|(r&j?2:0)|(r&1<
    
    (Since writing this, I have learned a lot of better golfing techniques)

10 Lines of BASIC

10 Line Dino is a minimal version of the "no internet" game, found in Chrome.

Run it under the EMF emulator

10 Line Dino - competition page


In C

Once upon a time, I wrote a Mandelbrot set generator, where the C code was shaped like a Mandelbrot set

There's also a tiny version of the song, 99 bottles of beer