#include #include #include #define N O-> #define Li(V,K)[(K)*Ga/32+V/32] #define Mg(P,V,K)(P Li(V,K)>>(V&31)&1) #define H(P,V,K)(P Li(V,K)|=1<<(V&31)) #define U(P)calloc(P,1) #define Au(V,K)Al[K|N U+V+V-1&7] #define Ti(V,I,K,Y)((V^I&&K^Y&&I=Li/2)+(V>D[P],Au(P,8)>>D[P], N V, N K)) Ar *U, *Au, W, Li, F; Mo Al[27]; S { Ar V, K, U, T; S *H; } *C, *Zn; S * Zr (Mo V, Mo K, Mo T) { S *O = C, *W = Zn; *(Mg(U, V, K)?&W:&O)=0; while (O) O = (W = !N T || (N T &= -!!(N V - V | N K - K | !(T - N T ^ 1))) ? O : 0) ? N H : 0; return W; } void Ag (Mo V, Mo K, Mo P, Mo T, S * O) { S *H = (O ? N H : C); *(H ? &O : &Zn) = O = *(O ? &N H : &C) = U (sizeof (S)); N U = P; N T = T; N H = H; N V = V; N K = K; F & 32 || H(U, V, K); } void main (Mo V, char ** O) { char *H, Sg[106]; srand (time (0)); while (*++O && (sscanf (*O, "%lu", W ? &Li : &W) || (--**O, F |= !((**O - 57) % 14) << (**O - 57) / 14)) ); puts("%!\n/S{ 0 setlinewidth} /N{ showpage} /O{ moveto rlineto stroke} def def def S"); for (V = 0; V < 8; Al[8 | (V - 2) & 7] = Al[V] = !!(V & 3) * (1 - (V & 4) / 2) * 4, V++); do { U = U (V = (As * Ga + 31) / 8); Au = U (V); for (*U = -W-1, H = U(W); ++*U; H[*U+W] = Mn); Ag (Ga / 2, As / 2, 5, 1, C); Ag (Ga / 2, As / 2, 1, 1, C); while (C) { Ar I[7], Y[5], D[13]; S *Ge, *O = C; if (N T) { D[8] = (F & 4 ? Mn : W ? H[N T % W] : (N T & 85) % 3); W ((!!C>>!C)); W ((!!C<> 1) | F & 1)); } *********************************************************** Best Use of Obfuscation: Leonid A. Broukhis Leonid A. Broukhis 46728 Crawford St., apt. 20 Fremont, CA 94539 USA Judges' comments: To use: make leo Try: leo 1 | cat - /dev/tty | gs - leo 37 80 | cat - /dev/tty | gs - Press return after each image is drawn. The variable names are element-ary. If you find this confusing, remember that it is nu-clear. :-) Some Ghostscripts/Postscript programs cleared the screen right after the image is drawn, so we added element 106 which acts as an input buffer. The original version may be found in leo.orig.c. If you don't have gs or an equivalent postscript viewer, try: echo "" | leo 1 > foo.ps and send foo.ps to your local postscript printer. To qualify for a category specially for yourself in the Geek code, find out the all the secret switches that the author doesn't divulge ! (All switches are single characters on the command line - anything that's not a number is a candidate) Selected notes from the author: The usage is: prog.sh [ deep ] [ right ] [ Variable ] [ cycle [ freq ] ] where the first three are literal words, `cycle' is a positive integer (0 is ignored), and `freq' is an integer (default = 0) supposed to be in range 0..100 (bigger values are allowed, however). Invalid parameters and options usually stop the command line parsing (but not always, why?). The actual position of the word options does not matter, so "prog.sh right Variable 1 70" is equivalent to "prog.sh 0 0 0 1 Variable 70 right", etc. If `Variable' is used, `cycle' is almost ignored (see below) but has to be present if you want to enter `freq' (and you usually do). Some options to try (besides the obvious): leo 1 | cat - /dev/tty | gs - This draws the basic pattern I invented in high school: You take a big sheet of "arithmetic" paper and draw a line of length 1 (between 2 crossings) it the center of the sheet: | This makes 2 open ends (I think the notion of an "open end" doesn't require explanations) in step 1. Now, until there are open ends in step N, repeat: for each open end pretend it points north and draw 2 lines going northwest and northeast from it to the nearest crossings. This needs to be done "simultaneously" for all ends that are open at the moment. Step 2: \./ | / \ Step 3: __| |__ \./ | __ / \ __ | | . Step 4: \./ \./ \__| |__/ / \./ \ | \__./ \.__/ / | | \ / \./ \ Step 5: ._| . |_. __| \./ \./ |__ \__| |__/ __./ \./ \.__ __I | I__ \__./ \.__/ __./ | | \.__ |_./ \./ \._| | | The lines marked by I show the places where "simultaneity" is significant. Note that so far all the drawings represent valid structural formulas of some organic substances. step 1: ethane step 2: 2,3-dimethylbutane step 3: (2,5-dimethyl;3,4-isopropyl)-hexane step 4 and 5: I don't know. Do you? etc. Step 6: \./ \./ \./ \./ ._| . |_. ._| . |_. \__| \./ \./ |__/ \__| \./ \./ |__/ / \__| |__/ \ / \__| |__/ \ \__./ \./ \.__/ \__./ \./ \.__/ X__| | |__X or <__| | |__> / \__./ \.__/ \ / \__./ \.__/ \ \__./ | | \.__/ \__./ | | \.__/ / |_./ \./ \._| / |_./ \./ \._| | | | | / \ / \ / \ / \ depending on the desired "hairiness". The original (paper-based) algorithm was "hairy", but it didn't look as good on the screen. The program cannot handle non-hairy mode 100% correctly - step 6 happens to be |__ ...__/ ...__/ ... \ ... \. ...__/ ...__/|__ ...__Y and step 7: ...__Y ... \ ... \ ...__/ ...__/ \ \.__ | and so on: the horisontal symmetry has been lost. That's why the opening for step 1 is not a single line but a cross: \./ / \ To watch it repeatedly (as a screen saver), use: leo 2 | cat - /dev/tty | gs - The command line: leo Variable 1 | cat - /dev/tty | gs - This draws the same as above. Try: leo Variable 1 1 | cat - /dev/tty | gs - what happened to the picture? Increase `freq' and watch the changes. If `cycle' is more than 1, the program loops, allowing the user to enjoy randomly changing patterns (the delay is 3 sec), but there is a secret switch to suppress looping : useful if you want to pipe the output to a printer. uudecode the spoiler below if you really want to know. begin 664 spoiler1 M*%1H92!C;VQO;B J:7,J('1H92!S96-R970@