├── .gitattributes ├── history.js ├── index.html ├── inputs ├── clock.txt ├── column.txt ├── column2.txt ├── column3.txt ├── corners.txt ├── dripping-pan.txt ├── endoh1.c ├── evaporation.txt ├── flat.txt ├── fountain.txt ├── funnel.txt ├── funnel2.txt ├── funnel3.txt ├── glass-half-empty.txt ├── hint.md ├── leidenfrost.txt ├── logo.txt ├── pour-out.txt └── tanada.txt ├── quine.html ├── quinemaker.html └── xemquine.html /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /history.js: -------------------------------------------------------------------------------- 1 | // compressed with https://xem.github.io/terser-online/ 2 | 3 | function e(e,a,r){this.posx=e,this.posy=a,this.wallflag=r,this.velx=0,this.vely=0,this.forcex=0,this.forcey=0,this.density=0}accuracy=1,Gravity=1,Pressure=3,Viscosity=4,w=79*accuracy,h=25*accuracy,scale=2;var a=[];canvas.width=w*scale,canvas.height=h*scale;var r=canvas.getContext("2d");previewarea.cols=w,previewarea.rows=h,init=()=>{a=[];for(var r=previewarea.value,s=0,t=0,c=0;c{for(var e=0;e{for(var e=0;e{canvas.width^=0,r.fillStyle="#0008";for(var e=0;e{density(),force(),draw()},fetch("inputs/endoh1.c").then(e=>e.text()).then(e=>{previewarea.value=e,init(),setInterval(nextframe,33)}) 4 | 5 | accuracy=1,Gravity=1,Pressure=3,Viscosity=4,w=79*accuracy,h=25*accuracy,scale=2;var e=[];canvas.width=w*scale,canvas.height=h*scale;var a=canvas.getContext("2d");previewarea.cols=w,previewarea.rows=h,init=()=>{e=[];for(var a=previewarea.value,r=0,s=0,c=0;c{for(var a=0;a{for(var a=0;a{canvas.width^=0,a.fillStyle="#0008";for(var r=0;r{density(),force(),draw()},fetch("inputs/endoh1.c").then(e=>e.text()).then(e=>{previewarea.value=e,init(),setInterval(nextframe,33)}) 6 | 7 | e=[];canvas.width=158,canvas.height=50;var r=canvas.getContext("2d");previewarea.cols=79,previewarea.rows=25,init=()=>{e=[];for(var r=previewarea.value,a=0,t=0,o=0;o{for(var r=0;r{for(var r=0;r{canvas.width^=0,r.fillStyle="#0008";for(var a=0;a{density(),force(),draw()},fetch("inputs/endoh1.c").then(e=>e.text()).then(e=>{previewarea.value=e,init(),setInterval(nextframe,33)}) 8 | 9 | e=[];c.width=158,c.height=50;var r=c.getContext("2d");p.cols=79,p.rows=25,init=()=>{e=[];for(var r=p.value,t=0,o=0,a=0;a{for(var r=0;r{for(var r=0;r{c.width^=0,r.fillStyle="#0008";for(var t=0;t{density(),force(),draw()},fetch("inputs/endoh1.c").then(e=>e.text()).then(e=>{p.value=e,init(),setInterval(nextframe,33)}) 10 | 11 | r=[];c.width=158,c.height=50;var t=c.getContext("2d");p.cols=79,p.rows=25,init=()=>{r=[];for(var t=p.value,a=0,e=0,v=0;v{for(var t=0;t{for(var t=0;t{c.width^=0,t.fillStyle="#0008";for(var a=0;a{d(),force(),draw()},fetch("inputs/endoh1.c").then(r=>r.text()).then(r=>{p.value=r,init(),setInterval(nextframe,33)}) 12 | 13 | r=[];c.width=158,c.height=50;var t=c.getContext("2d");init=()=>{r=[];for(var t=p.value,a=0,e=0,v=0;v{for(var t=0;t{for(var t=0;t{c.width^=0,t.fillStyle="#0008";for(var a=0;a{d(),force(),draw()},fetch("inputs/endoh1.c").then(r=>r.text()).then(r=>{p.value=r,init(),setInterval(nextframe,33)}) 14 | 15 | t=[];c.width=158,c.height=50;var r=c.getContext("2d");init=()=>{t=[];for(var r=p.value,e=0,a=0,f=0;ft.text()).then(e=>{p.value=e,init(),setInterval(()=>{for(var e=0;e{t=[];for(r=p.value,e=0,a=0,f=0;ft.text()).then(e=>{p.value=e,init(),setInterval(()=>{for(e=0;e{t=[];for(e=p.value,r=0,a=0,n=0;nt.text()).then(r=>{p.value=r,init(),setInterval(()=>{for(r=0;r{for(i=a.length;i--;)for(p=a[i],p.D=p.w?9:0,k=a.length;k--;)q=a[k],e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5/2-1,p.D+=W*W);for(i=a.length;i--;)for(p=a[i],p.d=G,p.c=0,k=a.length;k--;)q=a[k],f=p.y-q.y,e=p.x-q.x,g=f*f+e*e,g<4&&(W=g**.5/2-1,p.d+=(f*(3-p.D-q.D)*P+p.b*V-q.b*V)*W/p.D,p.c+=(e*(3-p.D-q.D)*P+p.a*V-q.a*V)*W/p.D);for(c.width^=0,X.fillStyle="#0008",i=a.length;i--;)p=a[i],x=p.x,y=p.y,p.w||(p.y+=p.b+=p.d/10,p.x+=p.a+=p.c/20),X.fillRect(2*x,2*y,4,4)},33) 22 | 23 | for(C of(P=3,V=4,a=[],c.width=160,c.height=50,X=c.getContext`2d`,a=[],y=0,x=0,v=O.value))if("\n"===C)y++,x=0;else{if(" "!==C)for(e=0;e<1;e++)for(f=0;f<1;f++)a.push({x:x+e,y:y+f,w:"#"===C,a:0,b:0,c:0,d:0,D:0});x++}setInterval(()=>{for(i=a.length;i--;)for(p=a[i],p.D=p.w?9:0,k=a.length;k--;)q=a[k],e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5/2-1,p.D+=W*W);for(i=a.length;i--;)for(p=a[i],p.d=1,p.c=0,k=a.length;k--;)q=a[k],f=p.y-q.y,e=p.x-q.x,g=f*f+e*e,g<4&&(W=g**.5/2-1,p.d+=(f*(3-p.D-q.D)*P+p.b*V-q.b*V)*W/p.D,p.c+=(e*(3-p.D-q.D)*P+p.a*V-q.a*V)*W/p.D);for(c.width^=0,X.fillStyle="#0008",i=a.length;i--;)p=a[i],x=p.x,y=p.y,p.w||(p.y+=p.b+=p.d/10,p.x+=p.a+=p.c/20),X.fillRect(2*x,2*y,4,4)},33) 24 | 25 | for(C of(P=3,V=4,a=[],c.width=160,c.height=50,X=c.getContext`2d`,a=[],y=0,x=0,v=O.value))"\n"===C?(y++,x=0):(" "!==C&&a.push({x:x,y:y,w:"#"===C,a:0,b:0,c:0,d:0,D:0}),x++);setInterval(()=>{for(i=a.length;i--;)for(p=a[i],p.D=p.w?9:0,k=a.length;k--;)q=a[k],e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5/2-1,p.D+=W*W);for(i=a.length;i--;)for(p=a[i],p.d=1,p.c=0,k=a.length;k--;)q=a[k],f=p.y-q.y,e=p.x-q.x,g=f*f+e*e,g<4&&(W=g**.5/2-1,p.d+=(f*(3-p.D-q.D)*P+p.b*V-q.b*V)*W/p.D,p.c+=(e*(3-p.D-q.D)*P+p.a*V-q.a*V)*W/p.D);for(c.width^=0,X.fillStyle="#0008",i=a.length;i--;)p=a[i],x=p.x,y=p.y,p.w||(p.y+=p.b+=p.d/10,p.x+=p.a+=p.c/20),X.fillRect(2*x,2*y,4,4)},33) 26 | 27 | for(C of(P=3,V=4,a=[],c.width=160,c.height=50,X=c.getContext`2d`,a=[],y=0,x=0,v=O.value))"\n"==C?(y++,x=0):(" "!==C&&a.push({x:x,y:y,w:"#"==C,a:0,b:0,c:0,d:0,D:0}),x++);setInterval(()=>{for(i=a.length;i--;)for(p=a[i],p.D=p.w?9:0,k=a.length;k--;)q=a[k],e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5/2-1,p.D+=W*W);for(i=a.length;i--;)for(p=a[i],p.d=1,p.c=0,k=a.length;k--;)q=a[k],f=p.y-q.y,e=p.x-q.x,g=f*f+e*e,g<4&&(W=g**.5/2-1,p.d+=(f*(3-p.D-q.D)*P+p.b*V-q.b*V)*W/p.D,p.c+=(e*(3-p.D-q.D)*P+p.a*V-q.a*V)*W/p.D);for(c.width^=0,X.fillStyle="#0008",i=a.length;i--;)p=a[i],x=p.x,y=p.y,p.w||(p.y+=p.b+=p.d/10,p.x+=p.a+=p.c/20),X.fillRect(2*x,2*y,4,4)},33) 28 | 29 | for(C of(a=[],c.width=160,c.height=50,X=c.getContext`2d`,a=[],y=x=0,v=O.value))"\n"==C?(y++,x=0):(" "!==C&&a.push({x:x,y:y,w:"#"==C,a:0,b:0,c:0,d:0,D:0}),x++);setInterval(()=>{for(i=l=a.length;i--;)for(p=a[i],p.D=p.w?9:0,k=l;k--;)q=a[k],e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5/2-1,p.D+=W*W);for(i=l;i--;)for(p=a[i],p.d=1,p.c=0,k=l;k--;)q=a[k],f=p.y-q.y,e=p.x-q.x,g=f*f+e*e,g<4&&(W=g**.5/2-1,p.d+=(f*(3-p.D-q.D)*3+3*p.b-3*q.b)*W/p.D,p.c+=(e*(3-p.D-q.D)*3+3*p.a-3*q.a)*W/p.D);for(c.width^=0,X.fillStyle="#0008",i=l;i--;)p=a[i],x=p.x,y=p.y,p.w||(p.y+=p.b+=p.d/10,p.x+=p.a+=p.c/20),X.fillRect(2*x,2*y,4,4)},33) 30 | 31 | for(C of(a=[],c.width=160,c.height=50,X=c.getContext`2d`,y=x=0,v=O.value))"\n"==C?(y++,x=0):(" "!==C&&a.push({x:x,y:y,w:"#"==C,a:0,b:0,c:0,d:0,D:0}),x++);setInterval(()=>{for(i=l=a.length;i--;)for(p=a[i],p.D=p.w?9:0,k=l;k--;)q=a[k],e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5-2,p.D+=W*W);for(i=l;i--;)for(p=a[i],p.d=1,p.c=0,k=l;k--;)q=a[k],f=p.y-q.y,e=p.x-q.x,g=f*f+e*e,g<4&&(W=g**.5-2,p.d+=(f*(3-p.D-q.D)+p.b-q.b)*W/p.D,p.c+=(e*(3-p.D-q.D)+p.a-q.a)*W/p.D);for(c.width^=0,X.fillStyle="#0008",i=l;i--;)p=a[i],x=p.x,y=p.y,p.w||(p.y+=p.b+=p.d/10,p.x+=p.a+=p.c/20),X.fillRect(2*x,2*y,4,4)},33) 32 | 33 | for(C of(a=[],c.width=160,c.height=50,X=c.getContext`2d`,y=x=0,v=O.value))"\n"==C?(y++,x=0):(" "!==C&&a.push({x:x,y:y,w:"#"==C,a:0,b:0,c:0,d:0,D:0}),x++);setInterval(()=>{for(i=l=a.length;i--;)for(p=a[i],p.D=p.w?9:0,k=l;q=a[--k];)e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5-2,p.D+=W*W);for(i=l;i--;)for(p=a[i],p.d=1,p.c=0,k=l;q=a[--k];)e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5-2,p.d+=(f*(3-p.D-q.D)+p.b-q.b)*W/p.D,p.c+=(e*(3-p.D-q.D)+p.a-q.a)*W/p.D);for(c.width^=0,X.fillStyle="#0008",i=l;i--;)p=a[i],x=p.x,y=p.y,p.w||(p.y+=p.b+=p.d/10,p.x+=p.a+=p.c/20),X.fillRect(2*x,2*y,4,4)},33) 34 | 35 | for(C of(a=[],c.width=160,c.height=50,X=c.getContext`2d`,y=x=0,v=O.value))"\n"==C?(y++,x=0):(" "!==C&&a.push({x:x,y:y,w:"#"==C,a:0,b:0,c:0,d:0,D:0}),x++);setInterval(()=>{for(i=l=a.length;p=a[--i];)for(p.D=p.w?9:0,k=l;q=a[--k];)e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5-2,p.D+=W*W);for(i=l;p=a[--i];)for(p.d=1,p.c=0,k=l;q=a[--k];)e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5-2,p.d+=(f*(3-p.D-q.D)+p.b-q.b)*W/p.D,p.c+=(e*(3-p.D-q.D)+p.a-q.a)*W/p.D);for(c.width^=0,X.fillStyle="#0008",i=l;p=a[--i];)x=p.x,y=p.y,p.w||(p.y+=p.b+=p.d/10,p.x+=p.a+=p.c/20),X.fillRect(2*x,2*y,4,4)},33) 36 | 37 | for(C of(a=[],c.width=160,c.height=50,X=c.getContext`2d`,y=x=0,v=O.value))"\n"==C?(y++,x=0):(" "!==C&&a.push({x:x,y:y,w:"#"==C,a:0,b:0,c:0,d:0,D:0}),x++);setInterval(()=>{for(i=l=a.length;p=a[--i];)for(p.D=p.w?9:0,k=l;q=a[--k];)e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5-2,p.D+=W*W);for(i=l;p=a[--i];)for(p.d=1,p.c=0,k=l;q=a[--k];)e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5-2,p.d+=(f*(3-p.D-q.D)+p.b-q.b)*W/p.D,p.c+=(e*(3-p.D-q.D)+p.a-q.a)*W/p.D);for(c.width^=0,X.fillStyle="#0008",i=l;p=a[--i];)X.fillRect(2*p.x,2*p.y,4,4),p.w||(p.y+=p.b+=p.d/10,p.x+=p.a+=p.c/20)},33) 38 | 39 | for(C of(a=[],c.width=160,c.height=50,X=c.getContext`2d`,y=x=0,v=O.value))"\n"==C?(y++,x=0):(" "!==C&&a.push({x:x,y:y,w:"#"==C,a:0,b:0,c:0,d:0,D:0}),x++);setInterval((()=>{for(i=l=a.length;p=a[--i];)for(p.D=p.w?9:0,k=l;q=a[--k];)e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5/2-1,p.D+=W*W);for(i=l;p=a[--i];)for(p.d=1,p.c=0,k=l;q=a[--k];)e=p.x-q.x,f=p.y-q.y,g=e*e+f*f,g<4&&(W=g**.5/2-1,p.d+=(f*(3-p.D-q.D)*3+4*p.b-4*q.b)*W/p.D,p.c+=(e*(3-p.D-q.D)*3+4*p.a-4*q.a)*W/p.D);for(c.width^=0,X.fillStyle="#0005",i=l;p=a[--i];)x=p.x,y=p.y,X.fillRect(2*p.x,2*p.y,4,4),p.w||(p.y+=p.b+=p.d/10,p.x+=p.a+=p.c/20)}),33) 40 | 41 | for(C of(a=[],X=c.getContext`2d`,y=x=0,O.value))"\n"==C?(y++,x=0):(" "!==C&&a.push({x:x,y:y,w:"#"==C,a:0,b:0,c:0,d:0,D:0}),x++);setInterval((()=>{for(i=l=a.length;p=a[--i];)for(p.D=p.w?9:0,k=l;q=a[--k];)g=Math.hypot(p.x-q.x,p.y-q.y),g<2&&(g=g**.5/2-1,p.D+=g*g);for(i=l;p=a[--i];)for(p.d=1,p.c=0,k=l;q=a[--k];)g=Math.hypot(e=p.x-q.x,f=p.y-q.y),g<2&&(g=g/2-1,p.d+=(f*(3-p.D-q.D)*3+4*p.b-4*q.b)*g/p.D,p.c+=(e*(3-p.D-q.D)*3+4*p.a-4*q.a)*g/p.D);for(c.width^=0,X.fillStyle="#0005",i=l;p=a[--i];)x=p.x,y=p.y,X.fillRect(3*p.x,5*p.y,8,8),p.w||(p.y+=p.b+=p.d/10,p.x+=p.a+=p.c/20)}),33) 42 | 43 | for(C of(a=[],X=c.getContext`2d`,y=x=0,O.value))"\n"==C?(y++,x=0):(" "!==C&&a.push({x:x,y:y,w:"#"==C,a:0,b:0,c:0,d:0,D:0}),x++);setInterval((()=>{for(p of a)for(q of(p.D=p.w?9:0,a))g=Math.hypot(p.x-q.x,p.y-q.y),g<2&&(g=g/2-1,p.D+=g*g);for(p of a)for(q of(p.d=1,p.c=0,a))g=Math.hypot(e=p.x-q.x,f=p.y-q.y),g<2&&(g=g/2-1,p.d+=(f*(3-p.D-q.D)*3+4*p.b-4*q.b)*g/p.D,p.c+=(e*(3-p.D-q.D)*3+4*p.a-4*q.a)*g/p.D);for(p of(c.width^=0,X.fillStyle="#0005",a))x=p.x,y=p.y,X.fillRect(3*p.x,5*p.y,9,8),p.w||(p.y+=p.b+=p.d/25,p.x+=p.a+=p.c/15)}),16) 44 | 45 | for(C of(a=[],X=c.getContext`2d`,y=x=0,O.value))C<" "?(y++,x=0):(C>" "&&a.push({x:x,y:y,p:"#"!=C,a:0,b:0,c:0,d:0,D:9}),x++);M=(p,o)=>{for(q of a)g=Math.min(0,Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1),o?(p.d+=(f*(3-p.D-q.D)*3+4*(p.b-q.b))*g/p.D,p.c+=(e*(3-p.D-q.D)*3+4*(p.a-q.a))*g/p.D):p.D+=g*g},setInterval(o=>{for(p of(c.width^=0,a))p.p&&(p.y+=p.b+=p.d/25,p.x+=p.a+=p.c/15,M(p,p.D=p.c=0),M(p,p.d=1)),X.fillRect(3*p.x,5*p.y,8,9)},16) 46 | 47 | for(C of(a=[],X=c.getContext`2d`,y=x=0,O.value))C<" "?(y++,x=0):(C>" "&&a.push({x,y,w:"#"==C,a:0,b:0}),x++);setInterval((()=>{for(p of a)for(q of(p.D=9*p.w,a))g=Math.hypot(p.x-q.x,p.y-q.y),g<2&&(g=g/2-1,p.D+=g*g);for(p of a)for(q of(p.d=1,p.c=0,a))g=Math.hypot(e=p.x-q.x,f=p.y-q.y),g<2&&(g=(2*g-4)/p.D,p.d+=(f*(z=3-p.D-q.D)+p.b-q.b)*g,p.c+=(e*z+p.a-q.a)*g);for(p of(c.width^=0,a))X.fillRect(3*p.x,5*p.y,8,9),p.w||(p.y+=p.b+=p.d/25,p.x+=p.a+=p.c/15)}),9) 48 | 49 | for(C of(a=[],X=c.getContext`2d`,y=x=0,O.value))C<" "?(y++,x=0):(C>" "&&a.push({x,y,w:"#"==C,a:0,b:0}),x++);M=o=>{for(p of a)for(q of(o?p.D=9*p.w:(p.d=1,p.c=0),a))g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2,o?p.D+=g<1&&--g*g:g<1&&(g=(4*g-4)/p.D,p.d+=(f*(z=3-p.D-q.D)+p.b-q.b)*g*2,p.c+=(e*z+p.a-q.a)*g*2)},setInterval((f=>{for(p of(M(1),M(),c.width^=0,a))X.fillRect(3*p.x,5*p.y,8,9),p.w||(p.y+=p.b+=p.d/25,p.x+=p.a+=p.c/15)}),9) 50 | 51 | for(C of(X=c.getContext`2d`,x=y=a=[],O.value))C<" "?(y++,x=0):(C>" "&&a.push({x,y,w:"#"==C,a:0,b:0}),x++);M=x=>{for(p of a)for(q of(x?p.D=9*p.w:(p.d=1,p.c=0),a))g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2,x?p.D+=g<1&&--g*g:g<1&&(g=(4*g-4)/p.D,p.d+=(f*(z=3-p.D-q.D)+p.b-q.b)*g*2,p.c+=(e*z+p.a-q.a)*g*2)},setInterval((f=>{for(p of(M(1),c.width^=M(),a))X.fillText("@",3*p.x,5*p.y),p.w||(p.y+=p.b+=p.d/30,p.x+=p.a+=p.c/15)}),9) 52 | 53 | for(C of(X=c.getContext`2d`,x=y=a=[],O.value))C<" "?(y++,x=0):(C>" "&&a.push({x,y,C,w:"#"==C,a:0,b:0}),x++);M=o=>{for(p of a)for(q of(p.d=.1,p.c=0,o||(p.D=9*p.w),a))!((g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1)<0)||(o?(g=g/p.D/2,p.d+=(f*(z=3-p.D-q.D)+p.b-q.b)*g,p.c+=(e*z+p.a-q.a)*g):p.D+=g*g)},setInterval(o=>{for(p of(M(c.width^=M()),a))X.fillText(p.C,3*p.x,5*p.y),p.w||(p.y+=p.b+=p.d/2,p.x+=p.a+=p.c)},9) 54 | 55 | for(C of(X=c.getContext`2d`,x=y=a=[],O.value))C<" "?(y++,x=0):(C>" "&&a.push({x,y,C,w:"#"==C,a:0,b:0}),x++);M=o=>{for(p of a)for(q of(p.d=.1,p.c=0,o||(p.D=9*p.w),a))!((g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1)<0)||(o?(g/=p.D*2,p.d+=(f*(z=3-p.D-q.D)+p.b-q.b)*g,p.c+=(e*z+p.a-q.a)*g):p.D+=g*g)},setInterval(o=>{for(p of(M(c.width^=M()),a))X.fillText(p.C,3*p.x,5*p.y),p.w||(p.y+=p.b+=p.d/2,p.x+=p.a+=p.c)},9) 56 | 57 | for(C of(X=c.getContext`2d`,x=y=a=[],O.value))C<" "?(y++,x=0):(C>" "&&a.push({x,y,C,w:"#"==C,a:0,b:0}),x++);M=o=>{for(p of a)for(q of(p.d=.1,p.c=0,o||(p.D=9*p.w),a))!((g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1)<0)||(o?(g/=2*p.D,p.d+=(f*(z=3-p.D-q.D)+p.b-q.b)*g,p.c+=(e*z+p.a-q.a)*g):p.D+=g*g)},setInterval(_=>{for(p of(M(c.width^=M()),a))with(p)X.fillText(C,3*x,5*y),w||(y+=b+=d/2,x+=a+=c)},9) 58 | 59 | for(C of(X=c.getContext`2d`,x=y=a=[],O.value))C<" "?(y++,x=0):(C>" "&&a.push({x,y,C,w:"#"==C,a:0,b:0}),x++);M=x=>{for(p of a)for(q of(p.d=.1,p.c=0,x||(p.D=9*p.w),a))!((g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1)<0)||(x?(g/=2*p.D,p.d+=(f*(z=3-p.D-q.D)+p.b-q.b)*g,p.c+=(e*z+p.a-q.a)*g):p.D+=g*g)},setInterval`for(p of(M(c.width^=M()),a))with(p)X.fillText(C,3*x,5*y),w||(y+=b+=d/2,x+=a+=c)` 60 | 61 | for(C of(X=c.getContext`2d`,x=y=a=[],O.value))C<" "?(y++,x=0):(C>" "&&a.push({x,y,C,w:"#"==C,a:0,b:0}),x++);M=x=>{for(p of a)for(q of(p.d=.1,p.c=0,x||(p.D=9*p.w),a))(g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1)<0&&(x?(g/=2*p.D,p.d+=(f*(z=3-p.D-q.D)+p.b-q.b)*g,p.c+=(e*z+p.a-q.a)*g):p.D+=g*g)},setInterval`for(p of(M(c.width^=M()),a))with(p)X.fillText(C,3*x,5*y),w||(y+=b+=d/2,x+=a+=c)` 62 | 63 | X=c.getContext`2d`;x=y=a=[];for(C of O.value)++x,C<" "?x=!++y:C>" "&&a.push({x,y,C,w:"#"==C,a:0,b:0});M=o=>a.map(p=>{for(q of(p.d=.1,p.c=0,o||(p.D=9*p.w),a))(g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1)<0?o?(g/=p.D,p.d+=(f*(z=3-p.D-q.D)+p.b-q.b)*g,p.c+=(e*z+p.a-q.a)*g):p.D+=g*g:1});setInterval`M(c.width^=M());for(p of a)with(p)X.fillText(C,3*x,5*y),w||(y+=b+=d/4,x+=a+=c/2)` 64 | 65 | x=y=a=[];for(C of O.value)++x,C<" "?x=!++y:C>" "&&a.push({x,y,C,w:"#"==C,u:0,v:0});M=o=>a.map(p=>{p.t=.1;p.s=0;o||(p.D=9*p.w);for(q of a)(g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1)<0?o?(g/=p.D,p.t+=(f*(z=3-p.D-q.D)+p.v-q.v)*g,p.s+=(e*z+p.u-q.u)*g):p.D+=g*g:1});setInterval`M(c.width^=M());for(p of a)with(p)c.getContext("2d").fillText(C,3*x,5*y),w||(y+=v+=t/4,x+=u+=s/2)` 66 | 67 | x=y=a=[];for(C of O.value)++x,C<" "?x=!++y:C>" "&&a.push({x,y,C,w:"#"==C,u:0,v:0});M=o=>a.map(p=>{p.t=.1;p.s=0;o||(p.D=p.w);for(q of a)(g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1)<0?o?(g/=p.D,p.t+=(f*(z=3-p.D-q.D)+p.v-q.v)*g,p.s+=(e*z+p.u-q.u)*g):p.D+=g*g:1});setInterval`M(c.width^=M());for(p of a)with(p)c.getContext("2d").fillText(C,3*x,5*y),w||(y+=v+=t/4,x+=u+=s/2)` 68 | 69 | x=y=a=[];for(C of O.value)++x,C<" "?x=!++y:C>" "&&a.push({x,y,C,w:"#"==C,u:0,v:0});M=o=>a.map(p=>{p.t=.1;p.s=0;o||(p.D=p.w);a.map(q=>(g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1)<0?o?(g/=p.D,p.t+=(f*(z=3-p.D-q.D)+p.v-q.v)*g,p.s+=(e*z+p.u-q.u)*g):p.D+=g*g:1)});setInterval`M(c.width^=M());for(p of a)with(p)c.getContext("2d").fillText(C,3*x,5*y),w||(y+=v+=t/4,x+=u+=s/2)` 70 | 71 | _=a=[];for(C of O.value)_++,C>" "&&a.push({x:_%80,y:_/80|0,C,w:"#"==C,u:0,v:0});M=o=>a.map(p=>{p.t=.1;p.s=0;o||(p.D=p.w);a.map(q=>(g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1)<0?o?(g/=p.D,p.t+=(f*(z=3-p.D-q.D)+p.v-q.v)*g,p.s+=(e*z+p.u-q.u)*g):p.D+=g*g:1)});setInterval`M(c.width^=M());for(p of a)with(p)c.getContext("2d").fillText(C,3*x,5*y),w||(y+=v+=t/4,x+=u+=s/2)` 72 | 73 | _=a=[];for(C of O.value)_++,C>" "&&a.push({x:_%80,y:_/80|0,C,w:"$">C,u:0,v:0});M=o=>a.map(p=>{p.t=.1;p.s=0;o||(p.D=p.w);a.map(q=>(g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1)<0?o?(g/=p.D,p.t+=(f*(z=3-p.D-q.D)+p.v-q.v)*g,p.s+=(e*z+p.u-q.u)*g):p.D+=g*g:1)});setInterval`M(c.width^=M());for(p of a)with(p)c.getContext("2d").fillText(C,3*x,5*y),w||(y+=v+=t/4,x+=u+=s/2)` 74 | 75 | _=a=[];for(C of O.value)_++,C>" "&&a.push({x:_%128,y:_>>7,C,w:"$">C,u:0,v:0});M=o=>a.map(p=>{p.t=.1;p.s=0;o||(p.D=p.w);a.map(q=>(g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1)<0?o?(g/=p.D,p.t+=(f*(z=3-p.D-q.D)+p.v-q.v)*g,p.s+=(e*z+p.u-q.u)*g):p.D+=g*g:1)});setInterval`M(c.width^=M());for(p of a)with(p)c.getContext("2d").fillText(C,3*x,5*y),w||(y+=v+=t/4,x+=u+=s/2)` 76 | 77 | _=a=[];for(C of O.value)_++,C!=0&&a.push({x:_%64,y:_>>6,C,w:'$'>C,u:0,v:0});M=o=>a.map(p=>{p.t=.1;p.s=0;o||(p.D=p.w);a.map(q=>(g=Math.hypot(e=p.x-q.x,f=p.y-q.y)/2-1)<0?o?(g/=p.D,p.t+=(f*(z=3-p.D-q.D)+p.v-q.v)*g,p.s+=(e*z+p.u-q.u)*g):p.D+=g*g:1)});setInterval('M(c.width^=M());for(p of a)with(p)c.getContext`2d`.fillText(C,3*x,5*y),w||(y+=v+=t/4,x+=u+=s/2)',20) -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

