Original content

master
Guillaume 11 years ago
commit 96832aa52c

@ -0,0 +1,222 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
################
# tool locations
################
#
SHELL= /bin/bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# Compiler warnings
#
#CWARN=
#CWARN= -Wall -W
CWARN= -Wall -W -pedantic
# compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
#
#OPT=
#OPT= -O
#OPT= -O1
OPT= -O2
#OPT= -O3
# Libraries needed to build
#
LIBS= -lm
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= endoh1
DATA= column.txt column2.txt column3.txt corners.txt dripping-pan.txt \
evaporation.txt flat.txt fountain.txt funnel.txt funnel2.txt \
funnel3.txt leidenfrost.txt logo.txt pour-out.txt tanada.txt
ALT_OBJ= endoh1_color.o
ALT_ENTRY= endoh1_color
# The factor of gravity
#
G=1
# The factor of pressure
#
P=4
# The factor of viscosity
#
V=8
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} -DG=$G -DP=$P -DV=$P $< -o $@ ${LIBS}
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
endoh1_deobfuscate: endoh1_deobfuscate.c
${CC} ${CFLAGS} -DG=$G -DP=$P -DV=$P $< -o $@ ${LIBS}
endoh1_color: endoh1_color.c
${CC} ${CFLAGS} -DG=$G -DP=$P -DV=$P $< -o $@ ${LIBS}
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you're joking Mr. Feynman!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'waste'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}

@ -0,0 +1,22 @@
# the factor of gravity
G=1
# the factor of pressure
P=4
# the factor of viscosity
V=8
RM= rm
TRUE= true
CWARN= -Wall -W -Wextra -pedantic
CSTD= -std=c99 -D_BSD_SOURCE
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT}
CC= gcc
ENTRY= prog
all: ${ENTRY}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} -DG=$G -DP=$P -DV=$P ${ENTRY}.c -o $@ -lm
clean:
$(RM) -f ${ENTRY}

@ -0,0 +1,24 @@
########################
##xxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxx##
###xxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxx###
###xxxxxxxxxxxx###
### ###
### ###
### ###
### ###
### ###
### ###
### ###
### ###
## ##
## ##
## ##
## ##
## ##
########################

@ -0,0 +1,23 @@
### ............... ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ............... ###
##########################################################################
########################################################################

@ -0,0 +1,22 @@
### .......... ###
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ...........
### ...........
### ...........
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ........... # ###
### .......... ### ###
##############################################################################
############################################################################

@ -0,0 +1,22 @@
### .......... ###
### .................................................................###
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ...........
### ...........
### ...........
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ........... # ###
### .......... ### ###
##############################################################################
############################################################################

@ -0,0 +1,23 @@
# #
# #
# #
#@ @#
###############################################################################

@ -0,0 +1,23 @@
# #
# #
# @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ #
#@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @#
##################################### #######################################

@ -0,0 +1,23 @@
# include<stdio.h>// .IOCCC Fluid- #
# include <unistd.h> //2012 _Sim!_ #
# include<complex.h> //|||| ,____. IOCCC- #
# define h for( x=011; 2012/* #
# */-1>x ++;)b[ x]//-' winner #
# define f(p,e) for(/* #
# */p=a; e,p<r; p+=5)// #
# define z(e,i) f(p,p/* #
## */[i]=e)f(q,w=cabs (d=*p- *q)/2- 1)if(0 <(x=1- w))p[i]+=w*/// ##
double complex a [ 97687] ,*p,*q ,*r=a, w=0,d; int x,y;char b/* ##
## */[6856]="\x1b[2J" "\x1b" "[1;1H ", *o= b, *t; int main (){/** ##
## */for( ;0<(x= getc ( stdin) );)w=x >10?32< x?4[/* ##
## */*r++ =w,r]= w+1,*r =r[5]= x==35, r+=9:0 ,w-I/* ##
## */:(x= w+2);; for(;; puts(o ),o=b+ 4){z(p [1]*/* ##
## */9,2) w;z(G, 3)(d*( 3-p[2] -q[2]) *P+p[4 ]*V-/* ##
## */q[4] *V)/p[ 2];h=0 ;f(p,( t=b+10 +(x=*p *I)+/* ##
## */80*( y=*p/2 ),*p+=p [4]+=p [3]/10 *!p[1]) )x=0/* ##
## */ <=x &&x<79 &&0<=y&&y<23?1[1 [*t|=8 ,t]|=4,t+=80]=1/* ##
## */, *t |=2:0; h=" '`-.|//,\\" "|\\_" "\\/\x23\n"[x/** ##
## */%80- 9?x[b] :16];;usleep( 12321) ;}return 0;}/* ##
#### ####
###############################################################################
**###########################################################################*/

