diff --git a/2015/burton/README.md b/2015/burton/README.md index 7e3d1e0d8..4516b6a43 100644 --- a/2015/burton/README.md +++ b/2015/burton/README.md @@ -226,7 +226,7 @@ If you do not want to puzzle out how it works, see `spoilers.markdown`. ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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 diff --git a/2015/dogon/README.md b/2015/dogon/README.md index 23e418b29..11768378c 100644 --- a/2015/dogon/README.md +++ b/2015/dogon/README.md @@ -55,7 +55,8 @@ Those blocks are generated by twisty maze of code blocks, almost all different. Can you find your way around either and understand where you are? -How many function keys does your keyboard have? Can you generate very high number function keys such as F30 or F31? :-) +How many function keys does your keyboard have? Can you generate very high +number function keys such as F30 or F31? :-) *Textures? We don't need no stinking textures.* @@ -63,55 +64,133 @@ How many function keys does your keyboard have? Can you generate very high numb ### What is it? -Just run prog with no arguments on an X11-compatible system. The scenery, though pseudo-randomly generated should be strangely familiar, specially to those still in their teen age. You can navigate using the keyboard arrow keys and the function keys. Your speed is a linear function of (n-1) where Fn is the last function key you have pressed, and you always move in the direction you are looking at. Be aware that you are probably some kind of a Creeper as is obvious from looking at the program, hence your movement is destructive to the environment. So after pressing F12 for warp speed, and moving around randomly, you might find yourself in a 3D maze of twisty little passages, from which there is only one Esc(ape) key. Note that in theory if you have a specialty keyboard with 32 function keys you may even press F31 to reach infinite improbability drive speed, though the author had never tested this feature. However a hidden comment in keysymdef.h suggests the existence of a mythical Sun Keyboard with 35 function keys :) +Just run prog with no arguments on an X11-compatible system. The scenery, though +pseudo-randomly generated should be strangely familiar, specially to those still +in their teen age. You can navigate using the keyboard arrow keys and the +function keys. Your speed is a linear function of (n-1) where Fn is the last +function key you have pressed, and you always move in the direction you are +looking at. Be aware that you are probably some kind of a Creeper as is obvious +from looking at the program, hence your movement is destructive to the +environment. So after pressing F12 for warp speed, and moving around randomly, +you might find yourself in a 3D maze of twisty little passages, from which there +is only one Esc(ape) key. Note that in theory if you have a specialty keyboard +with 32 function keys you may even press F31 to reach infinite improbability +drive speed, though the author had never tested this feature. However a hidden +comment in keysymdef.h suggests the existence of a mythical Sun Keyboard with 35 +function keys :) -### Full disclosure. -This entry, tough pretty thoroughly obfuscated, is not entirely original, nor am I Notch. The inspiration for this entry is a demo code written by the Notch himself, which was released with the following license: "you may use the code in here for any purpose in any way you want, at your own risk". That version will henceforth be referred to as the original. Though the original in itself was quite nice and rather dense piece of code, it was not written in C, nor entirely and meticulously obfuscated, a state of things I hopefully rectified. +### Full disclosure: +This entry, though pretty thoroughly obfuscated, is not entirely original, nor +am I Notch. The inspiration for this entry is a demo code written by the Notch +himself, which was released with the following license: "you may use the code +in here for any purpose in any way you want, at your own risk". That version +will henceforth be referred to as the original. Though the original in itself +was quite nice and rather dense piece of code, it was not written in C, nor +entirely and meticulously obfuscated, a state of things I hopefully rectified. -### Some extra features. +### Some extra features: -Basing it on the original which already had a wonderful simple and concise ray casting through a generated voxel world rendering, I added a few tweaks of my own device: +Basing it on the original which already had a wonderful simple and concise ray +casting through a generated voxel world rendering, I added a few tweaks of my +own device: -* Two pass optimized rendering. The program first calculates 1/16 of the output image by ray casting, and then, when possible uses texture interpolation on the voxel faces. It speeds up the rendering by at least a factor of 4 on most scenes, but extra care must be taken when passing rays through the leaves voxels ... -* Fixed a small omission in the original. When you looked though a transparent leaves voxel, you did not see the leaves at voxel faces that were far from you. In this version the rendering of those (far face leaves) is correct. +* Two pass optimized rendering. The program first calculates 1/16 of the output +image by ray casting, and then, when possible uses texture interpolation on the +voxel faces. It speeds up the rendering by at least a factor of 4 on most +scenes, but extra care must be taken when passing rays through the leaves voxels +... +* Fixed a small omission in the original. When you looked though a transparent +leaves voxel, you did not see the leaves at voxel faces that were far from you. +In this version the rendering of those (far face leaves) is correct. * Window rendering size specified in Makefile. * Added the keyboard controls for navigation (and destruction). -### Portability issues. +### Portability issues: -This entry is rather portable I think on modern platforms. It assumes of course basic X-windows availability. There are several other salient assumptions though: +This entry is rather portable I think on modern platforms. It assumes of course +basic X-windows availability. There are several other salient assumptions +though: -* The entry assumes sizeof(int)=4. This seems to cover pretty much everything that supports X-windows so would be broken only on quite ancient machines, embedded processors, or some big iron 64 bit system where sizeof(int)=8. -* The entry assumes the default visual has 24 bit depth (RGB). This seems to be the case on most X Servers this days. -* The entry, does a thing which is an absolute No-No for X-windows program, i.e. assuming it knows some numeric values for keysyms defined in keysymdef.h . I have searched far and wide the lord Google's domain, yet was unable to find a version of the file where those assumptions were broken. This enables the important support of up to 32 function keys keyboards without spilling over the size limit, and allows us to use such fun expression for arrow view control as the following: +* The entry assumes `sizeof(int)=4`. This seems to cover pretty much everything +that supports X-windows so would be broken only on quite ancient machines, +embedded processors, or some big iron 64 bit system where `sizeof(int)=8`. +* The entry assumes the default visual has 24 bit depth (RGB). This seems to be +the case on most X Servers this days. +* The entry, does a thing which is an absolute No-No for X-windows program, i.e. +assuming it knows some numeric values for keysyms defined in `keysymdef.h`. I +have searched far and wide the lord Google's domain, yet was unable to find a +version of the file where those assumptions were broken. This enables the +important support of up to 32 function keys keyboards without spilling over the +size limit, and allows us to use such fun expression for arrow view control as +the following: ```c *(a&1?&C:&B)-=(.05 -a/2%2*.1)*!(a-1&4092^3920) ``` -### Precision issues. +### Precision issues: -The entry, on purpose, (see the section about SIMD below) does not use enough bits of precision, so some times the ray will miss the intersection of two voxel faces and push on through. That's why you may notice some noise along close up voxel edges. Fixing this issue would have taken the entry over the size limit regrettably. +The entry, on purpose, (see the section about SIMD below) does not use enough +bits of precision, so some times the ray will miss the intersection of two voxel +faces and push on through. That's why you may notice some noise along close up +voxel edges. Fixing this issue would have taken the entry over the size limit +regrettably. -### Obfuscations. +### Obfuscations: -Well, of course you have all the usual suspects, used for extreme compression, and such a nice layout: not very informative identifiers, which are being reused all over the place, some rather gruesome looking expressions, a whole load of magic constants with apparently no rhyme nor reason (including a Lagrange polynomial), and a message from our friendly Cetaceans. However it also includes some clever and not so obvious though instructive techniques, to subtly make the code more magical and efficient, at the same time. +Well, of course you have all the usual suspects, used for extreme compression, +and such a nice layout: not very informative identifiers, which are being reused +all over the place, some rather gruesome looking expressions, a whole load of +magic constants with apparently no rhyme nor reason (including a Lagrange +polynomial), and a message from our friendly Cetaceans. However it also includes +some clever and not so obvious though instructive techniques, to subtly make the +code more magical and efficient, at the same time. -Those techniques are about the use of 64 bit integers in order to do SIMD work, in a portable way without ever using any SSE/AVX or other non-portable compiler inline functions! The irony though, is that when compiling the program on modern X86 architectures indeed SSE/AVX is used for the long longs. -Following is some "Spoiler" information, So if you want to play tough, stop reading at this point. +Those techniques are about the use of 64 bit integers in order to do SIMD work, +in a portable way without ever using any SSE/AVX or other non-portable compiler +inline functions! The irony though, is that when compiling the program on modern +X86 architectures indeed SSE/AVX is used for the long longs. Following is some +"Spoiler" information, So if you want to play tough, stop reading at this point. -### Portable SIMD programming. +### Portable SIMD programming: -So how is this done? Quite simply by using the whole long long arithmetic's capability. I think the C99 standard assures us that long long has at least 64 bits. Most of those bits are unused in normal programs, however here we use them more wisely. For example, in the inner loop of the program you have the innocent looking expression i+=d. What it does in fact, is a SIMD addition of two vectors, each with three signed fixed point coordinates, advancing our ray in 3D space! -To spell it out, the macro producing such vectors is P, and the assignment q=0x820008202625a0 sets our creeper original position to about (32.5, 32.5019, 2441.406) . +So how is this done? Quite simply by using the whole long long arithmetic's +capability. I think the C99 standard assures us that long long has at least 64 +bits. Most of those bits are unused in normal programs, however here we use them +more wisely. For example, in the inner loop of the program you have the innocent +looking expression `i+=d`. What it does in fact, is a SIMD addition of two +vectors, each with three signed fixed point coordinates, advancing our ray in 3D +space! -Evidently when doing such arithmetics, care must me taken to avoid overflow from one component to the other, but since our voxel world is a torus of size 64 in each dimension this hardly matters. A subtle issue, is how to deal with signed quantities. In the i+=d expression above i has 3 positive components, but d has arbitrary signed components, as our ray may face in any direction. It seems things should not work, specially as we defined both i and d as unsigned! However notice that the T (and P )macro converts float to signed long longs. Once sign is extended from a least component into higher bits, it seems at first to be recipe for disaster, however everything works beautifully, and you get precise component results when the final accumulation components in i are positive. This only gets broken a bit when the final accumulation has a least significant negative component. To see this bug in action change the assignment above to q=0x82000820000000, and look towards the negative direction of the main tunnel. +To spell it out, the macro producing such vectors is `P`, and the assignment +q=0x820008202625a0 sets our creeper original position to about `(32.5, 32.5019, +2441.406)`. -Similar technique is used on the RGB components so their brightness can be adjusted simultaneously by the expression: o=o*b>>8 . Of course some spare bits are needed between the components, so they are spread in the long long and reordered as RBG. +Evidently when doing such arithmetics, care must me taken to avoid overflow from +one component to the other, but since our voxel world is a torus of size 64 in +each dimension this hardly matters. A subtle issue, is how to deal with signed +quantities. In the `i+=d` expression above `i` has 3 positive components, but +`d` has arbitrary signed components, as our ray may face in any direction. It +seems things should not work, specially as we defined both `i` and `d` as +unsigned! However notice that the `T` (and `P`) macros convert `float` to +`signed long longs`. + +Once sign is extended from a least component into higher bits, it seems at first +to be recipe for disaster, however everything works beautifully, and you get +precise component results when the final accumulation components in `i` are +positive. This only gets broken a bit when the final accumulation has a least +significant negative component. To see this bug in action change the assignment +above to `q=0x82000820000000`, and look towards the negative direction of the main +tunnel. + +Similar technique is used on the RGB components so their brightness can be +adjusted simultaneously by the expression: `o=o*b>>8`. Of course some spare bits +are needed between the components, so they are spread in the long long and +reordered as RBG. ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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 diff --git a/2015/duble/README.md b/2015/duble/README.md index e7580f0e7..e130c1f6f 100644 --- a/2015/duble/README.md +++ b/2015/duble/README.md @@ -9,13 +9,13 @@ make ``` -### To run: +## To run: ```sh echo Some text | ./prog ``` -### Try: +## Try: ```sh echo Hello, world | ./prog @@ -29,9 +29,11 @@ DRAFT=1 ./prog < prog.c ./prog < prog.c ``` -### Alternate code +## Alternate code -An alternate version of this entry, prog.alt.c, is provided. This alternate code is discussed below in the "prog.c vs prog.alt.c" section of the Author's comments below. +An alternate version of this entry, prog.alt.c, is provided. This alternate +code is discussed below in the "prog.c vs prog.alt.c" section of the Author's +comments below. To compile this alternate version: @@ -64,11 +66,11 @@ wondering if it was not the reason for its very erratic behaviour. The file `prog.alt.c` is the one I submitted. -Gil Dogon noted a few unsafe statements (statements whose behaviour is -undefined in the C standard and, as such, could cause issues with other -compilers or optimization levels). These have been fixed in `prog.c`. -After this fix, in order to remain rule-2-compliant, a variable name has -also been shortened in this file. +[Gil Dogon](/winners.html#Gil_Dogon) noted a few unsafe statements (statements +whose behaviour is undefined in the C standard and, as such, could cause issues +with other compilers or optimization levels). These have been fixed in `prog.c`. +After this fix, in order to remain rule-2-compliant, a variable name has also +been shortened in this file. ### How to build @@ -84,61 +86,70 @@ Otherwise (gcc): ### How to use it -You need a terminal configured to handle an *UTF-8* encoding and a -font including *braille patterns*. +You need a terminal configured to handle a *UTF-8* encoding and a font including +*braille patterns*. + This is the default on most modern GNU/Linux operating systems. -The default terminal application (gnome-terminal) or even a simple -xterm should render things properly. -I tested this on several Debian and Ubuntu systems, 32 and 64bits (no configuration was needed). -I also tested it on FreeBSD 9.3 32bits (font and encoding configuration -was needed in this case). -Basic mode: +The default terminal application (gnome-terminal) or even a simple xterm should +render things properly. - $ echo 'I am testing this thing.' | ./prog - [... rendering ...] +I tested this on several Debian and Ubuntu systems, 32 and 64bits (no +configuration was needed). - $ ./prog < lorem-ipsum.txt - [... rendering ...] +I also tested it on FreeBSD 9.3 32bits (font and encoding configuration was +needed in this case). -Interactive mode: +#### Basic mode: - $ ./prog - > hello world!!! - [... rendering ...] - > +```sh +$ echo 'I am testing this thing.' | ./prog +[... rendering ...] -### Obfuscation +$ ./prog < lorem-ipsum.txt +[... rendering ...] +``` + +#### Interactive mode: + +```sh +$ ./prog +> hello world!!! +[... rendering ...] +> +``` + +### Obfuscation: This entry is obfuscated in various ways: -* The structure is hidden by avoiding loops, 'if' statements, ternary - conditionals, and jump-related instructions. Instead, recursivity is - heavily used. +* The structure is hidden by avoiding loops, `if` statements, ternary +conditionals, and jump-related instructions. Instead, recursivity is heavily +used. * Merging all functions into one added even more recursivity. ;) * The provided code does not contain the same number of opening and closing - parenthesis. +parenthesis. * Preprocessing the code inflates it and adds lots of indents. Removing some - of the tricks involved without breaking the program will be challenging. +of the tricks involved without breaking the program will be challenging. * The program 'plays' with standard input & output streams, which causes - unusual side effects. -* Some variables are re-used for unrelated processings. -* Crucial data may be hidden in unexpected places (e.g. as the size of - a temporary buffer). +unusual side effects. +* Some variables are re-used for unrelated processes. +* Crucial data may be hidden in unexpected places (e.g. as the size of a +temporary buffer). * Some parts of the code may have no effect (but may have an effect in a - specific context, who knows?), and classical libc functions may not act - as usual. +specific context, who knows?), and classical libc functions may not act as +usual. * And of course variable names are hard to read (or distracting). On the other hand, the following may help: * The code layout should help to identify which part of the code is - obfuscated. ;) -* File 'codes.txt' shows how each character is drawn. This data is - encoded in macro O_o at the top of the source file. +obfuscated. ;) +* File 'codes.txt' shows how each character is drawn. This data is encoded in +macro `O_o` at the top of the source file. -### Limitations +### Limitations: #### Charset @@ -147,54 +158,59 @@ chars: a-z, A-Z, '.' ':' ',' ';' '!' and '?'. -Uppercase and lowercase chars are rendered the same. -The program also understand the space and the linefeed (\n). -Other chars are simply ignored (most of the time ;) +Uppercase and lowercase chars are rendered the same. The program also understand +the space and the linefeed (\n). Other chars are simply ignored (most of the +time ;) #### Stack size -This limitation is due to the heavy use of recursivity. After having processed -a large number of characters, the process may exceed the stack size and crash. +This limitation is due to the heavy use of recursivity. After having processed a +large number of characters, the process may exceed the stack size and crash. (However I did not experience this myself. The top-level recursion might be removed by the compiler as part of its optimizations.) #### Line rendering -The program does its best to avoid cutting words at the end of lines, but -it could still happen in case of long words. +The program does its best to avoid cutting words at the end of lines, but it +could still happen in case of long words. ### Subtleties and extra features #### Handling more than text docs? -Given the limited set of characters handled, the program is mostly limited -to simple text documents. +Given the limited set of characters handled, the program is mostly limited to +simple text documents. + Thus, if you try for example: - $ ./prog < prog.c +```sh +$ ./prog < prog.c +``` -You will not get something that looks like C code. (but you can still try, -if you are curious. :) +You will not get something that looks like C code. (but you can still try, if +you are curious. :) #### A 'draft' mode Defining an environment variable called DRAFT will enable the 'draft-mode'. Try for example: - $ echo 'testing the draft mode' | DRAFT=1 ./prog +```sh +$ echo 'testing the draft mode' | DRAFT=1 ./prog +``` The program will run much faster but the rendering will be less precise. #### The subtle interactive mode -I saved the best for last: usually, programs that handle an "interactive -mode" have to check whether their standard input is a terminal or not (by -using isatty()). Did you notice that this program does not perform any such +I saved the best for last: usually, programs that handle an "interactive mode" +have to check whether their standard input is a terminal or not (by using +`isatty()`). Did you notice that this program does not perform any such detection, but still behaves (or seems to behave) appropriately? ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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 diff --git a/2015/endoh1/README.md b/2015/endoh1/README.md index af76cf3fc..bea69296e 100644 --- a/2015/endoh1/README.md +++ b/2015/endoh1/README.md @@ -1,11 +1,11 @@ # Most Diffused Reaction - Someone Anonymous - Twitter: @hirekoke +Someone Anonymous +Twitter: @hirekoke - Yusuke Endoh - - Twitter: @mametter +Yusuke Endoh + +Twitter: @mametter # To build: @@ -19,7 +19,12 @@ make ./prog ``` -Connect to port http://localhost:10333 with your browser +Connect to port http://localhost:10333 with your browser. + +The author said he had no recent version of macOS to test to see if this works +but in 2023 [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) did this +and reported that it works well. He also said he really loved it! Thank you +Cody! ### Try: @@ -37,7 +42,8 @@ find any other tributes? ## Author's comments: -What does "Alan Turing" remind you of? Cryptanalysis of the Enigma? Turing machine? Turing test? This program is also based on his work. +What does "Alan Turing" remind you of? Cryptanalysis of the Enigma? Turing +machine? Turing test? This program is also based on his work. ### Whirlwind tour @@ -53,39 +59,56 @@ cc -O3 -std=c99 \ -DTIMESTEP=1.0 -DSPEED=2 -DRGB=255:128:192 ``` -Then, run it under `tcpserver` command in [ucspi-tcp](http://cr.yp.to/ucspi-tcp.html) package, which was created by Daniel J. Bernstein, IOCCC 1989 "Best of Show" winner. +Then, run it under `tcpserver` command in +[ucspi-tcp](http://cr.yp.to/ucspi-tcp.html) package, which was created by +[Daniel J. Bernstein](/winners.html#Daniel_J._Bernstein), [IOCCC 1991 "Best of +Show"](../../1991/brnstnd/brnstnd.c) ([README.md](../../1991/brnstnd/README.md)). $ tcpserver -v 127.0.0.1 10333 ./prog ioccc.txt -Finally, open `http://127.0.0.1:10333/` by a modern browser supporting HTML5. You can use the mouse cursor to place drops into the Petri dish interactively. +Finally, open `http://127.0.0.1:10333/` by a modern browser supporting HTML5. +You can use the mouse cursor to place drops into the Petri dish interactively. ### Description This is a simulator of *reaction-diffusion systems*. -Reaction-diffusion systems, proposed by Alan Turing in [1], are mathematical models in which two chemical substances are transformed into each other (*local chemical reactions*) and spread out (*diffusion*). Their interactions sometimes form non-trivial patterns, such as spots, spiral, dappling, and labyrinths. +Reaction-diffusion systems, proposed by Alan Turing in [1], are mathematical +models in which two chemical substances are transformed into each other (*local +chemical reactions*) and spread out (*diffusion*). Their interactions sometimes +form non-trivial patterns, such as spots, spiral, dappling, and labyrinths. The systems are generally formulated as follows: du/dt = F(u, v) + Du * laplacian(u) dv/dt = G(u, v) + Dv * laplacian(v) -The functions `F(u, v)` and `G(u, v)` represent reactions of each substance, and the parameters `Du` and `Dv` are diffusion coefficients. By changing the functions and parameters, you can see a wide range of behaviors. +The functions `F(u, v)` and `G(u, v)` represent reactions of each substance, and +the parameters `Du` and `Dv` are diffusion coefficients. By changing the +functions and parameters, you can see a wide range of behaviors. -See [the Wikipedia article of "Reaction-diffusion system"](https://en.wikipedia.org/wiki/Reaction%E2%80%93diffusion_system) in detail. +See [the Wikipedia article of "Reaction-diffusion +system"](https://en.wikipedia.org/wiki/Reaction%E2%80%93diffusion_system) in +detail. -This program simulates the systems. The field consists of 128 x 128 cells. Each cell includes infomration of an amount of the two substances, and interacts with neighbor cells (in terms of von Neumann neighborhood) in each frame. +This program simulates the systems. The field consists of 128 x 128 cells. +Each cell includes information of an amount of the two substances, and interacts +with neighbor cells (in terms of von Neumann neighborhood) in each frame. ### Configuration -You can change the model, initial pattern, simulation speed, and color via macro definition. +You can change the model, initial pattern, simulation speed, and color via macro +definition. #### Model: `-Delta_u= -Delta_v=` -The definitions represent the equations of reaction-diffusion system. For example, the following is [the Gray-Scott model](http://groups.csail.mit.edu/mac/projects/amorphous/GrayScott/) in TeX notation. +The definitions represent the equations of reaction-diffusion system. For +example, the following is [the Gray-Scott +model](http://groups.csail.mit.edu/mac/projects/amorphous/GrayScott/) in TeX +notation. \frac{\partial u}{\partial t} = D_u \Delta u - u v^2 + F (1 - u) \frac{\partial v}{\partial t} = D_v \Delta v + u v^2 - v (F + K) @@ -99,9 +122,13 @@ You can specify this model as follows: #### Initial pattern: `-DUV_BACKGROUND=, -DUV_DROP=,` -The definitions specifies the initial amount of the two substances u and v. All cells have `(u0, v0)` by default. +The definitions specifies the initial amount of the two substances u and v. All +cells have `(u0, v0)` by default. -You can specify a pattern file when the executable is invoked (not compile-time). The file should include a sequence of points, see `ioccc.txt`, `center.txt`, or `line.txt` as examples. Each amount in cells near to the point included in the file, will be added by `(u1, v1)`. +You can specify a pattern file when the executable is invoked (not +compile-time). The file should include a sequence of points, see `ioccc.txt`, +`center.txt`, or `line.txt` as examples. Each amount in cells near to the point +included in the file, will be added by `(u1, v1)`. #### Simulation speed: `-DTIMESTEP=ts -DSPEED=spd` @@ -118,7 +145,8 @@ This specifies a color used for rendering. ### Examples -Some interesting parameters are included in `Makefile`. Do one of the following command and open `http://127.0.0.1:10333`. +Some interesting parameters are included in `Makefile`. Do one of the following +command and open `http://127.0.0.1:10333`. $ make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 ioccc.txt $ make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 center.txt @@ -130,27 +158,32 @@ Some interesting parameters are included in `Makefile`. Do one of the following $ make fitzhugh-nagumo-2 && tcpserver -v 127.0.0.1 10333 ./fitzhugh-nagumo-2 ioccc.txt $ make oregonator && tcpserver -v 127.0.0.1 10333 ./oregonator ioccc.txt -These examples are created by drawing (and modifying) the pattern files of [Ready](https://github.com/GollyGang/ready), a cross-platform implementation of various reaction-diffusion systems [2]. +These examples are created by drawing (and modifying) the pattern files of +[Ready](https://github.com/GollyGang/ready), a cross-platform implementation of +various reaction-diffusion systems [2]. ### Compatibility #### C part -This program compiles clean with no warnings under `-std=c99 -Wall -Wextra -pedantic`. Since it uses `long long` for 64bit integers, C99 is required. +This program compiles clean with no warnings under `-std=c99 -Wall -Wextra +-pedantic`. Since it uses `long long` for 64bit integers, C99 is required. #### Browser part -You must use a modern browser that supports the latest specification of WebSocket [3]. All the following browsers worked for me: +You must use a modern browser that supports the latest specification of +WebSocket [3]. All the following browsers worked for me: * Google Chrome 45 * Mozilla Firefox 39 * Microsoft Internet Explorer 11 (works but sluggish) -I think Safari 6 will work but I haven't tested. (I have no recent os x.) +I think Safari 6 will work but I haven't tested. (I have no recent macOS.) #### tcpserver alternatives -I think you may use `inetd` and `xinetd` instead of `tcpserver`. Here is an example of inetd configuration. +I think you may use `inetd` and `xinetd` instead of `tcpserver`. Here is an +example of inetd configuration. 10333 stream tcp nowait nobody /path/to/prog /path/to/prog /path/to/initial-pattern.txt @@ -158,10 +191,14 @@ But note that I didn't test well. ### Internal -1. The C program accepts HTTP connection from the browser, and sends a HTML document. +1. The C program accepts HTTP connection from the browser, and sends a HTML +document. 2. The browser tries to upgrade the connection to WebSocket. -3. The C program accepts WebSocket upgrade. This negotiation process requires SHA1 hash [4] and Base64 encoding [5]. The C program calculates them without the aid of any external libraries. -4. The C program simulates the reaction-diffusion system, and then send the field data to the browser on each frame. +3. The C program accepts WebSocket upgrade. This negotiation process requires +SHA1 hash [4] and Base64 encoding [5]. The C program calculates them without +the aid of any external libraries. +4. The C program simulates the reaction-diffusion system, and then send the +field data to the browser on each frame. 4. The browser receives and renders the field data onto the HTML5 canvas. @@ -175,7 +212,7 @@ But note that I didn't test well. ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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 diff --git a/2015/endoh2/README.md b/2015/endoh2/README.md index 23a7f64f6..1b7f0b989 100644 --- a/2015/endoh2/README.md +++ b/2015/endoh2/README.md @@ -57,7 +57,8 @@ If you are still puzzled, look at prog.c with your favorite text editor. You will do a double take. -Hint 1: Do `less prog.c`. You will see an **emphasized** string if your terminal supports bold. +Hint 1: Do `less prog.c`. You will see an **emphasized** string if your +terminal supports bold. Hint 2: Do `wc -c prog.c`. This is very long one-liner. @@ -65,7 +66,7 @@ Spoiler: Open the source with an editor like `vim` or `emacs`. ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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 diff --git a/2015/endoh3/README.md b/2015/endoh3/README.md index d92f7146d..4399ce2ff 100644 --- a/2015/endoh3/README.md +++ b/2015/endoh3/README.md @@ -26,31 +26,36 @@ make -B BACK_TO=ioccc.c ## Judges' comments: -Like Marty and Doc, something nostalgic from 1984 appears live in October of 2015! +Like Marty and Doc, something nostalgic from 1984 appears live in October of +2015! + The author of this gem is a true Delorean! -A question for inquisitive readers: is the implemented subset of PDP-11 instructions Turing-complete? -(For a clue, see the end of the author's remarks.) -If in doubt, use [APOUT](http://www.tuhs.org/Archive/PDP-11/Emulators/Apout/). +A question for inquisitive readers: is the implemented subset of PDP-11 +instructions Turing-complete? (For a clue, see the end of the author's remarks.) +If in doubt, use [APOUT](https://github.com/DoctorWkt/Apout). ## Author's comments: ### Hint / Compatibility * A little-endian system is required due to an external factor. -* Strictly speaking, this program does not comply with any C specification for the same reason. But I believe it is reasonably portable. +* Strictly speaking, this program does not comply with any C specification for +the same reason. But I believe it is reasonably portable. * It uses a GCC extension but works on clang. -* This is a kind of emulator. You may find its architecture name if you look at the source code from all angles. +* This is a kind of emulator. You may find its architecture name if you look at +the source code from all angles.. * Find main() function. ### Spoiler -This program is a joke PDP-11 emulator. ("ll-dpd" is embedded in the code. Read it upside down.) +This program is a joke PDP-11 emulator. ("ll-dpd" is embedded in the code. +Read it upside down.) You got it? This program is supposed to be used in this way: ```sh -wget http://ioccc.org/1984/mullender.c +wget https://www.ioccc.org/1984/mullender.c clang -o prog prog.c mullender.c ./prog ``` @@ -59,9 +64,12 @@ You can enjoy the legendary winner of the first IOCCC, again. ### Internal -This program uses `__attribute__((constructor))`, which is a GCC extension, to hijack the main function call. And then it interprets main as an instruction sequence. +This program uses `__attribute__((constructor))`, which is a GCC extension, to +hijack the main function call. And then it interprets main as an instruction +sequence. -It supports the minimal subset of instructions and addressing modes which are needed for mullender.c to work: +It supports the minimal subset of instructions and addressing modes which are +needed for mullender.c to work: * Instructions * BR: branch @@ -80,7 +88,10 @@ It supports the minimal subset of instructions and addressing modes which are ne ### Limitation -Non-trivial combination of instruction and addressing mode may cause undefined behavior (unsequenced modification), such as attempting to autoincrement a destination register. Index addressing mode works well only for R7 (PC register). +Non-trivial combination of instruction and addressing mode may cause undefined +behavior (unsequenced modification), such as attempting to autoincrement a +destination register. Index addressing mode works well only for R7 (PC +register). ### One more thing @@ -203,7 +214,7 @@ Note: the program writes a binary to stdout. ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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 diff --git a/2015/endoh4/README.md b/2015/endoh4/README.md index 321b74aab..399d9efb4 100644 --- a/2015/endoh4/README.md +++ b/2015/endoh4/README.md @@ -1,8 +1,8 @@ # Best One-liner - Yusuke Endoh - - Twitter: @mametter +Yusuke Endoh + +Twitter: @mametter # To build: @@ -31,7 +31,9 @@ make ### Alternate code An alternate version of this entry, `prog.alt.c`, is provided. -This alternate code does not contain improvements suggested by Gil Dogon. +This alternate code does not contain improvements suggested by [Gil +Dogon](/winners.html#Gil_Dogon); it is +the author's original entry. To compile this alternate version: @@ -61,13 +63,16 @@ Visual factorization 1-liner. Try: ./prog @ @ @ @ @ @ @ @ ./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ -Inspired by [Animated Factorization Diagrams](http://www.datapointed.net/visualizations/math/factorization/animated-diagrams/). +Inspired by [Animated Factorization +Diagrams](http://www.datapointed.net/visualizations/math/factorization/animated-diagrams/). -EDIT: `prog.alt.c` is the original version that I submitted. Gil Dogon kindly improved it during the review. Thank you! +`prog.alt.c` is the original version that I submitted. [Gil +Dogon](/winners.html#Gil_Dogon) kindly improved it during the review. Thank +you! ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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 diff --git a/2015/hou/README.md b/2015/hou/README.md index a1bd81570..3a43c8b7a 100644 --- a/2015/hou/README.md +++ b/2015/hou/README.md @@ -53,7 +53,8 @@ This looks like a normal C program. Almost everything is a double. -There are tell-tale signs like `pow(2,(?/12))` and `exp(-?*?)` (names redacted). You can also find a bunch of cosines and polynomial evaluations. +There are tell-tale signs like `pow(2,(?/12))` and `exp(-?*?)` (names redacted). +You can also find a bunch of cosines and polynomial evaluations. It looks like a ????? ???????????, right? @@ -61,29 +62,41 @@ Run and find out. ### Why obfuscated -Some poor scripting folks only have access to doubles (Jav?script, L?a, BA?IC, etc.). +Some poor scripting folks only have access to doubles (Jav?script, L?a, BA?IC, +etc.). -As a C programmer, I feel obliged to show a gesture of sympathy, to experience their pain and provide an answer. +As a C programmer, I feel obliged to show a gesture of sympathy, to experience +their pain and provide an answer. -Except when absolutely necessary (`printf`, `int main()`, array indexing), there isn't a single integer. Even `getchar()` and `EOF` are immediately converted. +Except when absolutely necessary (`printf`, `int main()`, array indexing), there +isn't a single integer. Even `getchar()` and `EOF` are immediately converted. -Since `bool` counts as an integer type too, there is no boolean either. No comparison, no `if`, no `?:`, no `||` `&&`. Everything is done in a single loop that terminates on printf. Straight up arithmetic. +Since `bool` counts as an integer type too, there is no boolean either. No +comparison, no `if`, no `?:`, no `||` `&&`. Everything is done in a single loop +that terminates on printf. Straight up arithmetic. -`floor` and `ceil` are technically double-to-double functions, but they feel like cheating. Yes `cos`, no `floor`. +`floor` and `ceil` are technically double-to-double functions, but they feel +like cheating. Yes `cos`, no `floor`. ### Limitations Hard requirements: -* The platform must implement the `double` type as IEEE754-compliant 64-bit floating point numbers. The 80-bit intermediate format used by x87 is considered as an violation of this. The code should print an error message on such platforms. +* The platform must implement the `double` type as IEEE754-compliant 64-bit +floating point numbers. The 80-bit intermediate format used by x87 is +considered as an violation of this. The code should print an error message on +such platforms. * The program must start with the CPU / FPU in round-to-nearest mode. Soft requirements: -* The compiler must respect `volatile`. The code is formatted to warn about that, though. +* The compiler must respect `volatile`. The code is formatted to warn about +that, though. -* The printed result is only correct on little-endian machines. The program takes care to warn about this issue after printing an incorrect big-endian result. Error messages become garbled, though. +* The printed result is only correct on little-endian machines. The program +takes care to warn about this issue after printing an incorrect big-endian +result. Error messages become garbled, though. Tested platforms: @@ -97,7 +110,7 @@ Tested platforms: ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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 diff --git a/2015/howe/README.md b/2015/howe/README.md index 1e71f7a7d..8429a1ca6 100644 --- a/2015/howe/README.md +++ b/2015/howe/README.md @@ -1,9 +1,9 @@ # Most Different - Anthony Howe - Montreal, Quebec, Canada - - Twitter: @SirWumpus +Anthony Howe +Montreal, Quebec, Canada + +Twitter: @SirWumpus # To build: @@ -94,15 +94,26 @@ NOTE: Unlike the original entry source, prog.alt.c, prog.c uses a ### Description -This is a functioning micro diff tool using an [O(NP) algorithm][Wu+89], compared to the older [O(ND) difference algorithm][Mye86] used by some versions of diff. Its output is based on the default diff(1) output described by POSIX and [The Open Group Base Specifications][SUSV7]. The output is suitable for use with patch(1). +This is a functioning micro diff tool using an [O(NP) algorithm][Wu+89], +compared to the older [O(ND) difference algorithm][Mye86] used by some versions +of diff. Its output is based on the default diff(1) output described by POSIX +and [The Open Group Base Specifications][SUSV7]. The output is suitable for use +with patch(1). The -d option simply writes the edit distance between file1 and file2. ### Observations -The FNV1a hash is a little slow compared to the trival hash GNU Diff uses. I downloaded a plain text copy of "War And Peace" from Project Gutenberg, used ``makeholes.c`` to make 1000 random changes, then profiled and timed the program verses GNU Diff. The bottle neck appears to be in the file I/O and line hashing with an average +0.05s slower. Using a huge file like "War And Peace" for testing offsets the diff(1) optimised file I/O. +The FNV1a hash is a little slow compared to the trivial hash GNU Diff uses. I +downloaded a plain text copy of "War And Peace" from Project Gutenberg, used +``makeholes.c`` to make 1000 random changes, then profiled and timed the program +verses GNU Diff. The bottleneck appears to be in the file I/O and line hashing +with an average +0.05s slower. Using a huge file like "War And Peace" for +testing offsets the diff(1) optimised file I/O. -There is no hash collision checking, partly because FNV1a appears to generate very [few collisions][HshCmp] and an assumption that localised collisions within a region of edits are highly unlikely. +There is no hash collision checking, partly because FNV1a appears to generate +very [few collisions][HshCmp] and an assumption that localised collisions within +a region of edits are highly unlikely. ### Support Files @@ -163,7 +174,7 @@ Which hashing algorithm is best for uniqueness and speed? ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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 diff --git a/2015/mills1/README.md b/2015/mills1/README.md index a737cadf9..d6114d7fa 100644 --- a/2015/mills1/README.md +++ b/2015/mills1/README.md @@ -1,7 +1,7 @@ # "For the Birds!" Award - Chris Mills - Twitter: @MisterXopher +Chris Mills +Twitter: @MisterXopher # To build: @@ -21,7 +21,7 @@ make ./prog ``` -Pressing the up arrow and the down arrow at the right time. +Press the up arrow and the down arrow at the right time. ## Judges' comments: @@ -33,7 +33,8 @@ bit easier for you: make clobber all DW=199999 DW=22 DH=16 DA=50 DI=-150 ``` -From the makefile: +From the Makefile: + # Game parameters # @@ -117,7 +118,7 @@ command line: * `-DF`: Sprite for player when flapping. * `-DG`: Instruction text. Change to your native tongue. -Feel free to try out physics or playfield options to make the game more +Feel free to try out physics or play field options to make the game more interesting. Try setting the player sprites to change the game completely -- maybe you can be a fish, or a pig -- the options are limitless! Try using emoji -- you can be a flying beer mug! @@ -139,9 +140,9 @@ make EMOJI=globe ``` for some examples (the full list of options is in the `Makefile`). Don't -forget to `make clean` first. If the output doesn't look right, you may need +forget to `make clobber` first. If the output doesn't look right, you may need to link with the "wide" version of `ncurses`. On MacOSX 10.11, it should work -with the current `-lcurses`; on Linux, you probably need `-lncursesw`. +with the current `-lcurses`; on Linux, you might need `-lncursesw`. See the `Makefile` to make this change if you need to. Or buy a Mac. You will also need a UTF-8 compatible terminal and an emoji font installed, @@ -156,7 +157,7 @@ live-streamed targeted video advertising. ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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 diff --git a/2015/mills2/README.md b/2015/mills2/README.md index 7d3a02203..46294275a 100644 --- a/2015/mills2/README.md +++ b/2015/mills2/README.md @@ -32,10 +32,10 @@ time ./prog test2.Z | cmp - test2 ## Judges' comments: -Without ASCII art, the source code of this entry would have been exactly 256 bytes. -Compared to [1990/jaw](http://ioccc.org/years.html#1990_jaw), it is very impressive, -even taking into account the missing atob functionality. Now we wish for a compress(1)-like compressor -using a similar idea. +Without ASCII art, the source code of this entry would have been exactly 256 +bytes. Compared to [1990/jaw](http://ioccc.org/years.html#1990_jaw), it is very +impressive, even taking into account the missing atob functionality. Now we wish +for a compress(1)-like compressor using a similar idea. Why is the sad smiley on line 12 in that particular place? @@ -43,7 +43,7 @@ Why is the sad smiley on line 12 in that particular place? ### The Program -This program is in implementation of the unix `zcat(1)` command for printing +This program is an implementation of the unix `zcat(1)` command for printing compressed files that have been created by the `compress(1)` command. The adaptive [LZW](https://en.wikipedia.org/wiki/Lempel–Ziv–Welch) compression @@ -122,14 +122,14 @@ In the event that you don't supply an argument, or that argument doesn't name a readable file, the program will just silently exit. This is a feature. The program depends on having a little-endian system. On a big-endian system -you will get a wierd big-endian version of `compress`, which might have come to +you will get a weird big-endian version of `compress`, which might have come to pass in an alternate universe where the vax on which `compress` was authored had been big-endian. Luckily for us, it wasn't, and neither are most of the systems you might want to compile this for. ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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 diff --git a/2015/muth/README.md b/2015/muth/README.md index 1e8aa643d..c12d08e96 100644 --- a/2015/muth/README.md +++ b/2015/muth/README.md @@ -109,7 +109,7 @@ To halt the machine, use the keyword "`break`" as in ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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 diff --git a/2015/schweikhardt/README.md b/2015/schweikhardt/README.md index 81beaf4bc..de3d21899 100644 --- a/2015/schweikhardt/README.md +++ b/2015/schweikhardt/README.md @@ -783,7 +783,7 @@ For all intents and purposes, the *Not Overflowing Type* keeps the promise! ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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 diff --git a/2015/yang/README.md b/2015/yang/README.md index ae5f68d7f..7405d5aaf 100644 --- a/2015/yang/README.md +++ b/2015/yang/README.md @@ -128,7 +128,7 @@ Code layout is inspired by Ibuki Fuuko, for her love of sea stars. ## Copyright: -(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved +(c) Copyright 1984-2015, [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