MiniFluid

4 |

A micro fluid simulation inspired by endoh1.c and its TS port endoh1-ts 5 |

Golfed by xem, p01, Aemkei, Irratix, RReverser 6 |

7 |

Input:

8 | 37 | 38 | 41 | -------------------------------------------------------------------------------- /inputs/clock.txt: -------------------------------------------------------------------------------- 1 | ######################## 2 | ##xxxxxxxxxxxxxxxxxxxx## 3 | ##xxxxxxxxxxxxxxxxxxxx## 4 | ##xxxxxxxxxxxxxxxxxxxx## 5 | ##xxxxxxxxxxxxxxxxxxxx## 6 | ##xxxxxxxxxxxxxxxxxxxx## 7 | ###xxxxxxxxxxxxxxxxxx### 8 | ###xxxxxxxxxxxxxxxx### 9 | ###xxxxxxxxxxxx### 10 | ### ### 11 | ### ### 12 | ### ### 13 | ### ### 14 | ### ### 15 | ### ### 16 | ### ### 17 | ### ### 18 | ## ## 19 | ## ## 20 | ## ## 21 | ## ## 22 | ## ## 23 | ######################## 24 | 25 | -------------------------------------------------------------------------------- /inputs/column.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ### ............... ### 7 | ### ................. ### 8 | ### ................. ### 9 | ### ................. ### 10 | ### ................. ### 11 | ### ................. ### 12 | ### ................. ### 13 | ### ................. ### 14 | ### ................. ### 15 | ### ................. ### 16 | ### ................. ### 17 | ### ................. ### 18 | ### ................. ### 19 | ### ................. ### 20 | ### ................. ### 21 | ### ............... ### 22 | ########################################################################## 23 | ######################################################################## 24 | -------------------------------------------------------------------------------- /inputs/column2.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ### .......... ### 6 | ### ........... ### 7 | ### ........... ### 8 | ### ........... ### 9 | ### ........... ### 10 | ### ........... ### 11 | ### ........... 12 | ### ........... 13 | ### ........... 14 | ### ........... ### 15 | ### ........... ### 16 | ### ........... ### 17 | ### ........... ### 18 | ### ........... ### 19 | ### ........... # ### 20 | ### .......... ### ### 21 | ############################################################################## 22 | ############################################################################ 23 | -------------------------------------------------------------------------------- /inputs/column3.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ### .......... ### 6 | ### .................................................................### 7 | ### ........... ### 8 | ### ........... ### 9 | ### ........... ### 10 | ### ........... ### 11 | ### ........... 12 | ### ........... 13 | ### ........... 14 | ### ........... ### 15 | ### ........... ### 16 | ### ........... ### 17 | ### ........... ### 18 | ### ........... ### 19 | ### ........... # ### 20 | ### .......... ### ### 21 | ############################################################################## 22 | ############################################################################ 23 | -------------------------------------------------------------------------------- /inputs/corners.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | # # 20 | # # 21 | # # 22 | #@ @# 23 | ############################################################################### 24 | -------------------------------------------------------------------------------- /inputs/dripping-pan.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | # # 10 | # # 11 | # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # 12 | #@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @# 13 | ##################################### ####################################### 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /inputs/endoh1.c: -------------------------------------------------------------------------------- 1 | # include// .IOCCC Fluid- # 2 | # include //2012 _Sim!_ # 3 | # include //|||| ,____. IOCCC- # 4 | # define h for( x=011; 2012/* # 5 | # */-1>x ++;)b[ x]//-' winner # 6 | # define f(p,e) for(/* # 7 | # */p=a; e,p10?32< x?4[/* ## 13 | ## */*r++ =w,r]= w+1,*r =r[5]= x==35, r+=9:0 ,w-I/* ## 14 | ## */:(x= w+2);; for(;; puts(o ),o=b+ 4){z(p [1]*/* ## 15 | ## */9,2) w;z(G, 3)(d*( 3-p[2] -q[2]) *P+p[4 ]*V-/* ## 16 | ## */q[4] *V)/p[ 2];h=0 ;f(p,( t=b+10 +(x=*p *I)+/* ## 17 | ## */80*( y=*p/2 ),*p+=p [4]+=p [3]/10 *!p[1]) )x=0/* ## 18 | ## */ <=x &&x<79 &&0<=y&&y<23?1[1 [*t|=8 ,t]|=4,t+=80]=1/* ## 19 | ## */, *t |=2:0; h=" '`-.|//,\\" "|\\_" "\\/\x23\n"[x/** ## 20 | ## */%80- 9?x[b] :16];;usleep( 12321) ;}return 0;}/* ## 21 | #### #### 22 | ############################################################################### 23 | **###########################################################################*/ 24 | -------------------------------------------------------------------------------- /inputs/evaporation.txt: -------------------------------------------------------------------------------- 1 | @ 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | # # 20 | # # 21 | # # 22 | # # 23 | ############################################################################### 24 | -------------------------------------------------------------------------------- /inputs/flat.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | # # 10 | # # 11 | # # 12 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@# 13 | ############################################################################### 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /inputs/fountain.txt: -------------------------------------------------------------------------------- 1 | 2 | x 3 | x 4 | x 5 | x 6 | x 7 | x 8 | x 9 | x 10 | x 11 | x 12 | x 13 | x 14 | x 15 | x 16 | x 17 | x 18 | x 19 | x 20 | ### x ### 21 | ### x ### 22 | ### x ### 23 | ############# 24 | -------------------------------------------------------------------------------- /inputs/funnel.txt: -------------------------------------------------------------------------------- 1 | # # 2 | #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx# 3 | #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx# 4 | #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx# 5 | #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx# 6 | #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx# 7 | #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx# 8 | #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx# 9 | #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx# 10 | #xxxxxxxxxxxxxxxxxxxxxxxxxxxx# 11 | #xxxxxxxxxxxxxxxxxxxxxxxxxx# 12 | #xxxxxxxxxxxxxxxxxxxxxxxx# 13 | #xxxxxxxxxxxxxxxxxxxxxx# 14 | #xxxxxxxxxxxxxxxxxxxx# 15 | #xxxxxxxxxxxxxxxxxx# 16 | #xxxxxxxxxxxxxxxx# 17 | #xxxxxxxxxxxxxx# 18 | #xxxxxxxxxxxx# 19 | #xxxxxxxxxx# 20 | #xxxxxxxx# 21 | #xxxxxx# 22 | #xxxx# 23 | #### 24 | -------------------------------------------------------------------------------- /inputs/funnel2.txt: -------------------------------------------------------------------------------- 1 | ## ## 2 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## 3 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## 4 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## 5 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## 6 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## 7 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## 8 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## 9 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## 10 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxx## 11 | ##xxxxxxxxxxxxxxxxxxxxxxxxxx## 12 | ##xxxxxxxxxxxxxxxxxxxxxxxx## 13 | ##xxxxxxxxxxxxxxxxxxxxxx## 14 | ##xxxxxxxxxxxxxxxxxxxx## 15 | ##xxxxxxxxxxxxxxxxxx## 16 | ##xxxxxxxxxxxxxxxx## 17 | ##xxxxxxxxxxxxxx## 18 | ##xxxxxxxxxxxx## 19 | ##xxxxxxxxxx## 20 | ##xxxxxxxx## 21 | ##xxxxxx## 22 | ##xxxx## 23 | ###### 24 | -------------------------------------------------------------------------------- /inputs/funnel3.txt: -------------------------------------------------------------------------------- 1 | ### ### 2 | ###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx### 3 | ###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx### 4 | ###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx### 5 | ###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx### 6 | ###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx### 7 | ###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx### 8 | ###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx### 9 | ###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx### 10 | ###xxxxxxxxxxxxxxxxxxxxxxxxxxxx### 11 | ###xxxxxxxxxxxxxxxxxxxxxxxxxx### 12 | ###xxxxxxxxxxxxxxxxxxxxxxxx### 13 | ###xxxxxxxxxxxxxxxxxxxxxx### 14 | ###xxxxxxxxxxxxxxxxxxxx### 15 | ###xxxxxxxxxxxxxxxxxx### 16 | ###xxxxxxxxxxxxxxxx### 17 | ###xxxxxxxxxxxxxx### 18 | ###xxxxxxxxxxxx### 19 | ###xxxxxxxxxx### 20 | ###xxxxxxxx### 21 | ###xxxxxx### 22 | ###xxxx### 23 | ######## 24 | ######## 25 | -------------------------------------------------------------------------------- /inputs/glass-half-empty.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ###.......................### 5 | ###.......................### 6 | ###.......................### 7 | ###.......................### 8 | ###.......................### 9 | ###.......................### 10 | ###.......................### 11 | ###.......................### 12 | ### ### 13 | ### ### 14 | ### ### 15 | ### ### 16 | ### ### 17 | ### ### 18 | ### ### 19 | ### ### 20 | ### ### 21 | ############################# 22 | ############################# 23 | -------------------------------------------------------------------------------- /inputs/hint.md: -------------------------------------------------------------------------------- 1 | # Most complex ASCII fluid - Honorable mention 2 | 3 | Yusuke Endoh 4 | 5 | 6 | 7 | ## Judges' comments: 8 | ### To build: 9 | 10 | make endoh1 11 | 12 | ### To run: 13 | 14 | ./endoh1 < configuration.txt 15 | 16 | ### Try: 17 | 18 | ./endoh1 < endoh1.c 19 | 20 | ./endoh1 < pour-out.txt 21 | 22 | ./endoh1 < fountain.txt 23 | 24 | ### Selected Judges Remarks: 25 | 26 | Let's play Jeopardy! 27 | 28 | * A: An obfuscated program that deals with complex numbers and produces animated ASCII graphics. 29 | * Q: What is a Mandelbrot simulator? 30 | 31 | Bzzzt! 32 | 33 | Such heavily squeezed fluid simulation (this is parsed uniquely 34 | as fluids are not squeezable) has a few quirks that the judges were 35 | happy to experiment with. 36 | 37 | One configuration file was inspired by an [XKCD what if? entry](http://whatif.xkcd.com/6/). 38 | 39 | ## Author's comments: 40 | ### Synopsis 41 | 42 | **DO NOT FORGET "-DG=1 -DP=4 -DV=8"** and make your terminal window larger 43 | than 80 x 25. 44 | 45 | gcc endoh1.c -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -o endoh1 -lm 46 | ./endoh1 < endoh1.c 47 | ./endoh1 < logo.txt 48 | ./endoh1 < column.txt 49 | ./endoh1 < pour-out.txt 50 | ./endoh1 < tanada.txt 51 | 52 | 53 | ### What it is 54 | 55 | ,___. ,. ,. ,. ,___. ,. ,. ,. 56 | |/--' || `' || |/--' `' || |\_. 57 | |\__. || ,. ,. ,. ,__/| |\__. ,. ,____. ,. ,. || ,_. |/-' ,_. ,__. 58 | |/--' || || || || |/-\| `--\| || |/\/\| || || || ,/-\. || ,/-\. |/-\. 59 | || || `\_/| || |\_/| ,__/| || |||||| `\_/| || `\_/\.`\_. `\_/' || `' 60 | `' `' `--' `' `---' `---' `' `'`'`' `--' `' `-'`' `-' `-' `' 61 | 62 | 63 | ,.,. ,.,. 64 | ,/\/\. ,. ,. ,. ,/\/\. ,. ,. ,__. 65 | |||#/' || `' ,_.|| |||#/' `',_.,__. || ||\\. ,. 66 | |||#\. || ,. ,. ,.,/#||| |\//\. ,.|#||##| ,. ,. || ,.,. |\/-' ,.,. ,.|\. 67 | |\/--' ||,/\.|| |||#/\/| `\#||| |||#||/\|,/\.|| ||,/'`\.|#| ,/'`\.|\/-\. 68 | `\| ||`\#||| |||#||\| ,//\/| ||`\|||||`\#||| ||`\.,/\/\|,.`\.,/'`\| `' 69 | `' `' `-'`' `'`-'`-' `-'`-' `' `'`'`' `-'`' `' `'`--'`'`' `'`' `' 70 | 71 | 72 | ,_.,_. ,. ,. ,. ,_.,_. ,. ,. ,. 73 | |#||#| || `' || |#||#| `' || ||,_. 74 | ||\/#| ||,. ,. ,.,_.,/| |\||#| ,.,_.,__.,. ,. || ,.,. |||#| ,.,. ,.,_. 75 | |||##| |||| || |||#||#| |#||#| |||#||##||| || ||,/||\.||`-',/||\.|||#\. 76 | ||`--' ||`\_.|| |||\||#| |#||#| ||||'||\|`\_.|| ||`\||#|`\.,.`\||/'||`--' 77 | `' `' |#||| `'|#||#| |#||#| `'`' `'`' |#||| `' |||/' |||| |||| `' 78 | `-'`' `-'`-' `-'`-' `-'`' `'`' `'`' `'`' 79 | 80 | 81 | This program is a fluid simulator using "Smoothed-particle hydrodynamics (SPH)" 82 | method. 83 | 84 | 85 | 86 | The SPH particles represent the fluid flow. Particles have information about 87 | the position, density, and velocity. In every simulation step, they are 88 | changed by pressure force, viscosity force, and external force (i.e., gravity). 89 | 90 | This program reads a text from standard input, and uses it as an initial 91 | configuration of the particles. The character `#` represents "wall particle" (a 92 | particle with fixed position), and any other non-space characters represent 93 | free particles. 94 | 95 | The compilation options `-DG=1 -DP=4 -DV=8` represent, respectively, the factor 96 | of gravity, pressure, and viscosity. By changing their values, you can see 97 | different fluid behavior. 98 | 99 | "Marching square"-like algorithm is used to render the particles. 100 | 101 | 102 | 103 | 104 | ### Portability 105 | 106 | The program requires a C99 compiler; it uses `complex` types and one-line 107 | comments. It also uses `usleep`, which may require `-D_BSD_SOURCE` or somewhat 108 | to build with no warning. Under these conditions, it should be portable. 109 | At least, recent compilers with `-std=c99 -Wall -W -Wextra -pedantic` says 110 | nothing. 111 | 112 | gcc -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -std=c99 -Wall -W -Wextra -pedantic endoh1.c 113 | clang -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -std=c99 -Wall -W -Wextra -pedantic endoh1.c 114 | 115 | I expect it to work in any Unix-like environment. VTxxx/ANSI sequences are 116 | used to clear screen and move cursor to home. 117 | 118 | I've tested with gcc-4.6.3 and clang-3.0 on Linux (Ubuntu 12.04) 119 | and gcc-4.5.3 and clang-3.1 on Cygwin. On Cygwin, gcc and clang complain about 120 | a usage of `I` (complex's imaginary unit), but I bet this is cygwin's issue; 121 | it is surely a C99 feature. 122 | 123 | 124 | ### Obfuscation w/ Spoiler 125 | 126 | First of all, the source code itself serves as an initial configuration. 127 | Preprocessing directives (such as `#include`)'s `#` serve as walls. 128 | 129 | This program uses `double complex` to represent any 2D vector. But, note that 130 | x-axis and y-axis is swapped (real axis = y-axis, imaginary axis = x-axis). 131 | The purpose of swapping is not only obfuscation, but also short coding: for 132 | example, to add gravity to total force, `force += G` suffices, rather than 133 | `force += G*I`. 134 | (Incidentally, you can exert horizontal gravity by using, such as, `-DG=I`) 135 | 136 | Every five entries of `double complex a[]` contain information of one particle: 137 | position, wall-flag, density, force, and velocity, in turn. 138 | 139 | You can use `G`, `P`, and `V` as a guide to find the calculation code of 140 | gravity, pressure, and viscosity forces. 141 | 142 | Though some assignments may look meaningless, it is actually meaningful; it 143 | extracts "integer part of real part" from a complex value by assigning (and 144 | casting) it to an integer-type variable. 145 | 146 | 147 | ### Notes about Additional Files 148 | 149 | "logo.txt" is a source of the logo in this remark file. 150 | 151 | "column.txt" is a water column collapse, which is a popular demo of SPH. 152 | 153 | "pour-out.txt" pours you a cup of tea. 154 | 155 | "tanada.txt" simulates "Terrace farming". ("Tanada" means a "terraced rice 156 | fields" in Japanese.) 157 | 158 | "clock.txt" is a "water" clock created by HAMANO Tsukasa. 159 | 160 | Other \*.txt files are due to the judges. 161 | 162 | 163 | "endoh1\_color.c" is a variant that shows the density by using terminal 256 164 | colors. 165 | 166 | 167 | ### Acknowledgment 168 | 169 | I would like to thank my wife @hirekoke for her teaching me the SPH method. 170 | 171 | The judges ordered suggested creating a color version 172 | after the judgment. 173 | 174 | The judges and HAMANO Tsukasa (The silver medalist at this IOCCC) kindly 175 | provided many configuration files. 176 | 177 | -------------------------------------------------------------------------------- 178 | 185 | -------------------------------------------------------------------------------- /inputs/leidenfrost.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | # # 20 | # # 21 | # # 22 | # @ # 23 | ############################################################################### 24 | -------------------------------------------------------------------------------- /inputs/logo.txt: -------------------------------------------------------------------------------- 1 | 2 | @@@@ @ @ @ @@@@ @ @ @ 3 | @ @ @ @ @ @@@ 4 | @@@@ @ @ @ @ @@@@ @@@@ @ @@@@@ @ @ @ @@ @ @@ @@@ 5 | @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 6 | @ @ @@@ @ @@@@ @@@@ @ @ @ @ @@@ @ @@ @ @@ @@ @ 7 | 8 | 9 | 10 | 11 | 12 | # # 13 | ##### ##### 14 | ###### ###### 15 | ####### ####### 16 | ######## ######## 17 | ######### ######### 18 | ########## ########## 19 | ## ## 20 | -------------------------------------------------------------------------------- /inputs/pour-out.txt: -------------------------------------------------------------------------------- 1 | 2 | ### . . . . . . . . . . . ### 3 | ###.......................### 4 | ### . . . . . . . . . . . ### 5 | ###.......................### 6 | ### . . . . . . . . . . . ### 7 | ###.......................### 8 | ### . . . . . . . . . . . ### 9 | ###.......................### 10 | ### . . . . . . . . . . . ### 11 | ###.......................### 12 | ### . . . . . . . . . . . ### 13 | ###.......................## 14 | ### . . . . . . . . . . . ## 15 | ###....................... ### 16 | ################################# ## ## 17 | ############################### ## ## 18 | ## ## 19 | ########### 20 | -------------------------------------------------------------------------------- /inputs/tanada.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## 4 | ##. . . . . . . . 5 | ##.................. 6 | ##. . . . . . . . . . .. 7 | ##....................... 8 | ##. . . . . . . . . . . .. 9 | ##........................## 10 | ##. . . . . . . . . . . ..## 11 | ############################ ## 12 | ## ## 13 | ############ ## 14 | ## ## 15 | ############ ## 16 | ## ## 17 | ############ ## 18 | ## ## 19 | ############ 20 | -------------------------------------------------------------------------------- /quine.html: -------------------------------------------------------------------------------- 1 | 1kb Fluid 2 | Simulation Quine

Click to restart / github

17 | -------------------------------------------------------------------------------- /quinemaker.html: -------------------------------------------------------------------------------- 1 |

Code:
2 |

Shape:
3 |

Result:
4 | 22 | -------------------------------------------------------------------------------- /xemquine.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xem/miniFluid/53f8048a979e434ec35ba4c8938bea3b5a77e7b1/xemquine.html --------------------------------------------------------------------------------