@ -0,0 +1,30 @@
# include<stdio.h>// .IOCCC Fluid- #
# include <unistd.h> //2012 _Sim!_ #
# include<complex.h> //|||| ,____. |||||| #
# define c y+=( x=ctanh( -cabs/* #
# */(4[t ]-=20) /2+9)* 3+3)*// #
# define f(p,e) for(p/* #
# */=a;e ,p<r;p +=5)/// #
# define z(e,i) f(p,p/* #
## */[i]=e)f(q,w=cabs (d=*p- *q)/2- 1)if(0 <(x=1- w))p[i]+=w*/// ##
double complex a [ 97687] ,*p,*q ,*r=a, w=0,d; char b[97687]=/* ##
## */"GO\x1b[2J\x1b[" "1;1H" ,*o=b, *t;int x,y,j; void h(int e){/** ##
## */for( t=b;b+ 24045> (t+=12 );c 6, sprintf (t,/** ##
## */"%c" "[48%" "c5;%" "03dm" "%c",3 *9,e,c 36,e/* ##
## */?(t- b)%960 ?(15-t [11])[ "\x23" "/\\_" "\\"/* ##
## */"||" ",//|" ".-`' "]:10: 0)) y= 0020,c 01;}/* ##
## */void g( int i){7[t +=i]|= x/=2;* t+=y=p [2];/* ##
## */}int main() {for(;( x=getc (stdin ))>0;)w =10</* ##
## */x?32 <x?4[* r++=w,r]=w+1,*r= r[5]=x ==35,r+=9:0,w-I/* ##
## */:(x= w+02); for(;;puts(o),o =b+6){ z(p[1]*9,2)w;z/* ##
## */(G,3 )(d*(3 -p[2]-q[2])*P +p[4]* V-q[4]*V )/p/* ##
#### ####
###############################################################################
**###########################################################################*/
[2];h(0 );f(p,* p+= p[4]+=p [3]/10*!p
[1] )(t =b+ 16+ (x= *p* I)* 12+ 960
*(y =*p /2) ,x= 0<= x&& 79> x&&
0<= y&& 23> y?x =16 ,g( 0),g(12),
g(+ 948 ),g (12 ),0 :0) ;h( 59) ;;;
usleep( 12321); }return 0;} /*IOCCC '12 **/

@ -0,0 +1,31 @@
#include <stdio.h>// .IOCCC Fluid- #
#include <unistd.h> //2012 _Sim!_ #
#include <complex.h> //|||| ,____. IOCCC- #
double complex a[97687], *p, *q, *r = a, w = 0, d;
int x , y;
char b [6856] = "\x1b[2J" "\x1b" "[1;1H ", *o = b, *t;
int
main()
{
for (; 0 < (x = getc(stdin));)
w = x > 10 ? 32 < x ? 4[*r++ = w, r] = w + 1, *r = r[5] = x == 35, r += 9 : 0, w - I : (x = w + 2);;
for (;; puts(o), o = b + 4) {
for (p = a; p[2] = p[1] * 9, p < r; p += 5)
for (q = a; w = cabs(d = *p - *q) / 2 - 1, q < r; q += 5)
if (0 < (x = 1 - w))
p[2] += w * w;
for (p = a; p[3] = G, p < r; p += 5)
for (q = a; w = cabs(d = *p - *q) / 2 - 1, q < r; q += 5)
if (0 < (x = 1 - w))
p[3] += w * (d * (3 - p[2] - q[2]) * P + p[4] * V - q[4] * V) / p[2];
for (x = 011; 2012 - 1 > x++;)
b[x] = 0;
for (p = a; (t = b + 10 + (x = *p * I) + 80 * (y = *p / 2), *p += p[4] += p[3] / 10 * !p[1]), p < r; p += 5)
x = 0 <= x && x < 79 && 0 <= y && y < 23 ? 1[1[*t |= 8, t] |= 4, t += 80] = 1, *t |= 2 : 0;
for (x = 011; 2012 - 1 > x++;)
b[x] = " '`-.|//,\\" "|\\_" "\\/\x23\n"[x % 80 - 9 ? x[b] : 16];;
usleep(12321);
} return 0;
}

@ -0,0 +1,23 @@
@
# #
# #
# #
# #
###############################################################################

@ -0,0 +1,23 @@
# #
# #
# #
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
###############################################################################

@ -0,0 +1,23 @@
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
### x ###
### x ###
### x ###
#############

@ -0,0 +1,23 @@
# #
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxx#
#xxxxxxxxxxxx#
#xxxxxxxxxx#
#xxxxxxxx#
#xxxxxx#
#xxxx#
####

@ -0,0 +1,23 @@
## ##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxx##
##xxxxxxxxxxxx##
##xxxxxxxxxx##
##xxxxxxxx##
##xxxxxx##
##xxxx##
######

@ -0,0 +1,24 @@
### ###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxx###
###xxxxxxxxxxxx###
###xxxxxxxxxx###
###xxxxxxxx###
###xxxxxx###
###xxxx###
########
########

@ -0,0 +1,22 @@
###.......................###
###.......................###
###.......................###
###.......................###
###.......................###
###.......................###
###.......................###
###.......................###
### ###
### ###
### ###
### ###
### ###
### ###
### ###
### ###
### ###
#############################
#############################

@ -0,0 +1,78 @@
* {
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
}
body {
max-width: 50em;
margin: 0 auto;
color: #111;
}
pre, code {
font-family: Monaco, Courier New, monospace;
font-size: 12px;
}
h1 {
font-size: 40px;
font-weight: bold;
letter-spacing: -1px;
margin-bottom: -5px;
}
h1 code {
font-size: 40px;
}
h2 {
color: rgb(43,105,145);
font-weight: bold;
margin-bottom: -5px;
}
h2 code {
font-size: 22px;
}
h3 {
/* color: rgb(43,105,145); */
font-weight: bold;
margin-bottom: -5px;
}
h3 code {
font-size: 16px;
}
a {
color: blue;
text-decoration: underline;
}
a:visited {
color: navy;
}
a:hover {
text-decoration: underline;
}
pre {
border-radius: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.3);
border-width: 1px;
border-color: rgb(16,48,0);
border-style: solid;
padding: 0.6em;
padding-left: 1em;
margin-left: 5%;
margin-right: 8%;
background-color: rgb(16,48,0);
overflow: auto;
color: rgb(75,224,0);
}
p, li {
font-size: 14px;
line-height: 18px;
}

@ -0,0 +1,211 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="hint.css">
<title>Most complex ASCII fluid - Honorable mention</title>
</head>
<body>
<h1>Most complex ASCII fluid - Honorable mention</h1>
<p>Yusuke Endoh<br>
<a href="&#109;&#x61;&#105;&#108;&#116;&#x6f;&#58;&#x6d;&#x61;&#x6d;&#101;&#64;&#116;&#115;&#x67;&#x2e;&#x6e;&#101;&#46;&#x6a;&#112;">&#109;&#97;&#x6d;&#101;&#64;&#116;&#x73;&#x67;&#46;&#110;&#101;&#46;&#x6a;&#112;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make endoh1
</code></pre>
<h3>To run:</h3>
<pre><code>./endoh1 &lt; configuration.txt
</code></pre>
<h3>Try:</h3>
<pre><code>./endoh1 &lt; endoh1.c
./endoh1 &lt; pour-out.txt
./endoh1 &lt; fountain.txt
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>Let&rsquo;s play Jeopardy!</p>
<ul>
<li>A: An obfuscated program that deals with complex numbers and produces animated ASCII graphics.</li>
<li>Q: What is a Mandelbrot simulator?</li>
</ul>
<p>Bzzzt!</p>
<p>Such heavily squeezed fluid simulation (this is parsed uniquely
as fluids are not squeezable) has a few quirks that the judges were
happy to experiment with.</p>
<p>One configuration file was inspired by an <a href="http://whatif.xkcd.com/6/">XKCD what if? entry</a>.</p>
<h2>Author&rsquo;s comments:</h2>
<h3>Synopsis</h3>
<p><strong>DO NOT FORGET &ldquo;-DG=1 -DP=4 -DV=8&rdquo;</strong> and make your terminal window larger
than 80 x 25.</p>
<pre><code>gcc endoh1.c -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -o endoh1 -lm
./endoh1 &lt; endoh1.c
./endoh1 &lt; logo.txt
./endoh1 &lt; column.txt
./endoh1 &lt; pour-out.txt
./endoh1 &lt; tanada.txt
</code></pre>
<h3>What it is</h3>
<pre><code>,___. ,. ,. ,. ,___. ,. ,. ,.
|/--' || `' || |/--' `' || |\_.
|\__. || ,. ,. ,. ,__/| |\__. ,. ,____. ,. ,. || ,_. |/-' ,_. ,__.
|/--' || || || || |/-\| `--\| || |/\/\| || || || ,/-\. || ,/-\. |/-\.
|| || `\_/| || |\_/| ,__/| || |||||| `\_/| || `\_/\.`\_. `\_/' || `'
`' `' `--' `' `---' `---' `' `'`'`' `--' `' `-'`' `-' `-' `'
,.,. ,.,.
,/\/\. ,. ,. ,. ,/\/\. ,. ,. ,__.
|||#/' || `' ,_.|| |||#/' `',_.,__. || ||\\. ,.
|||#\. || ,. ,. ,.,/#||| |\//\. ,.|#||##| ,. ,. || ,.,. |\/-' ,.,. ,.|\.
|\/--' ||,/\.|| |||#/\/| `\#||| |||#||/\|,/\.|| ||,/'`\.|#| ,/'`\.|\/-\.
`\| ||`\#||| |||#||\| ,//\/| ||`\|||||`\#||| ||`\.,/\/\|,.`\.,/'`\| `'
`' `' `-'`' `'`-'`-' `-'`-' `' `'`'`' `-'`' `' `'`--'`'`' `'`' `'
,_.,_. ,. ,. ,. ,_.,_. ,. ,. ,.
|#||#| || `' || |#||#| `' || ||,_.
||\/#| ||,. ,. ,.,_.,/| |\||#| ,.,_.,__.,. ,. || ,.,. |||#| ,.,. ,.,_.
|||##| |||| || |||#||#| |#||#| |||#||##||| || ||,/||\.||`-',/||\.|||#\.
||`--' ||`\_.|| |||\||#| |#||#| ||||'||\|`\_.|| ||`\||#|`\.,.`\||/'||`--'
`' `' |#||| `'|#||#| |#||#| `'`' `'`' |#||| `' |||/' |||| |||| `'
`-'`' `-'`-' `-'`-' `-'`' `'`' `'`' `'`'
</code></pre>
<p>This program is a fluid simulator using &ldquo;Smoothed-particle hydrodynamics (SPH)&rdquo;
method.</p>
<p><a href="http://en.wikipedia.org/wiki/Smoothed-particle_hydrodynamics">http://en.wikipedia.org/wiki/Smoothed-particle_hydrodynamics</a></p>
<p>The SPH particles represent the fluid flow. Particles have information about
the position, density, and velocity. In every simulation step, they are
changed by pressure force, viscosity force, and external force (i.e., gravity).</p>
<p>This program reads a text from standard input, and uses it as an initial
configuration of the particles. The character <code>#</code> represents &ldquo;wall particle&rdquo; (a
particle with fixed position), and any other non-space characters represent
free particles.</p>
<p>The compilation options <code>-DG=1 -DP=4 -DV=8</code> represent, respectively, the factor
of gravity, pressure, and viscosity. By changing their values, you can see
different fluid behavior.</p>
<p>&ldquo;Marching square&rdquo;-like algorithm is used to render the particles.</p>
<p><a href="http://en.wikipedia.org/wiki/Marching_squares">http://en.wikipedia.org/wiki/Marching_squares</a></p>
<h3>Portability</h3>
<p>The program requires a C99 compiler; it uses <code>complex</code> types and one-line
comments. It also uses <code>usleep</code>, which may require <code>-D_BSD_SOURCE</code> or somewhat
to build with no warning. Under these conditions, it should be portable.
At least, recent compilers with <code>-std=c99 -Wall -W -Wextra -pedantic</code> says
nothing.</p>
<pre><code>gcc -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -std=c99 -Wall -W -Wextra -pedantic endoh1.c
clang -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -std=c99 -Wall -W -Wextra -pedantic endoh1.c
</code></pre>
<p>I expect it to work in any Unix-like environment. VTxxx/ANSI sequences are
used to clear screen and move cursor to home.</p>
<p>I&rsquo;ve tested with gcc-4.6.3 and clang-3.0 on Linux (Ubuntu 12.04)
and gcc-4.5.3 and clang-3.1 on Cygwin. On Cygwin, gcc and clang complain about
a usage of <code>I</code> (complex&rsquo;s imaginary unit), but I bet this is cygwin&rsquo;s issue;
it is surely a C99 feature.</p>
<h3>Obfuscation w/ Spoiler</h3>
<p>First of all, the source code itself serves as an initial configuration.
Preprocessing directives (such as <code>#include</code>)&rsquo;s <code>#</code> serve as walls.</p>
<p>This program uses <code>double complex</code> to represent any 2D vector. But, note that
x-axis and y-axis is swapped (real axis = y-axis, imaginary axis = x-axis).
The purpose of swapping is not only obfuscation, but also short coding: for
example, to add gravity to total force, <code>force += G</code> suffices, rather than
<code>force += G*I</code>.
(Incidentally, you can exert horizontal gravity by using, such as, <code>-DG=I</code>)</p>
<p>Every five entries of <code>double complex a[]</code> contain information of one particle:
position, wall-flag, density, force, and velocity, in turn.</p>
<p>You can use <code>G</code>, <code>P</code>, and <code>V</code> as a guide to find the calculation code of
gravity, pressure, and viscosity forces.</p>
<p>Though some assignments may look meaningless, it is actually meaningful; it
extracts &ldquo;integer part of real part&rdquo; from a complex value by assigning (and
casting) it to an integer-type variable.</p>
<h3>Notes about Additional Files</h3>
<p>&ldquo;logo.txt&rdquo; is a source of the logo in this remark file.</p>
<p>&ldquo;column.txt&rdquo; is a water column collapse, which is a popular demo of SPH.</p>
<p>&ldquo;pour-out.txt&rdquo; pours you a cup of tea.</p>
<p>&ldquo;tanada.txt&rdquo; simulates &ldquo;Terrace farming&rdquo;. (&ldquo;Tanada&rdquo; means a &ldquo;terraced rice
fields&rdquo; in Japanese.)</p>
<p>&ldquo;clock.txt&rdquo; is a &ldquo;water&rdquo; clock created by HAMANO Tsukasa.</p>
<p>Other *.txt files are due to the judges.</p>
<p>&ldquo;endoh1_color.c&rdquo; is a variant that shows the density by using terminal 256
colors.</p>
<h3>Acknowledgment</h3>
<p>I would like to thank my wife @hirekoke for her teaching me the SPH method.</p>
<p>The judges <strike>ordered</strike> suggested creating a color version
after the judgment.</p>
<p>The judges and HAMANO Tsukasa (The silver medalist at this IOCCC) kindly
provided many configuration files.</p>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&copy; Copyright 1984-2012,
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
- All rights reserved<BR>
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
<TD>&nbsp;<!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
</TR></TABLE>
</body>
</html>

@ -0,0 +1,184 @@
# Most complex ASCII fluid - Honorable mention
Yusuke Endoh
<mame@tsg.ne.jp>
## Judges' comments:
### To build:
make endoh1
### To run:
./endoh1 < configuration.txt
### Try:
./endoh1 < endoh1.c
./endoh1 < pour-out.txt
./endoh1 < fountain.txt
### Selected Judges Remarks:
Let's play Jeopardy!
* A: An obfuscated program that deals with complex numbers and produces animated ASCII graphics.
* Q: What is a Mandelbrot simulator?
Bzzzt!
Such heavily squeezed fluid simulation (this is parsed uniquely
as fluids are not squeezable) has a few quirks that the judges were
happy to experiment with.
One configuration file was inspired by an [XKCD what if? entry](http://whatif.xkcd.com/6/).
## Author's comments:
### Synopsis
**DO NOT FORGET "-DG=1 -DP=4 -DV=8"** and make your terminal window larger
than 80 x 25.
gcc endoh1.c -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -o endoh1 -lm
./endoh1 < endoh1.c
./endoh1 < logo.txt
./endoh1 < column.txt
./endoh1 < pour-out.txt
./endoh1 < tanada.txt
### What it is
,___. ,. ,. ,. ,___. ,. ,. ,.
|/--' || `' || |/--' `' || |\_.
|\__. || ,. ,. ,. ,__/| |\__. ,. ,____. ,. ,. || ,_. |/-' ,_. ,__.
|/--' || || || || |/-\| `--\| || |/\/\| || || || ,/-\. || ,/-\. |/-\.
|| || `\_/| || |\_/| ,__/| || |||||| `\_/| || `\_/\.`\_. `\_/' || `'
`' `' `--' `' `---' `---' `' `'`'`' `--' `' `-'`' `-' `-' `'
,.,. ,.,.
,/\/\. ,. ,. ,. ,/\/\. ,. ,. ,__.
|||#/' || `' ,_.|| |||#/' `',_.,__. || ||\\. ,.
|||#\. || ,. ,. ,.,/#||| |\//\. ,.|#||##| ,. ,. || ,.,. |\/-' ,.,. ,.|\.
|\/--' ||,/\.|| |||#/\/| `\#||| |||#||/\|,/\.|| ||,/'`\.|#| ,/'`\.|\/-\.
`\| ||`\#||| |||#||\| ,//\/| ||`\|||||`\#||| ||`\.,/\/\|,.`\.,/'`\| `'
`' `' `-'`' `'`-'`-' `-'`-' `' `'`'`' `-'`' `' `'`--'`'`' `'`' `'
,_.,_. ,. ,. ,. ,_.,_. ,. ,. ,.
|#||#| || `' || |#||#| `' || ||,_.
||\/#| ||,. ,. ,.,_.,/| |\||#| ,.,_.,__.,. ,. || ,.,. |||#| ,.,. ,.,_.
|||##| |||| || |||#||#| |#||#| |||#||##||| || ||,/||\.||`-',/||\.|||#\.
||`--' ||`\_.|| |||\||#| |#||#| ||||'||\|`\_.|| ||`\||#|`\.,.`\||/'||`--'
`' `' |#||| `'|#||#| |#||#| `'`' `'`' |#||| `' |||/' |||| |||| `'
`-'`' `-'`-' `-'`-' `-'`' `'`' `'`' `'`'
This program is a fluid simulator using "Smoothed-particle hydrodynamics (SPH)"
method.
<http://en.wikipedia.org/wiki/Smoothed-particle_hydrodynamics>
The SPH particles represent the fluid flow. Particles have information about
the position, density, and velocity. In every simulation step, they are
changed by pressure force, viscosity force, and external force (i.e., gravity).
This program reads a text from standard input, and uses it as an initial
configuration of the particles. The character `#` represents "wall particle" (a
particle with fixed position), and any other non-space characters represent
free particles.
The compilation options `-DG=1 -DP=4 -DV=8` represent, respectively, the factor
of gravity, pressure, and viscosity. By changing their values, you can see
different fluid behavior.
"Marching square"-like algorithm is used to render the particles.
<http://en.wikipedia.org/wiki/Marching_squares>
### Portability
The program requires a C99 compiler; it uses `complex` types and one-line
comments. It also uses `usleep`, which may require `-D_BSD_SOURCE` or somewhat
to build with no warning. Under these conditions, it should be portable.
At least, recent compilers with `-std=c99 -Wall -W -Wextra -pedantic` says
nothing.
gcc -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -std=c99 -Wall -W -Wextra -pedantic endoh1.c
clang -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -std=c99 -Wall -W -Wextra -pedantic endoh1.c
I expect it to work in any Unix-like environment. VTxxx/ANSI sequences are
used to clear screen and move cursor to home.
I've tested with gcc-4.6.3 and clang-3.0 on Linux (Ubuntu 12.04)
and gcc-4.5.3 and clang-3.1 on Cygwin. On Cygwin, gcc and clang complain about
a usage of `I` (complex's imaginary unit), but I bet this is cygwin's issue;
it is surely a C99 feature.
### Obfuscation w/ Spoiler
First of all, the source code itself serves as an initial configuration.
Preprocessing directives (such as `#include`)'s `#` serve as walls.
This program uses `double complex` to represent any 2D vector. But, note that
x-axis and y-axis is swapped (real axis = y-axis, imaginary axis = x-axis).
The purpose of swapping is not only obfuscation, but also short coding: for
example, to add gravity to total force, `force += G` suffices, rather than
`force += G*I`.
(Incidentally, you can exert horizontal gravity by using, such as, `-DG=I`)
Every five entries of `double complex a[]` contain information of one particle:
position, wall-flag, density, force, and velocity, in turn.
You can use `G`, `P`, and `V` as a guide to find the calculation code of
gravity, pressure, and viscosity forces.
Though some assignments may look meaningless, it is actually meaningful; it
extracts "integer part of real part" from a complex value by assigning (and
casting) it to an integer-type variable.
### Notes about Additional Files
"logo.txt" is a source of the logo in this remark file.
"column.txt" is a water column collapse, which is a popular demo of SPH.
"pour-out.txt" pours you a cup of tea.
"tanada.txt" simulates "Terrace farming". ("Tanada" means a "terraced rice
fields" in Japanese.)
"clock.txt" is a "water" clock created by HAMANO Tsukasa.
Other \*.txt files are due to the judges.
"endoh1\_color.c" is a variant that shows the density by using terminal 256
colors.
### Acknowledgment
I would like to thank my wife @hirekoke for her teaching me the SPH method.
The judges <strike>ordered</strike> suggested creating a color version
after the judgment.
The judges and HAMANO Tsukasa (The silver medalist at this IOCCC) kindly
provided many configuration files.
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->

@ -0,0 +1,23 @@
# #
# #
# #
# @ #
###############################################################################

@ -0,0 +1,19 @@
@@@@ @ @ @ @@@@ @ @ @
@ @ @ @ @ @@@
@@@@ @ @ @ @ @@@@ @@@@ @ @@@@@ @ @ @ @@ @ @@ @@@
@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
@ @ @@@ @ @@@@ @@@@ @ @ @ @ @@@ @ @@ @ @@ @@ @
# #
##### #####
###### ######
####### #######
######## ########
######### #########
########## ##########
## ##

@ -0,0 +1,19 @@
### . . . . . . . . . . . ###
###.......................###
### . . . . . . . . . . . ###
###.......................###
### . . . . . . . . . . . ###
###.......................###
### . . . . . . . . . . . ###
###.......................###
### . . . . . . . . . . . ###
###.......................###
### . . . . . . . . . . . ###
###.......................##
### . . . . . . . . . . . ##
###....................... ###
################################# ## ##
############################### ## ##
## ##
###########

@ -0,0 +1,19 @@
##
##. . . . . . . .
##..................
##. . . . . . . . . . ..
##.......................
##. . . . . . . . . . . ..
##........................##
##. . . . . . . . . . . ..##
############################ ##
## ##
############ ##
## ##
############ ##
## ##
############ ##
## ##
############
Loading…
Cancel
Save