diff --git a/1984/anonymous/README.md b/1984/anonymous/README.md index bd17bfca2..d90dbe252 100644 --- a/1984/anonymous/README.md +++ b/1984/anonymous/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./anonymous ``` @@ -22,7 +22,7 @@ as the alternate code. See below for the tattoo side-by-side with the code. ### Alternate build: -```sh +``` make alt ``` @@ -31,7 +31,7 @@ as the alternate code. See below for the tattoo side-by-side with the code. NOTE: this version might not work on some systems like macOS. -```sh +``` ./anonymous.alt ``` diff --git a/1984/anonymous/index.html b/1984/anonymous/index.html index 1f28b0380..7aaf83028 100644 --- a/1984/anonymous/index.html +++ b/1984/anonymous/index.html @@ -141,19 +141,19 @@ Location: US - United States of America

To build:

-
    make all
+
    make all

To use:

-
    ./anonymous
+
    ./anonymous

Alternate code:

The original version of this entry was added, by request, in order to show the code that was turned into the tattoo, as the alternate code. See below for the tattoo side-by-side with the code.

Alternate build:

-
    make alt
+
    make alt

Alternate use:

NOTE: this version might not work on some systems like macOS.

-
    ./anonymous.alt
+
    ./anonymous.alt

Judges’ remarks:

The author was too embarrassed that they could write such trash, so I promised to protect their identity. I will say that the author of this diff --git a/1984/decot/README.md b/1984/decot/README.md index c1f1fdab9..37a9af299 100644 --- a/1984/decot/README.md +++ b/1984/decot/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -22,7 +22,7 @@ For more detailed information see [1984 decot bugs](../../bugs.html#1984_decot). ## To use: -```sh +``` ./decot ``` @@ -36,14 +36,14 @@ can use this version. ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./decot.alt ``` @@ -61,13 +61,13 @@ the judges offer this one comment: understand remarks! Some new (in 1984) compilers disliked line 15 of the original source, so we changed it from: -```c +``` for(signal=0;*k * x * __FILE__ *i;) do { ``` to: -```c +``` for(signal=0;*k *x * __FILE__ *i;) do { ``` @@ -75,7 +75,7 @@ To see what we mean look at the [original source file](decot.orig.c). The [alternate code](decot.alt.c) is the version that has this modification. The fixed version has instead: -```c +``` for(signal=0;*k *= * __FILE__ *i;) do { ``` diff --git a/1984/decot/index.html b/1984/decot/index.html index 5e3ae6c0b..728e9bc8a 100644 --- a/1984/decot/index.html +++ b/1984/decot/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

To build:

-
    make all
+
    make all

NOTE: there is an alternate version which will only work if you have an old enough compiler or a compiler that supports -traditional-cpp. The original code was fixed in 2023 to not require this.

@@ -150,15 +150,15 @@ The original code was fixed in 2023 to not require this.

    STATUS: INABIAF - please **DO NOT** fix

For more detailed information see 1984 decot bugs.

To use:

-
    ./decot
+
    ./decot

Alternate code:

This alternate code, the original, requires a compiler that supports -traditional-cpp or an old enough compiler. If you have such a compiler you can use this version.

Alternate build:

-
    make alt
+
    make alt

Alternate use:

-
    ./decot.alt
+
    ./decot.alt

Judges’ remarks:

This program prints out what looks like a fragment of C code.

Is this a bug or is this a feature? To help choose @@ -166,13 +166,13 @@ the judges offer this one comment: understand remarks!

Historical remarks:

Some new (in 1984) compilers disliked line 15 of the original source, so we changed it from:

-
    for(signal=0;*k * x * __FILE__ *i;) do {
+
    for(signal=0;*k * x * __FILE__ *i;) do {

to:

-
    for(signal=0;*k *x * __FILE__ *i;) do {
+
    for(signal=0;*k *x * __FILE__ *i;) do {

To see what we mean look at the original source file. The alternate code is the version that has this modification. The fixed version has instead:

-
    for(signal=0;*k *= * __FILE__ *i;) do {
+
    for(signal=0;*k *= * __FILE__ *i;) do {

Author’s remarks:

No remarks were provided by the author.

make all ``` ## To use: -```sh +``` ./laman ``` @@ -17,7 +17,7 @@ The program accepts ONE POSITIVE number. Seeing is believing, so try things like: -```sh +``` ./try.sh ./laman 4 @@ -33,14 +33,14 @@ This code should run you in circles. Some new compilers (in 1984) dislike lines 6 and 10 of the source, so we changed them from: -```c +``` ;++f)a[ b<<5|c] =d++,b+ =e;for( f=0;f ;++f)a[ b<<5|c] =d++,b+= e;for( f=0;fZZ - Unknown location

To build:

-
    make all
+
    make all

To use:

-
    ./laman <positive number>
+
    ./laman <positive number>

Try:

The program accepts ONE POSITIVE number. Seeing is believing, so try things like:

-
    ./try.sh
-
-    ./laman 4
-    ./laman 9
-    ./laman 16
+
    ./try.sh
+
+    ./laman 4
+    ./laman 9
+    ./laman 16

This code should run you in circles.

Judges’ remarks:

Some new compilers (in 1984) dislike lines 6 and 10 of the source, so we changed them from:

-
    ;++f)a[             b<<5|c]         =d++,b+         =e;for(         f=0;f<O
-    <<5|c]^             =a[b<<5         |c]^=a[         (k-(b+1         ))<<5|c]
+
    ;++f)a[             b<<5|c]         =d++,b+         =e;for(         f=0;f<O
+    <<5|c]^             =a[b<<5         |c]^=a[         (k-(b+1         ))<<5|c]

to:

-
    ;++f)a[             b<<5|c]         =d++,b+=        e;for(          f=0;f<O
-    <<5|c]^=    a[b<<5          |c]^=a[         (k-(b+1         ))<<5|c]
+
    ;++f)a[             b<<5|c]         =d++,b+=        e;for(          f=0;f<O
+    <<5|c]^=    a[b<<5          |c]^=a[         (k-(b+1         ))<<5|c]

I hope you have a C beautifier!

Author’s remarks:

No remarks were provided by the author.

diff --git a/1984/mullender/README.md b/1984/mullender/README.md index 577e0f7d2..cc8a359a9 100644 --- a/1984/mullender/README.md +++ b/1984/mullender/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make alt ``` @@ -24,7 +24,7 @@ For more detailed information see [1984 mullender bugs](../../bugs.html#1984_mul ## To use: -```sh +``` ./mullender.alt [microseconds] ``` @@ -48,7 +48,7 @@ which is probably not as uncommon as you think :-). ## Try: -```sh +``` ./mullender.alt ./mullender.alt 5000 # wait for 5000 microseconds and see what happens @@ -72,14 +72,14 @@ machine dependent code was discouraged. ### Original build: -```sh +``` make all ``` ### Original use: -```sh +``` ./mullender ``` @@ -137,19 +137,19 @@ Repo](https://github.com/dspinellis/unix-history-repo/tree/Research-Release). `gentab.c` can be built like: -```sh +``` make gentab ``` ### gentab use: -```sh +``` ./gentab file ``` ### gentab try: -```sh +``` ./gentab gentab > g.c ``` @@ -256,7 +256,7 @@ separate. The [PDP](https://en.wikipedia.org/wiki/Programmed_Data_Processor) and [VAX](https://en.wikipedia.org/wiki/VAX) codes implement the same algorithm: -```c +``` for (;;) { write(1, " :-)\b\b\b\b", 9); delay(); @@ -284,7 +284,7 @@ We started with writing the We both knew [PDP-11](https://en.wikipedia.org/wiki/PDP-11) assembly so that was no problem. The assembly code we came up with is as follows: -```asm +``` pdp: mov pc,r4 tst -(r4) @@ -331,7 +331,7 @@ VAX code in C and massaged the program that we came up with is as follows: -```asm +``` vax: .word 0400 + (pdp - vax) / 2 - 1 1: pushl $9 @@ -389,7 +389,7 @@ extracted the machine code from the object file. > NOTE from judges: see [gentab.c](gentab.c) for a copy of this file that can be compiled in modern systems. -```c +``` #include #include diff --git a/1984/mullender/index.html b/1984/mullender/index.html index d3f526552..ee62ac1b4 100644 --- a/1984/mullender/index.html +++ b/1984/mullender/index.html @@ -144,7 +144,7 @@ Location: NL - Kingdom of the Netherlan

To build:

-
    make alt
+
    make alt

NOTE: the original code will not work on any system other than VAX-11 and PDP-11 and this is why we encourage you @@ -155,7 +155,7 @@ the original version.

    STATUS: INABIAF - please **DO NOT** fix

For more detailed information see 1984 mullender bugs.

To use:

-
    ./mullender.alt [microseconds]
+
    ./mullender.alt [microseconds]

Hit ctrl-c/intr to exit the program.

The default microseconds is 190000 as this is approximately how long it slept in the original entry but it can be no lower than 5000 as any lower doesn’t work @@ -169,13 +169,13 @@ overflow!

BTW: is there such a thing as too fast a CPU ? :-) Actually yes for certain code which is probably not as uncommon as you think :-).

Try:

-
    ./mullender.alt
-
-    ./mullender.alt 5000        # wait for 5000 microseconds and see what happens
-
-    ./mullender.alt 20000       # wait for 20000 microseconds and see what happens
-
-    ./mullender.alt 100000      # wait for 100000 microseconds and see what happens
+
    ./mullender.alt
+
+    ./mullender.alt 5000        # wait for 5000 microseconds and see what happens
+
+    ./mullender.alt 20000       # wait for 20000 microseconds and see what happens
+
+    ./mullender.alt 100000      # wait for 100000 microseconds and see what happens

What happens if you hit enter after it reaches the end of the line? Why? What happens after some time of waiting?

Original code:

@@ -184,9 +184,9 @@ happens after some time of waiting?

PDP-11. In the following years, 1985 on, machine dependent code was discouraged.

Original build:

-
    make all
+
    make all

Original use:

-
    ./mullender
+
    ./mullender

Judges’ remarks:

Without question, this C program is the one of the most obfuscated C program that has ever been received! Like all great contest entries, it resulted in a @@ -225,11 +225,11 @@ in the fabulous gentab build:

gentab.c can be built like:

-
    make gentab
+
    make gentab

gentab use:

-
    ./gentab file
+
    ./gentab file

gentab try:

-
    ./gentab gentab > g.c
+
    ./gentab gentab > g.c

NOTE: it is highly unlikely that you will be able to run the output of gentab but it should at least compile.

Author’s remarks:

@@ -312,10 +312,10 @@ that branches over the VAX code. The PDP and VAX codes are thus completely separate.

The PDP and VAX codes implement the same algorithm:

-
    for (;;) {
-        write(1, "  :-)\b\b\b\b", 9);
-        delay();
-    }
+
    for (;;) {
+        write(1, "  :-)\b\b\b\b", 9);
+        delay();
+    }

The result is that the symbols :-) move across the screen. delay is implemented differently on the PDP, where we used a @@ -333,18 +333,18 @@ simple.

PDP code in assembly. We both knew PDP-11 assembly so that was no problem. The assembly code we came up with is as follows:

-
    pdp:
-        mov pc,r4
-        tst -(r4)
-        sub $9, r4
-        mov r4,0f
-        mov $1, r0
-        sys 4; 0:0; 9
-        mov $1000, r2
-    1:
-        sys 55
-        sob r2,1b
-        br pdp
+
    pdp:
+        mov pc,r4
+        tst -(r4)
+        sub $9, r4
+        mov r4,0f
+        mov $1, r0
+        sys 4; 0:0; 9
+        mov $1000, r2
+    1:
+        sys 55
+        sob r2,1b
+        br pdp

This is not the code we originally wrote, but it is the code that we ultimately used in the program. The string to be printed is shared by the VAX and the @@ -373,26 +373,26 @@ VAX assembly, we w VAX code in C and massaged the compiler output. The VAX assembly program that we came up with is as follows:

-
    vax: .word 0400 + (pdp - vax) / 2 - 1
-    1:
-        pushl $9
-        pushal str
-        pushl $1
-        calls $3, write
-        cvtwl $32767, r2
-
-    2:
-        decl r2
-        jneq 2b
-        jbr 1b
-
-    write: .word 0
-        chmk $4
-        ret
-
-    str: .ascii " :-)\b\b\b\b"
-
-    pdp: .word 4548, 3044, 58820, 9, 4407, 6, 5568, 1, 35076, 0, 9, 5570, 512, 35117, 32386, 496
+
    vax: .word 0400 + (pdp - vax) / 2 - 1
+    1:
+        pushl $9
+        pushal str
+        pushl $1
+        calls $3, write
+        cvtwl $32767, r2
+
+    2:
+        decl r2
+        jneq 2b
+        jbr 1b
+
+    write: .word 0
+        chmk $4
+        ret
+
+    str: .ascii " :-)\b\b\b\b"
+
+    pdp: .word 4548, 3044, 58820, 9, 4407, 6, 5568, 1, 35076, 0, 9, 5570, 512, 35117, 32386, 496

The first word (after the label vax) is the PDP branch instruction. @@ -426,59 +426,59 @@ extracted the machine code from the object file.

NOTE from judges: see gentab.c for a copy of this file that can be compiled in modern systems.

-
    #include <stdio.h>
-    #include <a.out.h>
-
-    main(argc, argv) char **argv;
-    {
-        register FILE *fp;
-        register short pos = 0, c, n;
-        register char *fmt;
-        if (argc != 2) {
-            fprintf (stderr, "Usage: %s file\n", argv[0]);
-            exit (1);
-        }
-
-        if ((fp = fopen(argv[1], "r")) == NULL) {
-            fprintf(stderr, "%s: can't open %s\n", argv[0], argv[1]);
-            exit(2);
-        }
-
-        fseek (fp, (long) sizeof (struct exec), 0);
-        printf("/* portable between VAX and PDP11 */\n\n");
-        printf ("short main[] = {\n");
-        for (;;) {
-            if (pos == 0)
-                printf("\t");
-
-            c=getc(fp) & 0377;
-            if (feof(fp)) break;
-            n = getc(fp) << 8|c;
-
-            switch (rand() % 5) {
-                case 0:
-                case 1:
-                    fmt = "%d"; break;
-                case 2:
-                    fmt = "%u"; break;
-                case 3:
-                    fmt = "0%o"; break;
-                case 4:
-                    fmt = "0x%x"; break;
-            }
-
-            if (32 <= n && n < 127 && (rand() % 4)) fmt = "'%c'";
-            printf(n < 8 ? "%d" : fmt, n);
-            printf(",");
-            if (pos++ == 8) {
-                printf("\n");
-                pos = 0;
-            }
-            else printf(" ");
-
-            printf("};\n");
-        }
-    }
+
    #include <stdio.h>
+    #include <a.out.h>
+
+    main(argc, argv) char **argv;
+    {
+        register FILE *fp;
+        register short pos = 0, c, n;
+        register char *fmt;
+        if (argc != 2) {
+            fprintf (stderr, "Usage: %s file\n", argv[0]);
+            exit (1);
+        }
+
+        if ((fp = fopen(argv[1], "r")) == NULL) {
+            fprintf(stderr, "%s: can't open %s\n", argv[0], argv[1]);
+            exit(2);
+        }
+
+        fseek (fp, (long) sizeof (struct exec), 0);
+        printf("/* portable between VAX and PDP11 */\n\n");
+        printf ("short main[] = {\n");
+        for (;;) {
+            if (pos == 0)
+                printf("\t");
+
+            c=getc(fp) & 0377;
+            if (feof(fp)) break;
+            n = getc(fp) << 8|c;
+
+            switch (rand() % 5) {
+                case 0:
+                case 1:
+                    fmt = "%d"; break;
+                case 2:
+                    fmt = "%u"; break;
+                case 3:
+                    fmt = "0%o"; break;
+                case 4:
+                    fmt = "0x%x"; break;
+            }
+
+            if (32 <= n && n < 127 && (rand() % 4)) fmt = "'%c'";
+            printf(n < 8 ? "%d" : fmt, n);
+            printf(",");
+            if (pos++ == 8) {
+                printf("\n");
+                pos = 0;
+            }
+            else printf(" ");
+
+            printf("};\n");
+        }
+    }

As can be seen, there is a slight preference for decimal, and also a character format is sometimes used, but only if the data is a printable ASCII character.

When we ran this program, we were almost completely satisfied with the result. diff --git a/1985/applin/README.md b/1985/applin/README.md index f6a386a10..9355efb8b 100644 --- a/1985/applin/README.md +++ b/1985/applin/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## Try: -```sh +``` ./applin ``` diff --git a/1985/applin/index.html b/1985/applin/index.html index ccc775f21..ec3aec2f6 100644 --- a/1985/applin/index.html +++ b/1985/applin/index.html @@ -144,9 +144,9 @@ Location: US - United States of America

To build:

-
    make all
+
    make all

Try:

-
    ./applin
+
    ./applin

Judges’ remarks:

One liner programs are short but twisted. This “Hello, world!” version certainly takes its time saying hello.

diff --git a/1985/august/README.md b/1985/august/README.md index 5850c3904..1750590b3 100644 --- a/1985/august/README.md +++ b/1985/august/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./august ``` ## Try: -```sh +``` ./try.sh ``` @@ -22,7 +22,7 @@ If you have the `primes(6)` tool (sometimes part of [BSD Games](https://github.com/vattam/BSDGames)) you can see what of the output in the first `N` (say `15` or `25`) lines are primes: -```sh +``` ./primes.sh # 15 ./primes.sh 25 ``` diff --git a/1985/august/index.html b/1985/august/index.html index d6559bff4..bb39411fd 100644 --- a/1985/august/index.html +++ b/1985/august/index.html @@ -141,16 +141,16 @@ Location: SE - Kingdom of Sweden (

To build:

-
    make all
+
    make all

To use:

-
    ./august
+
    ./august

Try:

-
    ./try.sh
+
    ./try.sh

If you have the primes(6) tool (sometimes part of BSD Games) you can see what of the output in the first N (say 15 or 25) lines are primes:

-
    ./primes.sh # 15
-    ./primes.sh 25
+
    ./primes.sh # 15
+    ./primes.sh 25

Note that try.sh will run this script anyway, telling you where to get primes(6) if you don’t have it installed, but it will only run with the default value of 15, rather than trying several different values.

diff --git a/1985/lycklama/README.md b/1985/lycklama/README.md index c723ed3b7..594552f67 100644 --- a/1985/lycklama/README.md +++ b/1985/lycklama/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make alt ``` ## To use: -```sh +``` ./lycklama.alt < some_file ``` @@ -24,13 +24,13 @@ call with a configurable time to sleep. The default is 500 microseconds but you reconfigure it like: -```sh +``` make SLEEP=700 clobber alt ``` which would set it at 700. Then, whether you use the default value or not, try: -```sh +``` ./try.alt.sh ``` @@ -45,21 +45,21 @@ modern systems. ### Original build: -```sh +``` make all ``` ### Original use: -```sh +``` ./lycklama < some_file ``` ### Original try: -```sh +``` ./lycklama < lycklama.c ./lycklama < lycklama.alt.c ./lycklama < lycklama.orig.c diff --git a/1985/lycklama/index.html b/1985/lycklama/index.html index 1d47354be..9d0d9b42a 100644 --- a/1985/lycklama/index.html +++ b/1985/lycklama/index.html @@ -141,9 +141,9 @@ Location: ZZ - Unknown location

To build:

-
    make alt
+
    make alt

To use:

-
    ./lycklama.alt < some_file
+
    ./lycklama.alt < some_file

To see why we recommend the alternate version instead of the original version, see below and the Original code section.

Try:

@@ -152,23 +152,23 @@ original, slows down the output so that you can see what it looked like back in This will be more enjoyable. It is slowed down by the usleep(3) library call with a configurable time to sleep. The default is 500 microseconds but you can reconfigure it like:

-
    make SLEEP=700 clobber alt
+
    make SLEEP=700 clobber alt

which would set it at 700. Then, whether you use the default value or not, try:

-
    ./try.alt.sh
+
    ./try.alt.sh

Original code:

As explained above, because modern systems run this entry way too fast to fully appreciate what it does, we encourage you to first try the alternate version. After this, however, you might wish to try the original version, fixed for modern systems.

Original build:

-
    make all
+
    make all

Original use:

-
    ./lycklama < some_file
+
    ./lycklama < some_file

Original try:

-
    ./lycklama < lycklama.c
-    ./lycklama < lycklama.alt.c
-    ./lycklama < lycklama.orig.c
-    ./lycklama < Makefile
+
    ./lycklama < lycklama.c
+    ./lycklama < lycklama.alt.c
+    ./lycklama < lycklama.orig.c
+    ./lycklama < Makefile

Judges’ remarks:

Run the program, redirecting a file into it, and notice how it redisplays it. The program itself looks like tty noise.

diff --git a/1985/shapiro/README.md b/1985/shapiro/README.md index 9f4ae46f0..a61165a9d 100644 --- a/1985/shapiro/README.md +++ b/1985/shapiro/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -10,7 +10,7 @@ There is alternate code which allows one to change the size of the maze. See ### To run: -```sh +``` ./shapiro ``` @@ -23,7 +23,7 @@ of the maze. The alt code allows one to easily do this. ### Alternate build: -```sh +``` make alt ``` @@ -32,7 +32,7 @@ of the maze. The alt code allows one to easily do this. If you wish to change the value you can do it like: -```sh +``` make clobber SIZE=5 alt ``` @@ -41,7 +41,7 @@ error. If it's <= 0 || >= 5000 then it is set to 39, the default. You might also wish to try: -```sh +``` ./try.alt.sh ``` diff --git a/1985/shapiro/index.html b/1985/shapiro/index.html index 363da534a..479884b71 100644 --- a/1985/shapiro/index.html +++ b/1985/shapiro/index.html @@ -141,23 +141,23 @@ Location: US - United States of America

To build:

-
    make all
+
    make all

There is alternate code which allows one to change the size of the maze. See Alternate code below.

To run:

-
    ./shapiro
+
    ./shapiro

Alternate code:

The code has a define C set to 39 but this can be modified to change the size of the maze. The alt code allows one to easily do this.

Alternate build:

-
    make alt
+
    make alt

Alternate try:

If you wish to change the value you can do it like:

-
    make clobber SIZE=5 alt
+
    make clobber SIZE=5 alt

Note that if it is not a number then obviously there will be a compilation error. If it’s <= 0 || >= 5000 then it is set to 39, the default.

You might also wish to try:

-
    ./try.alt.sh
+
    ./try.alt.sh

This script will compile the program five times with a random value and then prompt you in an infinite loop for values to try, exiting only if non-digits are in the input.

diff --git a/1985/sicherman/README.md b/1985/sicherman/README.md index 13032d87f..31c45cf22 100644 --- a/1985/sicherman/README.md +++ b/1985/sicherman/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -11,7 +11,7 @@ more details on it. ## To use: -```sh +``` ./sicherman < file echo foo | ./sicherman @@ -23,7 +23,7 @@ more details on it. ## Try: -```sh +``` ./try.sh ``` @@ -43,7 +43,7 @@ audience. Although this will be built if the original fails to compile you can do it manually like: -```sh +``` make alt ``` @@ -52,14 +52,14 @@ In this case it will be built as `sicherman.alt`. ### Alternate use: -```sh +``` ./sicherman.alt < file ``` ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -80,7 +80,7 @@ on a line. Now enter the letters 'n' through 'z'. But to borrow a quote from Richard Stallman: If you think you understand what this code does, then you don't, so read it again! Explain why: -```sh +``` ./sicherman < sicherman.c | ./sicherman | diff - ./sicherman.c ``` diff --git a/1985/sicherman/index.html b/1985/sicherman/index.html index 75abc49b7..f981ecb2f 100644 --- a/1985/sicherman/index.html +++ b/1985/sicherman/index.html @@ -141,19 +141,19 @@ Location: US - United States of America

To build:

-
    make all
+
    make all

There is another version that will be compiled in case the first fails. This should happen automatically. See Alternate code below for more details on it.

To use:

-
    ./sicherman < file
-
-    echo foo | ./sicherman
-
-    ./sicherman
-    # type or paste some text, making sure to hit enter after each line typed
+
    ./sicherman < file
+
+    echo foo | ./sicherman
+
+    ./sicherman
+    # type or paste some text, making sure to hit enter after each line typed

Try:

-
    ./try.sh
+
    ./try.sh

Alternate code:

The sicherman.alt.c is a slight change in the fixed version (fixed so it does not require -traditional-cpp) in that it has two args to @@ -164,12 +164,12 @@ audience.

Alternate build:

Although this will be built if the original fails to compile you can do it manually like:

-
    make alt
+
    make alt

In this case it will be built as sicherman.alt.

Alternate use:

-
    ./sicherman.alt < file
+
    ./sicherman.alt < file

Alternate try:

-
    ./try.alt.sh
+
    ./try.alt.sh

Judges’ remarks:

This program abuses the C preprocessor so much that some cpps fail to strip out all of the comments on the first pass! If you were able to understand @@ -182,7 +182,7 @@ Like the program says, what’s that mean?

on a line. Now enter the letters ‘n’ through ‘z’. But to borrow a quote from Richard Stallman: If you think you understand what this code does, then you don’t, so read it again! Explain why:

-
    ./sicherman < sicherman.c | ./sicherman | diff - ./sicherman.c
+
    ./sicherman < sicherman.c | ./sicherman | diff - ./sicherman.c

results in diff reporting a difference on some machines.

Author’s remarks:

No remarks were provided by the author.

diff --git a/1986/applin/README.md b/1986/applin/README.md index a313cf685..95c15bf30 100644 --- a/1986/applin/README.md +++ b/1986/applin/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./applin ``` ## Try: -```sh +``` ./applin.c ``` diff --git a/1986/applin/index.html b/1986/applin/index.html index 672d6ff64..c559b9adf 100644 --- a/1986/applin/index.html +++ b/1986/applin/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

To build:

-
    make all
+
    make all

To use:

-
    ./applin
+
    ./applin

Try:

-
    ./applin.c
+
    ./applin.c

Judges’ remarks:

The judges were so amused by this little program that we created an award just for it. This program is portable to the C and Fortran 77 diff --git a/1986/august/README.md b/1986/august/README.md index 83986a7f8..61fd004ca 100644 --- a/1986/august/README.md +++ b/1986/august/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [1986 august bugs](../../bugs.html#1986_august ## Try: -```sh +``` ./august ``` diff --git a/1986/august/index.html b/1986/august/index.html index 25549b3cc..b4793041d 100644 --- a/1986/august/index.html +++ b/1986/august/index.html @@ -141,13 +141,13 @@ Location: SE - Kingdom of Sweden (

To build:

-
    make all
+
    make all

Bugs and (Mis)features:

The current status of this entry is:

    STATUS: INABIAF - please **DO NOT** fix

For more detailed information see 1986 august bugs.

Try:

-
    ./august
+
    ./august

Judges’ remarks:

This program computes a specific mathematical value. Simply compile and give it an infinite amount of stack space and CPU time. Otherwise diff --git a/1986/bright/README.md b/1986/bright/README.md index af7816df7..210e99a2f 100644 --- a/1986/bright/README.md +++ b/1986/bright/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./bright some_file ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/1986/bright/index.html b/1986/bright/index.html index 10a439b11..d6b75c24d 100644 --- a/1986/bright/index.html +++ b/1986/bright/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

To build:

-
    make all
+
    make all

To use:

-
    ./bright some_file
+
    ./bright some_file

Try:

-
    ./try.sh
+
    ./try.sh

Judges’ remarks:

Compile this program and give a filename as an argument.

Mr. Bright exploits the C pre-processor, similar variables and diff --git a/1986/hague/README.md b/1986/hague/README.md index 87f8ce071..f900d03b6 100644 --- a/1986/hague/README.md +++ b/1986/hague/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./hague 2>/dev/null # enter some text ``` @@ -15,7 +15,7 @@ ## Try: -```sh +``` ./try.sh ``` diff --git a/1986/hague/index.html b/1986/hague/index.html index 2a66c5d6a..476ef0bef 100644 --- a/1986/hague/index.html +++ b/1986/hague/index.html @@ -141,12 +141,12 @@ Location: GB - United Kingdom of Great

To build:

-
    make all
+
    make all

To use:

-
    ./hague 2>/dev/null
-    # enter some text
+
    ./hague 2>/dev/null
+    # enter some text

Try:

-
    ./try.sh
+
    ./try.sh

Note that you can run the program without feeding it anything and then type in a message and line by line it will show the right output. Notice also how certain characters will print a ?.

diff --git a/1986/holloway/README.md b/1986/holloway/README.md index 81368e750..5b6da9421 100644 --- a/1986/holloway/README.md +++ b/1986/holloway/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## Try: -```sh +``` ./holloway ``` diff --git a/1986/holloway/index.html b/1986/holloway/index.html index 87dee4a32..4ceca4564 100644 --- a/1986/holloway/index.html +++ b/1986/holloway/index.html @@ -141,9 +141,9 @@ Location: US - United States of America

To build:

-
    make all
+
    make all

Try:

-
    ./holloway
+
    ./holloway

Judges’ remarks:

Believe it or not, this is the old standard “Hello, world” program performed in a very complex way. The judges and the author defy you diff --git a/1986/marshall/README.md b/1986/marshall/README.md index f991cc8c7..2f84c5feb 100644 --- a/1986/marshall/README.md +++ b/1986/marshall/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ if nothing else. ## To use: -```sh +``` ./marshall ``` @@ -36,14 +36,14 @@ instead offer the problematic code as an alternate version whereas To see if your compiler has the problems noted: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./marshall.alt ``` diff --git a/1986/marshall/compilers.html b/1986/marshall/compilers.html index 4c735585b..5a6aa4fb4 100644 --- a/1986/marshall/compilers.html +++ b/1986/marshall/compilers.html @@ -162,7 +162,7 @@ because of the call to _exit() (see below).

enable the optimiser clang will generate code that prints the string twice and dumps core just like before! What about the call to _exit()?

The call was:

-
    _exit(argv[(int)*argc-2/cc[1*(int)*argc]|-1<<4]);
+
    _exit(argv[(int)*argc-2/cc[1*(int)*argc]|-1<<4]);

Changing it to not refer to these variables and just exit 1 and the problems disappear!

macOS

@@ -172,9 +172,9 @@ it works fine but if it’s disabled it prints out the string and then enters an infinite loop!

After we fix the infinite loop if we change the _exit() call in macOS and disable the optimiser we might get something like:

-
    $ ./marshall
-          choo choo
-    Segmentation fault: 11
+
    $ ./marshall
+          choo choo
+    Segmentation fault: 11

Observe how it doesn’t print it twice. But of course it segfaults so it’s not right either.

If the optimiser is enabled, however, we will see that it works fine before the diff --git a/1986/marshall/compilers.md b/1986/marshall/compilers.md index 91948df78..a732d52fe 100644 --- a/1986/marshall/compilers.md +++ b/1986/marshall/compilers.md @@ -54,7 +54,7 @@ dumps core just like before! What about the call to `_exit()`? The call was: -```c +``` _exit(argv[(int)*argc-2/cc[1*(int)*argc]|-1<<4]); ``` @@ -72,7 +72,7 @@ infinite loop! After we fix the infinite loop if we change the `_exit()` call in macOS and disable the optimiser we might get something like: -```sh +``` $ ./marshall choo choo Segmentation fault: 11 diff --git a/1986/marshall/index.html b/1986/marshall/index.html index 21f264bc0..84d1f2678 100644 --- a/1986/marshall/index.html +++ b/1986/marshall/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

To build:

-
    make all
+
    make all

NOTE: we FORCE disable the optimiser due to a funny problem with different compilers and systems. See below and compilers.html for details.

There is an alternate version. The reason is a funny problem: @@ -152,7 +152,7 @@ might work but the other one would not. We describe this in more detail in compilers.html and we encourage you to read it for entertainment if nothing else.

To use:

-
    ./marshall
+
    ./marshall

Alternate code:

Due to the different conflicting problems with gcc and clang, we instead offer the problematic code as an alternate version whereas @@ -160,9 +160,9 @@ instead offer the problematic code as an alternate version whereas _exit() commented out, changing the value passed into _exit() to 1.

Alternate build:

To see if your compiler has the problems noted:

-
    make alt
+
    make alt

Alternate use:

-
    ./marshall.alt
+
    ./marshall.alt

Does it work in your system? That is does it not segfault, does it print it only once and does it not enter an infinite loop? Or more generally does it print the text exactly once and then exit?

diff --git a/1986/pawka/README.md b/1986/pawka/README.md index 57239169c..a3caf8c20 100644 --- a/1986/pawka/README.md +++ b/1986/pawka/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## Try: -```sh +``` ./pawka ``` diff --git a/1986/pawka/index.html b/1986/pawka/index.html index 691347053..023814ba2 100644 --- a/1986/pawka/index.html +++ b/1986/pawka/index.html @@ -141,9 +141,9 @@ Location: ZZ - Unknown location

To build:

-
    make all
+
    make all

Try:

-
    ./pawka
+
    ./pawka

Judges’ remarks:

The judges found this entry to be one of hardest to read without the aid of /lib/cpp and a good editor. When run, the program asks if it diff --git a/1986/stein/README.md b/1986/stein/README.md index f0dc9deda..73121e459 100644 --- a/1986/stein/README.md +++ b/1986/stein/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./stein $(printf "\015\015"); echo ``` @@ -24,7 +24,7 @@ The `\015` in the above `printf(1)` command produces a control-N. One some machines, a control-M control-N arg is needed to get the command to output cleanly: -```sh +``` ./stein $(printf "\014\015"); echo ``` diff --git a/1986/stein/index.html b/1986/stein/index.html index 7bc5b0d4f..3e3a12652 100644 --- a/1986/stein/index.html +++ b/1986/stein/index.html @@ -141,9 +141,9 @@ Location: ZZ - Unknown location

To build:

-
    make all
+
    make all

To use:

-
    ./stein $(printf "\015\015"); echo
+
    ./stein $(printf "\015\015"); echo

Judges’ remarks:

NOTE: to avoid problems with news and mail, the single line was split into 3 lines. Join all lines into a single line to recreate @@ -151,7 +151,7 @@ the original file.

The \015 in the above printf(1) command produces a control-N.

One some machines, a control-M control-N arg is needed to get the command to output cleanly:

-
    ./stein $(printf "\014\015"); echo
+
    ./stein $(printf "\014\015"); echo

Your system may require another set of characters. In time, you will figure out what it does. :-)

Author’s remarks:

diff --git a/1986/wall/README.md b/1986/wall/README.md index e0f36c4fc..6db56f878 100644 --- a/1986/wall/README.md +++ b/1986/wall/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./wall ``` diff --git a/1986/wall/index.html b/1986/wall/index.html index b9ad8de4c..8ac1e6661 100644 --- a/1986/wall/index.html +++ b/1986/wall/index.html @@ -141,9 +141,9 @@ Location: US - United States of America

To build:

-
    make all
+
    make all

To use:

-
    ./wall
+
    ./wall

Judges’ remarks:

The original version did not have a ‘;’ character in the first line. This caused a number of System V C pre-preprocessors to gripe about a diff --git a/1987/biggar/README.md b/1987/biggar/README.md index 9d2f5c92c..4430ea795 100644 --- a/1987/biggar/README.md +++ b/1987/biggar/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` some_command | ./biggar | od -c ./biggar < file | od -c @@ -16,7 +16,7 @@ ## Try: -```sh +``` ./try.sh ``` diff --git a/1987/biggar/index.html b/1987/biggar/index.html index 6dd42a983..275476c63 100644 --- a/1987/biggar/index.html +++ b/1987/biggar/index.html @@ -141,13 +141,13 @@ Location: ZZ - Unknown location

To build:

-
    make all
+
    make all

To use:

-
    some_command | ./biggar | od -c
-
-    ./biggar < file | od -c
+
    some_command | ./biggar | od -c
+
+    ./biggar < file | od -c

Try:

-
    ./try.sh
+
    ./try.sh

Judges’ remarks:

By changing the compile line you can make this program do anything you want. This is a very efficient way to transfer source, though it diff --git a/1987/heckbert/README.md b/1987/heckbert/README.md index 68c95d321..ae61cea5a 100644 --- a/1987/heckbert/README.md +++ b/1987/heckbert/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -10,7 +10,7 @@ To compile on a 16 bit machine, change 300000 to 30000. ## To use: -```sh +``` ./heckbert col < file ``` @@ -19,7 +19,7 @@ where col is the number of columns to fold at and file is the file to fold. ## Try: -```sh +``` ./try.sh ``` @@ -28,7 +28,7 @@ where col is the number of columns to fold at and file is the file to fold. Folding at the wrong length may be equivalent to a "Spindle or Mutilate" operation. For example: -```sh +``` ./heckbert 40 < heckbert.c > ph.c ; make ph ; ./ph 20 < heckbert.c > bar.c ; make bar ``` diff --git a/1987/heckbert/index.html b/1987/heckbert/index.html index ee086d6ac..1a0308b9b 100644 --- a/1987/heckbert/index.html +++ b/1987/heckbert/index.html @@ -141,17 +141,17 @@ Location: US - United States of America

To build:

-
    make all
+
    make all

On System V systems, we had to compile with -Dindex=strchr. To compile on a 16 bit machine, change 300000 to 30000.

To use:

-
    ./heckbert col < file
+
    ./heckbert col < file

where col is the number of columns to fold at and file is the file to fold.

Try:

-
    ./try.sh
+
    ./try.sh

Judges’ remarks:

Folding at the wrong length may be equivalent to a “Spindle or Mutilate” operation. For example:

-
    ./heckbert 40 < heckbert.c > ph.c ; make ph ; ./ph 20 < heckbert.c > bar.c ; make bar
+
    ./heckbert 40 < heckbert.c > ph.c ; make ph ; ./ph 20 < heckbert.c > bar.c ; make bar

Try not to Fold, Spindle or Mutilate files. :-)

diff --git a/1987/hines/README.md b/1987/hines/README.md index 7276dc644..59e84f8dd 100644 --- a/1987/hines/README.md +++ b/1987/hines/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./hines file.c ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/1987/hines/index.html b/1987/hines/index.html index 010c675e9..911d4dc53 100644 --- a/1987/hines/index.html +++ b/1987/hines/index.html @@ -141,11 +141,11 @@ Location: ZZ - Unknown location

To build:

-
    make all
+
    make all

To use:

-
    ./hines file.c
+
    ./hines file.c

Try:

-
    ./try.sh
+
    ./try.sh

Judges’ remarks:

This program was designed to maximize the bother function for structured programmers. This program takes goto statements to their diff --git a/1987/korn/README.md b/1987/korn/README.md index ce7e30bfa..80d27d030 100644 --- a/1987/korn/README.md +++ b/1987/korn/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./korn ``` @@ -29,14 +29,14 @@ Several points are important to understand this program: 2. What is the value of the symbol `"have"`? (hint: the value is NOT 4 characters, or `'h'`, or a string) Consider the fact that: -```c +``` char *x; ``` defines a pointer to a `char` (i.e. an address), and that the `=` assigns things of compatible types. Since: -```c +``` x = "have"; ``` @@ -44,13 +44,13 @@ is legal C, what type of value is `"have"`? 3. Note that the following expressions yield the same value: -```c +``` x[3] *(x+3) *(3+x) ``` since addition is commutative. What can be said about this value? -```c +``` 3[x] ``` diff --git a/1987/korn/index.html b/1987/korn/index.html index c1d9098cb..8ea8bd061 100644 --- a/1987/korn/index.html +++ b/1987/korn/index.html @@ -141,9 +141,9 @@ Location: US - United States of America

To build:

-
    make all
+
    make all

To use:

-
    ./korn
+
    ./korn

Judges’ remarks:

The Judges believe that this is the best one line entry ever received. Compile on a UNIX system, or at least one using a C implementation that @@ -158,17 +158,17 @@ section right now and see if you are one of the few people who can.

  • What is the value of the symbol "have"? (hint: the value is NOT 4 characters, or 'h', or a string) Consider the fact that:

  • -
        char *x;
    +
        char *x;

    defines a pointer to a char (i.e. an address), and that the = assigns things of compatible types. Since:

    -
        x = "have";
    +
        x = "have";

    is legal C, what type of value is "have"?

    1. Note that the following expressions yield the same value:
    -
        x[3]        *(x+3)    *(3+x)
    +
        x[3]        *(x+3)    *(3+x)

    since addition is commutative. What can be said about this value?

    -
        3[x]
    +
        3[x]

    David Korn’s /bin/ksh provides us with a greatly diff --git a/1987/lievaart/README.md b/1987/lievaart/README.md index 876c8f65c..4ae8714e6 100644 --- a/1987/lievaart/README.md +++ b/1987/lievaart/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./lievaart # enter a level and start playing as described below ``` @@ -17,7 +17,7 @@ To see what it would have looked like without the size restrictions: -```sh +``` ./lievaart2 # enter a level and start playing as described below ``` diff --git a/1987/lievaart/index.html b/1987/lievaart/index.html index e60b6cab0..359f1fad1 100644 --- a/1987/lievaart/index.html +++ b/1987/lievaart/index.html @@ -141,14 +141,14 @@ Location: NL - Kingdom of the Netherlan

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./lievaart
    -    # enter a level and start playing as described below
    +
        ./lievaart
    +    # enter a level and start playing as described below

    Try:

    To see what it would have looked like without the size restrictions:

    -
        ./lievaart2
    -    # enter a level and start playing as described below
    +
        ./lievaart2
    +    # enter a level and start playing as described below

    Judges’ remarks:

    We believe that you too will be amazed at just how much power Mr. Lievaart packed into 1024 bytes!

    diff --git a/1987/wall/README.md b/1987/wall/README.md index 435c0fbba..df10a656e 100644 --- a/1987/wall/README.md +++ b/1987/wall/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./wall # enter some numbers @@ -18,14 +18,14 @@ ## Try: -```sh +``` ./try.sh ``` You may of course run the commands manually and enter text as you wish. For instance you might try one or both of: -```sh +``` ./wall | bc ./wall | cat diff --git a/1987/wall/index.html b/1987/wall/index.html index 5d751686e..965c02ca8 100644 --- a/1987/wall/index.html +++ b/1987/wall/index.html @@ -141,20 +141,20 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./wall
    -    # enter some numbers
    -
    -    ./wall | some_command
    -    # enter some strings or numbers, depending on command
    +
        ./wall
    +    # enter some numbers
    +
    +    ./wall | some_command
    +    # enter some strings or numbers, depending on command

    Try:

    -
        ./try.sh
    +
        ./try.sh

    You may of course run the commands manually and enter text as you wish. For instance you might try one or both of:

    -
        ./wall | bc
    -
    -    ./wall | cat
    +
        ./wall | bc
    +
    +    ./wall | cat

    and enter some input like:

        x*x
         2^x
    diff --git a/1987/westley/README.md b/1987/westley/README.md
    index ff0635f16..564ce1a22 100644
    --- a/1987/westley/README.md
    +++ b/1987/westley/README.md
    @@ -1,13 +1,13 @@
     ## To build:
     
    -```sh
    +```
         make all
     ```
     
     
     ## To use:
     
    -```sh
    +```
         ./westley
     ```
     
    diff --git a/1987/westley/index.html b/1987/westley/index.html
    index 518059f0b..71cfb7ed4 100644
    --- a/1987/westley/index.html
    +++ b/1987/westley/index.html
    @@ -141,9 +141,9 @@ Location: US - United States of America
     
     
     

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./westley
    +
        ./westley

    Judges’ remarks:

    putchar() must exist in the C library and not just as a macro. If it fails to compile, bug your OS/compiler vendor.

    diff --git a/1988/applin/README.md b/1988/applin/README.md index c70dc626d..b0b04d5a5 100644 --- a/1988/applin/README.md +++ b/1988/applin/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -12,7 +12,7 @@ program. See the [Alternate code](#alternate-code) section below for details. ## Try: -```sh +``` ./applin ``` @@ -25,7 +25,7 @@ with this entry. ### Alternate build: -```sh +``` make alt ``` diff --git a/1988/applin/index.html b/1988/applin/index.html index 9d3cb009e..920a7da82 100644 --- a/1988/applin/index.html +++ b/1988/applin/index.html @@ -141,18 +141,18 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    A smaller version, originally called zsmall.c (and still exists as such, as the source of the alt code), of applin.c, can be found in applin.alt.c. Your machine may have an easier time with this program. See the Alternate code section below for details.

    Try:

    -
        ./applin
    +
        ./applin

    Alternate code:

    As noted above a smaller version can be used in case your cpp has a hard time with this entry.

    Alternate build:

    -
        make alt
    +
        make alt

    Use applin.alt as you would applin above.

    History about the smaller version:

    Way back in 1988 ..

    diff --git a/1988/dale/README.md b/1988/dale/README.md index 5740e7d27..c543dc8dd 100644 --- a/1988/dale/README.md +++ b/1988/dale/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,13 +18,13 @@ For more detailed information see [1988 dale bugs](../../bugs.html#1988_dale). ## Try: -```sh +``` ./try.sh ``` Observe that three of the commands in the script are: -```sh +``` ./dale these files are in this directory: * ./dale $(printf "the following files exist in this directory:\n%s\n" *) ./dale "$(printf "the following files exist in this directory:\n%s\n" *)" diff --git a/1988/dale/index.html b/1988/dale/index.html index 09c40a938..defc16f6d 100644 --- a/1988/dale/index.html +++ b/1988/dale/index.html @@ -141,17 +141,17 @@ Location: AU - Commonwealth of Australi

    To build:

    -
        make all
    +
        make all

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 1988 dale bugs.

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Observe that three of the commands in the script are:

    -
        ./dale these files are in this directory: *
    -    ./dale $(printf "the following files exist in this directory:\n%s\n" *)
    -    ./dale "$(printf "the following files exist in this directory:\n%s\n" *)"
    +
        ./dale these files are in this directory: *
    +    ./dale $(printf "the following files exist in this directory:\n%s\n" *)
    +    ./dale "$(printf "the following files exist in this directory:\n%s\n" *)"

    As the script asks what do the last two do and why do they do it? Why do they differ in format from the first command? Finally how can you get the more likely desired behaviour?

    diff --git a/1988/isaak/README.md b/1988/isaak/README.md index 3b056c3ef..f4fb99ff8 100644 --- a/1988/isaak/README.md +++ b/1988/isaak/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -11,7 +11,7 @@ code](#alternate-code) below. ## To use: -```sh +``` ./isaak ``` @@ -21,7 +21,7 @@ code](#alternate-code) below. The original version of this code is in [isaak.alt.c](isaak.alt.c). The original entry starts with the line: -```c +``` main(){}; ``` @@ -37,7 +37,7 @@ compile. ### Alternate build: -```sh +``` make alt ``` @@ -64,7 +64,7 @@ due to the fact that BSD style systems have an `sprintf(3)` that returns a `char *`. Due to the above problems, we placed the output of this program in the file: isaak.encode. To read this file do. -```sh +``` uudecode < isaak.encode cat isaak.output ``` diff --git a/1988/isaak/index.html b/1988/isaak/index.html index 5a21420fb..c82d0be24 100644 --- a/1988/isaak/index.html +++ b/1988/isaak/index.html @@ -141,16 +141,16 @@ Location: ZZ - Unknown location

    To build:

    -
        make all
    +
        make all

    There is an alternate version, the original, that can’t be compiled in modern systems but can be if you have an old enough compiler. See Alternate code below.

    To use:

    -
        ./isaak
    +
        ./isaak

    Alternate code:

    The original version of this code is in isaak.alt.c. The original entry starts with the line:

    -
        main(){};
    +
        main(){};

    This works on some systems. Why? Note that #include <stdio.h> is given on the last line. Why is this needed? Note the unusual calls to sprintf(3).

    This version also relied on being able to define #define to something else and @@ -158,7 +158,7 @@ using that macro for #define.

    This version will not likely work on modern systems if you can even get it to compile.

    Alternate build:

    -
        make alt
    +
        make alt

    Use isaak.alt as you would isaak above.

    Judges’ remarks:

    The program relies heavily on ASCII. Don’t even think of running it on @@ -173,8 +173,8 @@ from a single macro (e.g., "O/**/O" creates either ++

    NOTE: Most System V machines were not be able to execute this program correctly due to the fact that BSD style systems have an sprintf(3) that returns a char *. Due to the above problems, we placed the output of this program in the file: isaak.encode. To read this file do.

    -
        uudecode < isaak.encode
    -    cat isaak.output
    +
        uudecode < isaak.encode
    +    cat isaak.output

    Since this was fixed, this file is not strictly necessary. See the isaak.alt.c for the original source.

    FYI: We are likely to be more strict about portability in the future.

    diff --git a/1988/litmaath/README.md b/1988/litmaath/README.md index 82dd7ef80..a38ba4d0f 100644 --- a/1988/litmaath/README.md +++ b/1988/litmaath/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./litmaath some text ``` @@ -17,7 +17,7 @@ code](#alternate-code) section below. ## Try: -```sh +``` ./litmaath eschew obfuscation ``` @@ -31,7 +31,7 @@ a file. ### Alternate build: -```sh +``` make alt ``` @@ -40,7 +40,7 @@ Use `litmaath.alt` as you would `litmaath` above. ### Alternate try: -```sh +``` ./litmaath.alt six was afraid of seven because seven eight nine ``` @@ -50,7 +50,7 @@ Use `litmaath.alt` as you would `litmaath` above. Note the unusual structure: -```c +``` while () ; ``` @@ -66,7 +66,7 @@ could make the body of the `while` loop an `fprintf` with interesting variables like: -```c +``` fprintf(stderr, "argv=%lo *argv=%lo **argv=%c argv[1]=%lo *argv[1]=%c argc=%d\n", (long) argv, (long) *argv, *argv && **argv ? **argv : '@', diff --git a/1988/litmaath/index.html b/1988/litmaath/index.html index f72d5f603..e59ba43a1 100644 --- a/1988/litmaath/index.html +++ b/1988/litmaath/index.html @@ -141,26 +141,26 @@ Location: CH - Swiss Confederation

    To build:

    -
        make
    +
        make

    To use:

    -
        ./litmaath some text
    +
        ./litmaath some text

    There is an alternate version provided. See the Alternate code section below.

    Try:

    -
        ./litmaath eschew obfuscation
    +
        ./litmaath eschew obfuscation

    Alternate code:

    This alternate code, added to help understand the entry and for fun, is code that we suggested at the time of the entry publication but which we never put in a file.

    Alternate build:

    -
        make alt
    +
        make alt

    Use litmaath.alt as you would litmaath above.

    Alternate try:

    -
        ./litmaath.alt six was afraid of seven because seven eight nine
    +
        ./litmaath.alt six was afraid of seven because seven eight nine

    Judges’ remarks:

    Note the unusual structure:

    -
        while (<condition>)
    -             ;
    +
        while (<condition>)
    +             ;

    Did you notice that the body is empty?

    Furthermore, it’s interesting to note that only two variables are used to achieve everything.

    @@ -168,10 +168,10 @@ used to achieve everything.

    two small strings as arguments, and follow the program closely. One could make the body of the while loop an fprintf with interesting variables like:

    -
        fprintf(stderr,
    -         "argv=%lo *argv=%lo **argv=%c argv[1]=%lo *argv[1]=%c argc=%d\n",
    -         (long) argv, (long) *argv, *argv && **argv ? **argv : '@',
    -         (long) argv[1], argv[1] && *argv[1] ? *argv[1] : '@', argc);
    +
        fprintf(stderr,
    +         "argv=%lo *argv=%lo **argv=%c argv[1]=%lo *argv[1]=%c argc=%d\n",
    +         (long) argv, (long) *argv, *argv && **argv ? **argv : '@',
    +         (long) argv[1], argv[1] && *argv[1] ? *argv[1] : '@', argc);

    … which is what the alternate code is.

    Author’s remarks:

    No remarks were provided by the author.

    diff --git a/1988/phillipps/README.md b/1988/phillipps/README.md index 110c42351..4e8a9bbbc 100644 --- a/1988/phillipps/README.md +++ b/1988/phillipps/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` diff --git a/1988/phillipps/index.html b/1988/phillipps/index.html index a6ab162d4..0110ee207 100644 --- a/1988/phillipps/index.html +++ b/1988/phillipps/index.html @@ -141,7 +141,7 @@ Location: ZZ - Unknown location

    To build:

    -
        make all
    +
        make all

    Judges’ remarks:

    Compile and run without parameters.

    The program is smaller than even the ‘compressed’ form of its output, diff --git a/1988/reddy/README.md b/1988/reddy/README.md index 885f75ae5..25cd1004e 100644 --- a/1988/reddy/README.md +++ b/1988/reddy/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## Try: -```sh +``` ./reddy char *(*(fun[16])(); char *(*(*(*(*(*fun[32])))))(); @@ -15,7 +15,7 @@ What happens if you input, and what you do about it? -```c +``` char *(*(*(*(*(*fun[32])))))()); ``` diff --git a/1988/reddy/index.html b/1988/reddy/index.html index 7aa165538..05596c7e5 100644 --- a/1988/reddy/index.html +++ b/1988/reddy/index.html @@ -141,13 +141,13 @@ Location: ZZ - Unknown location

    To build:

    -
        make all
    +
        make all

    Try:

    -
        ./reddy
    -    char *(*(fun[16])();
    -    char *(*(*(*(*(*fun[32])))))();
    +
        ./reddy
    +    char *(*(fun[16])();
    +    char *(*(*(*(*(*fun[32])))))();

    What happens if you input, and what you do about it?

    -
        char *(*(*(*(*(*fun[32])))))());
    +
        char *(*(*(*(*(*fun[32])))))());

    Judges’ remarks:

    This is a somewhat restricted version of a useful program that has been posted to Usenet. What is unusual is what it is able to do so much diff --git a/1988/robison/README.md b/1988/robison/README.md index f22e77bb2..36dd9a375 100644 --- a/1988/robison/README.md +++ b/1988/robison/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## Try: -```sh +``` ./robison 80 10 ./robison 40 16 ``` The first and second parameters are optional. You might also try: -```sh +``` ./robison 80 2 # <--- can you find the bug? ./robison 80 -246 ``` @@ -24,7 +24,7 @@ The first and second parameters are optional. You might also try: The following might make an interesting benchmark: -```sh +``` ./robison 100 ``` diff --git a/1988/robison/index.html b/1988/robison/index.html index 687eb1735..965a79fc6 100644 --- a/1988/robison/index.html +++ b/1988/robison/index.html @@ -141,16 +141,16 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    Try:

    -
        ./robison 80 10
    -    ./robison 40 16
    +
        ./robison 80 10
    +    ./robison 40 16

    The first and second parameters are optional. You might also try:

    -
        ./robison 80 2   # <--- can you find the bug?
    -    ./robison 80 -246
    +
        ./robison 80 2   # <--- can you find the bug?
    +    ./robison 80 -246

    Judges’ remarks:

    The following might make an interesting benchmark:

    -
        ./robison 100
    +
        ./robison 100

    [Amdahl 5890-300E with System V cc: 8.40 seconds]

    We suggest that you C pre-process and perhaps C-beautify this program. All is not what it may appear to be in this program. Why does a whi1e diff --git a/1988/spinellis/README.md b/1988/spinellis/README.md index 31e87cf2c..aa12f1b32 100644 --- a/1988/spinellis/README.md +++ b/1988/spinellis/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make clobber all ``` @@ -12,7 +12,7 @@ code](#alternate-code) section below. ## To use: -```sh +``` ./spinellis ``` @@ -21,7 +21,7 @@ EOF (typically ctrl-d). Now run again: -```sh +``` ./spinellis ``` @@ -33,7 +33,7 @@ For clang or compilers that won't read from `/dev/tty`, we provide this version. ### Alternate build: -```sh +``` make clobber alt ``` @@ -42,7 +42,7 @@ and follow the instructions. ### Alternate use: -```sh +``` ./spinellis.alt ``` @@ -51,7 +51,7 @@ EOF (typically ctrl-d). Now run again: -```sh +``` ./spinellis.alt ``` diff --git a/1988/spinellis/index.html b/1988/spinellis/index.html index dad63885a..6f91e41f9 100644 --- a/1988/spinellis/index.html +++ b/1988/spinellis/index.html @@ -141,27 +141,27 @@ Location: GR - Hellenic Republic (

    To build:

    -
        make clobber all
    +
        make clobber all

    and follow the instructions this will give you.

    If your compiler will not read from /dev/tty see the Alternate code section below.

    To use:

    -
        ./spinellis
    +
        ./spinellis

    Type in or copy paste some C code, perhaps from input.txt, and send EOF (typically ctrl-d).

    Now run again:

    -
        ./spinellis
    +
        ./spinellis

    Alternate code:

    For clang or compilers that won’t read from /dev/tty, we provide this version.

    Alternate build:

    -
        make clobber alt
    +
        make clobber alt

    and follow the instructions.

    Alternate use:

    -
        ./spinellis.alt
    +
        ./spinellis.alt

    Type in or copy paste some C code, perhaps from input.txt, and send EOF (typically ctrl-d).

    Now run again:

    -
        ./spinellis.alt
    +
        ./spinellis.alt

    Judges’ remarks:

    We enjoyed this entry this year; however in the future programs must be able to be compiled from within a Makefile without the need of human intervention.

    diff --git a/1988/westley/README.md b/1988/westley/README.md index a554eaacb..800abe233 100644 --- a/1988/westley/README.md +++ b/1988/westley/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -11,13 +11,13 @@ might wish to do so. ## Try: -```sh +``` ./westley ``` Also try: -```sh +``` ./try.sh ``` @@ -31,7 +31,7 @@ This version is the original which might not work as you expect nowadays. ### Alternate build: -```sh +``` make alt ``` @@ -41,7 +41,7 @@ This version is the original which might not work as you expect nowadays. To see if your compiler has the problem described in the Judges' remarks below, try: -```sh +``` ./westley.alt ``` @@ -52,7 +52,7 @@ Does it show the same output as `westley`? Your compiler must parse -```c +``` #define _ -a -_ ``` @@ -62,7 +62,7 @@ conforming ANSI C Preprocessors may object to this: for such compilers, you can elide the non-standard token-pasting requirement by changing the #define line to: -```c +``` #define _ F-->00||F-OO--; ``` @@ -71,7 +71,7 @@ code is the original. You might enjoy looking at the output of: -```sh +``` cc -E westley.alt.c ``` diff --git a/1988/westley/index.html b/1988/westley/index.html index fbac68a51..4dc3e8537 100644 --- a/1988/westley/index.html +++ b/1988/westley/index.html @@ -141,37 +141,37 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    NOTE: this version is a fixed version for modern C compilers. See the Alternate code section below for how to use the original and why one might wish to do so.

    Try:

    -
        ./westley
    +
        ./westley

    Also try:

    -
        ./try.sh
    +
        ./try.sh

    to show the code with followed by the result so you can truly see the magic.

    Alternate code:

    This version is the original which might not work as you expect nowadays.

    Alternate build:

    -
        make alt
    +
        make alt

    Alternate use:

    To see if your compiler has the problem described in the Judges’ remarks below, try:

    -
        ./westley.alt
    +
        ./westley.alt

    Does it show the same output as westley?

    Judges’ remarks:

    Your compiler must parse

    -
        #define _ -a
    -    -_
    +
        #define _ -a
    +    -_

    as --a and not -(-a) or some other tokenized form. Some strictly conforming ANSI C Preprocessors may object to this: for such compilers, you can elide the non-standard token-pasting requirement by changing the #define line to:

    -
        #define _ F-->00||F-OO--;
    +
        #define _ F-->00||F-OO--;

    This is what the modified code in westley.c does whereas the alt code is the original.

    You might enjoy looking at the output of:

    -
        cc -E westley.alt.c
    +
        cc -E westley.alt.c

    Author’s remarks:

    No remarks were provided by the author.

    make all ``` @@ -18,14 +18,14 @@ For more detailed information see [1989 fubar bugs](../../bugs.html#1989_fubar). ## To use: -```sh +``` ./fubar ``` ## Try: -```sh +``` ./try.sh # run on 1 - 7 ./fubar.sh 2 # run via script diff --git a/1989/fubar/index.html b/1989/fubar/index.html index f2b7bfc49..123a44675 100644 --- a/1989/fubar/index.html +++ b/1989/fubar/index.html @@ -141,18 +141,18 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: known bug - please help us fix

    For more detailed information see 1989 fubar bugs.

    To use:

    -
        ./fubar <number>
    +
        ./fubar <number>

    Try:

    -
        ./try.sh # run on 1 - 7
    -
    -    ./fubar.sh 2 # run via script
    -    ./fubar 2 # run directly
    +
        ./try.sh # run on 1 - 7
    +
    +    ./fubar.sh 2 # run via script
    +    ./fubar 2 # run directly

    Judges’ remarks:

    Run this with a single digit argument (or wait a long time and risk an infinite loop as described in the 1989 fubar bugs file).

    diff --git a/1989/jar.1/README.md b/1989/jar.1/README.md index 067ad9990..e00bf6723 100644 --- a/1989/jar.1/README.md +++ b/1989/jar.1/README.md @@ -2,7 +2,7 @@ NOTE: this will run the program itself. -```sh +``` make clobber all ``` @@ -12,7 +12,7 @@ See the [Alternate code](#alternate-code) section below for more details. ## To use: -```sh +``` ./jar.1 ``` @@ -26,14 +26,14 @@ This alternate code, which prints something slightly different, is provided as w NOTE: this will run the program itself. -```sh +``` make clobber alt ``` ### Alternate use: -```sh +``` ./jar.1.alt ``` @@ -43,7 +43,7 @@ NOTE: this will run the program itself. On many systems the compiler will not allow you to send the object file to `/dev/tty`. The author suggested: -```sh +``` cc -c -o /dev/tty jar.1.c ``` diff --git a/1989/jar.1/index.html b/1989/jar.1/index.html index 928cc4b99..026643f68 100644 --- a/1989/jar.1/index.html +++ b/1989/jar.1/index.html @@ -142,22 +142,22 @@ Location: SE - Kingdom of Sweden (

    To build:

    NOTE: this will run the program itself.

    -
        make clobber all
    +
        make clobber all

    There is an alternate version with a slight difference that you may wish to try. See the Alternate code section below for more details.

    To use:

    -
        ./jar.1
    +
        ./jar.1

    Alternate code:

    This alternate code, which prints something slightly different, is provided as well.

    Alternate build:

    NOTE: this will run the program itself.

    -
        make clobber alt
    +
        make clobber alt

    Alternate use:

    -
        ./jar.1.alt
    +
        ./jar.1.alt

    Judges’ remarks:

    On many systems the compiler will not allow you to send the object file to /dev/tty. The author suggested:

    -
        cc -c -o /dev/tty jar.1.c
    +
        cc -c -o /dev/tty jar.1.c

    As a last resort the jar.1.sh script provided simulates writing the raw binary of the .o file to the terminal.

    Abuse of the rules winning entry usually result in a change of the rules. diff --git a/1989/jar.2/README.md b/1989/jar.2/README.md index d4b0ee2dc..09e031dc5 100644 --- a/1989/jar.2/README.md +++ b/1989/jar.2/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./jar.2 [enter some lisp] @@ -19,7 +19,7 @@ NOTE: this entry will likely segfault on invalid input. ## Try: -```sh +``` ./try.sh ./try.sh chocolate_cake.lisp @@ -65,7 +65,7 @@ lisp expressions (followed by CR), the program evaluates them and prints out the return values. End execution by typing an end-of-file character. -```lisp +``` (+ 2.5 3.1) (defun fib (n) (if (< n 2) diff --git a/1989/jar.2/index.html b/1989/jar.2/index.html index 2964b0b78..8a40f5b60 100644 --- a/1989/jar.2/index.html +++ b/1989/jar.2/index.html @@ -147,19 +147,19 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./jar.2
    -    [enter some lisp]
    -
    -    ./jar.2 < some_lisp_file
    +
        ./jar.2
    +    [enter some lisp]
    +
    +    ./jar.2 < some_lisp_file

    NOTE: this entry will likely segfault on invalid input.

    Try:

    -
        ./try.sh
    -
    -    ./try.sh chocolate_cake.lisp
    -
    -    ./try.sh try.txt
    +
        ./try.sh
    +
    +    ./try.sh chocolate_cake.lisp
    +
    +    ./try.sh try.txt

    Judges’ remarks:

    This is the most useful program submitted this year. It is a rather large subset of lisp. It has no error recovery, and @@ -192,24 +192,24 @@ The program implements a conventional lisp listener, i.e. you type in lisp expressions (followed by CR), the program evaluates them and prints out the return values. End execution by typing an end-of-file character.

    -
        (+ 2.5 3.1)
    -    (defun fib (n)
    -       (if (< n 2)
    -           1
    -           (+ (fib (- n 2)) (fib (- n 1)))))
    -    (fib 10)
    -    (defun ! (x) (if (equal x 0) 1 (* x (! (- x 1)))))
    -    (! 7)
    -    (defun fn1 (fn) (+ (fn 1 2) (fn 3 4)))
    -    (defun fn2 (a b) (+ a b))
    -    (fn1 (function +))
    -    (fn1 (function fn2))
    -    (fn1 (function (lambda (z1 z2) (+ z1 z2))))
    -    (quote a)
    -    (cons (quote (a b)) (quote (c d e)))
    -    (cons (quote (f)) ())
    -    (car (quote (a b c)))
    -    (cdr (cdr (quote (g h i))))
    +
        (+ 2.5 3.1)
    +    (defun fib (n)
    +       (if (< n 2)
    +           1
    +           (+ (fib (- n 2)) (fib (- n 1)))))
    +    (fib 10)
    +    (defun ! (x) (if (equal x 0) 1 (* x (! (- x 1)))))
    +    (! 7)
    +    (defun fn1 (fn) (+ (fn 1 2) (fn 3 4)))
    +    (defun fn2 (a b) (+ a b))
    +    (fn1 (function +))
    +    (fn1 (function fn2))
    +    (fn1 (function (lambda (z1 z2) (+ z1 z2))))
    +    (quote a)
    +    (cons (quote (a b)) (quote (c d e)))
    +    (cons (quote (f)) ())
    +    (car (quote (a b c)))
    +    (cdr (cdr (quote (g h i))))

    Please do not leave any whitespace before the first parenthesis when you type your input, or any other unnecessary whitespace. Please try to avoid any undefined variables or functions, wrong number of arguments diff --git a/1989/ovdluhe/README.md b/1989/ovdluhe/README.md index f69c14cc6..0192e7207 100644 --- a/1989/ovdluhe/README.md +++ b/1989/ovdluhe/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -11,7 +11,7 @@ To get this to compile with a modern CPP, we had to replace `#D` with `#define`. Run the program this way: -```sh +``` ./ovdluhe < textfile ``` @@ -21,7 +21,7 @@ by chance or is killed. ## Try: -```sh +``` ./try.sh ; sleep 2 ; ./try.sh ``` @@ -34,7 +34,7 @@ it's a `#define` it's easy to set up. ### Alternate build: -```sh +``` make P=9 clobber alt ``` @@ -46,14 +46,14 @@ program to fail and a negative value will cause a compilation error. ### Alternate use: -```sh +``` ./ovdluhe.alt ``` ### Alternate try: -```sh +``` ./try.alt.sh P=5 ./try.alt.sh diff --git a/1989/ovdluhe/index.html b/1989/ovdluhe/index.html index 45bc66698..71f36ce47 100644 --- a/1989/ovdluhe/index.html +++ b/1989/ovdluhe/index.html @@ -141,30 +141,30 @@ Location: ZZ - Unknown location

    To build:

    -
        make all
    +
        make all

    To get this to compile with a modern CPP, we had to replace #D with #define.

    To use:

    Run the program this way:

    -
        ./ovdluhe < textfile
    +
        ./ovdluhe < textfile

    The program stops when it reaches the end of the template buffer by chance or is killed.

    Try:

    -
        ./try.sh ; sleep 2 ; ./try.sh
    +
        ./try.sh ; sleep 2 ; ./try.sh

    Alternate code:

    The author suggested that one varies the definition of P from 2 through 10. As it’s a #define it’s easy to set up.

    Alternate build:

    -
        make P=9 clobber alt
    +
        make P=9 clobber alt

    You do not have to define P but if you do you can replace the value with whatever you wish, as long as it’s a positive int (or evaluates to a positive int like the default (A<<AP) does). Too high a value will likely cause the program to fail and a negative value will cause a compilation error.

    Alternate use:

    -
        ./ovdluhe.alt
    +
        ./ovdluhe.alt

    Alternate try:

    -
        ./try.alt.sh
    -
    -    P=5 ./try.alt.sh
    +
        ./try.alt.sh
    +
    +    P=5 ./try.alt.sh

    NOTE: if you specify too high a value for P the program might fail. If you specify a value < 0 it will fail to compile.

    Judges’ remarks:

    diff --git a/1989/paul/README.md b/1989/paul/README.md index c091e6b26..cc69b975d 100644 --- a/1989/paul/README.md +++ b/1989/paul/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -10,7 +10,7 @@ out. See [alternate code](#alternate-code) below for more details. ## Try: -```sh +``` ./paul ``` @@ -28,14 +28,14 @@ could easily be added. ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./paul.alt ``` diff --git a/1989/paul/index.html b/1989/paul/index.html index 76ee0b93d..e375b98ad 100644 --- a/1989/paul/index.html +++ b/1989/paul/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    There is an alternate version with a trace routine that the author had commented out. See alternate code below for more details.

    Try:

    -
        ./paul
    +
        ./paul

    Alternate code:

    This version was described by the author like:

    @@ -156,9 +156,9 @@ and forth as the program runs. A much better debugger or trace could easily be added.

    Alternate build:

    -
        make alt
    +
        make alt

    Alternate use:

    -
        ./paul.alt
    +
        ./paul.alt

    Judges’ remarks:

    The author’s comments is a detailed program explanation and spoiler. If you want a real challenge, don’t read any further and try to understand the program diff --git a/1989/robison/README.md b/1989/robison/README.md index fbe613620..90e9ef7da 100644 --- a/1989/robison/README.md +++ b/1989/robison/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [1989 robison bugs](../../bugs.html#1989_robis ## To use: -```sh +``` ./robison # enter valid expressions ``` @@ -26,7 +26,7 @@ For more detailed information see [1989 robison bugs](../../bugs.html#1989_robis ## Try: -```sh +``` ./robison 11x10 # enter other expressions diff --git a/1989/robison/index.html b/1989/robison/index.html index d52e769fd..cde482e6b 100644 --- a/1989/robison/index.html +++ b/1989/robison/index.html @@ -141,22 +141,22 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 1989 robison bugs.

    To use:

    -
        ./robison
    -    # enter valid expressions
    +
        ./robison
    +    # enter valid expressions

    Try:

    -
        ./robison
    -    11x10
    -    # enter other expressions
    -
    -    ./try.sh
    -
    -    echo 100 / 100 | ./robison # <-- what happens here ?
    +
        ./robison
    +    11x10
    +    # enter other expressions
    +
    +    ./try.sh
    +
    +    echo 100 / 100 | ./robison # <-- what happens here ?

    NOTE: This program will very likely crash or break into tiny bits :-) if you feed it numbers with non-binary digits. This, as you might notice if you try one of the above commands, can happen with other input as well. If you wish to diff --git a/1989/roemer/README.md b/1989/roemer/README.md index 0e0924b83..5991a2fa5 100644 --- a/1989/roemer/README.md +++ b/1989/roemer/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## Try: -```sh +``` ./roemer ``` diff --git a/1989/roemer/index.html b/1989/roemer/index.html index 899137470..14d88b633 100644 --- a/1989/roemer/index.html +++ b/1989/roemer/index.html @@ -141,9 +141,9 @@ Location: NL - Kingdom of the Netherlan

    To build:

    -
        make all
    +
        make all

    Try:

    -
        ./roemer
    +
        ./roemer

    Judges’ remarks:

    Do you know what this program does? If you do, look again, there is more here than meets the PI.

    diff --git a/1989/tromp/README.md b/1989/tromp/README.md index e9dec993d..397440e90 100644 --- a/1989/tromp/README.md +++ b/1989/tromp/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./tromp [drops_per_sec [cmd_string]] ``` ## Try: -```sh +``` ./tromp 5 ./tromp 10 "hkl jq" @@ -53,7 +53,7 @@ the judges' additional remarks in the author's remarks, for more details. ### Alternate build: -```sh +``` make alt ``` @@ -138,7 +138,7 @@ at the start and `-raw` at the end. This further reduces the size of the program, but has the possible disadvantage that the program can only by stopped by 'q' or by the `kill -9' command. -```c +``` long h[4];t(){h[3]-=h[3]/3000;setitimer(0,h,0);}c,d,l,v[]={(int)t,0,2},w,s,I,K =0,i=276,j,k,q[276],Q[276],*n=q,*m,x=17,f[]={7,-13,-12,1,8,-11,-12,-1,9,-1,1, 12,3,-13,-12,-1,12,-1,11,1,15,-1,13,1,18,-1,1,2,0,-12,-1,11,1,-12,1,13,10,-12, diff --git a/1989/tromp/index.html b/1989/tromp/index.html index f7e6a5b5c..609ee6377 100644 --- a/1989/tromp/index.html +++ b/1989/tromp/index.html @@ -141,13 +141,13 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./tromp [drops_per_sec  [cmd_string]]
    +
        ./tromp [drops_per_sec  [cmd_string]]

    Try:

    -
        ./tromp 5
    -
    -    ./tromp 10 "hkl jq"
    +
        ./tromp 5
    +
    +    ./tromp 10 "hkl jq"

    The second command, ./tromp 10 "hkl jq", will set up the keys kind of like vim:

      @@ -171,7 +171,7 @@ loser :-)

      The author provided an alternate version of the code with some improvements. See the judges’ additional remarks in the author’s remarks, for more details.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      Use tromp.alt as you would tromp above.

      NOTE: testing more than one user updating the high score file, one of the @@ -231,25 +231,25 @@ temporary file.

      at the start and -raw at the end. This further reduces the size of the program, but has the possible disadvantage that the program can only by stopped by ‘q’ or by the `kill -9’ command.

      -
          long h[4];t(){h[3]-=h[3]/3000;setitimer(0,h,0);}c,d,l,v[]={(int)t,0,2},w,s,I,K
      -    =0,i=276,j,k,q[276],Q[276],*n=q,*m,x=17,f[]={7,-13,-12,1,8,-11,-12,-1,9,-1,1,
      -    12,3,-13,-12,-1,12,-1,11,1,15,-1,13,1,18,-1,1,2,0,-12,-1,11,1,-12,1,13,10,-12,
      -    1,12,11,-12,-1,1,2,-12,-1,12,13,-12,12,13,14,-11,-1,1,4,-13,-12,12,16,-11,-12,
      -    12,17,-13,1,-1,5,-12,12,11,6,-12,12,24};u(){for(i=11;++i<264;)if((k=q[i])-Q[i]
      -    ){Q[i]=k;if(i-++I||i%12<1)printf("\033[%d;%dH",(I=i)/12,i%12*2+28);printf(
      -    "\033[%dm  "+(K-k?0:5),k);K=k;}Q[263]=c=getchar();}G(b){for(i=4;i--;)if(q[i?b+
      -    n[i]:b])return 0;return 1;}g(b){for(i=4;i--;q[i?x+n[i]:x]=b);}main(C,V,a)char*
      -    *V,*a;{h[3]=1000000/(l=C>1?atoi(V[1]):2);for(a=C>2?V[2]:"jkl pq";i;i--)*n++=i<
      -    25||i%12<2?7:0;srand(getpid());system("stty cbreak -echo stop u");sigvec(14,v,
      -    0);t();puts("\033[H\033[J");for(n=f+rand()%7*4;;g(7),u(),g(0)){if(c<0){if(G(x+
      -    12))x+=12;else{g(7);++w;for(j=0;j<252;j=12*(j/12+1))for(;q[++j];)if(j%12==10){
      -    for(;j%12;q[j--]=0);u();for(;--j;q[j+12]=q[j]);u();}n=f+rand()%7*4;G(x=17)||(c
      -    =a[5]);}}if(c==*a)G(--x)||++x;if(c==a[1])n=f+4**(m=n),G(x)||(n=m);if(c==a[2])G
      -    (++x)||--x;if(c==a[3])for(;G(x+12);++w)x+=12;if(c==a[4]||c==a[5]){s=sigblock(
      -    8192);printf("\033[H\033[J\033[0m%d\n",w);if(c==a[5])break;for(j=264;j--;Q[j]=
      -    0);while(getchar()-a[4]);puts("\033[H\033[J\033[7m");sigsetmask(s);}}d=popen(
      -    "stty -cbreak echo stop \023;sort -mnr -o HI - HI;cat HI","w");fprintf(d,
      -    "%4d from level %1d by %s\n",w,l,getlogin());pclose(d);}
      +
          long h[4];t(){h[3]-=h[3]/3000;setitimer(0,h,0);}c,d,l,v[]={(int)t,0,2},w,s,I,K
      +    =0,i=276,j,k,q[276],Q[276],*n=q,*m,x=17,f[]={7,-13,-12,1,8,-11,-12,-1,9,-1,1,
      +    12,3,-13,-12,-1,12,-1,11,1,15,-1,13,1,18,-1,1,2,0,-12,-1,11,1,-12,1,13,10,-12,
      +    1,12,11,-12,-1,1,2,-12,-1,12,13,-12,12,13,14,-11,-1,1,4,-13,-12,12,16,-11,-12,
      +    12,17,-13,1,-1,5,-12,12,11,6,-12,12,24};u(){for(i=11;++i<264;)if((k=q[i])-Q[i]
      +    ){Q[i]=k;if(i-++I||i%12<1)printf("\033[%d;%dH",(I=i)/12,i%12*2+28);printf(
      +    "\033[%dm  "+(K-k?0:5),k);K=k;}Q[263]=c=getchar();}G(b){for(i=4;i--;)if(q[i?b+
      +    n[i]:b])return 0;return 1;}g(b){for(i=4;i--;q[i?x+n[i]:x]=b);}main(C,V,a)char*
      +    *V,*a;{h[3]=1000000/(l=C>1?atoi(V[1]):2);for(a=C>2?V[2]:"jkl pq";i;i--)*n++=i<
      +    25||i%12<2?7:0;srand(getpid());system("stty cbreak -echo stop u");sigvec(14,v,
      +    0);t();puts("\033[H\033[J");for(n=f+rand()%7*4;;g(7),u(),g(0)){if(c<0){if(G(x+
      +    12))x+=12;else{g(7);++w;for(j=0;j<252;j=12*(j/12+1))for(;q[++j];)if(j%12==10){
      +    for(;j%12;q[j--]=0);u();for(;--j;q[j+12]=q[j]);u();}n=f+rand()%7*4;G(x=17)||(c
      +    =a[5]);}}if(c==*a)G(--x)||++x;if(c==a[1])n=f+4**(m=n),G(x)||(n=m);if(c==a[2])G
      +    (++x)||--x;if(c==a[3])for(;G(x+12);++w)x+=12;if(c==a[4]||c==a[5]){s=sigblock(
      +    8192);printf("\033[H\033[J\033[0m%d\n",w);if(c==a[5])break;for(j=264;j--;Q[j]=
      +    0);while(getchar()-a[4]);puts("\033[H\033[J\033[7m");sigsetmask(s);}}d=popen(
      +    "stty -cbreak echo stop \023;sort -mnr -o HI - HI;cat HI","w");fprintf(d,
      +    "%4d from level %1d by %s\n",w,l,getlogin());pclose(d);}

      NOTE: the alternate version was fixed for modern systems in 2023.

      make all ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/1989/vanb/index.html b/1989/vanb/index.html index 17b8c2be0..b1918885e 100644 --- a/1989/vanb/index.html +++ b/1989/vanb/index.html @@ -141,9 +141,9 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      This program computes all proper subsets of the set of arguments passed to it. Each subset is printed with one diff --git a/1989/westley/README.md b/1989/westley/README.md index 73389b49d..a9867c8d6 100644 --- a/1989/westley/README.md +++ b/1989/westley/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -20,26 +20,26 @@ For more detailed information see [1989 westley bugs](../../bugs.html#1989_westl Try compiling and running the 4 resulting programs like: -```sh +``` ./compile.sh ``` If you need to specify an alternate compiler path, say because your default compiler is clang (or in the case of macOS gcc is clang) you can do so like: -```sh +``` CC=/opt/local/bin/gcc-mp-12 ./compile.sh ``` If you wish to delay the script or remove the delay you can do so like: -```sh +``` DELAY=2 ./compile.sh ``` Finally try: -```sh +``` ./westley # input some lines of text, sending EOF (usually ctrl-d) to end @@ -70,7 +70,7 @@ different algorithm for each version (hereafter referred to as When compiling these versions, one needs to define `trgpune` in the compile line (which the Makefile now has). Example: -```sh +``` cc -Dtrgpune=putchar ver3.c -o ver3 ``` @@ -109,13 +109,13 @@ function `vs()` to define in the ROT13 version. But a function called `vs()` turns into a function called `if()` in the original, so it can't be done. Therefore, I do: -```c +``` expr1 && expr2 && (expr3=etc); ``` which is the same as: -```c +``` if (expr1 && expr2) expr3=etc; ``` @@ -124,7 +124,7 @@ expressions if they aren't in an assignment or conditional statement. This might warrant a warning, since other compilers may do this. I found MANY compilers botched: -```c +``` expr1 && (expr2,expr3); ``` @@ -146,7 +146,7 @@ such statements to make it more portable. Normally (!), a reversible C program is done thus: -```c +``` /**/ forward code /*/ edoc drawkcab /**/ ``` @@ -154,7 +154,7 @@ If your compiler nests comments, it will get this wrong. However, I have made some bits of the code palindromic, (or different, but reversible) so it is more like: -```c +``` /**/forward/*//**/ palindromic /**//*/drawkcab/**/ ``` diff --git a/1989/westley/index.html b/1989/westley/index.html index c864ec738..ba0a1326f 100644 --- a/1989/westley/index.html +++ b/1989/westley/index.html @@ -141,24 +141,24 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: known bug - please help us fix

      For more detailed information see 1989 westley bugs.

      Try:

      Try compiling and running the 4 resulting programs like:

      -
          ./compile.sh
      +
          ./compile.sh

      If you need to specify an alternate compiler path, say because your default compiler is clang (or in the case of macOS gcc is clang) you can do so like:

      -
          CC=/opt/local/bin/gcc-mp-12 ./compile.sh
      +
          CC=/opt/local/bin/gcc-mp-12 ./compile.sh

      If you wish to delay the script or remove the delay you can do so like:

      -
          DELAY=2 ./compile.sh
      +
          DELAY=2 ./compile.sh

      Finally try:

      -
          ./westley
      -    # input some lines of text, sending EOF (usually ctrl-d) to end
      -
      -    ./try.sh # demo of some input
      +
          ./westley
      +    # input some lines of text, sending EOF (usually ctrl-d) to end
      +
      +    ./try.sh # demo of some input

      Judges’ remarks:

      There is a secret way to get ONE of the versions to print out “Hello, world!\n”. Can you find how to do it?

      @@ -175,7 +175,7 @@ different algorithm for each version (hereafter referred to as (ROT13 and reversed)).

      When compiling these versions, one needs to define trgpune in the compile line (which the Makefile now has). Example:

      -
          cc -Dtrgpune=putchar ver3.c -o ver3
      +
          cc -Dtrgpune=putchar ver3.c -o ver3

      trgpune is the ROT13 of getchar(), so getchar() and putchar() are exchanged in the ROT13 counterpart. It is easy to see that this is unavoidable. I must have a #define for a library @@ -207,14 +207,14 @@ first argument (argc) must be at least one).

      function vs() to define in the ROT13 version. But a function called vs() turns into a function called if() in the original, so it can’t be done. Therefore, I do:

      -
          expr1 && expr2 && (expr3=etc);
      +
          expr1 && expr2 && (expr3=etc);

      which is the same as:

      -
          if (expr1 && expr2) expr3=etc;
      +
          if (expr1 && expr2) expr3=etc;

      A/UX on the Macintosh doesn’t get this right; it evaluates ALL expressions if they aren’t in an assignment or conditional statement. This might warrant a warning, since other compilers may do this. I found MANY compilers botched:

      -
          expr1 && (expr2,expr3);
      +
          expr1 && (expr2,expr3);

      expr2 was OFTEN evaluated even if expr1 was false. I removed such statements to make it more portable.

      Variable names worth noting

      @@ -224,11 +224,11 @@ such statements to make it more portable.

      tang and gnat are both ROT13 and palindrome pairs!

      –

      Normally (!), a reversible C program is done thus:

      -
          /**/ forward code /*/ edoc drawkcab /**/
      +
          /**/ forward code /*/ edoc drawkcab /**/

      If your compiler nests comments, it will get this wrong. However, I have made some bits of the code palindromic, (or different, but reversible) so it is more like:

      -
          /**/forward/*//**/ palindromic /**//*/drawkcab/**/
      +
          /**/forward/*//**/ palindromic /**//*/drawkcab/**/

      The code can therefore be interlaced. There are eight such palindromic bits. You can find them within the /*//**/ /**//*/ pairs.

      diff --git a/1990/baruch/README.md b/1990/baruch/README.md index b9db0e742..a384d813a 100644 --- a/1990/baruch/README.md +++ b/1990/baruch/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -21,7 +21,7 @@ For more detailed information see [1990 baruch bugs](../../bugs.html#1990_baruch ## To use: -```sh +``` echo 4 | ./baruch echo 7 | ./baruch ``` @@ -29,7 +29,7 @@ For more detailed information see [1990 baruch bugs](../../bugs.html#1990_baruch ## Try: -```sh +``` ./try.sh ``` @@ -47,7 +47,7 @@ question. YMMV. ### Alternate build: -```sh +``` make alt ``` diff --git a/1990/baruch/index.html b/1990/baruch/index.html index 5405766cf..c44dbf48e 100644 --- a/1990/baruch/index.html +++ b/1990/baruch/index.html @@ -144,7 +144,7 @@ Location: IL - State of Israel (

      To build:

      -
          make all
      +
          make all

      There is an alternate version for those using Turbo-C or MSC. See alternate code below for details.

      Bugs and (Mis)features:

      @@ -152,10 +152,10 @@ code below for details.

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 1990 baruch bugs.

      To use:

      -
          echo 4 | ./baruch
      -    echo 7 | ./baruch
      +
          echo 4 | ./baruch
      +    echo 7 | ./baruch

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Alternate code:

      This alternate code is for the very few users @@ -165,7 +165,7 @@ the " #Q" string was not changed as that showed worse looking outpu of improved output though admittedly we have no way to test the compilers in question. YMMV.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      Use baruch.alt as you would baruch.

      Judges’ remarks:

      diff --git a/1990/cmills/README.md b/1990/cmills/README.md index 4a24c37ba..d581abe43 100644 --- a/1990/cmills/README.md +++ b/1990/cmills/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./cmills [starting_cash] ``` ## Try: -```sh +``` ./cmills 5000 ``` diff --git a/1990/cmills/index.html b/1990/cmills/index.html index 0beba9f6b..e270b6664 100644 --- a/1990/cmills/index.html +++ b/1990/cmills/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./cmills [starting_cash]
      +
          ./cmills [starting_cash]

      Try:

      -
          ./cmills 5000
      +
          ./cmills 5000

      Judges’ remarks:

      The Makefile uses several -D defines. The following is is a list of the macros that may be changed:

      diff --git a/1990/dds/README.md b/1990/dds/README.md index c402de7b6..f060670a2 100644 --- a/1990/dds/README.md +++ b/1990/dds/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./dds ``` @@ -16,7 +16,7 @@ Give the following lines as input: -```basic +``` OLD LANDER.BAS RUN ``` diff --git a/1990/dds/index.html b/1990/dds/index.html index adf7e1d09..44789db16 100644 --- a/1990/dds/index.html +++ b/1990/dds/index.html @@ -141,12 +141,12 @@ Location: GR - Hellenic Republic (

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./dds
      +
          ./dds

      Try:

      Give the following lines as input:

      -
          OLD LANDER.BAS
      +
          OLD LANDER.BAS
           RUN

      NOTE: this entry is probably one of the only times CAPS LOCK might be worth having (though still not useful enough to enable :-) ) as all input has to be diff --git a/1990/dg/README.md b/1990/dg/README.md index 5315a3576..1712f36d2 100644 --- a/1990/dg/README.md +++ b/1990/dg/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` echo foo bar | ./dg ``` ## Try: -```sh +``` ./try.sh ``` @@ -24,13 +24,13 @@ Some C preprocessors got confused about single quotes in certain cases. In particular, the following source line: -```c +``` b12(ase(bco(acp(bi(acp(bcp(acp(bpl(aqu(bqu(A)))))))))))))))))))))))))))))) ``` sometimes has to be changed to: -```c +``` b12(ase(bco(acp(bi(acp(bcp(acp(bpl('A')))))))))))))))))))))))))))) ``` @@ -56,7 +56,7 @@ As for the rot13 algorithm, it relies on `index(3)` to find if the character is in the set `A-Za-z`. `l[]` is an array that gets filled with: -```c +``` "nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM" ``` diff --git a/1990/dg/index.html b/1990/dg/index.html index 5d9f466cb..2888a1ba3 100644 --- a/1990/dg/index.html +++ b/1990/dg/index.html @@ -141,17 +141,17 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      To use:

      -
          echo foo bar | ./dg
      +
          echo foo bar | ./dg

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      Some C preprocessors got confused about single quotes in certain cases. In particular, the following source line:

      -
          b12(ase(bco(acp(bi(acp(bcp(acp(bpl(aqu(bqu(A))))))))))))))))))))))))))))))
      +
          b12(ase(bco(acp(bi(acp(bcp(acp(bpl(aqu(bqu(A))))))))))))))))))))))))))))))

      sometimes has to be changed to:

      -
          b12(ase(bco(acp(bi(acp(bcp(acp(bpl('A'))))))))))))))))))))))))))))
      +
          b12(ase(bco(acp(bi(acp(bcp(acp(bpl('A'))))))))))))))))))))))))))))

      particularly if the C preprocessor botches single quotes in cpp expansions, which we have done for the wider audience.

      Author’s remarks:

      @@ -167,7 +167,7 @@ source. The axx() #defines do the same, but add tokens

      As for the rot13 algorithm, it relies on index(3) to find if the character is in the set A-Za-z. l[] is an array that gets filled with:

      -
          "nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM"
      +
          "nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM"

      If index(3) says the char is in the alphabet, then XOR the offset with 16 to translate, and output, otherwise pass it unchanged.

      make all ``` @@ -9,7 +9,7 @@ To test the official C entry, one might try: -```sh +``` echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw ``` @@ -19,7 +19,7 @@ sentence. #### Also try: -```sh +``` ./try.sh ``` @@ -39,14 +39,14 @@ it to 1530 bytes) which implements the complete shark utility. The script, The sender must have `compress` and `btoa`. To send, try: -```sh +``` ./shark.sh jaw.* README.md > receive ``` The resulting file, `receive`, unpacks the input files even if the receiver lacks `uncompress` and `btoa`: -```sh +``` mkdir -p test cd test sh ../receive @@ -168,7 +168,7 @@ Construct `sharkmail`, to auto-split `sharkives` into mailable segments and mail them. Here's a simple one, which could be extended to enable auto-reassembly with one shell cmd at the far end. -```sh +``` #!/bin/sh m=$1; shift shark $* | split -800 - /tmp/shark$$ diff --git a/1990/jaw/index.html b/1990/jaw/index.html index 8a3d4810a..1604bad73 100644 --- a/1990/jaw/index.html +++ b/1990/jaw/index.html @@ -147,14 +147,14 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      Try:

      To test the official C entry, one might try:

      -
          echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
      +
          echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw

      which should apply the identity transformation to a minimal holoalphabetic sentence.

      Also try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      The program, in its base form, implements two useful utilities:

        @@ -165,14 +165,14 @@ sentence.

        it to 1530 bytes) which implements the complete shark utility. The script, shark.sh, contains a jaw.c embedded within it!

        The sender must have compress and btoa. To send, try:

        -
            ./shark.sh jaw.* README.md > receive
        +
            ./shark.sh jaw.* README.md > receive

        The resulting file, receive, unpacks the input files even if the receiver lacks uncompress and btoa:

        -
            mkdir -p test
        -    cd test
        -    sh ../receive
        -    cmp ../jaw.c jaw.c
        -    cmp ../README.md README.md
        +
            mkdir -p test
        +    cd test
        +    sh ../receive
        +    cmp ../jaw.c jaw.c
        +    cmp ../README.md README.md

        NOTE: a limitation is that the script should be in the parent directory of the directory it is run from.

        Authors’ remarks:

        @@ -262,17 +262,17 @@ left, and source-to-source transformations galore.

        Construct sharkmail, to auto-split sharkives into mailable segments and mail them. Here’s a simple one, which could be extended to enable auto-reassembly with one shell cmd at the far end.

        -
            #!/bin/sh
        -    m=$1; shift
        -    shark $* | split -800 - /tmp/shark$$
        -    n=`ls /tmp/shark$$* | wc -l | sed 's/ *//'`
        -    p=0
        -    for f in `ls /tmp/shark$$*`
        -    do
        -         p=`expr $p + 1`
        -         mail -s "bundle ($p of $n) from '`whoami`'" $m < $f
        -    done
        -    rm /tmp/shark$$*
        +
            #!/bin/sh
        +    m=$1; shift
        +    shark $* | split -800 - /tmp/shark$$
        +    n=`ls /tmp/shark$$* | wc -l | sed 's/ *//'`
        +    p=0
        +    for f in `ls /tmp/shark$$*`
        +    do
        +         p=`expr $p + 1`
        +         mail -s "bundle ($p of $n) from '`whoami`'" $m < $f
        +    done
        +    rm /tmp/shark$$*

        Shark history:

        • May 1987: Karl Fox introduces 1023-byte zcat.c to USENET. diff --git a/1990/pjr/README.md b/1990/pjr/README.md index ad33dc46f..40225e8d5 100644 --- a/1990/pjr/README.md +++ b/1990/pjr/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -11,7 +11,7 @@ that can be used if your compiler is incapable of compiling `X=g()...` in ## To use: -```sh +``` ./pjr ``` @@ -22,7 +22,7 @@ Note that some compilers will be unable to compile the expression `X=g()...` in `main()` due to lack of temporary stack space. One might want to try replacing `main()` with: -```c +``` main(){X=s().v().o().o().l().S().d().l().i().o().w().N();} ``` @@ -34,14 +34,14 @@ well. ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./pjr.alt ``` @@ -74,7 +74,7 @@ opposite: To encode a new string input the string as it is meant to come out: -```c +``` X=s().v().o().o().l().S().d().l().i().o().w().N(); ``` diff --git a/1990/pjr/index.html b/1990/pjr/index.html index 9f71c4ade..8002f4f60 100644 --- a/1990/pjr/index.html +++ b/1990/pjr/index.html @@ -141,24 +141,24 @@ Location: GB - United Kingdom of Great

          To build:

          -
              make all
          +
              make all

          There is an alternate version that does something different that can be used if your compiler is incapable of compiling X=g()... in main(). It can be used for another purpose too.

          To use:

          -
              ./pjr
          +
              ./pjr

          Alternate code:

          Note that some compilers will be unable to compile the expression X=g()... in main() due to lack of temporary stack space. One might want to try replacing main() with:

          -
              main(){X=s().v().o().o().l().S().d().l().i().o().w().N();}
          +
              main(){X=s().v().o().o().l().S().d().l().i().o().w().N();}

          if this is a problem, which is what this alternate code is.

          NOTE: it prints something else and it is what the author suggested one try as well.

          Alternate build:

          -
              make alt
          +
              make alt

          Alternate use:

          -
              ./pjr.alt
          +
              ./pjr.alt

          Judges’ remarks:

          This program prints out a string. Can you figure out how it is done?

          @@ -175,7 +175,7 @@ alphabetical character from a to z is printed out as its opposite:

              a->z b->y c->x etc

          To encode a new string input the string as it is meant to come out:

          -
              X=s().v().o().o().l().S().d().l().i().o().w().N();
          +
              X=s().v().o().o().l().S().d().l().i().o().w().N();

          Note: S() represents a space and N() a newline. This will now produce…

              hello world
          diff --git a/1990/scjones/README.md b/1990/scjones/README.md index 1f7e87e08..00b8b344c 100644 --- a/1990/scjones/README.md +++ b/1990/scjones/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./scjones ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/1990/scjones/index.html b/1990/scjones/index.html index e204458a0..ecc59df96 100644 --- a/1990/scjones/index.html +++ b/1990/scjones/index.html @@ -141,11 +141,11 @@ Location: ZZ - Unknown location

          To build:

          -
              make all
          +
              make all

          To use:

          -
              ./scjones
          +
              ./scjones

          Try:

          -
              ./try.sh
          +
              ./try.sh

          Judges’ remarks:

          The addition of trigraphs has made it easier to make programs hard to read. It was a dark and stormy night for C when the ANSI C committee added trigraphs to diff --git a/1990/stig/README.md b/1990/stig/README.md index edf4c363e..761e50c8e 100644 --- a/1990/stig/README.md +++ b/1990/stig/README.md @@ -1,19 +1,19 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` make all ``` NOTE: that's not a typo or mistake but one can also do: -```sh +``` ./o ``` diff --git a/1990/stig/index.html b/1990/stig/index.html index f627d087b..de90e048a 100644 --- a/1990/stig/index.html +++ b/1990/stig/index.html @@ -141,11 +141,11 @@ Location: NO - Kingdom of Norway (

          To build:

          -
              make all
          +
              make all

          To use:

          -
              make all
          +
              make all

          NOTE: that’s not a typo or mistake but one can also do:

          -
              ./o
          +
              ./o

          Judges’ remarks:

          We changed the alias that the author’s suggested alias from a C-shell alias to a Bourne-like shell alias.

          diff --git a/1990/tbr/README.md b/1990/tbr/README.md index 3831a1eab..57ea68c95 100644 --- a/1990/tbr/README.md +++ b/1990/tbr/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -25,7 +25,7 @@ In 2023 it was noticed that in some systems like macOS there was confusing output due to a warning at runtime that was interspersed with the output of the program. For instance it would show: -```sh +``` ./tbr $ warning: this program uses gets(), which is unsafe. ``` @@ -40,7 +40,7 @@ below, in the [alternate version](#alternate-code) section. ## To use: -```sh +``` ./tbr $ enter some shell commands ``` @@ -54,7 +54,7 @@ just `exit` or `logout`? Hint: see the authors' remarks. ## Try: -```sh +``` ./tbr $ ls -l tbr tbr.c @@ -79,7 +79,7 @@ documented, are not considered bugs as such in the context of the contest. The authors supplied us with a slightly smaller unformatted version of the program which we include below: -```c +``` #define D ,close( char*c,q[512],m[256],*v[99],**u,*i[3];int f[2],p;main(){for(m[m[60]=m[62]= 32]=m[*m=124[m]=9]=6;e(-8),gets(1+(c=q))||(exit(0),0);r(0,0))for(;*++c;);} @@ -99,14 +99,14 @@ equivalent like the authors intended. ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./tbr.alt ``` @@ -165,13 +165,13 @@ argument is stolen every time a `>` or `<` is encountered. The shell flags an error if no arguments are on the stack. Thus, for example: -```sh +``` cat > foo > bar ``` cats to `foo`, since it was pushed last, but -```sh +``` cat > > foo bar ``` diff --git a/1990/tbr/index.html b/1990/tbr/index.html index 0f7c09f5a..b1516f095 100644 --- a/1990/tbr/index.html +++ b/1990/tbr/index.html @@ -144,7 +144,7 @@ Location: ZZ - Unknown location

          To build:

          -
              make all
          +
              make all

          The authors provided another version of this program. See the alternate version section below.

          Bugs and (Mis)features:

          @@ -155,31 +155,31 @@ version section below.

          In 2023 it was noticed that in some systems like macOS there was confusing output due to a warning at runtime that was interspersed with the output of the program. For instance it would show:

          -
              ./tbr
          -    $ warning: this program uses gets(), which is unsafe.
          +
              ./tbr
          +    $ warning: this program uses gets(), which is unsafe.

          which kind of hid the prompt. Thus the entry was changed to use fgets(3) which is referred to later in this file.

          Also exit(3) returns void but the entry was using it in a binary expression so this entry would not compile in modern systems. This fix is also referred to below, in the alternate version section.

          To use:

          -
              ./tbr
          -    $ enter some shell commands
          +
              ./tbr
          +    $ enter some shell commands

          NOTE: globs do not work with this entry. Why?

          NOTE: exit does not work and neither does logout. To exit try sending ctrl-d or ctrl-c (or kill it from another terminal :-) ). But why does it not work with just exit or logout? Hint: see the authors’ remarks.

          Try:

          -
              ./tbr
          -    $ ls -l tbr tbr.c
          -
          -    # notice how the following does not work:
          -    ls tbr*
          -
          -    # try figuring out how this entry works in an editor:
          -    vi tbr.c
          -
          -    # then figure out how to exit vi :-)
          +
              ./tbr
          +    $ ls -l tbr tbr.c
          +
          +    # notice how the following does not work:
          +    ls tbr*
          +
          +    # try figuring out how this entry works in an editor:
          +    vi tbr.c
          +
          +    # then figure out how to exit vi :-)

          What happens if you try using cd - to return to previous directory? What about cd with no args?

          The authors include a section called BUGS that, because they were @@ -187,23 +187,23 @@ documented, are not considered bugs as such in the context of the contest.

          Alternate code:

          The authors supplied us with a slightly smaller unformatted version of the program which we include below:

          -
              #define D ,close(
          -    char*c,q[512],m[256],*v[99],**u,*i[3];int f[2],p;main(){for(m[m[60]=m[62]=
          -    32]=m[*m=124[m]=9]=6;e(-8),gets(1+(c=q))||(exit(0),0);r(0,0))for(;*++c;);}
          -    r(t,o){*i=i[2]=0;for(u=v+98;m[*--c]^9;m[*c]&32?i[*c&2]=
          -    *u,u-v^98&&++u:3)if(!m[*c]){for(*++c=0;!m[*--c];);*--u=
          -    ++c;}u-v^98?strcmp(*u,"cd")?*c?pipe(f),o=f[1]:1,(p=fork())?e(p),o?
          -    r(o,0)D o)D*f):4,wait(0):(o?dup2(*f,0)D*f)D o):*i?1 D
          -    0),e(open(*i,0)):5,t?dup2(t,1)D t):i[2]?9 D
          -    1),e(creat(i[2],438)):2,e(execvp(*u,u))):e(chdir(u[1])*2):6;}
          -    e(x){x<0?write(2,"?\n$ "-x/4,2),x+1||(exit(1),0):5;}
          +
              #define D ,close(
          +    char*c,q[512],m[256],*v[99],**u,*i[3];int f[2],p;main(){for(m[m[60]=m[62]=
          +    32]=m[*m=124[m]=9]=6;e(-8),gets(1+(c=q))||(exit(0),0);r(0,0))for(;*++c;);}
          +    r(t,o){*i=i[2]=0;for(u=v+98;m[*--c]^9;m[*c]&32?i[*c&2]=
          +    *u,u-v^98&&++u:3)if(!m[*c]){for(*++c=0;!m[*--c];);*--u=
          +    ++c;}u-v^98?strcmp(*u,"cd")?*c?pipe(f),o=f[1]:1,(p=fork())?e(p),o?
          +    r(o,0)D o)D*f):4,wait(0):(o?dup2(*f,0)D*f)D o):*i?1 D
          +    0),e(open(*i,0)):5,t?dup2(t,1)D t):i[2]?9 D
          +    1),e(creat(i[2],438)):2,e(execvp(*u,u))):e(chdir(u[1])*2):6;}
          +    e(x){x<0?write(2,"?\n$ "-x/4,2),x+1||(exit(1),0):5;}

          and in the alternate source. It has the exit() returns void fix as well as the gets() to fgets() fix applied to it to make it functionally equivalent like the authors intended.

          Alternate build:

          -
              make alt
          +
              make alt

          Alternate use:

          -
              ./tbr.alt
          +
              ./tbr.alt

          Judges’ remarks:

          This program touches on a well known Unix utility, the 6th edition Bourne Shell (/bin/sh), whose original source was considered to be extremely obfuscated by @@ -245,9 +245,9 @@ is parsed; a pointer to the stack of arguments is assigned and an argument is stolen every time a > or < is encountered. The shell flags an error if no arguments are on the stack. Thus, for example:

          -
              cat > foo > bar
          +
              cat > foo > bar

          cats to foo, since it was pushed last, but

          -
              cat > > foo bar
          +
              cat > > foo bar

          cats to bar, since bar was pushed under foo (remember we’re parsing right-left).

          Depending on your flavor of Unix, cd without an argument will diff --git a/1990/theorem/README.md b/1990/theorem/README.md index 9d0c76dab..55707dce4 100644 --- a/1990/theorem/README.md +++ b/1990/theorem/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [1990 theorem bugs](../../bugs.html#1990_theor ## To use: -```sh +``` ./theorem expression x1 x2 h y1 ``` @@ -35,7 +35,7 @@ where: ## Try: -```sh +``` ./try.sh ``` @@ -62,7 +62,7 @@ left to right. (i.e., parenthesis aren't supported). Try running the program with the following args: -```sh +``` ./theorem y 0 1 0.1 1 ./theorem 1/x 1 2 0.1 0 ./theorem 'x^2/y+x' 0 1 0.1 6 @@ -71,14 +71,14 @@ Try running the program with the following args: But wait, there is more! You also get, free of charge, a reversing filter! Try: -```sh +``` ./theorem -r 0 0 0 0 < theorem.c > sorter.c ``` Still not impressed? The author throws in for free, a sort program! Try: -```sh +``` make sorter ls | ./sorter ``` @@ -87,14 +87,14 @@ This program is safe for home use as well. The author has included a safety feature in case you misplace the original program source: -```sh +``` ./sorter -r 0 0 0 0 < sorter.c > theorem_bkp.c ``` And finally, as a special offer to users of this entry, the author provides a Fibonacci sequence generator! Try: -```sh +``` ./sorter 0 0 0 0 < theorem.c > fibonacci.c make fibonacci ./fibonacci 1 1 diff --git a/1990/theorem/index.html b/1990/theorem/index.html index 3aea42e67..f6eb0e6bf 100644 --- a/1990/theorem/index.html +++ b/1990/theorem/index.html @@ -141,13 +141,13 @@ Location: US - United States of America

          To build:

          -
              make all
          +
              make all

          Bugs and (Mis)features:

          The current status of this entry is:

              STATUS: INABIAF - please **DO NOT** fix

          For more detailed information see 1990 theorem bugs.

          To use:

          -
              ./theorem expression x1 x2 h y1
          +
              ./theorem expression x1 x2 h y1

          where:

              expression - function f(x,y)  (see below)
               x1 - start of interval
          @@ -155,7 +155,7 @@ Location: US - United States of America
               h - step size
               y1 - initial value  (y(x1) == y1)

          Try:

          -
              ./try.sh
          +
              ./try.sh

          Judges’ remarks:

          The program’s source implements four functions, all from the same source file!

          @@ -169,26 +169,26 @@ operators:

          integer powers. Also note that all expressions are evaluated strictly left to right. (i.e., parenthesis aren’t supported).

          Try running the program with the following args:

          -
              ./theorem y 0 1 0.1 1
          -    ./theorem 1/x 1 2 0.1 0
          -    ./theorem 'x^2/y+x' 0 1 0.1 6
          +
              ./theorem y 0 1 0.1 1
          +    ./theorem 1/x 1 2 0.1 0
          +    ./theorem 'x^2/y+x' 0 1 0.1 6

          But wait, there is more! You also get, free of charge, a reversing filter! Try:

          -
              ./theorem -r 0 0 0 0 < theorem.c > sorter.c
          +
              ./theorem -r 0 0 0 0 < theorem.c > sorter.c

          Still not impressed? The author throws in for free, a sort program! Try:

          -
              make sorter
          -    ls | ./sorter
          +
              make sorter
          +    ls | ./sorter

          This program is safe for home use as well. The author has included a safety feature in case you misplace the original program source:

          -
              ./sorter -r 0 0 0 0 < sorter.c > theorem_bkp.c
          +
              ./sorter -r 0 0 0 0 < sorter.c > theorem_bkp.c

          And finally, as a special offer to users of this entry, the author provides a Fibonacci sequence generator! Try:

          -
              ./sorter 0 0 0 0 < theorem.c > fibonacci.c
          -    make fibonacci
          -    ./fibonacci 1 1
          -    ./fibonacci 2 1
          +
              ./sorter 0 0 0 0 < theorem.c > fibonacci.c
          +    make fibonacci
          +    ./fibonacci 1 1
          +    ./fibonacci 2 1

          NOTE: if the two args passed to fibonacci and theorem_bkp add to 0 it will print 0 over and over again in an infinite loop. In this case it should not be fixed (another condition where this occurred was fixed in 2023 as it affected diff --git a/1990/westley/README.md b/1990/westley/README.md index 75e8aa9a8..8ffd2c0f2 100644 --- a/1990/westley/README.md +++ b/1990/westley/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./westley ``` @@ -16,7 +16,7 @@ The number should be greater than 0. ## Try: -```sh +``` ./try.sh ``` @@ -30,14 +30,14 @@ The alternate code is provided to show how C changed. If you have an old enough compiler try and to see how C has changed over the years: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./westley.alt ``` diff --git a/1990/westley/index.html b/1990/westley/index.html index 4d4132ef9..1da1b630d 100644 --- a/1990/westley/index.html +++ b/1990/westley/index.html @@ -141,19 +141,19 @@ Location: US - United States of America

          To build:

          -
              make all
          +
              make all

          To use:

          -
              ./westley <number>
          +
              ./westley <number>

          The number should be greater than 0.

          Try:

          -
              ./try.sh
          +
              ./try.sh

          Alternate code:

          The alternate code is provided to show how C changed.

          Alternate build:

          If you have an old enough compiler try and to see how C has changed over the years:

          -
              make alt
          +
              make alt

          Alternate use:

          -
              ./westley.alt <number>
          +
              ./westley.alt <number>

          Judges’ remarks:

          If you would rather “Daisy” someone other than Westley, rename the program as needed. :-)

          diff --git a/1991/README.md b/1991/README.md index 4e9f2d2f2..c8812208f 100644 --- a/1991/README.md +++ b/1991/README.md @@ -35,7 +35,7 @@ been eliminated, and will likely be considered in future years. A number of entries made use of the following C pre-processor feature: -```c +``` #define X define #X foo bar ``` diff --git a/1991/ant/README.md b/1991/ant/README.md index 77c5497e6..12f231e7c 100644 --- a/1991/ant/README.md +++ b/1991/ant/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -10,7 +10,7 @@ familiar to vi(m) users. ## To use: -```sh +``` ./ant some_file ``` @@ -20,12 +20,12 @@ program exit without doing anything. ## Try: -```sh +``` make hill ./ant hill ``` -```sh +``` make mole ./ant mole ``` @@ -46,7 +46,7 @@ rest was unchanged. ### Alternate build: -```sh +``` make alt ``` diff --git a/1991/ant/index.html b/1991/ant/index.html index 1fa9c75ff..e57894264 100644 --- a/1991/ant/index.html +++ b/1991/ant/index.html @@ -141,18 +141,18 @@ Location: CA - Canada
        • To build:

          -
              make all
          +
              make all

          There is an alternate version that might feel a bit more familiar to vi(m) users.

          To use:

          -
              ./ant some_file
          +
              ./ant some_file

          NOTE: the file must already exist and not specifying any arg will make the program exit without doing anything.

          Try:

          -
              make hill
          -    ./ant hill
          -
              make mole
          -    ./ant mole
          +
              make hill
          +    ./ant hill
          +
              make mole
          +    ./ant mole

          Alternate code:

          This version changes the commands slightly so that to go to the first column you should enter 0, to go to the last column you should enter $, to quit you @@ -163,7 +163,7 @@ ESC (\x1b).

          These will make it slightly less unwieldy for those familiar with vi(m); the rest was unchanged.

          Alternate build:

          -
              make alt
          +
              make alt

          Alternate use:

          Use ant.alt as you would ant above with the changes in the input keys. See the author’s remarks for the remaining keys.

          diff --git a/1991/brnstnd/README.md b/1991/brnstnd/README.md index 531b48c37..b6dba7ac1 100644 --- a/1991/brnstnd/README.md +++ b/1991/brnstnd/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## Try: -```sh +``` ./try.sh ./sorta < sorta.itailrec diff --git a/1991/brnstnd/index.html b/1991/brnstnd/index.html index 7752f6fe8..93c82c6bd 100644 --- a/1991/brnstnd/index.html +++ b/1991/brnstnd/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

          To build:

          -
              make all
          +
              make all

          Try:

          -
              ./try.sh
          -
          -    ./sorta < sorta.itailrec
          +
              ./try.sh
          +
          +    ./sorta < sorta.itailrec

          Judges’ remarks:

          For info on more examples, read the sorta.README.html web page.

          The author wished to win the “most useful program” award and documented this in diff --git a/1991/buzzard/README.md b/1991/buzzard/README.md index 3a4e5bb1b..3d65edf07 100644 --- a/1991/buzzard/README.md +++ b/1991/buzzard/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -21,7 +21,7 @@ For more detailed information see [1991 buzzard bugs](../../bugs.html#1991_buzza ## To use: -```sh +``` ./buzzard ``` @@ -37,14 +37,14 @@ code directly so the keys are not made a `-D` at the compiler. ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./buzzard.alt ``` @@ -89,7 +89,7 @@ so make sure to convert tabs to spaces before using it. Usage: -```sh +``` ./buzzard [filename [escape-char [start-x start-yNNN ``` diff --git a/1991/buzzard/index.html b/1991/buzzard/index.html index edd36ac16..12a8b4bec 100644 --- a/1991/buzzard/index.html +++ b/1991/buzzard/index.html @@ -141,7 +141,7 @@ Location: ZZ - Unknown location

          To build:

          -
              make all
          +
              make all

          There is an alternate version which might feel more at home for vi(m) users in navigation.

          Bugs and (Mis)features:

          @@ -149,7 +149,7 @@ for vi(m) users in navigation.

              STATUS: INABIAF - please **DO NOT** fix

          For more detailed information see 1991 buzzard bugs.

          To use:

          -
              ./buzzard
          +
              ./buzzard

          Alternate code:

          This version changes the keys f for forward, l for left and r for right by default to k for forward, l for right and h for left, which is more @@ -157,9 +157,9 @@ natural for those who use vi(m). Also one can just hit q followed b quit the maze. It is problematic to reconfigure the keys except by modifying the code directly so the keys are not made a -D at the compiler.

          Alternate build:

          -
              make alt
          +
              make alt

          Alternate use:

          -
              ./buzzard.alt
          +
              ./buzzard.alt

          Judges’ remarks:

          You will be A-mazed.

          You are invited to try to cheat, … if you can figure out how! :-)

          @@ -186,7 +186,7 @@ separate physical rows in the maze; a space indicates a corridor, and any other character is a wall. Tabs are also considered walls, so make sure to convert tabs to spaces before using it.

          Usage:

          -
              ./buzzard [filename [escape-char [start-x start-yNNN
          +
              ./buzzard [filename [escape-char [start-x start-yNNN

          Filename is the name of the file containing the maze. This defaults to buzzard.c or rather __FILE__.

          Escape-char is the character in the maze that represents the exit. diff --git a/1991/cdupont/README.md b/1991/cdupont/README.md index 4851deaec..531da5248 100644 --- a/1991/cdupont/README.md +++ b/1991/cdupont/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./cdupont ``` @@ -16,7 +16,7 @@ Why is the following label necessary? -```c +``` sorryfor_this_unused_but_very_needed_label: ``` diff --git a/1991/cdupont/index.html b/1991/cdupont/index.html index 94287df76..89348b275 100644 --- a/1991/cdupont/index.html +++ b/1991/cdupont/index.html @@ -141,12 +141,12 @@ Location: FR - French Republic (

          To build:

          -
              make all
          +
              make all

          To use:

          -
              ./cdupont
          +
              ./cdupont

          Judges’ remarks:

          Why is the following label necessary?

          -
              sorryfor_this_unused_but_very_needed_label:
          +
              sorryfor_this_unused_but_very_needed_label:

          Notice that if you C beautify (cb) or pre-process this program, it will no longer work correctly, if at all. (go ahead, try it… :-))

          NOTE: One should remove the final trailing newline to obtain the diff --git a/1991/davidguy/README.md b/1991/davidguy/README.md index a98707dac..f206f507c 100644 --- a/1991/davidguy/README.md +++ b/1991/davidguy/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./davidguy ip_address:server.screen ``` @@ -16,7 +16,7 @@ where `ip_address` in an IP address of an X server. ## Try: -```sh +``` ./davidguy 127.0.0.1:0.0 ``` @@ -24,7 +24,7 @@ Of course, you may need to supply a more reasonable address. :-) ## Also try: -```sh +``` cp -f davidguy guydavid ./guydavid 127.0.0.1:0.0 ``` diff --git a/1991/davidguy/index.html b/1991/davidguy/index.html index f9024da23..bf344e5ef 100644 --- a/1991/davidguy/index.html +++ b/1991/davidguy/index.html @@ -141,16 +141,16 @@ Location: US - United States of America

          To build:

          -
              make all
          +
              make all

          To use:

          -
              ./davidguy ip_address:server.screen
          +
              ./davidguy ip_address:server.screen

          where ip_address in an IP address of an X server.

          Try:

          -
              ./davidguy 127.0.0.1:0.0
          +
              ./davidguy 127.0.0.1:0.0

          Of course, you may need to supply a more reasonable address. :-)

          Also try:

          -
              cp -f davidguy guydavid
          -    ./guydavid 127.0.0.1:0.0
          +
              cp -f davidguy guydavid
          +    ./guydavid 127.0.0.1:0.0

          Can you determine why this makes a difference?

          Judges’ remarks:

          We permitted this type of entry to win because:

          diff --git a/1991/dds/README.md b/1991/dds/README.md index 82d624e16..73a57d3c8 100644 --- a/1991/dds/README.md +++ b/1991/dds/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./dds basic_program ./a.out 2>/dev/null ``` @@ -17,7 +17,7 @@ The author suggests trying: -```sh +``` ./dds LANDER.BAS ./a.out ``` @@ -27,7 +27,7 @@ produced? How does `a.c` relate to [LANDER.BAS](LANDER.BAS)? What happens if you give the program a C program like itself? Try: -```sh +``` ./dds dds.c ``` diff --git a/1991/dds/index.html b/1991/dds/index.html index f1f746b79..f47062b5c 100644 --- a/1991/dds/index.html +++ b/1991/dds/index.html @@ -141,18 +141,18 @@ Location: GR - Hellenic Republic (

          To build:

          -
              make all
          +
              make all

          To use:

          -
              ./dds basic_program
          -    ./a.out 2>/dev/null
          +
              ./dds basic_program
          +    ./a.out 2>/dev/null

          Try:

          The author suggests trying:

          -
              ./dds LANDER.BAS
          -    ./a.out
          +
              ./dds LANDER.BAS
          +    ./a.out

          Notice that a file a.c has been generated. Can you tell how a.c was produced? How does a.c relate to LANDER.BAS?

          What happens if you give the program a C program like itself? Try:

          -
              ./dds dds.c
          +
              ./dds dds.c

          You’ll get errors yes but what does the generated file look like? What about other types of files?

          Judges’ remarks:

          diff --git a/1991/fine/README.md b/1991/fine/README.md index 4df99404b..a70c6c98a 100644 --- a/1991/fine/README.md +++ b/1991/fine/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` echo text | ./fine ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/1991/fine/index.html b/1991/fine/index.html index 866869bd3..91a6221f2 100644 --- a/1991/fine/index.html +++ b/1991/fine/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

          To build:

          -
              make all
          +
              make all

          To use:

          -
              echo text | ./fine
          +
              echo text | ./fine

          Try:

          -
              ./try.sh
          +
              ./try.sh

          Make sure that you read the last line backwards! Credit goes to Merlyn LeRoy (Brian Westley) for that. See his 22 August 1992 rec.puzzles diff --git a/1991/index.html b/1991/index.html index f2b8d9ca8..1b7a0444b 100644 --- a/1991/index.html +++ b/1991/index.html @@ -155,8 +155,8 @@ a winning entry for the past 5 years!

          would deny awards to more deserving entries. These categories have not been eliminated, and will likely be considered in future years.

          A number of entries made use of the following C pre-processor feature:

          -
              #define X define
          -    #X foo bar
          +
              #define X define
          +    #X foo bar

          This is not permitted under ANSI C. Some ANSI C compilers do allow this. In the future, we do not want programs to use this feature. Because this request was not stated in the 1991 rules, we did not reject entries of this diff --git a/1991/rince/README.md b/1991/rince/README.md index dcd8535c9..f315d8e7a 100644 --- a/1991/rince/README.md +++ b/1991/rince/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -11,7 +11,7 @@ that's fewer than the original program. ## To use: -```sh +``` ./rince ``` @@ -30,7 +30,7 @@ The author set the maximum number of moves to 484. ### Alternate build: -```sh +``` make alt ``` @@ -41,7 +41,7 @@ configurable maximum number of moves allowed, defaulting to the entry's max, To reconfigure the maximum number of moves to 700: -```sh +``` make clobber MAXMOVES=700 alt ``` @@ -50,13 +50,13 @@ To reconfigure the maximum number of moves to 700: To run the first alt version: -```sh +``` ./rince.alt ``` To run the second alt version: -```sh +``` ./rince.alt2 ``` diff --git a/1991/rince/index.html b/1991/rince/index.html index 70be75eb9..7d3698de0 100644 --- a/1991/rince/index.html +++ b/1991/rince/index.html @@ -141,12 +141,12 @@ Location: GB - United Kingdom of Great

          To build:

          -
              make all
          +
              make all

          There are two alternate versions which allow one to not be restricted in movements or to change the maximum number of movements, even if that’s fewer than the original program.

          To use:

          -
              ./rince
          +
              ./rince

          Alternate code:

          The first alternate version, rince.alt.c, disables a maximum move count so that anyone with enough patience and time can complete the puzzle, @@ -156,18 +156,18 @@ reconfigure at compilation the maximum number of moves, even if that is lowering the count.

          The author set the maximum number of moves to 484.

          Alternate build:

          -
              make alt
          +
              make alt

          This will build both alt versions where the first one, rince.alt, has no restrictions in the number of movements and the second one, rince.alt2, has a configurable maximum number of moves allowed, defaulting to the entry’s max, 484.

          To reconfigure the maximum number of moves to 700:

          -
              make clobber MAXMOVES=700 alt
          +
              make clobber MAXMOVES=700 alt

          Alternate use:

          To run the first alt version:

          -
              ./rince.alt
          +
              ./rince.alt

          To run the second alt version:

          -
              ./rince.alt2
          +
              ./rince.alt2

          Can you figure out how to make the two alternate versions equivalent in functionality without modifying the code? That is can you make the second alt version end up allowing any number of movements?

          diff --git a/1991/westley/README.md b/1991/westley/README.md index 59a2a630c..93bce8dbe 100644 --- a/1991/westley/README.md +++ b/1991/westley/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -27,7 +27,7 @@ for the interested. See the [try](#try) section if you just want to play. Make and then run as follows: -```sh +``` ./westley [move_location] | tee nextmove.c ``` @@ -43,7 +43,7 @@ a move on a tic-tac-toe board: If you omit `move_location`, then the computer moves first. For your next move, recompile `nextmove.c` and play it again: -```sh +``` make nextmove ./nextmove move_location | tee nextmove.c ``` @@ -54,7 +54,7 @@ next move, recompile `nextmove.c` and play it again: We have provided the shell script, [ttt](ttt.sh), to make it easier to play the game: -```sh +``` make ttt ./ttt [first_move] # <- omit first arg to have it move first ./ttt next_move @@ -64,14 +64,14 @@ The shell script determines when the game is over, and automatically replaces `merlyn.c` (copied from [westley.c](westley.c) with an improved version after a loss). The [ttt](ttt.sh) script has two other modes: -```sh +``` ./ttt quitgame # cancel any game in progress, revert to merlyn.c ./ttt clobber # remove all game files, revert to original source ``` For example here is a potentially losing game: -```sh +``` ./ttt 1 ./ttt 4 ./ttt 6 @@ -80,7 +80,7 @@ For example here is a potentially losing game: The final might look like: -```c +``` a(X){/*/X=- a(X){/*/X=- X -1;F;X=- -1;F;X=- -1;F;}/*/ -1;F;}/*/ @@ -123,7 +123,7 @@ can lose if you cheat. That's supposed to happen. Can you win any other time? ### Alternate build: -```sh +``` make alt ``` @@ -194,7 +194,7 @@ function as `a()`, `b()`, or `c()`. After each function is called, the global variables `X` and `O` contain bitmasks of where all the `X`s and `O`s are placed. The statement: -```c +``` X=- -1; ``` diff --git a/1991/westley/index.html b/1991/westley/index.html index fa01995fd..3be92e0d9 100644 --- a/1991/westley/index.html +++ b/1991/westley/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

          To build:

          -
              make all
          +
              make all

          There is an alternate version that is supposed to win all the time.

          Bugs and (Mis)features:

          @@ -152,7 +152,7 @@ time.

          NOTE: we have provided a script to perform the below procedure which we include for the interested. See the try section if you just want to play.

          Make and then run as follows:

          -
              ./westley [move_location] | tee nextmove.c
          +
              ./westley [move_location] | tee nextmove.c

          where the move_location is a digit from 1 to 9 that represents a move on a tic-tac-toe board:

              1 2 3
          @@ -160,59 +160,59 @@ a move on a tic-tac-toe board:

          7 8 9

          If you omit move_location, then the computer moves first. For your next move, recompile nextmove.c and play it again:

          -
              make nextmove
          -    ./nextmove move_location | tee nextmove.c
          +
              make nextmove
          +    ./nextmove move_location | tee nextmove.c

          Try:

          We have provided the shell script, ttt, to make it easier to play the game:

          -
              make ttt
          -    ./ttt [first_move]  # <- omit first arg to have it move first
          -    ./ttt next_move
          +
              make ttt
          +    ./ttt [first_move]  # <- omit first arg to have it move first
          +    ./ttt next_move

          The shell script determines when the game is over, and automatically replaces merlyn.c (copied from westley.c with an improved version after a loss). The ttt script has two other modes:

          -
              ./ttt quitgame      # cancel any game in progress, revert to merlyn.c
          -    ./ttt clobber       # remove all game files, revert to original source
          +
              ./ttt quitgame      # cancel any game in progress, revert to merlyn.c
          +    ./ttt clobber       # remove all game files, revert to original source

          For example here is a potentially losing game:

          -
              ./ttt 1
          -    ./ttt 4
          -    ./ttt 6
          +
              ./ttt 1
          +    ./ttt 4
          +    ./ttt 6

          The final might look like:

          -
                              a(X){/*/X=-         a(X){/*/X=-
          -            X   -1;F;X=-                -1;F;X=-
          -                    -1;F;}/*/           -1;F;}/*/
          -    char z[][100]={"char z[][100]={","a(X){/*/X=-","-1;F;X=-","-1;F;}/*/","1999999999  :-) ",
          -    "int q,i,j,k,X,O=0,H;S(x)int*x;{X+=X;O+=O;*x+1?*x+2||X++:O++;*x=1;}L(n){for(*",
          -    "z[i=1]=n+97;i<4;i++)M(256),s(i),M(128),s(i),M(64),N;X*=8;O*=8;}s(R){char*r=z",
          -    "[R];for(q&&Q;*r;)P(*r++);q&&(Q,P(44));}M(m){P(9);i-2||P(X&m?88:O&m?48:32);P(",
          -    "9);}y(A){for(j=8;j;)~A&w[--j]||(q=0);}e(W,Z){for(i-=i*q;i<9&&q;)y(W|(1<<i++&",
          -    "~Z));}R(){for(k=J[*J-48]-40;k;)e(w[k--],X|O);}main(u,v)char**v;{a(q=1);b(1);",
          -    "c(1);*J=--u?O?*J:*v[1]:53;X|=u<<57-*v[u];y(X);K=40+q;q?e(O,X),q&&(K='|'),e(X",
          -    ",O),R(),O|=1<<--i:J[*J-48+(X=O=0)]--;L(q=0);for(s(i=0);q=i<12;)s(i++),i>4&&N",
          -    ";s(q=12);P(48);P('}');P(59);N;q=0;L(1);for(i=5;i<13;)s(i++),N;L(2);}",0};
          -                    b(X){/*/X=-         b(X){/*/X=-
          -            X   -1;F;X=-                -1;F;X=-        X
          -                    -1;F;}/*/           -1;F;}/*/
          -    int q,i,j,k,X,O=0,H;S(x)int*x;{X+=X;O+=O;*x+1?*x+2||X++:O++;*x=1;}L(n){for(*
          -    z[i=1]=n+97;i<4;i++)M(256),s(i),M(128),s(i),M(64),N;X*=8;O*=8;}s(R){char*r=z
          -    [R];for(q&&Q;*r;)P(*r++);q&&(Q,P(44));}M(m){P(9);i-2||P(X&m?88:O&m?48:32);P(
          -    9);}y(A){for(j=8;j;)~A&w[--j]||(q=0);}e(W,Z){for(i-=i*q;i<9&&q;)y(W|(1<<i++&
          -    ~Z));}R(){for(k=J[*J-48]-40;k;)e(w[k--],X|O);}main(u,v)char**v;{a(q=1);b(1);
          -    c(1);*J=--u?O?*J:*v[1]:53;X|=u<<57-*v[u];y(X);K=40+q;q?e(O,X),q&&(K='|'),e(X
          -    ,O),R(),O|=1<<--i:J[*J-48+(X=O=0)]--;L(q=0);for(s(i=0);q=i<12;)s(i++),i>4&&N
          -    ;s(q=12);P(48);P('}');P(59);N;q=0;L(1);for(i=5;i<13;)s(i++),N;L(2);}
          -                    c(X){/*/X=-         c(X){/*/X=-
          -            0   -1;F;X=-        0       -1;F;X=-        0
          -                    -1;F;}/*/           -1;F;}/*/
          -
          -    ttt: I win!
          +
                              a(X){/*/X=-         a(X){/*/X=-
          +            X   -1;F;X=-                -1;F;X=-
          +                    -1;F;}/*/           -1;F;}/*/
          +    char z[][100]={"char z[][100]={","a(X){/*/X=-","-1;F;X=-","-1;F;}/*/","1999999999  :-) ",
          +    "int q,i,j,k,X,O=0,H;S(x)int*x;{X+=X;O+=O;*x+1?*x+2||X++:O++;*x=1;}L(n){for(*",
          +    "z[i=1]=n+97;i<4;i++)M(256),s(i),M(128),s(i),M(64),N;X*=8;O*=8;}s(R){char*r=z",
          +    "[R];for(q&&Q;*r;)P(*r++);q&&(Q,P(44));}M(m){P(9);i-2||P(X&m?88:O&m?48:32);P(",
          +    "9);}y(A){for(j=8;j;)~A&w[--j]||(q=0);}e(W,Z){for(i-=i*q;i<9&&q;)y(W|(1<<i++&",
          +    "~Z));}R(){for(k=J[*J-48]-40;k;)e(w[k--],X|O);}main(u,v)char**v;{a(q=1);b(1);",
          +    "c(1);*J=--u?O?*J:*v[1]:53;X|=u<<57-*v[u];y(X);K=40+q;q?e(O,X),q&&(K='|'),e(X",
          +    ",O),R(),O|=1<<--i:J[*J-48+(X=O=0)]--;L(q=0);for(s(i=0);q=i<12;)s(i++),i>4&&N",
          +    ";s(q=12);P(48);P('}');P(59);N;q=0;L(1);for(i=5;i<13;)s(i++),N;L(2);}",0};
          +                    b(X){/*/X=-         b(X){/*/X=-
          +            X   -1;F;X=-                -1;F;X=-        X
          +                    -1;F;}/*/           -1;F;}/*/
          +    int q,i,j,k,X,O=0,H;S(x)int*x;{X+=X;O+=O;*x+1?*x+2||X++:O++;*x=1;}L(n){for(*
          +    z[i=1]=n+97;i<4;i++)M(256),s(i),M(128),s(i),M(64),N;X*=8;O*=8;}s(R){char*r=z
          +    [R];for(q&&Q;*r;)P(*r++);q&&(Q,P(44));}M(m){P(9);i-2||P(X&m?88:O&m?48:32);P(
          +    9);}y(A){for(j=8;j;)~A&w[--j]||(q=0);}e(W,Z){for(i-=i*q;i<9&&q;)y(W|(1<<i++&
          +    ~Z));}R(){for(k=J[*J-48]-40;k;)e(w[k--],X|O);}main(u,v)char**v;{a(q=1);b(1);
          +    c(1);*J=--u?O?*J:*v[1]:53;X|=u<<57-*v[u];y(X);K=40+q;q?e(O,X),q&&(K='|'),e(X
          +    ,O),R(),O|=1<<--i:J[*J-48+(X=O=0)]--;L(q=0);for(s(i=0);q=i<12;)s(i++),i>4&&N
          +    ;s(q=12);P(48);P('}');P(59);N;q=0;L(1);for(i=5;i<13;)s(i++),N;L(2);}
          +                    c(X){/*/X=-         c(X){/*/X=-
          +            0   -1;F;X=-        0       -1;F;X=-        0
          +                    -1;F;}/*/           -1;F;}/*/
          +
          +    ttt: I win!

          Redirects stderr to /dev/null by default. If you need errors or warnings use -e.

          Alternate code:

          This version is based on the author’s remarks. It is not supposed to lose but it can lose if you cheat. That’s supposed to happen. Can you win any other time?

          Alternate build:

          -
              make alt
          +
              make alt

          Alternate use:

          Rather than use ttt try the script ttt.alt instead.

          Judges’ remarks:

          @@ -259,7 +259,7 @@ longer loses games.

          function as a(), b(), or c(). After each function is called, the global variables X and O contain bitmasks of where all the Xs and Os are placed. The statement:

          -
              X=-   <char>   -1;
          +
              X=-   <char>   -1;

          evaluates to 1, -1, or -2 when X is 1 and <char> is one of "X", "0", or " ". The function S(&X) sets the appropriate bits in (global vars) X and O and resets the value of &X to 1. This is how the current diff --git a/1992/adrian/README.md b/1992/adrian/README.md index 1c88a8f4f..458e89c06 100644 --- a/1992/adrian/README.md +++ b/1992/adrian/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -19,13 +19,13 @@ For more detailed information see [1992 adrian bugs](../../bugs.html#1992_adrian ## Try: -```sh +``` ./try.sh ``` For the slow minded, try: -```sh +``` ./adsleep 32767 ``` @@ -134,7 +134,7 @@ character list. With the automaton specification in `filename`, invoke the program by typing -```sh +``` ./adrian filename ``` @@ -151,7 +151,7 @@ occurs if your automaton has more than 257 states. Running: -```sh +``` ./adrian from < your_mailbox ``` @@ -169,7 +169,7 @@ the regular expression: I suggest using `adrian.c` as input, and storing the output in `adwc.c`: -```sh +``` ./adrian < adrian.c > adwc.c ``` @@ -181,13 +181,13 @@ in the input file. Another possibly interesting automaton can be created by slightly adjusting the `adrian.c` file. Change the first line to read -```c +``` /* . echo| . */ ``` and repeat the process above -```sh +``` ./adrian adecho.c ``` @@ -204,7 +204,7 @@ employed. Two other adjustments to the first line also yield useful results. By changing it to -```c +``` /* . head; . */ ``` @@ -221,7 +221,7 @@ specified (again this was changed to `__FILE__`). By setting the first line to -```c +``` /* . basename . */ ``` @@ -240,7 +240,7 @@ The resulting base name is printed to stdout. Lastly, by setting the first line to -```c +``` /* . sleep . */ ``` diff --git a/1992/adrian/index.html b/1992/adrian/index.html index 1f7d7b014..a1bcf6898 100644 --- a/1992/adrian/index.html +++ b/1992/adrian/index.html @@ -141,16 +141,16 @@ Location: US - United States of America

          To build:

          -
              make all
          +
              make all

          Bugs and (Mis)features:

          The current status of this entry is:

              STATUS: known bug - please help us fix
               STATUS: INABIAF - please **DO NOT** fix

          For more detailed information see 1992 adrian bugs.

          Try:

          -
              ./try.sh
          +
              ./try.sh

          For the slow minded, try:

          -
              ./adsleep 32767
          +
              ./adsleep 32767

          Judges’ remarks:

          Once you get past the obfuscation, you have an opportunity to learn about regular expressions and state machines.

          @@ -214,7 +214,7 @@ character list.

          [q5]

      With the automaton specification in filename, invoke the program by typing

      -
          ./adrian filename
      +
          ./adrian filename

      It will read the file and print out all the lines which the automaton accepts. If the file cannot be opened, a system error message will be printed. If the input contains errors, then an error message along @@ -225,7 +225,7 @@ being processed is printed. Error no_destination occurs if you spec set of characters, but no destination state, and error too_many_states occurs if your automaton has more than 257 states.

      Running:

      -
          ./adrian from < your_mailbox
      +
          ./adrian from < your_mailbox

      will perform a function similar to that of the unix from command.

      If no filename is specified on the command line, then __FILE__ is used as the specification for the automaton. (Originally this was "adgrep.c" but the file @@ -234,23 +234,23 @@ changed to __FILE__.) In this case, the program will search for mat the regular expression:

          ^.[^|C][^w[Q]*(Q|[w[]c).*|^.[C|]$

      I suggest using adrian.c as input, and storing the output in adwc.c:

      -
          ./adrian < adrian.c > adwc.c
      +
          ./adrian < adrian.c > adwc.c

      Compiling the new file, adwc.c, yields a clone of the unix wc command. It runs on one file, defaulting to "adrian.c" if no file is given (again, this was changed to be __FILE__) and displays the number of lines, words, and bytes in the input file.

      Another possibly interesting automaton can be created by slightly adjusting the adrian.c file. Change the first line to read

      -
          /* . echo| . */
      +
          /* . echo| . */

      and repeat the process above

      -
          ./adrian <adrian.c > adecho.c
      +
          ./adrian <adrian.c > adecho.c

      The new file now contains all lines which match

          ^.[^5|m^]*[m^]([e=p,;]|[^e=+p,;].*)$

      Compile and run. This is an echo(1) clone. Note the efficient algorithm employed.

      Two other adjustments to the first line also yield useful results. By changing it to

      -
          /* . head; . */
      +
          /* . head; . */

      you can search for matches to

          ^.[^W]*W..*$

      By some freak happenstance, lines of adrian.c which match this regular @@ -258,7 +258,7 @@ expression form a unix head(1) command. It prints the first ten lin the file specified on the command line or adrian.c if no file is specified (again this was changed to __FILE__).

      By setting the first line to

      -
          /* . basename . */
      +
          /* . basename . */

      a clone of the unix basename(1) command can be unearthed. The automaton will search for

          ^.[^j]*jr.*$
      @@ -268,7 +268,7 @@ filename, and the second, an extension. All leading pathname components are removed from the filename, and the extension is removed if present. The resulting base name is printed to stdout.

      Lastly, by setting the first line to

      -
          /* . sleep . */
      +
          /* . sleep . */

      you can search for

          ^.[^(~][^s]*sl.*$

      Filtering adrian.c through this search yields a clone of the sleep(1) diff --git a/1992/albert/README.md b/1992/albert/README.md index f3cb6bbeb..035ac3196 100644 --- a/1992/albert/README.md +++ b/1992/albert/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -21,14 +21,14 @@ For more detailed information see [1992 albert bugs](../../bugs.html#1992_albert ## To use: -```sh +``` ./albert number ``` ## Try: -```sh +``` ./try.sh ``` @@ -64,7 +64,7 @@ The [albert.alt.c](albert.c) file is the fixed file, whereas the To compile this alternate version: -```sh +``` make alt ``` @@ -76,7 +76,7 @@ Use `albert.alt` as you would `albert` above. ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -106,7 +106,7 @@ if you want to factor Fermat's 4th number. Then just run it. Or you may type `./albert ` A nice one is also (30 ones): -```sh +``` ./albert 111111111111111111111111111111 ``` @@ -114,7 +114,7 @@ Apart from the foregoing there are no special execution instructions. To customize the program into a factorizer of a fixed number, use -```sh +``` cc albert.c -o 4294967297 ``` diff --git a/1992/albert/index.html b/1992/albert/index.html index aa7e5bc51..9f11173f6 100644 --- a/1992/albert/index.html +++ b/1992/albert/index.html @@ -141,16 +141,16 @@ Location: NL - Kingdom of the Netherlan

      To build:

      -
          make all
      +
          make all

      An alternate version exists that fixes a bug.

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: known bug - please help us fix

      For more detailed information see 1992 albert bugs.

      To use:

      -
          ./albert number
      +
          ./albert number

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Alternate code:

      An alternate version of this entry, albert.alt.c, is provided. Leo Broukhis, before he was an IOCCC judge, sent the IOCCC @@ -173,11 +173,11 @@ judges this Email message:

      albert.c is the file before applying Leo Broukhis’ fix.

      Alternate build:

      To compile this alternate version:

      -
          make alt
      +
          make alt

      Alternate use:

      Use albert.alt as you would albert above.

      Alternate try:

      -
          ./try.alt.sh
      +
          ./try.alt.sh

      Judges’ remarks:

      We were impressed with the speed at which it was able to factor arbitrarily large numbers consisting of factors that fit into @@ -194,10 +194,10 @@ multiplication, until the candidate factor no longer fits in a signed long.

      if you want to factor Fermat’s 4th number. Then just run it.

      Or you may type ./albert <some-number> A nice one is also (30 ones):

      -
          ./albert 111111111111111111111111111111
      +
          ./albert 111111111111111111111111111111

      Apart from the foregoing there are no special execution instructions.

      To customize the program into a factorizer of a fixed number, use

      -
          cc albert.c -o 4294967297
      +
          cc albert.c -o 4294967297

      or some such.

      There are no data files used, and it is not possible to feed input via stdin.

      diff --git a/1992/ant/README.md b/1992/ant/README.md index 63e0c3238..38e47788f 100644 --- a/1992/ant/README.md +++ b/1992/ant/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./ant Makefile ./ant Makefile rule @@ -18,7 +18,7 @@ where `Makefile` is a Makefile to use and `rule` is an optional rule to use. ## Try: -```sh +``` ./try.sh ``` diff --git a/1992/ant/index.html b/1992/ant/index.html index 51a29f2a0..55e7049ca 100644 --- a/1992/ant/index.html +++ b/1992/ant/index.html @@ -141,14 +141,14 @@ Location: CA - Canada

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./ant Makefile
      -
      -    ./ant Makefile rule
      +
          ./ant Makefile
      +
      +    ./ant Makefile rule

      where Makefile is a Makefile to use and rule is an optional rule to use.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      Like much of POSIX, obfuscation has its place. Your task is to figure out where.

      diff --git a/1992/buzzard.1/README.md b/1992/buzzard.1/README.md index 0c141c346..03c59c42d 100644 --- a/1992/buzzard.1/README.md +++ b/1992/buzzard.1/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./buzzard.1 num num ``` ## Try: -```sh +``` ./try.sh ``` @@ -23,7 +23,7 @@ To see good C Preprocessor buzzard.1, try: -```sh +``` make babble.cppcb cat babble.cppcb ``` @@ -54,19 +54,19 @@ short strings. `buzzard.1` is a simple mathematical program. It expects two numeric arguments. -```sh +``` ./buzzard.1 0 ``` will print out the factorial of ``. -```sh +``` ./buzzard.1 ``` will print out the largest common factor of `num1` and `num2`. -```sh +``` ./buzzard.1 1 ``` @@ -171,21 +171,21 @@ programs is the conditional (given that we have loops). Since all you can do in the given operation output set is assignment, we implement "conditional assignment": -```c +``` if (x) y = z; ``` To implement this, we constrain `x` to be either 0 or 1, and simply compute: -```c +``` y = (z * x) + (y * (1-x)); ``` This is more obscured by factoring out common terms and restricting ourselves to two operand operations: -```c +``` temp = z; (temp == z) temp -= y; (temp == z-y) temp *= x; (temp == (z-y)*x) @@ -199,7 +199,7 @@ Next we imagine we have a [pc](https://en.wikipedia.org/wiki/Program_counter). we're not currently coming up on statement pc. To handle this, we simply make every operation conditional on the pc having the correct value: -```c +``` if (pc == some_constant) y = z; ``` diff --git a/1992/buzzard.1/index.html b/1992/buzzard.1/index.html index 12c033952..d207a6bbb 100644 --- a/1992/buzzard.1/index.html +++ b/1992/buzzard.1/index.html @@ -141,15 +141,15 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./buzzard.1 num num
      +
          ./buzzard.1 num num

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      To see good C Preprocessor buzzard.1, try:

      -
          make babble.cppcb
      -    cat babble.cppcb
      +
          make babble.cppcb
      +    cat babble.cppcb

      Notice how many statements it takes to do anything useful?

      Author’s remarks:

      What you shouldn’t think about buzzard.1:

      @@ -162,11 +162,11 @@ short strings.

      What it does

      buzzard.1 is a simple mathematical program. It expects two numeric arguments.

      -
          ./buzzard.1 0 <num>
      +
          ./buzzard.1 0 <num>

      will print out the factorial of <num>.

      -
          ./buzzard.1 <num1> <num2>
      +
          ./buzzard.1 <num1> <num2>

      will print out the largest common factor of num1 and num2.

      -
          ./buzzard.1 1 <num2>
      +
          ./buzzard.1 1 <num2>

      will print out a factor of num2 if it’s composite, or else it will print a string informing you that num2 is prime.

      If the first argument is less than 0, it prints out an @@ -244,23 +244,23 @@ BCD, so it can be output by the hexadecimal output statement.

      programs is the conditional (given that we have loops). Since all you can do in the given operation output set is assignment, we implement “conditional assignment”:

      -
          if (x) y = z;
      +
          if (x) y = z;

      To implement this, we constrain x to be either 0 or 1, and simply compute:

      -
          y = (z * x) + (y * (1-x));
      +
          y = (z * x) + (y * (1-x));

      This is more obscured by factoring out common terms and restricting ourselves to two operand operations:

      -
          temp = z;                       (temp == z)
      -    temp -= y;                      (temp == z-y)
      -    temp *= x;                      (temp == (z-y)*x)
      -    y += temp;                      (y    == (z-y)*x + y)
      -                                    (     == z*x - y*x + y)
      -                                    (     == z*x + y*(1-x))
      +
          temp = z;                       (temp == z)
      +    temp -= y;                      (temp == z-y)
      +    temp *= x;                      (temp == (z-y)*x)
      +    y += temp;                      (y    == (z-y)*x + y)
      +                                    (     == z*x - y*x + y)
      +                                    (     == z*x + y*(1-x))

      Next we imagine we have a pc. “I’m supposed to execute statement pc next”, says our emulator. But suppose we’re not currently coming up on statement pc. To handle this, we simply make every operation conditional on the pc having the correct value:

      -
          if (pc == some_constant) y = z;
      +
          if (pc == some_constant) y = z;

      To combine this with other operations, we simply multiply by our (pc == some_constant) flag right after the above temp *= x.

      To evaluate pc == some_constant requires one more trick. We assume that diff --git a/1992/buzzard.2/README.md b/1992/buzzard.2/README.md index e0bf9e803..50a722c48 100644 --- a/1992/buzzard.2/README.md +++ b/1992/buzzard.2/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -13,13 +13,13 @@ code](#alternate-code) below for details. First, you must make sure that `first` is made first (even though `make all` should make first first :-) ): -```sh +``` make first ``` Second: -```sh +``` # get help: echo help | cat third help.th - | ./first @@ -29,7 +29,7 @@ Second: Third: -```sh +``` cat third help.th - | ./first ``` @@ -50,7 +50,7 @@ Fourth: ## Try: -```sh +``` ./try.sh ``` @@ -63,7 +63,7 @@ fix that the author notes in their remarks. ### Alternate build: -```sh +``` make alt ``` @@ -75,7 +75,7 @@ Use `buzzard.2.alt` as you would `buzzard.2` above. ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -125,7 +125,7 @@ Do not expect to be able to do anything interesting with `first`. To do something interesting, you need to feed `first` the file [third](third) first. In unix, you can do -```sh +``` cat third help.th - | ./first ``` @@ -226,7 +226,7 @@ When you get the `Ok.` message from `third`, try out some sample you in a normal way. It only prints `'Ok.'` after you define a word). -```sh +``` 2 3 + . cr ``` diff --git a/1992/buzzard.2/index.html b/1992/buzzard.2/index.html index a655e58b9..8d7df6ac0 100644 --- a/1992/buzzard.2/index.html +++ b/1992/buzzard.2/index.html @@ -141,37 +141,37 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      There is an alternate version of this program. See Alternate code below for details.

      To use:

      First, you must make sure that first is made first (even though make all should make first first :-) ):

      -
          make first
      +
          make first

      Second:

      -
          # get help:
      -    echo help | cat third help.th - | ./first
      -
      -    # try out a demo:
      -    cat third demo5.th | ./first
      +
          # get help:
      +    echo help | cat third help.th - | ./first
      +
      +    # try out a demo:
      +    cat third demo5.th | ./first

      Third:

      -
          cat third help.th - | ./first
      +
          cat third help.th - | ./first

      NOTE: Wait until ‘Ok’ is printed and the type:

          2 3 + . cr

      Yes you should really type the 2 letters: cr.

      Fourth:

          Sorry, this is third!

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Alternate code:

      This alternate version, buzzard.2.alt.c, does not contain a fix that the author notes in their remarks.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      Use buzzard.2.alt as you would buzzard.2 above.

      Alternate try:

      -
          ./try.alt.sh
      +
          ./try.alt.sh

      Judges’ remarks:

      Have fun!

      Author’s remarks:

      @@ -204,7 +204,7 @@ included, but it only works on ASCII systems.

      Do not expect to be able to do anything interesting with first.

      To do something interesting, you need to feed first the file third first. In unix, you can do

      -
          cat third help.th - | ./first
      +
          cat third help.th - | ./first

      to do this. Hopefully most operating systems will provide a way to do this. It may take some time for this to complete (I seem to remember it taking several minutes on an 8086 PC); THIRD will prompt you when it is finished. The file @@ -283,7 +283,7 @@ take a significant amount of time in THIRD.

      FORTH code (first has no way of knowing if keyboard input is waiting, so it can’t actually prompt you in a normal way. It only prints 'Ok.' after you define a word).

      -
          2 3 + . cr
      +
          2 3 + . cr

      (which adds 2 and 3, and print the result and a newline.)

      THIRD responds:

          5
      diff --git a/1992/gson/README.md b/1992/gson/README.md index 739147fb4..8f400bd4e 100644 --- a/1992/gson/README.md +++ b/1992/gson/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -21,14 +21,14 @@ For more detailed information see [1992 gson bugs](../../bugs.html#1992_gson). ## To use: -```sh +``` ./ag word word2 word3 < /path/to/dictionary ``` ## Try: -```sh +``` ./try.sh ``` @@ -45,7 +45,7 @@ following locations though the last one is more ironic: Then using the proper dictionary file it does: -```sh +``` ./ag free software foundation < /usr/share/dict/words ./ag obfuscated c contest < /usr/share/dict/words ./ag unix international < /usr/share/dict/words @@ -73,7 +73,7 @@ weren't allowed to print! The author provided an obfuscated script that can be used to construct dictionaries which has been put in as [mkdict.sh](mkdict.sh). To use try: -```sh +``` cat README.md | ./mkdict.sh > words ``` @@ -103,7 +103,7 @@ have one already, you can make your own dictionary by concatenating a few hundred of your favourite Usenet articles and piping them through the following obfuscated shell script: -```sh +``` #!/bin/sh z=a-z];tr [A-Z\] \[$z|sed s/[\^$z[\^$z*/_/g|tr _ \\012|grep ..|sort -u ``` @@ -258,7 +258,7 @@ those bits that should remain zero. For example, the following program prints all those 16-bit integers that contain zeroes in all even bit positions: -```c +``` main(){int i=0,s=0xAAAA;do{printf("%04x\t",i);}while(i=((i|~s)+1)&s);} ``` diff --git a/1992/gson/index.html b/1992/gson/index.html index e08e32a8e..fea6c379f 100644 --- a/1992/gson/index.html +++ b/1992/gson/index.html @@ -141,7 +141,7 @@ Location: FI - Republic of Finland

      To build:

      -
          make all
      +
          make all

      NOTE: we DISABLE the optimiser because having it enabled causes some invocations to crash in some systems.

      Bugs and (Mis)features:

      @@ -149,9 +149,9 @@ to crash in some systems.

          STATUS: uses gets() - change to fgets() if possible

      For more detailed information see 1992 gson bugs.

      To use:

      -
          ./ag word word2 word3 < /path/to/dictionary
      +
          ./ag word word2 word3 < /path/to/dictionary

      Try:

      -
          ./try.sh
      +
          ./try.sh

      This script will determine (or try and determine) where your system dictionary is located and assuming that it can find one it’ll use that. It checks the following locations though the last one is more ironic:

      @@ -160,13 +160,13 @@ following locations though the last one is more ironic:

      /usr/ucblib/dict/words /dev/null # <-- for machines with nothing to say

    Then using the proper dictionary file it does:

    -
        ./ag free software foundation       < /usr/share/dict/words
    -    ./ag obfuscated c contest   < /usr/share/dict/words
    -    ./ag unix international             < /usr/share/dict/words
    -    ./ag george bush            < /usr/share/dict/words
    -    ./ag bill clinton           < /usr/share/dict/words
    -    ./ag ross perot                     < /usr/share/dict/words
    -    ./ag paul e tsongas         < /usr/share/dict/words
    +
        ./ag free software foundation       < /usr/share/dict/words
    +    ./ag obfuscated c contest   < /usr/share/dict/words
    +    ./ag unix international             < /usr/share/dict/words
    +    ./ag george bush            < /usr/share/dict/words
    +    ./ag bill clinton           < /usr/share/dict/words
    +    ./ag ross perot                     < /usr/share/dict/words
    +    ./ag paul e tsongas         < /usr/share/dict/words

    where /usr/share/dict/words is the dictionary file.

    Then it uses the mkdict.sh script to create a dictionary file out of the files README.md, try.sh (itself) and @@ -179,7 +179,7 @@ names listed above. Run this program to find the anagrams they weren’t allowed to print!

    The author provided an obfuscated script that can be used to construct dictionaries which has been put in as mkdict.sh. To use try:

    -
        cat README.md | ./mkdict.sh > words
    +
        cat README.md | ./mkdict.sh > words

    Then try using the program as shown above with the file words.

    Author’s remarks:

    The name of the game:

    @@ -195,8 +195,8 @@ natural language of your choice, one word on each line. If your machine doesn’ have one already, you can make your own dictionary by concatenating a few hundred of your favourite Usenet articles and piping them through the following obfuscated shell script:

    -
        #!/bin/sh
    -    z=a-z];tr [A-Z\] \[$z|sed s/[\^$z[\^$z*/_/g|tr _ \\012|grep ..|sort -u
    +
        #!/bin/sh
    +    z=a-z];tr [A-Z\] \[$z|sed s/[\^$z[\^$z*/_/g|tr _ \\012|grep ..|sort -u

    Using articles from alt.folklore.computers is likely to make a more professional-looking dictionary than rec.arts.erotica.

    AG must be run with the dictionary file as standard input.

    @@ -323,7 +323,7 @@ the carries generated in incrementing i propagate straight across those bits that should remain zero. For example, the following program prints all those 16-bit integers that contain zeroes in all even bit positions:

    -
        main(){int i=0,s=0xAAAA;do{printf("%04x\t",i);}while(i=((i|~s)+1)&s);}
    +
        main(){int i=0,s=0xAAAA;do{printf("%04x\t",i);}while(i=((i|~s)+1)&s);}

    AG uses a similar method but works in the opposite direction, finding the next lower value with zeroes in given bit positions by propagating borrows across those bits. Some additional adjustments are made diff --git a/1992/imc/README.md b/1992/imc/README.md index 22c1e17fb..c30322335 100644 --- a/1992/imc/README.md +++ b/1992/imc/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` # text mode ./imc -text @@ -19,7 +19,7 @@ To see a number of options and configurations: -```sh +``` ./try.sh ``` @@ -164,7 +164,7 @@ standard error to indicate its progress (one dot per pixel line). Here are a couple of good pictures to draw: -```sh +``` ./imc -s 512,512 -f 600000 -l 512 -m 16 -c.00805,.74274 > screen1.ras ./imc -s512,512 -j-.523,-.535 > screen2.ras ``` diff --git a/1992/imc/index.html b/1992/imc/index.html index 67ebe9137..5ef4e9435 100644 --- a/1992/imc/index.html +++ b/1992/imc/index.html @@ -141,15 +141,15 @@ Location: GB - United Kingdom of Great

    To build:

    -
        make all
    +
        make all

    To use:

    -
        # text mode
    -    ./imc -text
    -
    -    ./imc
    +
        # text mode
    +    ./imc -text
    +
    +    ./imc

    Try:

    To see a number of options and configurations:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    The program is more interesting to run on workstations that can make use of a Sun raster file. Others can make use of the -text flag for character oriented @@ -263,8 +263,8 @@ bits (e.g. 8).

    standard error to indicate its progress (one dot per pixel line).

    Example pictures to try

    Here are a couple of good pictures to draw:

    -
        ./imc -s 512,512 -f 600000 -l 512 -m 16 -c.00805,.74274 > screen1.ras
    -    ./imc -s512,512 -j-.523,-.535 > screen2.ras
    +
        ./imc -s 512,512 -f 600000 -l 512 -m 16 -c.00805,.74274 > screen1.ras
    +    ./imc -s512,512 -j-.523,-.535 > screen2.ras
    make alt ``` @@ -24,7 +24,7 @@ For more detailed information see [1992 kivinen bugs](../../bugs.html#1992_kivin ## To use: -```sh +``` ./kivinen.alt ./kivinen.alt a @@ -41,7 +41,7 @@ Also try changing the speed that the game moves. For instance if you wish to change the `usleep(3)` value to `30000` from `20000`, try: -```sh +``` make clobber SLEEP=30000 alt # make it slower make clobber SLEEP=10000 alt # make it faster @@ -59,7 +59,7 @@ code. ### Original build: -```sh +``` make all ``` diff --git a/1992/kivinen/index.html b/1992/kivinen/index.html index 5526b2e9e..f91fe832d 100644 --- a/1992/kivinen/index.html +++ b/1992/kivinen/index.html @@ -142,7 +142,7 @@ Location: FI - Republic of Finland To build:

    If your machine support the X Window System, Version 11:

    -
        make alt
    +
        make alt

    We recommend that you try the alt version first so you can get a better idea of what this looked like back in 1992. See original code for the original should you wish to see what we mean.

    @@ -151,25 +151,25 @@ original should you wish to see what we mean.

        STATUS: known bug - please help us fix

    For more detailed information see 1992 kivinen bugs.

    To use:

    -
        ./kivinen.alt
    -
    -    ./kivinen.alt a
    -
    -    ./kivinen.alt a b
    +
        ./kivinen.alt
    +
    +    ./kivinen.alt a
    +
    +    ./kivinen.alt a b

    See also the author’s remarks for other variations.

    Try:

    Also try changing the speed that the game moves. For instance if you wish to change the usleep(3) value to 30000 from 20000, try:

    -
        make clobber SLEEP=30000 alt # make it slower
    -
    -    make clobber SLEEP=10000 alt # make it faster
    +
        make clobber SLEEP=30000 alt # make it slower
    +
    +    make clobber SLEEP=10000 alt # make it faster

    Then use the same syntax as above and described by the author.

    Original code:

    As noted above, the alt version is recommended because the code goes too fast in modern systems. If you wish to see the original you may do so with the original code.

    Original build:

    -
        make all
    +
        make all

    Original use:

    Use kivinen as you would kivinen.alt.

    Judges’ remarks:

    diff --git a/1992/lush/README.md b/1992/lush/README.md index 1a6ec7774..cb10e36c2 100644 --- a/1992/lush/README.md +++ b/1992/lush/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [1992 lush bugs](../../bugs.html#1992_lush). ## To use: -```sh +``` ./lush.sh ``` diff --git a/1992/lush/index.html b/1992/lush/index.html index 2f4af753b..d55bdc8e3 100644 --- a/1992/lush/index.html +++ b/1992/lush/index.html @@ -141,13 +141,13 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: doesn't work with some compilers - please provide alternative code or fix for more compilers

    For more detailed information see 1992 lush bugs.

    To use:

    -
        ./lush.sh
    +
        ./lush.sh

    Judges’ remarks:

    The program uses error messages issued by the C Preprocessor to generate its message to the world. One program’s error is another diff --git a/1992/marangon/README.md b/1992/marangon/README.md index 838912d95..883441bcf 100644 --- a/1992/marangon/README.md +++ b/1992/marangon/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./marangon ``` diff --git a/1992/marangon/index.html b/1992/marangon/index.html index dfb19efae..18e31bc4a 100644 --- a/1992/marangon/index.html +++ b/1992/marangon/index.html @@ -141,9 +141,9 @@ Location: IT - Italian Republic (<

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./marangon
    +
        ./marangon

    Judges’ remarks:

    The object is to refill the table with 5’s, by incrementing or decrementing numbers as needed. It is the side effects that get you into trouble. If you diff --git a/1992/nathan/README.md b/1992/nathan/README.md index 446e47e55..0cf51e6a2 100644 --- a/1992/nathan/README.md +++ b/1992/nathan/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./nathan # enter some text ``` @@ -17,7 +17,7 @@ To see some other fun uses: -```sh +``` ./try.sh ``` @@ -58,7 +58,7 @@ distribute some winning entries outside of the US. Nathan Sidwell stated that he was willing to distribute the winning source. To read HIS instructions of how to obtain his winning program one was able to run: -```sh +``` make nathan ./nathan ``` diff --git a/1992/nathan/index.html b/1992/nathan/index.html index 0eb81e94a..c8e03cbe9 100644 --- a/1992/nathan/index.html +++ b/1992/nathan/index.html @@ -141,13 +141,13 @@ Location: GB - United Kingdom of Great

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./nathan
    -    # enter some text
    +
        ./nathan
    +    # enter some text

    Try:

    To see some other fun uses:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    WARNING:

    The judges make no claim as to the strength or security @@ -173,8 +173,8 @@ fall under this restricted category, the judges originally were not able to distribute some winning entries outside of the US.

    Nathan Sidwell stated that he was willing to distribute the winning source. To read HIS instructions of how to obtain his winning program one was able to run:

    -
        make nathan
    -    ./nathan
    +
        make nathan
    +    ./nathan

    to learn how to get a copy of the code.

    See the 1992/nathan.c file in the archive/historic/archive-1992.tar.bz2 diff --git a/1992/vern/README.md b/1992/vern/README.md index dc8b0b821..77e4eabd4 100644 --- a/1992/vern/README.md +++ b/1992/vern/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [1992 vern bugs](../../bugs.html#1992_vern). ## To use: -```sh +``` ./vern 3 # <-- default is 2 ``` @@ -42,7 +42,7 @@ suggested above. :-) For a real quick game try: -```sh +``` ./vern 65 55 @@ -124,7 +124,7 @@ wouldn't pass the character limit. A nice side effect is that the initial source is gloriously difficult to peruse. In particular, the Makefile does: -```sh +``` sed vern.tmp.c ``` diff --git a/1992/vern/index.html b/1992/vern/index.html index c5572cfcc..7cf972984 100644 --- a/1992/vern/index.html +++ b/1992/vern/index.html @@ -141,13 +141,13 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 1992 vern bugs.

    To use:

    -
        ./vern 3    # <-- default is 2
    +
        ./vern 3    # <-- default is 2

    Try:

    You might start off by giving the following input:

        63 43
    @@ -158,10 +158,10 @@ Location: US - United States of America
     

    The judges assume no responsibility for the obfuscated opening suggested above. :-)

    For a real quick game try:

    -
        ./vern
    -
    -    65 55
    -    66 46
    +
        ./vern
    +
    +    65 55
    +    66 46

    NOTE: Move values must be restricted to the range 00 to 77.

    NOTE: Because some mailers have problems with the original winning source, a slightly modified version with shorter lines has been provided.

    @@ -225,8 +225,8 @@ at build time into much-needed text. Without this hack the program wouldn’t pass the character limit. A nice side effect is that the initial source is gloriously difficult to peruse. In particular, the Makefile does:

    -
        sed <vern.c 's/{ /(/g;s/} /)/g;s/;       /#define /' | \
    -        sed 's/}      /=/g;s/{        /i/g' >vern.tmp.c
    +
        sed <vern.c 's/{ /(/g;s/} /)/g;s/;       /#define /' | \
    +        sed 's/}      /=/g;s/{        /i/g' >vern.tmp.c

    and compiles vern.tmp.c.

    Second, the rather ho-hum step has been taking of naming each variable with a one or two letter identifier to render it meaningless (and save diff --git a/1992/westley/README.md b/1992/westley/README.md index efda4b11d..2cd0f342e 100644 --- a/1992/westley/README.md +++ b/1992/westley/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -22,7 +22,7 @@ For more detailed information see [1992 westley bugs](../../bugs.html#1992_westl If lost: -```sh +``` ./whereami.sh lat long ``` @@ -36,7 +36,7 @@ should just use the `westley` and `westley.alt` programs directly. ## Try: -```sh +``` ./try.sh ``` @@ -48,14 +48,14 @@ The author provided a version for the US which we added. To build: ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./whereami.alt.sh lat long ``` @@ -67,7 +67,7 @@ NOTE: this alternative version also needs a terminal with at least 80 columns. The [try.sh](try.sh) script uses both the original entry and the alternate code so one can try the same script for both: -```sh +``` ./try.sh ``` @@ -76,7 +76,7 @@ so one can try the same script for both: To find the approximate place where this entry was judged, type: -```sh +``` ./whereami 37 -122 # NOTE: - means west of meridian # or if you don't have curses installed: @@ -164,7 +164,7 @@ is reasonably accurate. For a domestic (US) version with higher resolution, try: -```c +``` main(l,a,n,d)char**a;{for(d=atoi(a[1])/2*80-atoi(a[2])-2043; n="bnaBCOCXdBBHGYdAP[A M E R I C A].AqandkmavX|ELC}BOCd" [l++-3];)for(;n-->64;)putchar(!d+++33^l&1);} @@ -173,7 +173,7 @@ For a domestic (US) version with higher resolution, try: The code will test the 80-column wrap and document itself if it is joined together as one 160-character line and listed. You should see: -```c +``` main(l,a,n,d)... [A M E R I C A]... ``` diff --git a/1992/westley/index.html b/1992/westley/index.html index 66a9b2e32..09f647601 100644 --- a/1992/westley/index.html +++ b/1992/westley/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix
    @@ -149,31 +149,31 @@ Location: US - United States of America
     

    For more detailed information see 1992 westley bugs.

    To use:

    If lost:

    -
        ./whereami.sh lat long
    +
        ./whereami.sh lat long

    Where lat and long correspond to your latitude and longitude.

    NOTE: you MUST have a terminal that is at least 80 columns for this to show properly. The whereami and whereami.alt code checks this but it is not prohibitive if it cannot be compiled and linked (it uses curses); instead one should just use the westley and westley.alt programs directly.

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Alternate code:

    The author provided a version for the US which we added. To build:

    Alternate build:

    -
        make alt
    +
        make alt

    Alternate use:

    -
        ./whereami.alt.sh lat long
    +
        ./whereami.alt.sh lat long

    NOTE: this alternative version also needs a terminal with at least 80 columns.

    Alternate try:

    The try.sh script uses both the original entry and the alternate code so one can try the same script for both:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    To find the approximate place where this entry was judged, type:

    -
        ./whereami 37 -122  # NOTE: - means west of meridian
    -
    -    # or if you don't have curses installed:
    -    ./westley 37 -122   # NOTE: - means west of meridian
    +
        ./whereami 37 -122  # NOTE: - means west of meridian
    +
    +    # or if you don't have curses installed:
    +    ./westley 37 -122   # NOTE: - means west of meridian

    Author’s remarks:

    Run the program with your latitude & longitude as integer arguments; it will produce a map made up of '!' with the given @@ -243,13 +243,13 @@ is reasonably accurate.

  • Tokyo 36 140
  • For a domestic (US) version with higher resolution, try:

    -
        main(l,a,n,d)char**a;{for(d=atoi(a[1])/2*80-atoi(a[2])-2043;
    -    n="bnaBCOCXdBBHGYdAP[A M E R I C A].AqandkmavX|ELC}BOCd"
    -    [l++-3];)for(;n-->64;)putchar(!d+++33^l&1);}
    +
        main(l,a,n,d)char**a;{for(d=atoi(a[1])/2*80-atoi(a[2])-2043;
    +    n="bnaBCOCXdBBHGYdAP[A M E R I C A].AqandkmavX|ELC}BOCd"
    +    [l++-3];)for(;n-->64;)putchar(!d+++33^l&1);}

    The code will test the 80-column wrap and document itself if it is joined together as one 160-character line and listed. You should see:

    -
        main(l,a,n,d)...
    -    [A M E R I C A]...
    +
        main(l,a,n,d)...
    +    [A M E R I C A]...

    …going down the left edge if your terminal auto-wraps at 80 characters.

    make all ``` @@ -18,14 +18,14 @@ For more detailed information see [1993 ant bugs](../../bugs.html#1993_ant). ## To use: -```sh +``` ./ant 'ERE' [file ...] ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/1993/ant/index.html b/1993/ant/index.html index 9d5d04a66..7c3267373 100644 --- a/1993/ant/index.html +++ b/1993/ant/index.html @@ -141,15 +141,15 @@ Location: CA - Canada

    To build:

    -
        make all
    +
        make all

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: missing file - please provide it

    For more detailed information see 1993 ant bugs.

    To use:

    -
        ./ant 'ERE' [file ...]
    +
        ./ant 'ERE' [file ...]

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    See the author’s POSIX P1003.2-like documentation file ant.txt for more information.

    diff --git a/1993/cmills/README.md b/1993/cmills/README.md index 3772c4e9c..7cbd1b02b 100644 --- a/1993/cmills/README.md +++ b/1993/cmills/README.md @@ -4,7 +4,7 @@ We recommend you try the alt version first so you can get a better idea of what this entry was like back in 1993. See the [original code](#original-code) section below to run the original. -```sh +``` make alt ``` @@ -16,7 +16,7 @@ requires X11?](../../faq.html#X11macos). To configure how many microseconds to sleep before updates try: -```sh +``` make clobber SLEEP=200 alt ``` @@ -34,7 +34,7 @@ For more detailed information see [1993 cmills bugs](../../bugs.html#1993_cmills ## To use: -```sh +``` DISPLAY="your_X_server_display" export DISPLAY ./cmills.alt [speed] # must be run on an X11 server @@ -56,7 +56,7 @@ on but you can use the original without any delays if you wish. ### Original build: -```sh +``` make all ``` diff --git a/1993/cmills/index.html b/1993/cmills/index.html index af19d1b30..350bc84d6 100644 --- a/1993/cmills/index.html +++ b/1993/cmills/index.html @@ -144,21 +144,21 @@ Location: US - United States of America

    We recommend you try the alt version first so you can get a better idea of what this entry was like back in 1993. See the original code section below to run the original.

    -
        make alt
    +
        make alt

    NOTE: this entry requires the X11/Xlib.h header file and the X11 library to compile. If you’re under macOS and do not know how to install and use X11 programs see FAQ 3.7 - How do I compile and use on macOS, an IOCCC entry that requires X11?.

    To configure how many microseconds to sleep before updates try:

    -
        make clobber SLEEP=200 alt
    +
        make clobber SLEEP=200 alt

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: known bug - please help us fix

    For more detailed information see 1993 cmills bugs.

    To use:

    -
        DISPLAY="your_X_server_display"
    -    export DISPLAY
    -    ./cmills.alt [speed]        # must be run on an X11 server
    +
        DISPLAY="your_X_server_display"
    +    export DISPLAY
    +    ./cmills.alt [speed]        # must be run on an X11 server

    where:

    speed is update speed from 1 to 9 (default is 9).

    NOTE: in most cases DISPLAY should already be set.

    @@ -166,7 +166,7 @@ requires X11?.

    We recommend the version that uses usleep(3) to more easily see what is going on but you can use the original without any delays if you wish.

    Original build:

    -
        make all
    +
        make all

    Original use:

    Use cmills as you would cmills.alt above.

    Judges’ remarks:

    diff --git a/1993/dgibson/README.md b/1993/dgibson/README.md index d32666ba5..39b5ab711 100644 --- a/1993/dgibson/README.md +++ b/1993/dgibson/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./dgibson.sh [datafile] ``` @@ -18,7 +18,7 @@ where: ## Try: -```sh +``` ./try.sh ``` diff --git a/1993/dgibson/index.html b/1993/dgibson/index.html index 8f7707583..303a2b951 100644 --- a/1993/dgibson/index.html +++ b/1993/dgibson/index.html @@ -141,13 +141,13 @@ Location: ZZ - Unknown location

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./dgibson.sh [datafile]
    +
        ./dgibson.sh [datafile]

    where:

    datafile is the initial pattern (default: dgibson.data1)

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    We have provided the shell script dgibson.sh to make it easier to run this entry. Run this shell script several times to diff --git a/1993/ejb/README.md b/1993/ejb/README.md index dc1a48a9d..0a1f272f6 100644 --- a/1993/ejb/README.md +++ b/1993/ejb/README.md @@ -1,26 +1,26 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./ejb level ``` where: -```sh +``` level a value from -128 to 127 ``` ## Try: -```sh +``` ./try.sh ``` @@ -45,7 +45,7 @@ We note that this also works under macOS just fine. #### Output solution to Towers of Hanoi for five rings: -```sh +``` ./ejb 5 ``` @@ -54,7 +54,7 @@ text description of how to solve the puzzle. #### Output solution to the Patience puzzle for six rings: -```sh +``` ./ejb -6 ``` diff --git a/1993/ejb/index.html b/1993/ejb/index.html index 8a38327cf..7630150cc 100644 --- a/1993/ejb/index.html +++ b/1993/ejb/index.html @@ -141,13 +141,13 @@ Location: ZZ - Unknown location

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./ejb level
    +
        ./ejb level

    where:

    -
        level   a value from -128 to 127
    +
        level   a value from -128 to 127

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    A negative argument plays the patience puzzle. An argument greater than 0 plays the Tower of Hanoi puzzle. In either case @@ -160,11 +160,11 @@ the argument 127 to this program and want to see it finish!

    Author’s remarks:

    What this program does

    Output solution to Towers of Hanoi for five rings:

    -
        ./ejb 5
    +
        ./ejb 5

    The format of the output for the Towers of Hanoi case is simply a text description of how to solve the puzzle.

    Output solution to the Patience puzzle for six rings:

    -
        ./ejb -6
    +
        ./ejb -6

    For the patience puzzle, the output is a sequence binary codes representing successive states of the puzzle. The rightmost digit represents the first ring. A 1 means the ring is on the U; a 0 means it is off the U. The program diff --git a/1993/jonth/README.md b/1993/jonth/README.md index 2537681cc..62ffed00e 100644 --- a/1993/jonth/README.md +++ b/1993/jonth/README.md @@ -5,14 +5,14 @@ compile. macOS users running Mountain Lion and later will need to download and install [XQuartz](https://www.xquartz.org) in order to compile and run this entry. -```sh +``` make all ``` ## To use: -```sh +``` ./jonth # must be run on an X11 server ``` diff --git a/1993/jonth/index.html b/1993/jonth/index.html index 8f7be10a1..f92f627fd 100644 --- a/1993/jonth/index.html +++ b/1993/jonth/index.html @@ -145,9 +145,9 @@ Location: NO - Kingdom of Norway ( compile. macOS users running Mountain Lion and later will need to download and install XQuartz in order to compile and run this entry.

    -
        make all
    +
        make all

    To use:

    -
        ./jonth     # must be run on an X11 server
    +
        ./jonth     # must be run on an X11 server

    Judges’ remarks:

    Use h and l to shift objects left or right. Use k to rotate and press SPACE to drop.

    diff --git a/1993/leo/README.md b/1993/leo/README.md index c16564900..df9439aa9 100644 --- a/1993/leo/README.md +++ b/1993/leo/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -9,13 +9,13 @@ To have the computer guess: -```sh +``` ./leo [colors] ``` To guess the computer's number: -```sh +``` ./mind [colors] ``` diff --git a/1993/leo/index.html b/1993/leo/index.html index c18fa4724..46c3a38f1 100644 --- a/1993/leo/index.html +++ b/1993/leo/index.html @@ -141,12 +141,12 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    To use:

    To have the computer guess:

    -
        ./leo [colors]
    +
        ./leo [colors]

    To guess the computer’s number:

    -
        ./mind [colors]
    +
        ./mind [colors]

    where:

    [colors] is the number of possible colors (1 to 15) (default: 6)

    Judges’ remarks:

    diff --git a/1993/lmfjyh/README.md b/1993/lmfjyh/README.md index 1582f5346..127aa6f33 100644 --- a/1993/lmfjyh/README.md +++ b/1993/lmfjyh/README.md @@ -2,7 +2,7 @@ If you have gcc < 2.3.3 you can build this entry like: -```sh +``` make all ``` @@ -48,7 +48,7 @@ For more detailed information see [1993 lmfjyh bugs](../../bugs.html#1993_lmfjyh If you have gcc < 2.3.3 (i.e. the entry can compile): -```sh +``` ./lmfjyh ``` @@ -64,7 +64,7 @@ Nonetheless it will be compiled in case the original entry fails to compile. Should you wish to build this version manually: -```sh +``` make alt ``` @@ -99,7 +99,7 @@ that should be familiar to all C-programmers. #### Listing 1: A simple "Hello World" program -```c +``` main() { puts("Hello World!"); @@ -118,14 +118,14 @@ the file. #### Listing 2: Compressed "Hello world" -```c +``` char*_=__FILE__; ``` #### Listing 3: Code embedded in the file name -```c +``` ";main(){puts("Hello World!");}char*C=".c ``` diff --git a/1993/lmfjyh/index.html b/1993/lmfjyh/index.html index 1627064a6..d87abf463 100644 --- a/1993/lmfjyh/index.html +++ b/1993/lmfjyh/index.html @@ -142,7 +142,7 @@ Location: FI - Republic of Finland To build:

    If you have gcc < 2.3.3 you can build this entry like:

    -
        make all
    +
        make all

    This will try to create a file whose actual filename is literally:

        ";main(){puts("Hello World!");}char*C=".c

    When that file is compiled, it will greet the world in the @@ -166,14 +166,14 @@ section below for more details.

    For more detailed information see 1993 lmfjyh bugs.

    To use:

    If you have gcc < 2.3.3 (i.e. the entry can compile):

    -
        ./lmfjyh
    +
        ./lmfjyh

    Alternate code:

    This version does what the code did but in a way that will work with modern compilers. We’d like to say there’s something special about it but there isn’t. Nonetheless it will be compiled in case the original entry fails to compile.

    Alternate build:

    Should you wish to build this version manually:

    -
        make alt
    +
        make alt

    Alternate use:

    Use lmfjyh.alt as you would lmfjyh above. Note that other code could also be done with the bug that the entry abuses but that would have to be manually @@ -189,10 +189,10 @@ best with C-source code.

    As an example, I have taken a simple “Hello world!” program that should be familiar to all C-programmers.

    Listing 1: A simple “Hello World” program

    -
        main()
    -    {
    -      puts("Hello World!");
    -    }
    +
        main()
    +    {
    +      puts("Hello World!");
    +    }

    Packing method

    Normally a file name is used only to identify the file, but this new revolutionary method introduces a totally new concept: THE FILE NAME IS THE @@ -200,9 +200,9 @@ PROGRAM. There is no need to waste valuable disk space to store source The program is embedded in the file name, only a minor portion of it is inside the file.

    Listing 2: Compressed “Hello world”

    -
        char*_=__FILE__;
    +
        char*_=__FILE__;

    Listing 3: Code embedded in the file name

    -
        ";main(){puts("Hello World!");}char*C=".c
    +
        ";main(){puts("Hello World!");}char*C=".c

    The sample program in listing 1 is 36 bytes long. By using the new compression method, the example program may be squeezed to sixteen bytes. In the example the compression ratio is 2:1. It is evident diff --git a/1993/plummer/README.md b/1993/plummer/README.md index af15d25ee..ba076c352 100644 --- a/1993/plummer/README.md +++ b/1993/plummer/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make alt ``` @@ -12,21 +12,21 @@ code](#original-code) below. If you wish to speed the entry up, say to 500 microseconds between writes, try: -```sh +``` make clobber SLEEP=500 alt ``` Alternatively if you wish to slow it down, say to 1500 microseconds between writes, try: -```sh +``` make clobber SLEEP=1500 alt ``` ## To use: -```sh +``` ./plummer.alt number arg ``` @@ -42,7 +42,7 @@ bypass](https://hitchhikers.fandom.com/wiki/Bypass). ## Try: -```sh +``` ./try.alt.sh ./try.alt.sh 21701 @@ -70,7 +70,7 @@ course). ### Original build: -```sh +``` make all ``` @@ -82,7 +82,7 @@ Use `plummer` as you would `plummer.alt` above. ### Original try: -```sh +``` ./try.sh ./try.sh 21701 diff --git a/1993/plummer/index.html b/1993/plummer/index.html index 5bec962f0..f569432b8 100644 --- a/1993/plummer/index.html +++ b/1993/plummer/index.html @@ -141,19 +141,19 @@ Location: ZZ - Unknown location

    To build:

    -
        make alt
    +
        make alt

    We recommend that you try the alternate version first to get a better idea of what this entry looked like back in 1993. The alternate version sleeps (via usleep(3)) in between writes, defaulting at 1000 microseconds (but reconfigurable). If you wish to see the original entry then see original code below.

    If you wish to speed the entry up, say to 500 microseconds between writes, try:

    -
        make clobber SLEEP=500 alt
    +
        make clobber SLEEP=500 alt

    Alternatively if you wish to slow it down, say to 1500 microseconds between writes, try:

    -
        make clobber SLEEP=1500 alt
    +
        make clobber SLEEP=1500 alt

    To use:

    -
        ./plummer.alt number arg
    +
        ./plummer.alt number arg

    where:

    • number is a number (try 21701)
    • @@ -163,43 +163,43 @@ writes, try:

      Vogons build that hyperspace bypass.

      Try:

      -
          ./try.alt.sh
      -
      -    ./try.alt.sh 21701
      -
      -    SLEEP=500 ./try.alt.sh
      -
      -    SLEEP=900 ./try.alt.sh 789789789789789
      -
      -    ./try.alt.sh 789789789
      -
      -    SLEEP=400 ./try.alt.sh 42424242424242
      -
      -    SLEEP=1000 ./try.alt.sh xyzzyzzyx
      -
      -    SLEEP=1200 ./try.alt.sh xyzzyzzyx 5555
      +
          ./try.alt.sh
      +
      +    ./try.alt.sh 21701
      +
      +    SLEEP=500 ./try.alt.sh
      +
      +    SLEEP=900 ./try.alt.sh 789789789789789
      +
      +    ./try.alt.sh 789789789
      +
      +    SLEEP=400 ./try.alt.sh 42424242424242
      +
      +    SLEEP=1000 ./try.alt.sh xyzzyzzyx
      +
      +    SLEEP=1200 ./try.alt.sh xyzzyzzyx 5555

      Original code:

      This version, the original, does not sleep in between writes, and is thus much faster (depending on the SLEEP parameter specified in the build of alt, of course).

      Original build:

      -
          make all
      +
          make all

      Original use:

      Use plummer as you would plummer.alt above.

      Original try:

      -
          ./try.sh
      -
      -    ./try.sh 21701
      -
      -    ./try.sh 789789789789789
      -
      -    ./try.sh 789789789
      -
      -    ./try.sh 42424242424242
      -
      -    ./try.sh xyzzyzzyx
      -
      -    ./try.sh xyzzyzzyx 5555
      +
          ./try.sh
      +
      +    ./try.sh 21701
      +
      +    ./try.sh 789789789789789
      +
      +    ./try.sh 789789789
      +
      +    ./try.sh 42424242424242
      +
      +    ./try.sh xyzzyzzyx
      +
      +    ./try.sh xyzzyzzyx 5555

      Judges’ remarks:

      For extra credit: What happens when ‘number’ contains non-numeric characters, and why?

      diff --git a/1993/rince/README.md b/1993/rince/README.md index d339f141e..2b51f33c6 100644 --- a/1993/rince/README.md +++ b/1993/rince/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -22,7 +22,7 @@ For more detailed information see [bugs report with 1993/rince](../../bugs.html# ## To use: -```sh +``` ./rince [cabbage] ``` @@ -37,13 +37,13 @@ Some people may want to slow down the game by increasing the value 17 in the lines: -```c +``` struct timeval v= {0,1<<17} ; ``` and -```c +``` refresh(),c=select(k,&y,0,0,(v.tv_usec=1<<17,&v))?getch():0; ``` @@ -57,7 +57,7 @@ changed). ### Alternate build: -```sh +``` make SLEEP=18 clobber alt ``` @@ -107,7 +107,7 @@ with the curses library (typically `/lib/libcurses.a` for static libraries) used. It has been suggested that the following gcc command may help: -```sh +``` gcc -fno-builtin -I/usr/include -o rince rince.c -lcurses -ltermcap ``` diff --git a/1993/rince/index.html b/1993/rince/index.html index e6df5b651..87eaf2d76 100644 --- a/1993/rince/index.html +++ b/1993/rince/index.html @@ -141,7 +141,7 @@ Location: GB - United Kingdom of Great

      To build:

      -
          make all
      +
          make all

      NOTE: there are two alternate versions of this program, both allowing one to slow down the game and the second one with movements more familiar to vi users. See the Alternate code section below.

      @@ -150,22 +150,22 @@ See the Alternate code section below.

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see bugs report with 1993/rince.

      To use:

      -
          ./rince [cabbage]
      +
          ./rince [cabbage]

      where:

      [cabbage] is a CABBAGE description file (default: rince.c)

      Alternate code:

      Some people may want to slow down the game by increasing the value 17 in the lines:

      -
          struct timeval v= {0,1<<17} ;
      +
          struct timeval v= {0,1<<17} ;

      and

      -
          refresh(),c=select(k,&y,0,0,(v.tv_usec=1<<17,&v))?getch():0;
      +
          refresh(),c=select(k,&y,0,0,(v.tv_usec=1<<17,&v))?getch():0;

      to another value like 18 or 19 which you can do with the alternate code.

      In the case of rince.alt2.c the movement keys for the default game are slightly different and will feel more familiar to vi users: h for left, l for right (that was not changed) and k for fire (that was also not changed).

      Alternate build:

      -
          make SLEEP=18 clobber alt
      +
          make SLEEP=18 clobber alt

      Replace 18 with whatever number you wish.

      Alternate use:

      Use rince.alt or rince.alt2 as you would rince above.

      @@ -194,7 +194,7 @@ with it.

      /usr/local/include/curses.h if not /usr/include/curses.h) is not compatible with the curses library (typically /lib/libcurses.a for static libraries) used. It has been suggested that the following gcc command may help:

      -
          gcc -fno-builtin -I/usr/include -o rince rince.c -lcurses -ltermcap
      +
          gcc -fno-builtin -I/usr/include -o rince rince.c -lcurses -ltermcap

      Author’s remarks:

      This is a Cellular Automata Based, Beautifully Abysmal Game Environment (or CABBAGE for short). To execute the program simply type ./rince gamefile, diff --git a/1993/schnitzi/README.md b/1993/schnitzi/README.md index 1f867a41e..630f5978b 100644 --- a/1993/schnitzi/README.md +++ b/1993/schnitzi/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [1993 schnitzi bugs](../../bugs.html#1993_schn ## To use: -```sh +``` ./schnitzi file ``` @@ -33,14 +33,14 @@ in [1993 schnitzi bugs](../../bugs.html#1993_schnitzi). ## Try: -```sh +``` ./schnitzi schnitzi.info # ask some questions suggested by the author, noted below ``` We also suggest you ask the program the following questions: -```sh +``` Who is Mark Schnitzus? Who was Jack the Ripper ? @@ -51,7 +51,7 @@ intentional spelling error there. Try feeding the program source to the program and ask both: -```sh +``` What is cat ? What is cat? ``` diff --git a/1993/schnitzi/index.html b/1993/schnitzi/index.html index 9a77fc975..a25e6b260 100644 --- a/1993/schnitzi/index.html +++ b/1993/schnitzi/index.html @@ -141,29 +141,29 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 1993 schnitzi bugs.

      To use:

      -
          ./schnitzi file
      +
          ./schnitzi file

      where

      file is a file containing some text.

      Certain input will cause the program to fail as described in 1993 schnitzi bugs.

      Try:

      -
          ./schnitzi schnitzi.info
      -    # ask some questions suggested by the author, noted below
      +
          ./schnitzi schnitzi.info
      +    # ask some questions suggested by the author, noted below

      We also suggest you ask the program the following questions:

      -
          Who is Mark Schnitzus?
      -
      -    Who was Jack the Ripper ?
      +
          Who is Mark Schnitzus?
      +
      +    Who was Jack the Ripper ?

      Notice how it still manages to answer the first question despite there being an intentional spelling error there.

      Try feeding the program source to the program and ask both:

      -
          What is cat ?
      -    What is cat?
      +
          What is cat ?
      +    What is cat?

      What happens if you ask it other questions with and without a space before the ??

      Judges’ remarks:

      diff --git a/1993/vanb/README.md b/1993/vanb/README.md index d2cff7f79..3223518e2 100644 --- a/1993/vanb/README.md +++ b/1993/vanb/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [1993 vanb bugs](../../bugs.html#1993_vanb). ## To use: -```sh +``` ./vanb 'exp' ``` @@ -28,7 +28,7 @@ hexadecimal and decimal numbers. ## Try: -```sh +``` ./try.sh ``` @@ -133,7 +133,7 @@ Here's a version of the program before it got formatted into the VIII, augmented with comments showing where each state begins. `N1` and `N2` are notes: -```c +``` #define O5 main O5(O2,O7,O3)char**O7; { @@ -180,14 +180,14 @@ printf, and sends the parser to state `012` (which is ``). The `E` and `T` states work like this: -```c +``` int e(){ return eprime( t() ); } ``` The `E'` and `T'` states work like this: -```c +``` int eprime( int intermediate ) { if( ch == '+' ) @@ -202,7 +202,7 @@ The `E'` and `T'` states work like this: The `D`, `X` and `O` states work like this (they assume that they're initially called with `0`): -```c +``` int octal( int intermediate ) { if( ch>='0' && ch<='7' ) diff --git a/1993/vanb/index.html b/1993/vanb/index.html index a257761e3..cb5050585 100644 --- a/1993/vanb/index.html +++ b/1993/vanb/index.html @@ -141,17 +141,17 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 1993 vanb bugs.

      To use:

      -
          ./vanb 'exp'
      +
          ./vanb 'exp'

      where exp is an octal expression. See below for how it can also have hexadecimal and decimal numbers.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      What happens if you use something other than valid digits?

      Judges’ remarks:

      The octal expression may contain:

      @@ -217,70 +217,70 @@ involving **O7 and octal constants are looking for certain characte

      Here’s a version of the program before it got formatted into the VIII, augmented with comments showing where each state begins. N1 and N2 are notes:

      -
          #define O5 main
      -    O5(O2,O7,O3)char**O7;
      -    {
      -             return
      -    /* N1 */ !(O2+=~01+01) ?\
      -                  00:
      -    /* N2 */ !(O2-=02>01) ?\
      -                  printf("\045\157\012",O5(012,O7+01,00)):
      -    /* O  */ !(O2-=02>>01) ?\
      -                  (**O7<=067 && **O7>057 ? O5(03,O7,*(*O7)++-060+010*O3):O3):
      -    /* D  */ !(O2-=-O3-~O3) ?\
      -                  (072>**O7 && 060<=**O7 ? O5(04,O7,012*O3-060+*(*O7)++):O3):
      -    /* X  */ !(O2-=!O3+!!O3) ?\
      -                  (**O7>057 && **O7<=071 ? O5(05,O7,*(*O7)+++O3*020-060):
      -                  **O7<=0106 && 0101<=**O7 ? O5(05,O7,020*O3+*(*O7)++-067):
      -                  0140<**O7 && **O7<0147 ? O5(05,O7,-0127+*(*O7)+++020*O3):O3):
      -    /* F  */ !(O2-=02-01) ?\
      -                  (**O7==050 ? 050**++*O7,O5(013,O7,O5(012,O7,00)):
      -                  **O7<056 && 054<**O7 ? 055**++*O7,-O5(06,O7,00):
      -                  054>**O7 && 052<**O7 ? 050**(*O7)++,O5(06,O7,00):
      -                  !(**O7^0170)||!(0130^**O7) ? *++*O7,O5(05,O7,00):
      -                  **O7==0144||**O7==0104 ? ++*O7,O5(04,O7,00):O5(03,O7,00)):
      -    /* T' */ !--O2 ?\
      -                  (**O7==052 ? O5(07,O7,O3*(*++*O7,O5(06,O7,00))):
      -                  !(045-**O7) ? O5(07,O7,O3%(03+(*O7)++,O5(06,O7,00))):
      -                  !(**O7^057) ? O5(07,O7,O3/(03-*++*O7,O5(06,O7,00))):O3):
      -    /* T  */ !(O2+=01-02) ?\
      -                  O5(07,O7,O5(06,O7,00)):
      -    /* E' */ !(O2+=-02/02) ?\
      -                  (!(**O7-053)?O5(011,O7,O3+(++*O7,O5(010,O7,00))):
      -                  !(055^**O7) ? O5(011,O7,O3-(03+*(*O7)++,O5(010,O7,00))):O3):
      -    /* E  */ !(O2-=0563&0215) ?\
      -                  O5(011,O7,O5(010,O7,00)):
      -    /* C  */ (++*O7,O3);
      -    }
      +
          #define O5 main
      +    O5(O2,O7,O3)char**O7;
      +    {
      +             return
      +    /* N1 */ !(O2+=~01+01) ?\
      +                  00:
      +    /* N2 */ !(O2-=02>01) ?\
      +                  printf("\045\157\012",O5(012,O7+01,00)):
      +    /* O  */ !(O2-=02>>01) ?\
      +                  (**O7<=067 && **O7>057 ? O5(03,O7,*(*O7)++-060+010*O3):O3):
      +    /* D  */ !(O2-=-O3-~O3) ?\
      +                  (072>**O7 && 060<=**O7 ? O5(04,O7,012*O3-060+*(*O7)++):O3):
      +    /* X  */ !(O2-=!O3+!!O3) ?\
      +                  (**O7>057 && **O7<=071 ? O5(05,O7,*(*O7)+++O3*020-060):
      +                  **O7<=0106 && 0101<=**O7 ? O5(05,O7,020*O3+*(*O7)++-067):
      +                  0140<**O7 && **O7<0147 ? O5(05,O7,-0127+*(*O7)+++020*O3):O3):
      +    /* F  */ !(O2-=02-01) ?\
      +                  (**O7==050 ? 050**++*O7,O5(013,O7,O5(012,O7,00)):
      +                  **O7<056 && 054<**O7 ? 055**++*O7,-O5(06,O7,00):
      +                  054>**O7 && 052<**O7 ? 050**(*O7)++,O5(06,O7,00):
      +                  !(**O7^0170)||!(0130^**O7) ? *++*O7,O5(05,O7,00):
      +                  **O7==0144||**O7==0104 ? ++*O7,O5(04,O7,00):O5(03,O7,00)):
      +    /* T' */ !--O2 ?\
      +                  (**O7==052 ? O5(07,O7,O3*(*++*O7,O5(06,O7,00))):
      +                  !(045-**O7) ? O5(07,O7,O3%(03+(*O7)++,O5(06,O7,00))):
      +                  !(**O7^057) ? O5(07,O7,O3/(03-*++*O7,O5(06,O7,00))):O3):
      +    /* T  */ !(O2+=01-02) ?\
      +                  O5(07,O7,O5(06,O7,00)):
      +    /* E' */ !(O2+=-02/02) ?\
      +                  (!(**O7-053)?O5(011,O7,O3+(++*O7,O5(010,O7,00))):
      +                  !(055^**O7) ? O5(011,O7,O3-(03+*(*O7)++,O5(010,O7,00))):O3):
      +    /* E  */ !(O2-=0563&0215) ?\
      +                  O5(011,O7,O5(010,O7,00)):
      +    /* C  */ (++*O7,O3);
      +    }

      Note N1: It should never enter this state, unless the user invokes the program with no parameters, in which case it just returns 0.

      Note N2: Since the program is properly invoked with 1 parameter, this is the first state it will go into. This state just invokes printf, and sends the parser to state 012 (which is <E>).

      The E and T states work like this:

      -
          int e(){ return eprime( t() ); }
      +
          int e(){ return eprime( t() ); }

      The E' and T' states work like this:

      -
          int eprime( int intermediate )
      -    {
      -        if( ch == '+' )
      -        {
      -            ch = nextchar();
      -            return eprime( intermediate + t() );
      -        }
      -        else return intermediate;
      -    }
      +
          int eprime( int intermediate )
      +    {
      +        if( ch == '+' )
      +        {
      +            ch = nextchar();
      +            return eprime( intermediate + t() );
      +        }
      +        else return intermediate;
      +    }

      The D, X and O states work like this (they assume that they’re initially called with 0):

      -
          int octal( int intermediate )
      -    {
      -        if( ch>='0' && ch<='7' )
      -        {
      -            intermediate = intermediate * 8 + ch - '0';
      -            ch = nextchar();
      -            return octal( intermediate );
      -        }
      -        else return intermediate;
      -    }
      +
          int octal( int intermediate )
      +    {
      +        if( ch>='0' && ch<='7' )
      +        {
      +            intermediate = intermediate * 8 + ch - '0';
      +            ch = nextchar();
      +            return octal( intermediate );
      +        }
      +        else return intermediate;
      +    }

      F and C work similarly.

      make all ``` ## To use: -```sh +``` ./dodsond1 ``` diff --git a/1994/dodsond1/index.html b/1994/dodsond1/index.html index c23f4f268..b92be3032 100644 --- a/1994/dodsond1/index.html +++ b/1994/dodsond1/index.html @@ -141,9 +141,9 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./dodsond1
      +
          ./dodsond1

      Try:

      At the prompt, try entering E3.

      Judges’ remarks:

      diff --git a/1994/dodsond2/README.md b/1994/dodsond2/README.md index 43153667b..1da32eb2a 100644 --- a/1994/dodsond2/README.md +++ b/1994/dodsond2/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -23,7 +23,7 @@ For more detailed information see [1994 dodsond2 bugs](../../bugs.html#1994_dods ## To use: -```sh +``` ./dodsond2 ``` @@ -39,21 +39,21 @@ from working in some cases. ### Alternate build: -```sh +``` make alt ``` The default number of arrows in this version is 3 but if you want to change it, say to 5, try: -```sh +``` make clobber ARROWS=5 alt ``` ### Alternate use: -```sh +``` ./dodsond2.alt ``` diff --git a/1994/dodsond2/index.html b/1994/dodsond2/index.html index 82601d42d..73034a0fb 100644 --- a/1994/dodsond2/index.html +++ b/1994/dodsond2/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      There is an alternate version that allows you to cheat, giving you configurable amount of arrows at the start of the game. See the Alternate code section below.

      @@ -150,19 +150,19 @@ code section below.

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 1994 dodsond2 bugs.

      To use:

      -
          ./dodsond2
      +
          ./dodsond2

      Alternate code:

      This version allows you to choose how many arrows to start with, instead of the default 0. If one tries specifying a value < 0 it will set it to 0.

      Fun fact: this version helped uncover and fix a bug that prevented the entry from working in some cases.

      Alternate build:

      -
          make alt
      +
          make alt

      The default number of arrows in this version is 3 but if you want to change it, say to 5, try:

      -
          make clobber ARROWS=5 alt
      +
          make clobber ARROWS=5 alt

      Alternate use:

      -
          ./dodsond2.alt
      +
          ./dodsond2.alt

      Judges’ remarks:

      Each year people find new ways to squeeze more and more out of the contest rules. Next year, entries that use compression utilities diff --git a/1994/horton/README.md b/1994/horton/README.md index e1a424abb..8a38f2227 100644 --- a/1994/horton/README.md +++ b/1994/horton/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./horton A B C D ``` @@ -16,7 +16,7 @@ ## Try: -```sh +``` ./try.sh ``` @@ -29,14 +29,14 @@ version. ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./horton.alt A B C D ``` @@ -45,7 +45,7 @@ Where A, B, C and D are numbers like with `horton`. ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -80,7 +80,7 @@ It's easily modified to graph *any* 96x160 bitmap on a dumb terminal. See the [gtface](gtface.c) program for another example. Try: -```sh +``` make gtface ./gtface < gtface.data ``` diff --git a/1994/horton/index.html b/1994/horton/index.html index 9ca118141..e6bdf67c1 100644 --- a/1994/horton/index.html +++ b/1994/horton/index.html @@ -141,22 +141,22 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./horton A B C D
      +
          ./horton A B C D

      A, B, C and D are numeric arguments.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Alternate code:

      This confuses cb greatly. See horton.alt.c for an unobfuscated/enhanced version.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      -
          ./horton.alt A B C D
      +
          ./horton.alt A B C D

      Where A, B, C and D are numbers like with horton.

      Alternate try:

      -
          ./try.alt.sh
      +
          ./try.alt.sh

      Judges’ remarks:

      Try to figure out how this program prints, for a given slope, the right character. And for extra credit, try to figure out which @@ -176,8 +176,8 @@ cogs in the wheels of the grand plot to overthrow the cubics!

      Oh, by the way, it uses a self-contained graphtab and frame buffer. It’s easily modified to graph any 96x160 bitmap on a dumb terminal.

      See the gtface program for another example. Try:

      -
          make gtface
      -    ./gtface < gtface.data
      +
          make gtface
      +    ./gtface < gtface.data

      For more information, see my article

      Using GraphTab; USENIX ;login: Sept/Oct 1992, pages 28-31.

                MMMM,M,MM"MM,,,
      diff --git a/1994/imc/README.md b/1994/imc/README.md
      index bd239274c..4cb8e1e3a 100644
      --- a/1994/imc/README.md
      +++ b/1994/imc/README.md
      @@ -1,13 +1,13 @@
       ## To build:
       
      -```sh
      +```
           make all
       ```
       
       
       ## To use:
       
      -```sh
      +```
           ./imc [NUMBER]
       ```
       
      @@ -16,7 +16,7 @@ where `[NUMBER]` is an optional number. Default is 5.
       
       ## Try:
       
      -```sh
      +```
           ./try.sh
       ```
       
      diff --git a/1994/imc/index.html b/1994/imc/index.html
      index 320ff9c49..f91b6ae2d 100644
      --- a/1994/imc/index.html
      +++ b/1994/imc/index.html
      @@ -141,12 +141,12 @@ Location: GB - United Kingdom of Great
       
       
       

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./imc [NUMBER]
      +
          ./imc [NUMBER]

      where [NUMBER] is an optional number. Default is 5.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      This entry’s algorithm is as magic as its output!

      Author’s remarks:

      diff --git a/1994/ldb/README.md b/1994/ldb/README.md index 33bdcb07d..f0082cd05 100644 --- a/1994/ldb/README.md +++ b/1994/ldb/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [1994 ldb bugs](../../bugs.html#1994_ldb). ## To use: -```sh +``` ./ldb < file some_command | ./ldb @@ -27,7 +27,7 @@ For more detailed information see [1994 ldb bugs](../../bugs.html#1994_ldb). ## Try: -```sh +``` ./try.sh ``` diff --git a/1994/ldb/index.html b/1994/ldb/index.html index 481faffd2..99c86de66 100644 --- a/1994/ldb/index.html +++ b/1994/ldb/index.html @@ -141,17 +141,17 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 1994 ldb bugs.

      To use:

      -
          ./ldb < file
      -
      -    some_command | ./ldb
      +
          ./ldb < file
      +
      +    some_command | ./ldb

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      Trigraphs are natural obfuscators. Most C-beautifiers become C-uglifiers because they don’t handle them correctly.

      diff --git a/1994/schnitzi/README.md b/1994/schnitzi/README.md index 1be00157b..06c925d81 100644 --- a/1994/schnitzi/README.md +++ b/1994/schnitzi/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -23,14 +23,14 @@ For more detailed information see [1994 schnitzi bugs](../../bugs.html#1994_schn ## To use: -```sh +``` ./schnitzi < textfile ``` ## Try: -```sh +``` ./try.sh ``` @@ -49,7 +49,7 @@ buffer size. This is due to a comment which is explained in more detail in ### Alternate build: -```sh +``` make alt ``` @@ -62,7 +62,7 @@ feeding the source code to it will not work right. ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -71,7 +71,7 @@ feeding the source code to it will not work right. Try: -```sh +``` ./schnitzi < schnitzi.c ``` @@ -96,14 +96,14 @@ is run by redirecting a file into the executable on the command line; for instance, for the file 'info', the program would be run as follows: -```sh +``` ./schnitzi < info ``` The program generates interesting results when its source file is used as input: -```sh +``` ./schnitzi < schnitzi.c ``` diff --git a/1994/schnitzi/index.html b/1994/schnitzi/index.html index 037beefa6..2cab2a491 100644 --- a/1994/schnitzi/index.html +++ b/1994/schnitzi/index.html @@ -141,7 +141,7 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      There are two alternate versions, one that has an increased buffer size and one that uses fgets(); neither are completely functional. See below section bugs and (mis)features for details and the alternate @@ -151,9 +151,9 @@ code section for how to use.

          STATUS: uses gets() - change to fgets() if possible

      For more detailed information see 1994 schnitzi bugs.

      To use:

      -
          ./schnitzi < textfile
      +
          ./schnitzi < textfile

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Alternate code:

      The first version, schnitzi.alt.c, uses fgets(3) but when fed its own code it will generate code that still uses gets(3). What’s more is it will not @@ -163,15 +163,15 @@ its own source code it will generate code that can compile but with the original buffer size. This is due to a comment which is explained in more detail in 1994/schnitzi bugs.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      Use schnitzi.alt and schnitzi.alt2 as you would schnitzi above except that feeding the source code to it will not work right.

      Alternate try:

      -
          ./try.alt.sh
      +
          ./try.alt.sh

      Judges’ remarks:

      Try:

      -
          ./schnitzi < schnitzi.c
      +
          ./schnitzi < schnitzi.c

      Compare the output of the program with its source. Sure the output is different, but there is more than meets the diff’s eye. Can you find out why?

      @@ -187,10 +187,10 @@ second row is written down the second column, etc. The program is run by redirecting a file into the executable on the command line; for instance, for the file ‘info’, the program would be run as follows:

      -
          ./schnitzi < info
      +
          ./schnitzi < info

      The program generates interesting results when its source file is used as input:

      -
          ./schnitzi < schnitzi.c
      +
          ./schnitzi < schnitzi.c

      The result of this command is a program which does the exact same thing – in other words, both the program and the “flipped” version of itself work identically (you’ll need to redirect the diff --git a/1994/shapiro/README.md b/1994/shapiro/README.md index 61080e408..f99824384 100644 --- a/1994/shapiro/README.md +++ b/1994/shapiro/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -19,7 +19,7 @@ For more detailed information see [1994 shapiro bugs](../../bugs.html#1994_shapi ## To use: -```sh +``` ./shapiro & ``` @@ -28,7 +28,7 @@ Now find the clock in the same terminal window (or console if at the console). ## Try: -```sh +``` ./shapiro ^Z bg diff --git a/1994/shapiro/index.html b/1994/shapiro/index.html index 120b38abc..be7496a8b 100644 --- a/1994/shapiro/index.html +++ b/1994/shapiro/index.html @@ -141,24 +141,24 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: missing file - please provide it
           STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 1994 shapiro bugs.

      To use:

      -
          ./shapiro &
      +
          ./shapiro &

      Now find the clock in the same terminal window (or console if at the console).

      Try:

      -
          ./shapiro
      -    ^Z
      -    bg
      -    ps x
      -    fg
      -    ^C
      -
      -    ./shapiro_t1
      +
          ./shapiro
      +    ^Z
      +    bg
      +    ps x
      +    fg
      +    ^C
      +
      +    ./shapiro_t1

      Notice what you see in the output of ps! Observe too what happens after you bring it back to the foreground.

      Judges’ remarks:

      diff --git a/1994/smr/README.md b/1994/smr/README.md index f9b7516f5..4c7feef23 100644 --- a/1994/smr/README.md +++ b/1994/smr/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./smr ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/1994/smr/index.html b/1994/smr/index.html index 8b592cbf3..14ea1cd45 100644 --- a/1994/smr/index.html +++ b/1994/smr/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./smr
      +
          ./smr

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      Nearly every year, one or more people would submit what they claimed was the world’s smallest self reproducing program. While the sizes diff --git a/1994/tvr/README.md b/1994/tvr/README.md index d6988575b..19d356653 100644 --- a/1994/tvr/README.md +++ b/1994/tvr/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -22,7 +22,7 @@ For more detailed information see [1994 tvr bugs](../../bugs.html#1994_tvr). ## To use: -```sh +``` ./tvr mode screensize/2 < colormapfile ``` @@ -31,7 +31,7 @@ Mode may be a value from 0 to 12. ## Try: -```sh +``` ./try.color.sh # for colour displays ./try.bw.sh # for Black & White displays ``` @@ -44,14 +44,14 @@ The author provided us a spoiler version that might be of interest to some. ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./tvr.alt altmode screensize/2 < colormapfile ``` @@ -61,7 +61,7 @@ where `altmode` `1` - `4` correspond to mode `0` - `3` in the original entry and ### Alternate try: -```sh +``` ./try.alt.color.sh # for colour displays ./try.alt.bw.sh # for Black & White displays ``` @@ -123,7 +123,7 @@ the fourth is a variation of that with more nice effects. ### Usage: -```sh +``` ./tvr mode screensize/2 < colormapfile ``` diff --git a/1994/tvr/index.html b/1994/tvr/index.html index 687fb808f..4c836d3d0 100644 --- a/1994/tvr/index.html +++ b/1994/tvr/index.html @@ -141,7 +141,7 @@ Location: FI - Republic of Finland

      To build:

      -
          make all
      +
          make all

      The author provided a spoiler version as alt code. See Alternate code below.

      Bugs and (Mis)features:

      @@ -149,22 +149,22 @@ code below.

          STATUS: known bug - please help us fix

      For more detailed information see 1994 tvr bugs.

      To use:

      -
          ./tvr mode screensize/2 < colormapfile
      +
          ./tvr mode screensize/2 < colormapfile

      Mode may be a value from 0 to 12.

      Try:

      -
          ./try.color.sh                      # for colour displays
      -    ./try.bw.sh                 # for Black & White displays
      +
          ./try.color.sh                      # for colour displays
      +    ./try.bw.sh                 # for Black & White displays

      Alternate code:

      The author provided us a spoiler version that might be of interest to some.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      -
          ./tvr.alt altmode screensize/2 < colormapfile
      +
          ./tvr.alt altmode screensize/2 < colormapfile

      where altmode 1 - 4 correspond to mode 0 - 3 in the original entry and altmode 0 calculates Mandelbrot/Julian sets correctly.

      Alternate try:

      -
          ./try.alt.color.sh                  # for colour displays
      -    ./try.alt.bw.sh                     # for Black & White displays
      +
          ./try.alt.color.sh                  # for colour displays
      +    ./try.alt.bw.sh                     # for Black & White displays

      Judges’ remarks:

      This entry requires the use of X11. It will form two windows (hopefully your window manager will ask you where to place these in your display) which you @@ -208,7 +208,7 @@ noise.

      second is a variation of that. The third makes nice 3D-look-a-like effects and the fourth is a variation of that with more nice effects.

      Usage:

      -
          ./tvr mode screensize/2 < colormapfile
      +
          ./tvr mode screensize/2 < colormapfile

      The first parameter is the operating-mode of the program. There are 4 fractal pairs and 3 display modes, making total of 12 modes. screensize is half of the actual screenlength/width. I.e. if you use 128 as a second parameter, you will diff --git a/1994/weisberg/README.md b/1994/weisberg/README.md index ca72d9302..f12d8ab7b 100644 --- a/1994/weisberg/README.md +++ b/1994/weisberg/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -10,20 +10,20 @@ code](#alternate-code) below for more details. ## To use: -```sh +``` ./weisberg ``` ## Try: -```sh +``` ./try.sh ``` If you have `primes(1)` installed you might also wish to try: -```sh +``` ./primes.sh number ``` @@ -40,14 +40,14 @@ something with you might try this version. ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./weisberg.alt ``` diff --git a/1994/weisberg/index.html b/1994/weisberg/index.html index 260404528..b2e0e7d54 100644 --- a/1994/weisberg/index.html +++ b/1994/weisberg/index.html @@ -141,15 +141,15 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      There is an alternate version that uses more memory. See alternate code below for more details.

      To use:

      -
          ./weisberg
      +
          ./weisberg

      Try:

      -
          ./try.sh
      +
          ./try.sh

      If you have primes(1) installed you might also wish to try:

      -
          ./primes.sh number
      +
          ./primes.sh number

      where number is a positive number, defaulting to 15. The try.sh script will also do this.

      Alternate code:

      @@ -157,9 +157,9 @@ script will also do this.

      have some 512 Megabytes of virtual memory lying around with to do something with you might try this version.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      -
          ./weisberg.alt
      +
          ./weisberg.alt

      Lesser systems will find this alternative version a good way to create a core file. :-)

      Judges’ remarks:

      diff --git a/1994/westley/README.md b/1994/westley/README.md index 07fec758a..7707e4bd4 100644 --- a/1994/westley/README.md +++ b/1994/westley/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make alt ``` @@ -15,7 +15,7 @@ see [Original code](#original-code) below. ## To use: -```sh +``` ./westley.alt ``` @@ -39,14 +39,14 @@ from start to finish. For something more interesting try compiling it with different `cc -D` arguments and then run the program each time. For example: -```sh +``` cc -Describe -Door westley.alt.c -o westley.alt && ./westley.alt cc -Describe -Drain westley.alt.c -o westley.alt && ./westley.alt ``` To see the game from start to finish, try: -```sh +``` ./try.alt.sh ``` @@ -65,7 +65,7 @@ reason that we recommend you try it first. ### Original build: -```sh +``` make all ``` @@ -95,14 +95,14 @@ error messages; there is no running the program. For something more interesting try compiling it with different `cc -D` arguments: -```sh +``` cc -Describe -Door westley.c cc -Describe -Drain westley.c ``` To see the game from start to complete, try: -```sh +``` ./try.sh ``` @@ -115,7 +115,7 @@ For spoilers see the end of the notes from the author below. To use: -```sh +``` ./try.sh ``` @@ -131,7 +131,7 @@ This program is a simple adventure game which uses only C preprocessor error messages (for missing `#include` files) as output. To begin, try to compile the program with no options: -```sh +``` cc westley.c ``` @@ -159,7 +159,7 @@ missing include file name, which functions as the game text. To "do" things, all words must start with `-D`. For example, to look at the door, do: -```sh +``` cc -Describe -Door prog.c ``` @@ -176,7 +176,7 @@ Here is a walk-through for the game, including a few dead-ends: ### SPOILER -```sh +``` cc -Describe -Door westley.c cc -Describe -Drain westley.c cc -Describe -Dwarf westley.c diff --git a/1994/westley/index.html b/1994/westley/index.html index e0d7aa76c..0603556f4 100644 --- a/1994/westley/index.html +++ b/1994/westley/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

      To build:

      -
          make alt
      +
          make alt

      We recommend that you try the alternate version first as the original entry requires (for better display) 80 columns and 8 character tabs with wraparound.

      The alt code uses the same logic as the original code except that the original @@ -149,7 +149,7 @@ code used #includes of files that do not exist to generate the mess compiler errors) whereas the alt code uses printf(3). For the original entry see Original code below.

      To use:

      -
          ./westley.alt
      +
          ./westley.alt

      The purpose of the game is to escape the dungeon. Depending on the compiler line you will get a different message when you run the program. One compiler line will make you win the game (escape the dungeon) and others will show something @@ -164,10 +164,10 @@ from start to finish.

      Try:

      For something more interesting try compiling it with different cc -D arguments and then run the program each time. For example:

      -
          cc -Describe -Door westley.alt.c -o westley.alt && ./westley.alt
      -    cc -Describe -Drain westley.alt.c -o westley.alt && ./westley.alt
      +
          cc -Describe -Door westley.alt.c -o westley.alt && ./westley.alt
      +    cc -Describe -Drain westley.alt.c -o westley.alt && ./westley.alt

      To see the game from start to finish, try:

      -
          ./try.alt.sh
      +
          ./try.alt.sh

      Original code:

      The purpose of the game is to escape the dungeon via the compiler line where you get messages as compiler errors. Depending on the compiler line you @@ -177,7 +177,7 @@ game!

      wraparound. The alternate code does not have this limitation and it is for this reason that we recommend you try it first.

      Original build:

      -
          make all
      +
          make all

      There are a variety of different -D flags you can give to cc that change the message you get. You might wish to look at the source code to get a better idea or see below in the Original try section for @@ -196,15 +196,15 @@ error messages; there is no running the program.

      Original try:

      For something more interesting try compiling it with different cc -D arguments:

      -
          cc -Describe -Door westley.c
      -    cc -Describe -Drain westley.c
      +
          cc -Describe -Door westley.c
      +    cc -Describe -Drain westley.c

      To see the game from start to complete, try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      Not all compiler errors are bad.

      For spoilers see the end of the notes from the author below.

      To use:

      -
          ./try.sh
      +
          ./try.sh

      Author’s remarks:

      This program, in accordance with the rules, compiles into a legal C program without human intervention. However, it simply compiles @@ -213,7 +213,7 @@ to actually compile the program.

      This program is a simple adventure game which uses only C preprocessor error messages (for missing #include files) as output. To begin, try to compile the program with no options:

      -
          cc westley.c
      +
          cc westley.c

      This will fail, producing an error message for a missing #include file as the opening description. Your terminal should be set for 80 columns, 8 character tabs, and wraparound, as there is no way @@ -232,7 +232,7 @@ to reliably output newlines. You should see something like this missing include file name, which functions as the game text.

      To “do” things, all words must start with -D. For example, to look at the door, do:

      -
          cc -Describe -Door prog.c
      +
          cc -Describe -Door prog.c

      …and you will get another error message telling you about the door. (note: some compilers will stop after the first missing include file, while others will continue to try compiling; the latter will repeat @@ -241,24 +241,24 @@ with “verbose” turned on).

      The goal of the game is to escape the dungeon.

      Here is a walk-through for the game, including a few dead-ends:

      SPOILER

      -
          cc -Describe -Door westley.c
      -    cc -Describe -Drain westley.c
      -    cc -Describe -Dwarf westley.c
      -    cc -Describe -Debris westley.c # or -Dungeon
      -    cc -Describe -Desk westley.c
      -    cc -Describe -Dime westley.c
      -    cc -Describe -Directory westley.c
      -    cc -Dial -DUNgeon0614 westley.c
      -    cc -Drink -Daiquiri westley.c
      -    cc -Drop -Daiquiri westley.c
      -    cc -Drop -Dwarf -Daiquiri westley.c # or -Drop -Down -Daiquiri
      -    cc -Describe -Document westley.c
      -    cc -Depress -Dotted -Dog westley.c
      -    cc -Depress -Dalmatian westley.c # also accepts "Dalmation" [sic]
      -    cc -Deposit -Dime westley.c
      -    cc -Drop -Donut westley.c
      -    cc -Drop -Donut -Down -Drain westley.c # or -Drop -Dwarf -Donut
      -    # (at this point, you win!)
      +
          cc -Describe -Door westley.c
      +    cc -Describe -Drain westley.c
      +    cc -Describe -Dwarf westley.c
      +    cc -Describe -Debris westley.c # or -Dungeon
      +    cc -Describe -Desk westley.c
      +    cc -Describe -Dime westley.c
      +    cc -Describe -Directory westley.c
      +    cc -Dial -DUNgeon0614 westley.c
      +    cc -Drink -Daiquiri westley.c
      +    cc -Drop -Daiquiri westley.c
      +    cc -Drop -Dwarf -Daiquiri westley.c # or -Drop -Down -Daiquiri
      +    cc -Describe -Document westley.c
      +    cc -Depress -Dotted -Dog westley.c
      +    cc -Depress -Dalmatian westley.c # also accepts "Dalmation" [sic]
      +    cc -Deposit -Dime westley.c
      +    cc -Drop -Donut westley.c
      +    cc -Drop -Donut -Down -Drain westley.c # or -Drop -Dwarf -Donut
      +    # (at this point, you win!)

      Note that the game has no real state information; you can type these commands in any order, at any time. Also note that word order is unimportant.

      diff --git a/1995/cdua/README.md b/1995/cdua/README.md index 7ad1ff8b2..f8fb27678 100644 --- a/1995/cdua/README.md +++ b/1995/cdua/README.md @@ -4,7 +4,7 @@ We recommend that you try the alternate version first so you can see what this entry looked like back in 1995 (with a configurable speed). See the [original code](#original-code) section below for the original entry. -```sh +``` make alt ``` @@ -28,14 +28,14 @@ For more detailed information see [1995 cdua bugs](../../bugs.html#1995_cdua). ## To use: -```sh +``` ./cdua.alt ``` ## Try: -```sh +``` make SLEEP=1500 clobber alt ./cdua.alt # press enter and watch it go much faster! @@ -43,7 +43,7 @@ For more detailed information see [1995 cdua bugs](../../bugs.html#1995_cdua). You might also like to try: -```sh +``` make SLEEP=65000 clobber alt ./cdua.alt # press enter and watch it go much slower! @@ -66,14 +66,14 @@ fast your computer is :-) or use both to see the difference, you can do so. ### Original build: -```sh +``` make all ``` ### Original use: -```sh +``` ./cdua ``` diff --git a/1995/cdua/index.html b/1995/cdua/index.html index b33fd33d4..a37eb0891 100644 --- a/1995/cdua/index.html +++ b/1995/cdua/index.html @@ -144,7 +144,7 @@ Location: ZZ - Unknown locationWe recommend that you try the alternate version first so you can see what this entry looked like back in 1995 (with a configurable speed). See the original code section below for the original entry.

      -
          make alt
      +
          make alt

      The alternate version uses usleep(3) with SLEEP (defined in the Makefile, default 3000) microseconds to make it easier to see the maze being solved in real time. You can redefine SLEEP at compile time to reconfigure it in case @@ -155,15 +155,15 @@ making it 100000 (which is actually fun :-) ).

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 1995 cdua bugs.

      To use:

      -
          ./cdua.alt
      +
          ./cdua.alt

      Try:

      -
          make SLEEP=1500 clobber alt
      -
      -    ./cdua.alt # press enter and watch it go much faster!
      +
          make SLEEP=1500 clobber alt
      +
      +    ./cdua.alt # press enter and watch it go much faster!

      You might also like to try:

      -
          make SLEEP=65000 clobber alt
      -
      -    ./cdua.alt # press enter and watch it go much slower!
      +
          make SLEEP=65000 clobber alt
      +
      +    ./cdua.alt # press enter and watch it go much slower!

      Do you see anything strange in this version when SLEEP is a high value like 65000? What happens if you use 100000? Is this strange output still there? Why?

      @@ -174,9 +174,9 @@ actually see it being solved in real time rather than have it go by in a flash.<

      If you wish to use the original version, for instance if you wish to see how fast your computer is :-) or use both to see the difference, you can do so.

      Original build:

      -
          make all
      +
          make all

      Original use:

      -
          ./cdua
      +
          ./cdua

      Judges’ remarks:

      This could be used as the basis of an a-maze-ing screen exerciser.

      Author’s remarks:

      diff --git a/1995/dodsond1/README.md b/1995/dodsond1/README.md index c75017483..41a232325 100644 --- a/1995/dodsond1/README.md +++ b/1995/dodsond1/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./dodsond1 < text_file ``` ## Try: -```sh +``` ./dodsond1 < README.md ``` @@ -32,7 +32,7 @@ You might consider giving the following input: ... which can be done like: -```c +``` ./try.sh ``` diff --git a/1995/dodsond1/index.html b/1995/dodsond1/index.html index 97f2fe640..50bb9f564 100644 --- a/1995/dodsond1/index.html +++ b/1995/dodsond1/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./dodsond1 < text_file
      +
          ./dodsond1 < text_file

      Try:

      -
          ./dodsond1 < README.md
      +
          ./dodsond1 < README.md

      Judges’ remarks:

      You might consider giving the following input:

          ... a male (who) gets very, very frustrated sitting in a chair all
      @@ -153,7 +153,7 @@ Location: US - United States of America
           giraffes.
                   -- Adjunct Professor Newt Gingrich, Reinhardt College, 1/7/95

      … which can be done like:

      -
          ./try.sh
      +
          ./try.sh

      Author’s remarks:

      Istha ogrampra akesta Englishwa extta aswa inputwa andwa anslatestra itwa intowa Igpa Atinla.

      diff --git a/1995/dodsond2/README.md b/1995/dodsond2/README.md index 34950eb55..730f6386a 100644 --- a/1995/dodsond2/README.md +++ b/1995/dodsond2/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./dodsond2 ``` diff --git a/1995/dodsond2/index.html b/1995/dodsond2/index.html index 094b8f746..a5c39633c 100644 --- a/1995/dodsond2/index.html +++ b/1995/dodsond2/index.html @@ -141,9 +141,9 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./dodsond2
      +
          ./dodsond2

      Judges’ remarks:

      An amazing entry!

      The official chef enjoyed solving the maze, which she did on the first diff --git a/1995/esde/README.md b/1995/esde/README.md index bb1eb8aa4..d630bb55c 100644 --- a/1995/esde/README.md +++ b/1995/esde/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./esde data-file word ``` @@ -16,7 +16,7 @@ where data-file contains lines of < 255 chars in length. ## Try: -```sh +``` ./try.sh ``` diff --git a/1995/esde/index.html b/1995/esde/index.html index 7c357ca0d..2ce424e1e 100644 --- a/1995/esde/index.html +++ b/1995/esde/index.html @@ -141,12 +141,12 @@ Location: PL - Republic of Poland

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./esde data-file word
      +
          ./esde data-file word

      where data-file contains lines of < 255 chars in length.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      When reading the source be careful to distinguish between variable names and library functions.

      diff --git a/1995/garry/README.md b/1995/garry/README.md index 383f07c20..2c87e7da6 100644 --- a/1995/garry/README.md +++ b/1995/garry/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./garry output_file ``` ## Try: -```sh +``` ./try.sh ``` @@ -29,21 +29,21 @@ left intact) looked very much like a rat "dropping core". See ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./garry.alt output_file ``` ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -63,13 +63,13 @@ environment variables. The calling syntax is pretty simple, just use it with `stdio`-redirection or inside pipelines, e.g.: -```sh +``` ./garry converted_file ``` or -```sh +``` cat all_my_files/* | ./garry | lp ``` @@ -87,7 +87,7 @@ Unknown Env-variables or malformed expressions are ignored and kept intact. Additionally, the filter replaces escaped octal values in the environment variables by their binary representation, e.g.: -```sh +``` $ TEST="\110\145\154\154\157" $ export TEST $ echo '$TEST$' | ./garry diff --git a/1995/garry/index.html b/1995/garry/index.html index 910709ec9..d7386e146 100644 --- a/1995/garry/index.html +++ b/1995/garry/index.html @@ -141,22 +141,22 @@ Location: DE - Federal Republic of Germ

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./garry <input_file >output_file
      +
          ./garry <input_file >output_file

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Alternate code:

      While it may not have been the intention of the author, the judges noted that the C pre-processed version (with the #includes left intact) looked very much like a rat “dropping core”. See garry.alt.c and judge for yourself!

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      -
          ./garry.alt <input_file >output_file
      +
          ./garry.alt <input_file >output_file

      Alternate try:

      -
          ./try.alt.sh
      +
          ./try.alt.sh

      Judges’ remarks:

      The author was kind enough to provide a less obfuscated version of the source called garry.fmt.c.

      @@ -166,9 +166,9 @@ incorporating the ability to create binary from escaped data in the environment variables.

      The calling syntax is pretty simple, just use it with stdio-redirection or inside pipelines, e.g.:

      -
          ./garry <file_to_convert >converted_file
      +
          ./garry <file_to_convert >converted_file

      or

      -
          cat all_my_files/* | ./garry | lp
      +
          cat all_my_files/* | ./garry | lp

      The syntax of the conversion of the input file is as follows: To include the value of an environment variable in the output file, place the name of the variable between $-signs in the input, e.g.:

      @@ -177,10 +177,10 @@ variable between $-signs in the input, e.g.:

      Unknown Env-variables or malformed expressions are ignored and kept intact.

      Additionally, the filter replaces escaped octal values in the environment variables by their binary representation, e.g.:

      -
          $ TEST="\110\145\154\154\157"
      -    $ export TEST
      -    $ echo '$TEST$' | ./garry
      -    Hello
      +
          $ TEST="\110\145\154\154\157"
      +    $ export TEST
      +    $ echo '$TEST$' | ./garry
      +    Hello
      make all ``` ## To use: -```sh +``` ./heathbar num num ``` @@ -16,7 +16,7 @@ where num is a non-negative number. ## Try: -```sh +``` ./try.sh ``` diff --git a/1995/heathbar/index.html b/1995/heathbar/index.html index de46c9f2f..330790ffd 100644 --- a/1995/heathbar/index.html +++ b/1995/heathbar/index.html @@ -144,12 +144,12 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./heathbar num num
      +
          ./heathbar num num

      where num is a non-negative number.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      The main reason we liked this entry was mainly because the main effect of the source was self documenting! :-)

      diff --git a/1995/leo/README.md b/1995/leo/README.md index 7904614fa..d41fa0228 100644 --- a/1995/leo/README.md +++ b/1995/leo/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [1995 leo bugs](../../bugs.html#1995_leo). ## To use: -```sh +``` ./leo [ deep ] [ right ] [ Variable ] [ cycle [ freq ] ] ``` @@ -27,7 +27,7 @@ See the author's information below on these details. ## Try: -```sh +``` ./try.sh ``` @@ -52,7 +52,7 @@ characters on the command line - anything that's not a number is a candidate.) The usage is: -```sh +``` ./leo [ deep ] [ right ] [ Variable ] [ cycle [ freq ] ] ``` @@ -68,7 +68,7 @@ to be present if you want to enter `freq` (and you usually do). Some options to try (besides the obvious): -```sh +``` ./leo 1 | cat - /dev/tty | gs - ``` @@ -191,19 +191,19 @@ the opening for step 1 is not a single line but a cross: To watch it repeatedly (as a screen saver), use: -```sh +``` ./leo 2 | cat - /dev/tty | gs - ``` The command line: -```sh +``` ./leo Variable 1 | cat - /dev/tty | gs - ``` draws the same as above. Try: -```sh +``` ./leo Variable 1 1 | cat - /dev/tty | gs - ``` @@ -228,7 +228,7 @@ If `Variable` is used, the actual value of `cycle` doesn't matter, as far as it is > 1. To figure out what difference `cycle` makes when `Variable` is not used, try -```sh +``` ./leo Variable 37 80 | cat - /dev/tty | gs - ``` diff --git a/1995/leo/index.html b/1995/leo/index.html index 8a8398a1f..52b26955d 100644 --- a/1995/leo/index.html +++ b/1995/leo/index.html @@ -141,16 +141,16 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: known bug - please help us fix

      For more detailed information see 1995 leo bugs.

      To use:

      -
          ./leo [ deep ] [ right ] [ Variable ] [ cycle [ freq ] ]
      +
          ./leo [ deep ] [ right ] [ Variable ] [ cycle [ freq ] ]

      See the author’s information below on these details.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      Press return after each image is drawn.

      The variable names are element-ary. If you find this confusing, @@ -163,7 +163,7 @@ 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.)

      Author’s remarks:

      The usage is:

      -
          ./leo [ deep ] [ right ] [ Variable ] [ cycle [ freq ] ]
      +
          ./leo [ 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) that’s supposed to be in the range 0..100 (bigger values are allowed, however). Invalid parameters and @@ -173,7 +173,7 @@ equivalent to ./leo 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 -
      +
          ./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) at the center of the sheet:

      @@ -253,11 +253,11 @@ 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 -
      +
          ./leo 2 | cat - /dev/tty | gs -

      The command line:

      -
          ./leo Variable 1 | cat - /dev/tty | gs -
      +
          ./leo Variable 1 | cat - /dev/tty | gs -

      draws the same as above. Try:

      -
          ./leo Variable 1 1 | cat - /dev/tty | gs -
      +
          ./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 seconds), @@ -272,7 +272,7 @@ if you want to pipe the output to a printer.

      If Variable is used, the actual value of cycle doesn’t matter, as far as it is > 1. To figure out what difference cycle makes when Variable is not used, try

      -
          ./leo Variable 37 80 | cat - /dev/tty | gs -
      +
          ./leo Variable 37 80 | cat - /dev/tty | gs -

      and other values of cycle; smaller values usually require smaller values of freq for the patterns to be non-trivial.

      The options deep and right make the patterns to be drawn in different diff --git a/1995/makarios/README.md b/1995/makarios/README.md index ff9a7aa51..764a049c8 100644 --- a/1995/makarios/README.md +++ b/1995/makarios/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./makarios ``` diff --git a/1995/makarios/index.html b/1995/makarios/index.html index a792f0d5d..437bc16f6 100644 --- a/1995/makarios/index.html +++ b/1995/makarios/index.html @@ -144,9 +144,9 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./makarios
      +
          ./makarios

      Judges’ remarks:

      The judges were impressed that such a small program could do so much! Can you figure out how it does it?

      diff --git a/1995/savastio/README.md b/1995/savastio/README.md index d503276dc..1535c4c45 100644 --- a/1995/savastio/README.md +++ b/1995/savastio/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [1995 savastio bugs](../../bugs.html#1995_sava ## To use: -```sh +``` ./savastio # enter a POSITIVE number such as 100 ``` @@ -29,7 +29,7 @@ what happens if you give a non-number? ## Try: -```sh +``` ./try.sh ``` diff --git a/1995/savastio/index.html b/1995/savastio/index.html index 02070fc2e..fccf6413e 100644 --- a/1995/savastio/index.html +++ b/1995/savastio/index.html @@ -141,18 +141,18 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 1995 savastio bugs.

      To use:

      -
          ./savastio
      -    # enter a POSITIVE number such as 100
      +
          ./savastio
      +    # enter a POSITIVE number such as 100

      NOTE: if you specify a negative number it will get stuck, showing no output. But what happens if you give a non-number?

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      I know an l when I see a 1.

      Author’s remarks:

      diff --git a/1995/schnitzi/README.md b/1995/schnitzi/README.md index 2875d4505..ce1dcc707 100644 --- a/1995/schnitzi/README.md +++ b/1995/schnitzi/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./schnitzi num ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/1995/schnitzi/index.html b/1995/schnitzi/index.html index df4d4f0bc..4ec2890a1 100644 --- a/1995/schnitzi/index.html +++ b/1995/schnitzi/index.html @@ -141,11 +141,11 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./schnitzi num
      +
          ./schnitzi num

      Try:

      -
          ./try.sh
      +
          ./try.sh

      WARNING: the author warns to not use too high a number! If you wish to ignore the warning it is an exercise to determine how high is too high. :-)

      Judges’ remarks:

      diff --git a/1995/spinellis/README.md b/1995/spinellis/README.md index 4a5c104a9..b204ba18c 100644 --- a/1995/spinellis/README.md +++ b/1995/spinellis/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./spinellis < spinellis.c ``` diff --git a/1995/spinellis/index.html b/1995/spinellis/index.html index 3e90ac12c..d4aff492f 100644 --- a/1995/spinellis/index.html +++ b/1995/spinellis/index.html @@ -141,9 +141,9 @@ Location: GR - Hellenic Republic (

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./spinellis < spinellis.c
      +
          ./spinellis < spinellis.c

      Judges’ remarks:

      While the code does not abuse the rules, its output surely does!

      P.S. Does the source have any spelling errors?

      diff --git a/1995/vanschnitz/README.md b/1995/vanschnitz/README.md index 6caee70fc..16b12e557 100644 --- a/1995/vanschnitz/README.md +++ b/1995/vanschnitz/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -21,14 +21,14 @@ For more detailed information see [1995 vanschnitz bugs](../../bugs.html#1995_va ## To use: -```sh +``` ./vanschnitz ``` ## Try: -```sh +``` ./try.sh ``` @@ -43,7 +43,7 @@ to first try and figure out the program without the spoiler. ### Alternate build: -```sh +``` make alt ``` @@ -84,7 +84,7 @@ line. For instance, to cause the compiler to solve the Towers of Hanoi problem with four disks, you would compile the program like this: -```sh +``` gcc hanoi.c -o hanoi -Dn=4 ``` @@ -111,7 +111,7 @@ concatenated; a version that does not use this feature has been included for people who can only run K&R). A good way to see the resulting program (on a Unix system) is to do the command -```sh +``` gcc hanoi.c -E -Dn=5 | grep -v \# | grep -v ^\$ ``` diff --git a/1995/vanschnitz/index.html b/1995/vanschnitz/index.html index 43b5062d9..84128b98a 100644 --- a/1995/vanschnitz/index.html +++ b/1995/vanschnitz/index.html @@ -144,7 +144,7 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      The authors provided a spoiler version, originally uuencoded but uudecoded by us in 2023. See Alternate code below.

      Bugs and (Mis)features:

      @@ -152,16 +152,16 @@ in 2023. See Alternate code below.

          STATUS: missing file - please provide it

      For more detailed information see 1995 vanschnitz bugs.

      To use:

      -
          ./vanschnitz
      +
          ./vanschnitz

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Alternate code:

      The authors provided a spoiler version of the program. Originally uuencoded we have decoded it for the wider audience in vanschnitz.alt.c. The uuencoded blob is still available in their remarks below. They encourage you to first try and figure out the program without the spoiler.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      Use vanschnitz.alt as you would vanschnitz above.

      Judges’ remarks:

      @@ -187,7 +187,7 @@ for. This is done by defining the symbol n on the compile line. For instance, to cause the compiler to solve the Towers of Hanoi problem with four disks, you would compile the program like this:

      -
          gcc hanoi.c -o hanoi -Dn=4
      +
          gcc hanoi.c -o hanoi -Dn=4

      A default value of 5 will be used for n if you do not define it on the command line. The value of n cannot be greater than fifteen (the compiler we used to test has a limit on the #include @@ -208,7 +208,7 @@ ANSI C feature in which adjacent character strings are concatenated; a version that does not use this feature has been included for people who can only run K&R). A good way to see the resulting program (on a Unix system) is to do the command

      -
          gcc hanoi.c -E -Dn=5 | grep -v \# | grep -v ^\$
      +
          gcc hanoi.c -E -Dn=5 | grep -v \# | grep -v ^\$

      For an odd number of disks, the program will provide a solution wherein the disks end up on peg 2; for an even number of disks, they will end on peg 3. This should diff --git a/1996/august/README.md b/1996/august/README.md index b709d7931..a941d549e 100644 --- a/1996/august/README.md +++ b/1996/august/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [1996 august bugs](../../bugs.html#1996_august ## To use: -```sh +``` cat august.c test.oc | ./august > test.oo ./august < test.oo ``` @@ -33,7 +33,7 @@ The above should print a `!` followed by a newline. ## Try: -```sh +``` ./try.sh ``` @@ -43,33 +43,33 @@ The above should print a `!` followed by a newline. This entry can feed on itself. If you C pre-process the source, you can compile the interpreter: -```sh +``` make august.oc ``` We can now compile the interpreter as follows: -```sh +``` cat august.c august.oc | ./august > august.oo ``` and use the compiled interpreter to execute some previously compiled code: -```sh +``` cat august.oo test.oo | ./august ``` And we can have the compiled interpreter interpret itself which in turn compiles the test program: -```sh +``` cat august.oo august.oo fac.oo | ./august ``` And if you have lots of spare time, you can recurse one level deeper: -```sh +``` cat august.oo august.oo august.oo fac.oo | ./august ``` @@ -107,25 +107,25 @@ can go wrong. But this is what seasoned C programmers are used to. Assume that the interpreter has been compiled (source in [august.c](august.c) and binary in august) and that we have this in a file named `test.oc`: -```c +``` main() { putchar('!'); putchar('\n'); exit(0); } ``` We can then compile by -```sh +``` cat august.c test.oc | ./august > test.oo ``` And run the compiled program by -```sh +``` ./august < test.oo ``` Or even simpler: -```sh +``` cat august.c test.oc | ./august | ./august ``` @@ -141,26 +141,26 @@ need to use an external one. To pre-process [august.c](august.c) use the command from the Makefile, but add the `-E` flag and change 60000 to 40000, i.e.: -```sh +``` cc -E -DZ=40000 .... august.c > august.oc ``` If `august.oc` contain some junk line starting with a `#` (most likely it does) then remove it like: -```sh +``` sed -i'' '/^#/d' august.oc ``` OK, we can now compile the interpreter: -```sh +``` cat august.c august.oc | ./august > august.oo ``` And we can run it: -```sh +``` cat august.oo test.oo | ./august ``` @@ -168,13 +168,13 @@ Here we have the interpreter interpreting another interpreter that runs the program. Did you think that was too fast? Just throw in another level of interpretation: -```sh +``` cat august.oo august.oo test.oo | ./august ``` And another... -```sh +``` cat august.oo august.oo august.oo test.oo | ./august ``` diff --git a/1996/august/index.html b/1996/august/index.html index 5b7301421..d95a707e8 100644 --- a/1996/august/index.html +++ b/1996/august/index.html @@ -141,34 +141,34 @@ Location: SE - Kingdom of Sweden (

      To build:

      -
          make all
      +
          make all

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: doesn't work with some compilers - please provide alternative code or fix for more compilers

      For more detailed information see 1996 august bugs.

      To use:

      -
          cat august.c test.oc | ./august > test.oo
      -    ./august < test.oo
      +
          cat august.c test.oc | ./august > test.oo
      +    ./august < test.oo

      NOTE: some compilers will compile this code into infinite loops! If the above cat line (or one of the ones later in the try section) does not execute in a very short amount of time, then you may need to fix your compiler or use gcc.

      The above should print a ! followed by a newline.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      This entry can feed on itself. If you C pre-process the source, you can compile the interpreter:

      -
          make august.oc
      +
          make august.oc

      We can now compile the interpreter as follows:

      -
          cat august.c august.oc | ./august > august.oo
      +
          cat august.c august.oc | ./august > august.oo

      and use the compiled interpreter to execute some previously compiled code:

      -
          cat august.oo test.oo | ./august
      +
          cat august.oo test.oo | ./august

      And we can have the compiled interpreter interpret itself which in turn compiles the test program:

      -
          cat august.oo august.oo fac.oo | ./august
      +
          cat august.oo august.oo fac.oo | ./august

      And if you have lots of spare time, you can recurse one level deeper:

      -
          cat august.oo august.oo august.oo fac.oo | ./august
      +
          cat august.oo august.oo august.oo fac.oo | ./august

      We (the judges) recommend that you spend some time studying this entry as it surely will make the ‘best of the IOCCC’ list. It was very well received by those who attended the IOCCC BOF.

      @@ -194,13 +194,13 @@ of operators, and control constructs.

      can go wrong. But this is what seasoned C programmers are used to.

      Assume that the interpreter has been compiled (source in august.c and binary in august) and that we have this in a file named test.oc:

      -
          main() { putchar('!'); putchar('\n'); exit(0); }
      +
          main() { putchar('!'); putchar('\n'); exit(0); }

      We can then compile by

      -
          cat august.c test.oc | ./august > test.oo
      +
          cat august.c test.oc | ./august > test.oo

      And run the compiled program by

      -
          ./august < test.oo
      +
          ./august < test.oo

      Or even simpler:

      -
          cat august.c test.oc | ./august | ./august
      +
          cat august.c test.oc | ./august | ./august

      A larger example is included fac.oc.

      The compiler for OC is naturally written in OC (where did you think the byte code came from?). It is in the file parse.oc.

      @@ -210,20 +210,20 @@ preprocessor (hey, what do you expect from a program that is this small), so we need to use an external one. To pre-process august.c use the command from the Makefile, but add the -E flag and change 60000 to 40000, i.e.:

      -
          cc -E -DZ=40000 .... august.c > august.oc
      +
          cc -E -DZ=40000 .... august.c > august.oc

      If august.oc contain some junk line starting with a # (most likely it does) then remove it like:

      -
          sed -i'' '/^#/d' august.oc
      +
          sed -i'' '/^#/d' august.oc

      OK, we can now compile the interpreter:

      -
          cat august.c august.oc | ./august > august.oo
      +
          cat august.c august.oc | ./august > august.oo

      And we can run it:

      -
          cat august.oo test.oo | ./august
      +
          cat august.oo test.oo | ./august

      Here we have the interpreter interpreting another interpreter that runs the program. Did you think that was too fast? Just throw in another level of interpretation:

      -
          cat august.oo august.oo test.oo | ./august
      +
          cat august.oo august.oo test.oo | ./august

      And another…

      -
          cat august.oo august.oo august.oo test.oo | ./august
      +
          cat august.oo august.oo august.oo test.oo | ./august

      Fitting the byte code for the compiler into the initial comment was a challenge. I had to strip the compiler/interpreter of diff --git a/1996/dalbec/README.md b/1996/dalbec/README.md index 37b0da52c..5796ed640 100644 --- a/1996/dalbec/README.md +++ b/1996/dalbec/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./dalbec ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/1996/dalbec/index.html b/1996/dalbec/index.html index 69f3e7b53..a3af9b6b3 100644 --- a/1996/dalbec/index.html +++ b/1996/dalbec/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./dalbec
      +
          ./dalbec

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Why does the output end with 121?

      Judges’ remarks:

      The output is mis-leading … why does it also print 2047?

      diff --git a/1996/eldby/README.md b/1996/eldby/README.md index 1dba0efa0..36abe14e5 100644 --- a/1996/eldby/README.md +++ b/1996/eldby/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make alt ``` @@ -11,7 +11,7 @@ section. ## To use: -```sh +``` ./eldby.alt ``` @@ -28,7 +28,7 @@ problematic for some people, can be configured to different speeds by way of the value used in `usleep()`. The default is `35000` but you can easily change it. To do so try: -```sh +``` make SLEEP=20000 clobber alt ./eldby.alt ``` @@ -41,7 +41,7 @@ This version is the original which has no sleep time in between updates. ### Original build: -```sh +``` make all ``` diff --git a/1996/eldby/index.html b/1996/eldby/index.html index 46beec3db..526c4dadd 100644 --- a/1996/eldby/index.html +++ b/1996/eldby/index.html @@ -141,12 +141,12 @@ Location: ZZ - Unknown location

      To build:

      -
          make alt
      +
          make alt

      We recommend that you use the alt version to see what the entry looked like back in 1996. For the original version see the original code section.

      To use:

      -
          ./eldby.alt
      +
          ./eldby.alt

      To quit send intr (typically ctrl-c).

      NOTE: to reset the sanity of your terminal after this program ends try reset.

      Try:

      @@ -155,12 +155,12 @@ happening with modern systems, and to not flash too quickly, which can be problematic for some people, can be configured to different speeds by way of the value used in usleep(). The default is 35000 but you can easily change it. To do so try:

      -
          make SLEEP=20000 clobber alt
      -    ./eldby.alt
      +
          make SLEEP=20000 clobber alt
      +    ./eldby.alt

      Original code:

      This version is the original which has no sleep time in between updates.

      Original build:

      -
          make all
      +
          make all

      Original use:

      Use ./eldby as you would ./eldby.alt above.

      Judges’ remarks:

      diff --git a/1996/gandalf/README.md b/1996/gandalf/README.md index 85a89c9e0..c6aef9239 100644 --- a/1996/gandalf/README.md +++ b/1996/gandalf/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,14 +18,14 @@ For more detailed information see [1996 gandalf bugs](../../bugs.html#1996_ganda ## To use: -```sh +``` ./gandalf ``` ## Try: -```sh +``` ./try.sh ``` @@ -41,7 +41,7 @@ BTW: it is perilous to 'try' the patience of For misleading C pre-processor output, try: -```sh +``` cc -E gandalf.c ``` diff --git a/1996/gandalf/index.html b/1996/gandalf/index.html index 8feb9c57b..a96194304 100644 --- a/1996/gandalf/index.html +++ b/1996/gandalf/index.html @@ -141,15 +141,15 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: missing or dead link - please provide them

      For more detailed information see 1996 gandalf bugs.

      To use:

      -
          ./gandalf
      +
          ./gandalf

      Try:

      -
          ./try.sh
      +
          ./try.sh

      As the script asks, care to guess why these execute differently? Only the compiler knows … ok maybe other things like the author, the judges and perhaps you too?

      @@ -157,7 +157,7 @@ you too?

      Gandalf. Go ahead, ‘try’ it! :-)

      Judges’ remarks:

      For misleading C pre-processor output, try:

      -
          cc -E gandalf.c
      +
          cc -E gandalf.c

      Author’s remarks:

      The program requires an ASCII system.

      make all ``` @@ -18,14 +18,14 @@ For more detailed information see [1996 huffman bugs](../../bugs.html#1996_huffm ## To use: -```sh +``` echo 'Huffman Decoding' | ./huffman ``` ## Try: -```sh +``` ./try.sh ``` @@ -39,7 +39,7 @@ And for a misleading hint, consider who won! :-) And if you really can't see what is going on, here is an extra spoiler: -```sh +``` ./huffman < huffman.c 2>/dev/null ``` diff --git a/1996/huffman/index.html b/1996/huffman/index.html index 13e8d82f9..b9e84869b 100644 --- a/1996/huffman/index.html +++ b/1996/huffman/index.html @@ -141,21 +141,21 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: uses gets() - change to fgets() if possible

      For more detailed information see 1996 huffman bugs.

      To use:

      -
          echo 'Huffman Decoding' | ./huffman
      +
          echo 'Huffman Decoding' | ./huffman

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      If you are still confused and want to read a spoiler, check out the source and it will be clear as mud!

      And for a misleading hint, consider who won! :-)

      And if you really can’t see what is going on, here is an extra spoiler:

      -
          ./huffman < huffman.c 2>/dev/null
      +
          ./huffman < huffman.c 2>/dev/null

      This entry was very well received at the IOCCC BOF.

      Author’s remarks:

      This filter program is really not obfuscated code. It compiles cleanly diff --git a/1996/jonth/README.md b/1996/jonth/README.md index d9c600d97..d6ebb244e 100644 --- a/1996/jonth/README.md +++ b/1996/jonth/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -24,7 +24,7 @@ For more detailed information see [1996 jonth bugs](../../bugs.html#1996_jonth). ## To use: -```sh +``` ./jonth :0 :0 ``` @@ -35,7 +35,7 @@ off the other so that you can properly play. NOTE: if there is no X service open this will crash. If this is the case you might try: -```sh +``` ./jonth ``` @@ -49,7 +49,7 @@ These are supposed to happen. As is written in the ## Try: -```sh +``` ./jonth host1:0 host2:0 ``` diff --git a/1996/jonth/index.html b/1996/jonth/index.html index 005565841..8c766457d 100644 --- a/1996/jonth/index.html +++ b/1996/jonth/index.html @@ -141,7 +141,7 @@ Location: NO - Kingdom of Norway (

      To build:

      -
          make all
      +
          make all

      NOTE: this entry requires X11/Xlib.h header file and the X11 library to compile. macOS users running Mountain Lion and later will need to download and install XQuartz in order to compile and run this @@ -152,17 +152,17 @@ entry.

      STATUS: missing or dead link - please provide them

      For more detailed information see 1996 jonth bugs.

      To use:

      -
          ./jonth :0 :0
      +
          ./jonth :0 :0

      NOTE: the two boards will be on top of each other so you will have to drag one off the other so that you can properly play.

      NOTE: if there is no X service open this will crash. If this is the case you might try:

      -
          ./jonth
      +
          ./jonth

      These are supposed to happen. As is written in the The Jargon File:

          That's not a bug, that's a feature.

      Try:

      -
          ./jonth host1:0 host2:0
      +
          ./jonth host1:0 host2:0

      Judges’ remarks:

      For extra credit, figure out how you can cheat by taking over a square already occupied by an opponent.

      diff --git a/1996/rcm/README.md b/1996/rcm/README.md index 02b10dc1d..44ef7702d 100644 --- a/1996/rcm/README.md +++ b/1996/rcm/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./rcm < file.gz ``` @@ -18,7 +18,7 @@ where `file.gz` is some gzipped file. For more information try: -```sh +``` ./try.sh ``` @@ -27,7 +27,7 @@ For more information try: For a good no-op try: -```sh +``` gzip -c < rcm.c | ./rcm ``` diff --git a/1996/rcm/index.html b/1996/rcm/index.html index a45203fca..08e797f94 100644 --- a/1996/rcm/index.html +++ b/1996/rcm/index.html @@ -141,16 +141,16 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./rcm < file.gz
      +
          ./rcm < file.gz

      where file.gz is some gzipped file.

      Try:

      For more information try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      For a good no-op try:

      -
          gzip -c < rcm.c | ./rcm
      +
          gzip -c < rcm.c | ./rcm

      NOTE: this is done in the try.sh script as well, along with some other commands including a way to do the above command but with more steps.

      Author’s remarks:

      diff --git a/1996/schweikh1/README.md b/1996/schweikh1/README.md index 05a8a9e82..696e76757 100644 --- a/1996/schweikh1/README.md +++ b/1996/schweikh1/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./schweikh1 ``` @@ -17,7 +17,7 @@ To find the day that Easter falls on in the current year and to show all Easter dates from 1582 to 2199: -```sh +``` ./try.sh ``` diff --git a/1996/schweikh1/index.html b/1996/schweikh1/index.html index ed3425230..9b9131e6d 100644 --- a/1996/schweikh1/index.html +++ b/1996/schweikh1/index.html @@ -141,13 +141,13 @@ Location: DE - Federal Republic of Germ

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./schweikh1
      +
          ./schweikh1

      Try:

      To find the day that Easter falls on in the current year and to show all Easter dates from 1582 to 2199:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      Look at the source. There is something very odd going on here. Where does the real code come from if everything is a C pre-processor diff --git a/1996/schweikh2/README.md b/1996/schweikh2/README.md index 44f5eb44c..b37a4f2c5 100644 --- a/1996/schweikh2/README.md +++ b/1996/schweikh2/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./schweikh2 ``` @@ -24,19 +24,19 @@ The program accepts up to 4 parameters: ## Try: -```sh +``` ./try.sh ``` What happens if you pass only three parameters like the below? -```sh +``` ./schweikh2 15 1 0 ``` The author also suggests: -```sh +``` while :; do grep -v '#' schweikh2.c; done ``` @@ -51,7 +51,7 @@ The original program, with only slight obfuscations, may be found in [hunni.c](hunni.c). The perl script, [hunni.pl](hunni.pl), obfuscates it appropriately. Try: -```sh +``` less hunni.c perl ./hunni.pl < hunni.c @@ -137,7 +137,7 @@ minutes (`gcc -O3`). ### Sample arguments: -```sh +``` ./schweikh2 6 ./schweikh2 7 0 ./schweikh2 7 7 0 @@ -151,7 +151,7 @@ minutes (`gcc -O3`). The diamond pattern can be continued without a break. For a nice printout try this on your Bourne compatible shell: -```sh +``` while :; do grep -v '#' schweikh2.c; done ``` diff --git a/1996/schweikh2/index.html b/1996/schweikh2/index.html index d7710cfd7..353a5695e 100644 --- a/1996/schweikh2/index.html +++ b/1996/schweikh2/index.html @@ -141,9 +141,9 @@ Location: DE - Federal Republic of Germ

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./schweikh2
      +
          ./schweikh2

      The program accepts up to 4 parameters:

      1. The number of operators in the expression [default: 9]

      2. @@ -152,11 +152,11 @@ Location: DE - Federal Republic of Germ
      3. The goal value or 0/0 [default: 42]

      Try:

      -
          ./try.sh
      +
          ./try.sh

      What happens if you pass only three parameters like the below?

      -
          ./schweikh2 15 1 0
      +
          ./schweikh2 15 1 0

      The author also suggests:

      -
          while :; do grep -v '#' schweikh2.c; done
      +
          while :; do grep -v '#' schweikh2.c; done

      (and we do too) which works with sh, bash, ksh and zsh as well. Press ctrl-c to stop it. Observe how the try.sh script does this once to make it easier to see what is happening.

      @@ -164,9 +164,9 @@ make it easier to see what is happening.

      The original program, with only slight obfuscations, may be found in hunni.c. The perl script, hunni.pl, obfuscates it appropriately. Try:

      -
          less hunni.c
      -
      -    perl ./hunni.pl < hunni.c
      +
          less hunni.c
      +
      +    perl ./hunni.pl < hunni.c

      This entry was another crowd pleaser at the IOCCC BOF.

      Author’s remarks:

      Note: the source must be viewed with tabstop 8. To appreciate the @@ -230,16 +230,16 @@ operators but you will probably wait quite some time for every of the on a 50 MHz SPARC, 4^11 expressions are evaluated in about 3 cpu minutes (gcc -O3).

      Sample arguments:

      -
          ./schweikh2 6
      -    ./schweikh2 7 0
      -    ./schweikh2 7 7 0
      -    ./schweikh2 8 9 -1 -67/21
      -    ./schweikh2 8 2 2/5 -98/25
      -    ./schweikh2 2 1/0 1 1/0
      +
          ./schweikh2 6
      +    ./schweikh2 7 0
      +    ./schweikh2 7 7 0
      +    ./schweikh2 8 9 -1 -67/21
      +    ./schweikh2 8 2 2/5 -98/25
      +    ./schweikh2 2 1/0 1 1/0

      Miscellaneous

      The diamond pattern can be continued without a break. For a nice printout try this on your Bourne compatible shell:

      -
          while :; do grep -v '#' schweikh2.c; done
      +
          while :; do grep -v '#' schweikh2.c; done
      make all ``` @@ -12,7 +12,7 @@ It may render your system unusable for a limited amount of time or force you to reboot using the Big Red Button! This is **NOT** a joke. You have been warned. -```sh +``` ./schweikh3 ``` @@ -27,7 +27,7 @@ systems. But still it is a useful utility. To use try: -```sh +``` ./schweikh3 ``` @@ -57,7 +57,7 @@ You have to select maximum ANSI C conformance of your compiler. The source fails to compile under a C++ compiler due to the `new' identifier which is a C++ reserved word: -```sh +``` $ g++ schweikh3.c schweikh3.c:9: parse error before `new' schweikh3.c:16: parse error before `new' @@ -71,7 +71,7 @@ the `new' identifier which is a C++ reserved word: The source fails to compile on compilers that recognize the inline keyword by default, e.g. gcc: -```sh +``` $ gcc schweikh3.c schweikh3.c:46: parse error before `void' schweikh3.c: In function `main': diff --git a/1996/schweikh3/index.html b/1996/schweikh3/index.html index 5d7ff5350..3f003a2b5 100644 --- a/1996/schweikh3/index.html +++ b/1996/schweikh3/index.html @@ -141,20 +141,20 @@ Location: DE - Federal Republic of Germ

      To build:

      -
          make all
      +
          make all

      To use:

      WARNING: DO NOT RUN this program without reading this text down to the end! It may render your system unusable for a limited amount of time or force you to reboot using the Big Red Button! This is NOT a joke. You have been warned.

      -
          ./schweikh3
      +
          ./schweikh3

      Judges’ remarks:

      The source fails to compile on compilers that recognize the inline keyword by default. For gcc, you may need to use -ansi.

      See the file schweikh3.info for example output from various systems.

      But still it is a useful utility. To use try:

      -
          ./schweikh3
      +
          ./schweikh3

      and thanks for the virtual memories! :-)

      Author’s remarks:

      Why I think my entry is obfuscated

      @@ -171,22 +171,22 @@ COBOL, F77, awk etc.

      You have to select maximum ANSI C conformance of your compiler. The source fails to compile under a C++ compiler due to the `new’ identifier which is a C++ reserved word:

      -
          $ g++ schweikh3.c
      -    schweikh3.c:9: parse error before `new'
      -    schweikh3.c:16: parse error before `new'
      -    schweikh3.c:46: parse error before `void'
      -    schweikh3.c:65: parse error before `Lisp'
      -    schweikh3.c:68: parse error before `;'
      -    [...]
      -    schweikh3.c:91: confused by earlier errors, bailing out
      +
          $ g++ schweikh3.c
      +    schweikh3.c:9: parse error before `new'
      +    schweikh3.c:16: parse error before `new'
      +    schweikh3.c:46: parse error before `void'
      +    schweikh3.c:65: parse error before `Lisp'
      +    schweikh3.c:68: parse error before `;'
      +    [...]
      +    schweikh3.c:91: confused by earlier errors, bailing out

      The source fails to compile on compilers that recognize the inline keyword by default, e.g. gcc:

      -
          $ gcc schweikh3.c
      -    schweikh3.c:46: parse error before `void'
      -    schweikh3.c: In function `main':
      -    schweikh3.c:91: parse error before `inline'
      -    schweikh3.c: At top level:
      -    schweikh3.c:97: parse error before `void'
      +
          $ gcc schweikh3.c
      +    schweikh3.c:46: parse error before `void'
      +    schweikh3.c: In function `main':
      +    schweikh3.c:91: parse error before `inline'
      +    schweikh3.c: At top level:
      +    schweikh3.c:97: parse error before `void'

      The -ansi option to gcc fixes this.

      The source fails to compile on obsolete systems with obsolete memory models due to the identifier far (to be honest: this is diff --git a/1996/westley/README.md b/1996/westley/README.md index c48c14320..fbbc52e47 100644 --- a/1996/westley/README.md +++ b/1996/westley/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -11,7 +11,7 @@ ## To use: -```sh +``` ./clock1.sh ./clock2.sh ./clock3.sh @@ -20,7 +20,7 @@ ## Try: -```sh +``` ./try.sh ``` @@ -34,14 +34,14 @@ provided, to show the differences. ### Alternate build: -```sh +``` make alt ``` ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -81,7 +81,7 @@ larger. The code is simple; the arguments passed are: -```sh +``` ./westley minute_map hour_map hand_symbol clock_image ``` diff --git a/1996/westley/index.html b/1996/westley/index.html index 5b656d3ea..2e03a92e2 100644 --- a/1996/westley/index.html +++ b/1996/westley/index.html @@ -141,24 +141,24 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      There is another version which is the original entry. See alternate version for details as to how to use and why it was made the alt version.

      To use:

      -
          ./clock1.sh
      -    ./clock2.sh
      -    ./clock3.sh
      +
          ./clock1.sh
      +    ./clock2.sh
      +    ./clock3.sh

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Alternate code:

      The original version had a display problem in modern systems which somewhat affected the usability of the program. This alternate code, the original, is provided, to show the differences.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate try:

      -
          ./try.alt.sh
      +
          ./try.alt.sh

      Judges’ remarks:

      Time and time again, Brian Westley seems to come up with a winning entry! We are amazed at how much is being done with only one relatively @@ -183,7 +183,7 @@ my sample scripts.

      These assumptions are pretty reasonable. 2) can be eliminated but makes the code larger.

      The code is simple; the arguments passed are:

      -
          ./westley minute_map hour_map hand_symbol clock_image
      +
          ./westley minute_map hour_map hand_symbol clock_image

      The program merely takes the minute (0-59) and the hour (0-23) values, looks up the offsets in minute_map and hour_map and writes the hand_symbol for each into the clock_image diff --git a/1998/banks/README.md b/1998/banks/README.md index 2d21fe3f9..636defc25 100644 --- a/1998/banks/README.md +++ b/1998/banks/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -34,14 +34,14 @@ macros to, depending on what controls you wish to redefine. For instance, to set the throttle up and down to `u` and `d`: -```sh +``` make clobber IT=XK_u DT=XK_d all ``` because in the header file you can see that `XK_u` corresponds to `u` and `XK_d` corresponds to `d`: -```c +``` #define XK_d 0x0064 /* U+0064 LATIN SMALL LETTER D */ #define XK_u 0x0075 /* U+0075 LATIN SMALL LETTER U */ ``` @@ -63,7 +63,7 @@ preselected alternative keys. ## To use: -```sh +``` cat horizon.sc pittsburgh.sc | ./banks ``` @@ -106,7 +106,7 @@ the right side for movement. These are hard coded, as noted. To use the default settings for the alternate build: -```sh +``` make alt ``` @@ -231,7 +231,7 @@ Here is a brief description of the scenery files: A few examples of how to input scenery: -```sh +``` cat horizon.sc pittsburgh.sc | ./banks cat mountains.sc bb.sc | ./banks cat mountains.sc river.sc pyramids.sc | ./banks @@ -240,7 +240,7 @@ A few examples of how to input scenery: You can simulate flying through a cloud bank as well: -```sh +``` ./banks < /dev/null ``` diff --git a/1998/banks/index.html b/1998/banks/index.html index 1c259125b..ab345e273 100644 --- a/1998/banks/index.html +++ b/1998/banks/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

      To build:

      -
          make all
      +
          make all

      If you do not have a page up or page down key you might wish to see the Alternate code section below. You may redefine all the keys and the time step with predefined macros, however, so one lacking page up / page @@ -164,11 +164,11 @@ Instructions section.

      to use. The name of the macro in the header file is what you need to set the macros to, depending on what controls you wish to redefine. For instance, to set the throttle up and down to u and d:

      -
          make clobber IT=XK_u DT=XK_d all
      +
          make clobber IT=XK_u DT=XK_d all

      because in the header file you can see that XK_u corresponds to u and XK_d corresponds to d:

      -
          #define XK_d                             0x0064  /* U+0064 LATIN SMALL LETTER D */
      -    #define XK_u                             0x0075  /* U+0075 LATIN SMALL LETTER U */
      +
          #define XK_d                             0x0064  /* U+0064 LATIN SMALL LETTER D */
      +    #define XK_u                             0x0075  /* U+0075 LATIN SMALL LETTER U */

      Note that the keysym.h file is not complete from X11; it’s just the more likely candidates (and some that are probably unlikely :-) ).

      The upper case letters would be XK_U and XK_D and you can search the header @@ -181,7 +181,7 @@ instructions. Since you can use the original entry to redefine these this is not a problem and is purely a convenience .. if only for those who are okay with the preselected alternative keys.

      To use:

      -
          cat horizon.sc pittsburgh.sc | ./banks
      +
          cat horizon.sc pittsburgh.sc | ./banks

      See the author’s remarks in scenery for more details on the scenery files.

      Try:

      @@ -208,7 +208,7 @@ you should use the original entry as described in the to build section above.

      To use the default settings for the alternate build:

      -
          make alt
      +
          make alt

      You may change the other keys as described in the build instructions, above, but this alt code can be seen as an alternative for those who don’t have or don’t want to use page up and page down.

      @@ -289,11 +289,11 @@ landscape.

      Follow a flowing river from the sky.

    A few examples of how to input scenery:

    -
        cat horizon.sc pittsburgh.sc | ./banks
    -    cat mountains.sc bb.sc | ./banks
    -    cat mountains.sc river.sc pyramids.sc | ./banks
    +
        cat horizon.sc pittsburgh.sc | ./banks
    +    cat mountains.sc bb.sc | ./banks
    +    cat mountains.sc river.sc pyramids.sc | ./banks

    You can simulate flying through a cloud bank as well:

    -
        ./banks < /dev/null
    +
        ./banks < /dev/null

    You will usually want at least a horizon, though.

    The format of scenery files is simple, by the way. They’re just a list of 3D coordinates, and the simulator simply draws line diff --git a/1998/bas1/README.md b/1998/bas1/README.md index b15a680da..377fb73d8 100644 --- a/1998/bas1/README.md +++ b/1998/bas1/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./bas1.sh ``` diff --git a/1998/bas1/index.html b/1998/bas1/index.html index d6dd0aaba..265dd030c 100644 --- a/1998/bas1/index.html +++ b/1998/bas1/index.html @@ -141,9 +141,9 @@ Location: NL - Kingdom of the Netherlan

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./bas1.sh
    +
        ./bas1.sh

    Judges’ remarks:

    The output is supposed to be a 3D maze, but it is somewhat more than that. If you’ve seen any of the Maurits diff --git a/1998/bas2/README.md b/1998/bas2/README.md index 6d31258fc..907b4b967 100644 --- a/1998/bas2/README.md +++ b/1998/bas2/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./bas2 < file echo text | ./bas2 ``` @@ -15,7 +15,7 @@ ## Try: -```sh +``` ./try.sh ./try.sh "foo bar" "baz" "IOCCC 1998/bas2" README.md diff --git a/1998/bas2/index.html b/1998/bas2/index.html index 8dff694f0..59c06951e 100644 --- a/1998/bas2/index.html +++ b/1998/bas2/index.html @@ -141,16 +141,16 @@ Location: NL - Kingdom of the Netherlan

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./bas2 < file
    -    echo text | ./bas2
    +
        ./bas2 < file
    +    echo text | ./bas2

    Try:

    -
        ./try.sh
    -
    -    ./try.sh "foo bar" "baz" "IOCCC 1998/bas2" README.md
    -
    -    ./try.sh try.sh "bas2.c" bas2.orig.c
    +
        ./try.sh
    +
    +    ./try.sh "foo bar" "baz" "IOCCC 1998/bas2" README.md
    +
    +    ./try.sh try.sh "bas2.c" bas2.orig.c

    Judges’ remarks:

    Questions to ponder:

    Can you determine the relationship between the input and the resulting numeric diff --git a/1998/chaos/README.md b/1998/chaos/README.md index 427d7d8f6..3570f3747 100644 --- a/1998/chaos/README.md +++ b/1998/chaos/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make chaos ``` @@ -8,21 +8,21 @@ NOTE: Some systems do not implement `halfdelay()` in their `libcurses`. You might try compiling with -lncurses if you have that library. Or you can build this entry without the `halfdelay()` call by: -```sh +``` make chaos_nohalf ``` ## To use: -```sh +``` ./chaos ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/1998/chaos/index.html b/1998/chaos/index.html index 0b3dfc548..0bf5dd6c7 100644 --- a/1998/chaos/index.html +++ b/1998/chaos/index.html @@ -141,15 +141,15 @@ Location: US - United States of America

    To build:

    -
        make chaos
    +
        make chaos

    NOTE: Some systems do not implement halfdelay() in their libcurses. You might try compiling with -lncurses if you have that library. Or you can build this entry without the halfdelay() call by:

    -
        make chaos_nohalf
    +
        make chaos_nohalf

    To use:

    -
        ./chaos
    +
        ./chaos

    Try:

    -
        ./try.sh
    +
        ./try.sh

    This script will run the program on each data file. To quit the program hit q. If not all files have been used it will go to the next one; otherwise the script will be finished. To end the script early send intr/ctrl-c.

    diff --git a/1998/df/README.md b/1998/df/README.md index 7fc3dd43f..a9b3a5626 100644 --- a/1998/df/README.md +++ b/1998/df/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./df ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/1998/df/index.html b/1998/df/index.html index 0d0806f77..4aee89502 100644 --- a/1998/df/index.html +++ b/1998/df/index.html @@ -141,11 +141,11 @@ Location: ZZ - Unknown location

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./df
    +
        ./df

    Try:

    -
        ./try.sh
    +
        ./try.sh

    This will run the program in a loop until you exit (q when prompted or ctrl-c/intr).

    Can you figure out a very simple pipeline to cheat?

    diff --git a/1998/dlowe/README.md b/1998/dlowe/README.md index f1e1bca73..421244af9 100644 --- a/1998/dlowe/README.md +++ b/1998/dlowe/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -10,7 +10,7 @@ below for more details. ## To use: -```sh +``` ./dlowe < file > pootfile ./dlowe < file @@ -30,7 +30,7 @@ For more detailed information see [1998 dlowe bugs](../../bugs.html#1998_dlowe). ## Try: -```sh +``` ./dlowe < README.md ./dlowe < README.md > README.poot.md ``` @@ -39,7 +39,7 @@ Why is there different output? Also try: -```sh +``` ./try.sh ``` @@ -54,7 +54,7 @@ that program. ### Alternate build: -```sh +``` make alt ``` @@ -70,7 +70,7 @@ What's the difference between this and `dlowe`? ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -93,7 +93,7 @@ more consistent level of quality. :-) A CGI script such as: -```sh +``` #!/bin/sh # pootify - a sample CGI pootifier # @@ -131,7 +131,7 @@ should use the above one instead. You can use the script [pootify.sh](pootify.sh), however, to download and generate html files that you can look at locally in a browser or pipe through `less(1)`. For instance: -```sh +``` ./pootify.sh URL=https://microsoft.com | less ./pootify.sh -r URL=https://microsoft.com > ms.html @@ -143,7 +143,7 @@ it in a browser. For an old example of it working as a CGI script see: -```sh +``` https://web.archive.org/web/20040326083431/http://www.pootpoot.com/poot/pootify/?URL=http%3A%2F%2Fwww.ioccc.org ``` diff --git a/1998/dlowe/index.html b/1998/dlowe/index.html index 97c2f4093..8c09dd812 100644 --- a/1998/dlowe/index.html +++ b/1998/dlowe/index.html @@ -141,34 +141,34 @@ Location: US - United States of America

    To build:

    -
        make all
    +
        make all

    There is an alternate version available. See Alternate code below for more details.

    To use:

    -
        ./dlowe < file > pootfile
    -
    -    ./dlowe < file
    +
        ./dlowe < file > pootfile
    +
    +    ./dlowe < file

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: missing or dead link - please provide them

    For more detailed information see 1998 dlowe bugs.

    Try:

    -
        ./dlowe < README.md
    -    ./dlowe < README.md > README.poot.md
    +
        ./dlowe < README.md
    +    ./dlowe < README.md > README.poot.md

    Why is there different output?

    Also try:

    -
        ./try.sh
    +
        ./try.sh

    Did you spot the Easter egg there?

    Alternate code:

    The original entry was just a text based pootifier. This alternate version is that program.

    Alternate build:

    -
        make alt
    +
        make alt

    Alternate use:

        ./dlowe.alt < file > pootfile

    What’s the difference between this and dlowe?

    Alternate try:

    -
        ./try.alt.sh
    +
        ./try.alt.sh

    Did you spot the Easter egg there?

    Judges’ remarks:

    Why could this this entry be considered a utility? Well because it @@ -179,27 +179,27 @@ a CGI program: Historical remarks:

    A CGI script such as:

    -
        #!/bin/sh
    -    # pootify - a sample CGI pootifier
    -    #
    -    POOT="/usr/local/bin/dlowe"
    -    LYNX="/usr/local/bin/lynx"
    -    ECHO="/usr/bin/echo"
    -    EXPR="/usr/bin/expr"
    -    ${ECHO} "Content-type: text/html"
    -    ${ECHO}
    -    if [ -z "${QUERY_STRING}" ]; then
    -        ${ECHO} "QUERY_STRING not found"
    -    else
    -        URL=`${EXPR} "$QUERY_STRING" : '[Uu][Rr][Ll]=\(.*\)'`
    -        if [ -z "${URL}" ]; then
    -            ${ECHO} "No URL given in QUERY_STRING"
    -        elif [ X`${EXPR} "${URL}" : '[Ff][Ii][Ll][Ee]:'` != X0 ]; then
    -            ${ECHO} "file: based URLs are not allowed"
    -        else
    -            ${LYNX} -restrictions=all -source "${URL}" | ${POOT}
    -        fi
    -    fi
    +
        #!/bin/sh
    +    # pootify - a sample CGI pootifier
    +    #
    +    POOT="/usr/local/bin/dlowe"
    +    LYNX="/usr/local/bin/lynx"
    +    ECHO="/usr/bin/echo"
    +    EXPR="/usr/bin/expr"
    +    ${ECHO} "Content-type: text/html"
    +    ${ECHO}
    +    if [ -z "${QUERY_STRING}" ]; then
    +        ${ECHO} "QUERY_STRING not found"
    +    else
    +        URL=`${EXPR} "$QUERY_STRING" : '[Uu][Rr][Ll]=\(.*\)'`
    +        if [ -z "${URL}" ]; then
    +            ${ECHO} "No URL given in QUERY_STRING"
    +        elif [ X`${EXPR} "${URL}" : '[Ff][Ii][Ll][Ee]:'` != X0 ]; then
    +            ${ECHO} "file: based URLs are not allowed"
    +        else
    +            ${LYNX} -restrictions=all -source "${URL}" | ${POOT}
    +        fi
    +    fi

    can be used to pootify web pages. This has been added as pootify.cgi.sh which forbids file:// based URLs and which uses lynx(1) with the option referred to above. This will not, of course, @@ -212,14 +212,14 @@ added bonus that one can use file:// URLs. If one wants a CGI scrip should use the above one instead. You can use the script pootify.sh, however, to download and generate html files that you can look at locally in a browser or pipe through less(1). For instance:

    -
        ./pootify.sh URL=https://microsoft.com | less
    -
    -    ./pootify.sh -r URL=https://microsoft.com > ms.html
    +
        ./pootify.sh URL=https://microsoft.com | less
    +
    +    ./pootify.sh -r URL=https://microsoft.com > ms.html

    where the first one would show the text as rendered but without links, images etc. and the second one would write the html to ms.html so that you could open it in a browser.

    For an old example of it working as a CGI script see:

    -
        https://web.archive.org/web/20040326083431/http://www.pootpoot.com/poot/pootify/?URL=http%3A%2F%2Fwww.ioccc.org
    +
        https://web.archive.org/web/20040326083431/http://www.pootpoot.com/poot/pootify/?URL=http%3A%2F%2Fwww.ioccc.org

    Author’s remarks:

    This program is a text filter, it reads stdin and outputs the “corrected” text to stdout.

    diff --git a/1998/dloweneil/README.md b/1998/dloweneil/README.md index 84603bc6e..4cf455f44 100644 --- a/1998/dloweneil/README.md +++ b/1998/dloweneil/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -22,7 +22,7 @@ For more detailed information see [1998 dloweneil bugs](../../bugs.html#1998_dlo ## To use: -```sh +``` ./pootris [X size of board] [Y size of board] ``` @@ -45,14 +45,14 @@ clockwise `l` does as well. Instead of using `d` to drop the letter you can do ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./pootris.alt [X size of board] [Y size of board] ``` @@ -73,7 +73,7 @@ experience may mirror one of our experiences: ### Usage -```sh +``` ./pootris [X size of board] [Y size of board] ``` diff --git a/1998/dloweneil/index.html b/1998/dloweneil/index.html index 412878c48..0a74e6e9e 100644 --- a/1998/dloweneil/index.html +++ b/1998/dloweneil/index.html @@ -144,7 +144,7 @@ Location: ZZ - Unknown location

    To build:

    -
        make all
    +
        make all

    There is an alternate version available that has a key configuration that will be more familiar to vi(m) users and also allows one to quit. See alternate code below.

    @@ -153,7 +153,7 @@ code below.

        STATUS: missing or dead link - please provide them

    For more detailed information see 1998 dloweneil bugs.

    To use:

    -
        ./pootris [X size of board] [Y size of board]
    +
        ./pootris [X size of board] [Y size of board]

    Pressing a moves the current letter position counterclockwise/anticlockwise (a)round the border of the playing field.

    Pressing s moves the current letter one position clockwise around the border @@ -165,9 +165,9 @@ counterclockwise/anticlockwise h does as well; and in addition to < clockwise l does as well. Instead of using d to drop the letter you can do j or space. Finally to quit this version you can press q.

    Alternate build:

    -
        make alt
    +
        make alt

    Alternate use:

    -
        ./pootris.alt [X size of board] [Y size of board]
    +
        ./pootris.alt [X size of board] [Y size of board]

    Judges’ remarks:

    Read the authors’ remarks below to find out how to play. We believe that your experience may mirror one of our experiences:

    @@ -176,7 +176,7 @@ experience may mirror one of our experiences:

    I spelled my first "poot". I was hooked ...

    Author’s remarks:

    Usage

    -
        ./pootris [X size of board] [Y size of board]
    +
        ./pootris [X size of board] [Y size of board]

    Synopsis

    The object of this game is to spell POOT as much as possible. There is no time pressure. You’re given one letter at a time (sort of randomly diff --git a/1998/dorssel/README.md b/1998/dorssel/README.md index 7d5da726a..565f286b3 100644 --- a/1998/dorssel/README.md +++ b/1998/dorssel/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./dorssel # input some text @@ -17,7 +17,7 @@ ## Try: -```sh +``` ./try.sh ``` @@ -48,7 +48,7 @@ altering the behavior ? Try doing what the last part of the last command in [try.sh](try.sh) suggests. As in, do the following: -```sh +``` echo ". -..- . .-. -.-. .. ... . -.-. .... .- -. --. . - .... . .--. .-. --- --. .-. .- -- ... --- .. - -.. --- . ... -. --- - ... .... --- ..- -" | ./dorssel ``` @@ -91,7 +91,7 @@ invoke undefined behavior. Try: -```sh +``` ./dorssel < dorssel.c | ./dorssel ``` @@ -101,20 +101,20 @@ better job than most C beautifiers). - Filter your text twice (as in the previous sample) to obtain a version of your text that can be reversibly Morsified, i.e. -```sh +``` ./dorssel < dorssel.c | ./dorssel | ./dorssel | ./dorssel ``` is the same as -```sh +``` ./dorssel < dorssel.c | ./dorssel ``` - The file [dorssel.md](dorssel.md) contains all the information needed to understand this program. For an obfuscated spoiler, try -```sh +``` ./dorssel < dorssel.md ``` diff --git a/1998/dorssel/dorssel.html b/1998/dorssel/dorssel.html index 3ba18fb14..6752e93bf 100644 --- a/1998/dorssel/dorssel.html +++ b/1998/dorssel/dorssel.html @@ -150,11 +150,11 @@ two bits would suffice, e.g.

    That means bits 6 and 5 set to 00 is length 1, set to 01 is length 2, etc. But this would mean that we would have to extract the length into a counter before shifting out each symbol, such as

    -
        length = (encoding & 96) >> 5;
    -    do {
    -            putchar(encoding & 1 ? '-' : '.');
    -            encoding >>= 1;
    -    } while (length--);
    +
        length = (encoding & 96) >> 5;
    +    do {
    +            putchar(encoding & 1 ? '-' : '.');
    +            encoding >>= 1;
    +    } while (length--);

    We can also use the remaining bits to include the counter

        length 1: 00000.1x     E > 00000.11
         length 2: 0000.1xx
    @@ -162,10 +162,10 @@ counter before shifting out each symbol, such as

    length 4: 00.1xxxx Z > 00.11100 length 5: 0.1xxxxx 3 > 0.100111

    with 1 bit still to be chosen freely (let’s assume it is 0). Now we can do

    -
        do {
    -            putchar(encoding & 1 ? '-' : '.');
    -            encoding >>= 1;
    -    while (encoding > 1);
    +
        do {
    +            putchar(encoding & 1 ? '-' : '.');
    +            encoding >>= 1;
    +    while (encoding > 1);

    As you see, the encoded Morse sequence can be the counter itself. But this is not very pleasant, as some Morse sequences will end up having an ASCII value < 32, i.e. they will be control codes. This would make @@ -179,21 +179,21 @@ following

    Notice these encodings in the initialization string. Only the coding for 5 needs an escape (5 = ..... > 01111111 = '\177'). The way the length is encoded still allows the encoding to be its own counter:

    -
        do {
    -            putchar(encoding & 1 ? '-' : '.');
    -            encoding = (encoding + 32) >> 1;
    -    } while (encoding > 35);
    +
        do {
    +            putchar(encoding & 1 ? '-' : '.');
    +            encoding = (encoding + 32) >> 1;
    +    } while (encoding > 35);

    The last shift will always result in 00100010, hence the test for >35. Note that the calculation for the next value of encoding is done at int precision, so that the actual value of the char remains <= 127.

    The character '-' (ASCII 45) and '.' (ASCII 46) are conveniently in sequence, so the putchar can simply be

    -
        putchar(45 + encoding % 2);
    +
        putchar(45 + encoding % 2);

    I used the modulo operator this time, because + takes precedence over &. The assignment can be incorporated into the while control test, and a do-while loop with a body of a single expression statement can be written as a while loop with a comma operator in the test:

    -
        while(putchar(45 + encoding % 2), encoding = encoding + 32 >> 1);
    +
        while(putchar(45 + encoding % 2), encoding = encoding + 32 >> 1);

    Voila.

    Now, the decoding of Morse codes is just the reverse. We shift in 0s and 1s as we scan the line. But: we have to scan from back to front diff --git a/1998/dorssel/dorssel.md b/1998/dorssel/dorssel.md index 202f74b6c..189745f1e 100644 --- a/1998/dorssel/dorssel.md +++ b/1998/dorssel/dorssel.md @@ -42,7 +42,7 @@ That means bits 6 and 5 set to 00 is length 1, set to 01 is length 2, etc. But this would mean that we would have to extract the length into a counter before shifting out each symbol, such as -```c +``` length = (encoding & 96) >> 5; do { putchar(encoding & 1 ? '-' : '.'); @@ -62,7 +62,7 @@ We can also use the remaining bits to *include* the counter with 1 bit still to be chosen freely (let's assume it is 0). Now we can do -```c +``` do { putchar(encoding & 1 ? '-' : '.'); encoding >>= 1; @@ -87,7 +87,7 @@ Notice these encodings in the initialization string. Only the coding for `5` needs an escape (`5 = ..... > 01111111 = '\177'`). The way the length is encoded still allows the encoding to be its own counter: -```c +``` do { putchar(encoding & 1 ? '-' : '.'); encoding = (encoding + 32) >> 1; @@ -101,7 +101,7 @@ precision, so that the actual value of the `char` remains `<= 127`. The character `'-'` (ASCII 45) and `'.'` (ASCII 46) are conveniently in sequence, so the putchar can simply be -```c +``` putchar(45 + encoding % 2); ``` @@ -110,7 +110,7 @@ The assignment can be incorporated into the `while` control test, and a `do-while` loop with a body of a single expression statement can be written as a `while` loop with a comma operator in the test: -```c +``` while(putchar(45 + encoding % 2), encoding = encoding + 32 >> 1); ``` diff --git a/1998/dorssel/index.html b/1998/dorssel/index.html index 717e14647..dc4050613 100644 --- a/1998/dorssel/index.html +++ b/1998/dorssel/index.html @@ -141,14 +141,14 @@ Location: ZZ - Unknown location

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./dorssel
    -    # input some text
    -
    -    echo text | ./dorssel
    +
        ./dorssel
    +    # input some text
    +
    +    echo text | ./dorssel

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    How does the program decide which way to convert?

    What obsolescent feature are we talking about? (No, it’s not a @@ -166,8 +166,8 @@ altering the behavior ?

    Extra credit:

    Try doing what the last part of the last command in try.sh suggests. As in, do the following:

    -
        echo ". -..- . .-. -.-. .. ... .
    -    -.-. .... .- -. --. .  - .... .  .--. .-. --- --. .-. .- --  ... ---  .. -  -.. --- . ...  -. --- -  ... .... --- ..- -" | ./dorssel
    +
        echo ". -..- . .-. -.-. .. ... .
    +    -.-. .... .- -. --. .  - .... .  .--. .-. --- --. .-. .- --  ... ---  .. -  -.. --- . ...  -. --- -  ... .... --- ..- -" | ./dorssel

    and make the necessary adjustments.

    You might also want to read the dorssel.html file.

    Author’s remarks:

    @@ -195,21 +195,21 @@ ASCII. As far as I can tell, the program is conforming and does not invoke undefined behavior.

    Hints

    Try:

    -
        ./dorssel < dorssel.c | ./dorssel
    +
        ./dorssel < dorssel.c | ./dorssel

    to see what variables, numbers, and functions are used. (Does a better job than most C beautifiers).

    • Filter your text twice (as in the previous sample) to obtain a version of your text that can be reversibly Morsified, i.e.
    -
        ./dorssel < dorssel.c | ./dorssel | ./dorssel | ./dorssel
    +
        ./dorssel < dorssel.c | ./dorssel | ./dorssel | ./dorssel

    is the same as

    -
        ./dorssel < dorssel.c | ./dorssel
    +
        ./dorssel < dorssel.c | ./dorssel
    • The file dorssel.md contains all the information needed to understand this program. For an obfuscated spoiler, try
    -
        ./dorssel < dorssel.md
    +
        ./dorssel < dorssel.md
    make all ``` @@ -10,7 +10,7 @@ this entry because of the system resources it requires. ## To use: -```sh +``` ./fanf ``` @@ -19,7 +19,7 @@ this entry because of the system resources it requires. Enter an expression on standard input. To try some we have selected: -```sh +``` ./try.sh ``` @@ -47,7 +47,7 @@ can you begin to understand what it is doing? Look at the first stage of the C pre-processing which was done like: -```sh +``` cc fanf.c -E > fanftmp1.c ``` diff --git a/1998/fanf/index.html b/1998/fanf/index.html index 343ca2462..0b97d488a 100644 --- a/1998/fanf/index.html +++ b/1998/fanf/index.html @@ -141,14 +141,14 @@ Location: GB - United Kingdom of Great

    To build:

    -
        make all
    +
        make all

    NOTE: this may take a while. Some systems may have problems building this entry because of the system resources it requires.

    To use:

    -
        ./fanf
    +
        ./fanf

    Try:

    Enter an expression on standard input. To try some we have selected:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    Historical aside:

    At a time the code in fanf.c was that of fanf.orig.c @@ -165,7 +165,7 @@ source.

    fanftmp2.c C program. Take a look at that final C program again, can you begin to understand what it is doing?

    Look at the first stage of the C pre-processing which was done like:

    -
        cc fanf.c -E > fanftmp1.c
    +
        cc fanf.c -E > fanftmp1.c

    Skip to the bottom of fanftmp1.c (after all of the C pre-processor header stuff … look for a line of the form: # 38 "fanf.c" near the bottom) and look at the resulting code. This code, when C pre-processed diff --git a/1998/schnitzi/README.md b/1998/schnitzi/README.md index f088cdb61..cbf0e96d1 100644 --- a/1998/schnitzi/README.md +++ b/1998/schnitzi/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [1998 schnitzi bugs](../../bugs.html#1998_schn ## To use: -```sh +``` ./schnitzi n > sort.c make sort ./sort @@ -32,14 +32,14 @@ where `n` and `x`, `y` and `z` are numbers. ## Try: -```sh +``` ./try.sh ``` What happens if at the command line you don't specify `n` numbers that the program expects? For instance try: -```sh +``` ./schnitzi 5 > sort.c make sort @@ -99,7 +99,7 @@ a depth of one. So what does it do? Give it an integer `(1 < n < 27)` on the command line, such as -```sh +``` ./schnitzi 5 ``` @@ -109,7 +109,7 @@ them, however, using only `if/else` statements, without arrays or looping. To see the resulting program run, redirect the output from `schnitzi` into another file, like this -```sh +``` ./schnitzi 4 > sort.c ``` diff --git a/1998/schnitzi/index.html b/1998/schnitzi/index.html index a4c1b34a3..933ffa12f 100644 --- a/1998/schnitzi/index.html +++ b/1998/schnitzi/index.html @@ -141,28 +141,28 @@ Location: ZZ - Unknown location

    To build:

    -
        make all
    +
        make all

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 1998 schnitzi bugs.

    To use:

    -
        ./schnitzi n > sort.c
    -    make sort
    -    ./sort
    -    # enter three numbers, space separated
    -
    -    echo x y z | ./sort
    +
        ./schnitzi n > sort.c
    +    make sort
    +    ./sort
    +    # enter three numbers, space separated
    +
    +    echo x y z | ./sort

    where n and x, y and z are numbers.

    Try:

    -
        ./try.sh
    +
        ./try.sh

    What happens if at the command line you don’t specify n numbers that the program expects? For instance try:

    -
        ./schnitzi 5 > sort.c
    -    make sort
    -
    -    # try running the next command four or five times:
    -    echo 2 5 3 1 | ./sort
    +
        ./schnitzi 5 > sort.c
    +    make sort
    +
    +    # try running the next command four or five times:
    +    echo 2 5 3 1 | ./sort

    Why does this happen?

    Judges’ remarks:

    This is a beautiful program. How can a program with no conditional (except for @@ -201,13 +201,13 @@ memory capacity, since the function call stack never goes beyond a depth of one.

    So what does it do? Give it an integer (1 < n < 27) on the command line, such as

    -
        ./schnitzi 5
    +
        ./schnitzi 5

    The output will itself be a lipographic program, one which expects input of (in this case) five numbers and prints them out sorted. It sorts them, however, using only if/else statements, without arrays or looping. To see the resulting program run, redirect the output from schnitzi into another file, like this

    -
        ./schnitzi 4 > sort.c
    +
        ./schnitzi 4 > sort.c

    and then compile it.

    Spoilers And Hints:

    The big key to this program is figuring out what the names of the diff --git a/1998/schweikh1/README.md b/1998/schweikh1/README.md index 6497f2aae..c70e413e5 100644 --- a/1998/schweikh1/README.md +++ b/1998/schweikh1/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -12,7 +12,7 @@ includes some interesting details about the entry. ## To use: -```sh +``` ./schweikh1 ``` @@ -30,7 +30,7 @@ if you don't have a Mac as it has some interesting details about the entry. ### Alternate build: -```sh +``` make alt ``` @@ -126,7 +126,7 @@ macros can be defined, because you could write strictly conforming programs that may fail to compile due to syntax errors: supposing that `` defines `PIPE_BUF`, then the conforming -```c +``` #include #include /* <- or where the bogus macro is defined */ #include @@ -155,7 +155,7 @@ C compilers. must resemble one of the canonical forms, `"foo.h"` or ``. This lets us write things like -```c +``` #define HEADER "foo.h" #include HEADER ``` @@ -164,7 +164,7 @@ C compilers. torturing the preprocessor a little more, by using token pasting, at least one compiler falls over. -```c +``` #define H(x) #include H(dio) /* expands to */ ``` @@ -187,7 +187,7 @@ C compilers. ISO 6.8.4. ISO 6.1.4 defines string literals as s-char-sequences, which may include octal escape sequences. Let's look at -```c +``` #include #line 42 "foo\0bar" int main (void) { @@ -214,7 +214,7 @@ C compilers. under his/her nose. Easy money from a bet! Make sure your guru has no chance to use Standardese weasel words as an escape: can I have -```c +``` case : case : ``` @@ -255,7 +255,7 @@ script to compute the character count according to the rules. The advantages of an independent clean room approach... -```perl +``` #!/usr/bin/perl -w $/ = "\0"; $_ = <>; @@ -266,7 +266,7 @@ The advantages of an independent clean room approach... To use, try: -```sh +``` perl ./charcount.pl schweikh1.c ``` diff --git a/1998/schweikh1/index.html b/1998/schweikh1/index.html index 98548f7c8..a33680129 100644 --- a/1998/schweikh1/index.html +++ b/1998/schweikh1/index.html @@ -141,13 +141,13 @@ Location: DE - Federal Republic of Germ

    To build:

    -
        make all
    +
        make all

    There is an alternate version of this entry that will work with macOS. See the Alternate code section below. We recommend you look at it even if you don’t have a Mac, unless you want to figure it out yourself, as it includes some interesting details about the entry.

    To use:

    -
        ./schweikh1
    +
        ./schweikh1

    Alternate code:

    As noted above this entry will not work as it stands for macOS and there are some important notes as well as a description of how the fixed version works @@ -157,7 +157,7 @@ adjustments). For details of what had to change, see macos. Unless you wish to figure it out yourself, we recommend that you read this even if you don’t have a Mac as it has some interesting details about the entry.

    Alternate build:

    -
        make alt
    +
        make alt

    Alternate build:

    Use schweikh1.alt as you would schweikh1 above.

    Alternate try:

    @@ -220,17 +220,17 @@ macros are explicitly enumerated. In a compliant implementation no other macros can be defined, because you could write strictly conforming programs that may fail to compile due to syntax errors: supposing that <stdio.h> defines PIPE_BUF, then the conforming

    -
        #include <assert.h>
    -    #include <stdio.h>    /*  <- or where the bogus macro is defined */
    -    #include <string.h>
    -    #define STR(x) #x
    -    #define XSTR(x) STR(x)
    -    int main (void)
    -    {
    -       int PIPE_BUF = 0;
    -       assert (strcmp ("PIPE_BUF", XSTR (PIPE_BUF)) == 0);
    -       return 0;
    -    }
    +
        #include <assert.h>
    +    #include <stdio.h>    /*  <- or where the bogus macro is defined */
    +    #include <string.h>
    +    #define STR(x) #x
    +    #define XSTR(x) STR(x)
    +    int main (void)
    +    {
    +       int PIPE_BUF = 0;
    +       assert (strcmp ("PIPE_BUF", XSTR (PIPE_BUF)) == 0);
    +       return 0;
    +    }

    is expected to compile and meet the assertion. If it does not, your compiler compiles some other language than ISO C.

    Why I think my program is obfuscated

    @@ -243,13 +243,13 @@ C compilers.

    must resemble one of the canonical forms, "foo.h" or <bar.h>. This lets us write things like -
        #define HEADER "foo.h"
    -    #include HEADER
    +
        #define HEADER "foo.h"
    +    #include HEADER

    I could not find a compiler rejecting this. However, if we’re torturing the preprocessor a little more, by using token pasting, at least one compiler falls over.

    -
        #define H(x) <st##x##.h>
    -    #include H(dio)              /* expands to <stdio.h> */
    +
        #define H(x) <st##x##.h>
    +    #include H(dio)              /* expands to <stdio.h> */

    is rejected by tcc version 4.1.2, the TenDRA compiler: "t.c", line 3: Error:\ [ISO 6.8.3.3]: Invalid result for '##' operator in macro 'H'.

    To be honest, I don’t know if the rules for pp-tokens and token @@ -264,12 +264,12 @@ allows: in #line num "file" the "file" is an s-char-se ISO 6.8.4. ISO 6.1.4 defines string literals as s-char-sequences, which may include octal escape sequences. Let’s look at -

        #include <stdio.h>
    -    #line 42 "foo\0bar"
    -    int main (void) {
    -       printf ("%s %d\n", __FILE__, (int)sizeof __FILE__);
    -       return 0;
    -    }
    +
        #include <stdio.h>
    +    #line 42 "foo\0bar"
    +    int main (void) {
    +       printf ("%s %d\n", __FILE__, (int)sizeof __FILE__);
    +       return 0;
    +    }

    This is supposed to output 'foo 8'. Here’s what happens in RL:

        foo 4        gcc 2.7.2.1, lcc
         foo\0bar 9   tcc 4.1.2, Sunsoft cc turn "\0" into "\\0", ugh!
    @@ -283,8 +283,8 @@ ISO 6.6.4.2. Then make fun of the guru’s answer by waving case __LINE__: under his/her nose. Easy money from a bet! Make sure your guru has no chance to use Standardese weasel words as an escape: can I have

    -
        case <some_token>:
    -    case <some_token>:
    +
        case <some_token>:
    +    case <some_token>:

    in the same switch? (Note that you need the [invisible] newline. You can generously allow the additional constraint that no #undefs or #defines are allowed between the two cases.)

    @@ -315,14 +315,14 @@ I could have used a lot more ^K and ^L probably undete counter but decided to err on the side of safety. I use a perl script to compute the character count according to the rules. The advantages of an independent clean room approach…

    -
        #!/usr/bin/perl -w
    -     = "\0";
    -     = <>;
    -    s/[;{}][ \t\n]/\n/g;
    -    s/[ \t\n]+//g;
    -    print length (),"\n";
    +
        #!/usr/bin/perl -w
    +    $/ = "\0";
    +    $_ = <>;
    +    s/[;{}][ \t\n]/\n/g;
    +    s/[ \t\n]+//g;
    +    print length ($_),"\n";

    To use, try:

    -
        perl ./charcount.pl schweikh1.c
    +
        perl ./charcount.pl schweikh1.c

    I have tried, as suggested in the guidelines, to let the code look like ordinary C code. Apart from a few long lines I think I left the indentation like I would in RL. You should however not try to diff --git a/1998/schweikh1/macos.html b/1998/schweikh1/macos.html index cb10eee28..3590c5fdf 100644 --- a/1998/schweikh1/macos.html +++ b/1998/schweikh1/macos.html @@ -138,7 +138,7 @@ a file was not found (this limitation was removed in both versions in 2023). see

    However, as noted, macOS does not have /usr/include so this would never work for macOS without some changes, described next. For macOS you will need the command line tools installed which can be done like:

    -
        sudo xcode-select --install
    +
        sudo xcode-select --install

    An important point is that the original version hard-coded gcc but just like the entry, the alternate version has also removed this limitation despite gcc existing (though it’s clang) in macOS.

    @@ -154,9 +154,9 @@ the command is:

    which has been changed to be:

    "0cc -ansi -E -dM -undef %s /usr/include/%s>r\0 ("

    Shortly below that you will see, as noted above, the numbers:

    -
        if ((H = fopen (__FILE__+43, 43+__FILE__)))
    -    while ((fgets (L, (int)sizeof L, H)) != 0) {
    -            I[strcspn (I, 45+__FILE__)] = O = 0;
    +
        if ((H = fopen (__FILE__+43, 43+__FILE__)))
    +    while ((fgets (L, (int)sizeof L, H)) != 0) {
    +            I[strcspn (I, 45+__FILE__)] = O = 0;

    The first number in the above C means the length starting from 0 up through the >. The second number is the same starting point but up through the \0 which is why it’s +2. But what happens if only the first number is updated (from the diff --git a/1998/schweikh1/macos.md b/1998/schweikh1/macos.md index ef18d9c0c..29187e070 100644 --- a/1998/schweikh1/macos.md +++ b/1998/schweikh1/macos.md @@ -19,7 +19,7 @@ However, as noted, macOS does **not** have `/usr/include` so this would never work for macOS without some changes, described next. For macOS you will need the command line tools installed which can be done like: -```sh +``` sudo xcode-select --install ``` @@ -50,7 +50,7 @@ which has been changed to be: Shortly below that you will see, as noted above, the numbers: -```c +``` if ((H = fopen (__FILE__+43, 43+__FILE__))) while ((fgets (L, (int)sizeof L, H)) != 0) { I[strcspn (I, 45+__FILE__)] = O = 0; diff --git a/1998/schweikh2/README.md b/1998/schweikh2/README.md index 2f7ed9b0e..5ad2fa7a1 100644 --- a/1998/schweikh2/README.md +++ b/1998/schweikh2/README.md @@ -1,26 +1,26 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./yarng ``` or -```sh +``` ./yarng integer_number ``` ## Try: -```sh +``` ./try.sh ./yarng @@ -42,13 +42,13 @@ At the time of judging, some non-gcc compilers that were not fully ANSI standard did not compile this entry correctly. Also at that time, some gcc and egcs implementations ran into a problem when building the entry. Doing: -```sh +``` make schweikh2 ``` often produced an error of the form: -```sh +``` gcc -ansi schweikh2.alt.c -o schweikh2.alt as: Error: cca00NzV.s, line 58: Missing " at end of string " @@ -58,20 +58,20 @@ often produced an error of the form: because the line: -```c +``` #line 10 ONE(O(1,1,2,6,0,6)) ``` turned into the line: -```c +``` # 9 "01\012" ``` (note, though, how that line is on line 11) which caused gcc to give to the assembler the following two lines: -```asm +``` .stabs "schweikh2.c ",132,0,0,Ltext1 ``` @@ -80,7 +80,7 @@ and the lone `"` after the `#.file` line resulted in an assembly syntax error. In some cases one had to compile using `gcc -g`: -```sh +``` make schweikh2 CFLAGS=-g ``` @@ -105,7 +105,7 @@ still can :-) ). Because of this bug, the code was changed to be instead: -```c +``` #line 10 "01\015" ``` @@ -122,13 +122,13 @@ compiler error: so the line: -```c +``` #line 10 "01\015" ``` was changed to: -```c +``` #line 10 ONE(O(1,1,2,6,0,6)) ``` @@ -158,7 +158,7 @@ different values? How long would you need for an empirical test? For example: -```sh +``` $ ./yarng 32 10111001010101110110010101001111 $ ./yarng 5 diff --git a/1998/schweikh2/index.html b/1998/schweikh2/index.html index f89d07d45..180b4bca7 100644 --- a/1998/schweikh2/index.html +++ b/1998/schweikh2/index.html @@ -141,16 +141,16 @@ Location: DE - Federal Republic of Germ

    To build:

    -
        make all
    +
        make all

    To use:

    -
        ./yarng
    +
        ./yarng

    or

    -
        ./yarng integer_number
    +
        ./yarng integer_number

    Try:

    -
        ./try.sh
    -
    -    ./yarng
    -    # watch what it does
    +
        ./try.sh
    +
    +    ./yarng
    +    # watch what it does

    What is the difference between what is in the script and running yarng without an arg?

    Judges’ remarks:

    @@ -160,24 +160,24 @@ results different? Why?

    At the time of judging, some non-gcc compilers that were not fully ANSI standard did not compile this entry correctly. Also at that time, some gcc and egcs implementations ran into a problem when building the entry. Doing:

    -
        make schweikh2
    +
        make schweikh2

    often produced an error of the form:

    -
        gcc -ansi schweikh2.alt.c -o schweikh2.alt
    -    as: Error: cca00NzV.s, line 58: Missing " at end of string
    -         "
    -    as: Error: cca00NzV.s, line 58: malformed statement
    -    *** Error code 1 (bu21)
    +
        gcc -ansi schweikh2.alt.c -o schweikh2.alt
    +    as: Error: cca00NzV.s, line 58: Missing " at end of string
    +         "
    +    as: Error: cca00NzV.s, line 58: malformed statement
    +    *** Error code 1 (bu21)

    because the line:

    -
        #line 10 ONE(O(1,1,2,6,0,6))
    +
        #line 10 ONE(O(1,1,2,6,0,6))

    turned into the line:

    -
        # 9 "01\012"
    +
        # 9 "01\012"

    (note, though, how that line is on line 11) which caused gcc to give to the assembler the following two lines:

    -
        .stabs "schweikh2.c
    -    ",132,0,0,Ltext1
    +
        .stabs "schweikh2.c
    +    ",132,0,0,Ltext1

    and the lone " after the #.file line resulted in an assembly syntax error.

    In some cases one had to compile using gcc -g:

    -
        make schweikh2 CFLAGS=-g
    +
        make schweikh2 CFLAGS=-g

    to trigger this error.

    With the proper text beyond the \012, it was even possible to have all kinds of fun adding inline assembly via #line directives. :-)

    @@ -191,7 +191,7 @@ for that matter :-) ).

    you could have emailed the author for a free pat on the back (and maybe you still can :-) ).

    Because of this bug, the code was changed to be instead:

    -
        #line 10 "01\015"
    +
        #line 10 "01\015"

    However in 2023 it was observed that it is gcc (at least some versions?) that has a problem with the compilation of the modified program, giving an internal compiler error:

    @@ -200,9 +200,9 @@ compiler error:

    :12:1: warning: missing terminating " character :12:19: internal compiler error: invalid built-in macro "__FILE__"

    so the line:

    -
        #line 10 "01\015"
    +
        #line 10 "01\015"

    was changed to:

    -
        #line 10 ONE(O(1,1,2,6,0,6))
    +
        #line 10 ONE(O(1,1,2,6,0,6))

    and now it works with both clang and gcc.

    Author’s remarks:

    What this program does

    @@ -223,10 +223,10 @@ bits may be specified by an argument and defaults either to UINT_MAXUINT_MAX+1 (most likely). Extra credit: why the different values? How long would you need for an empirical test?

    For example:

    -
        $ ./yarng 32
    -    10111001010101110110010101001111
    -    $ ./yarng 5
    -    10011
    +
        $ ./yarng 32
    +    10111001010101110110010101001111
    +    $ ./yarng 5
    +    10011

    Why I think this is obfuscated

    • Ever seen a ‘do for … while’ loop?

    • diff --git a/1998/schweikh3/README.md b/1998/schweikh3/README.md index 5b9f48e6e..704acf525 100644 --- a/1998/schweikh3/README.md +++ b/1998/schweikh3/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -23,7 +23,7 @@ If `dir` is the directory (or a directory tree) where you keep all your favorite pictures off the Internet or from `alt.binaries.pictures.*`, do -```sh +``` find dir -type f -print | ./samefile ``` @@ -34,7 +34,7 @@ Maybe you will not need to buy another 10 GB disk to store them. :-) If you're in this winning entry's directory: -```sh +``` ./try.sh ``` @@ -53,7 +53,7 @@ which if (in the code) is unset will be set to the default, 32767. If you wish to change the size to say, 55555: -```sh +``` make clobber SIZE=55555 alt ``` @@ -83,7 +83,7 @@ Thank God the IEEE does not standardize a coding style... This is best explained in the man page. The troff source for this man page can be found in the file [samefile.1](samefile.1). To render try: -```sh +``` `man ./samefile.1 ``` @@ -100,7 +100,7 @@ Otherwise: #### SYNOPSIS -```sh +``` ./samefile ``` @@ -141,7 +141,7 @@ inode numbers is also minimized. Suppose you have six identical files of size 100 in an inode group consisting of the three inodes with numbers 10, 20 and 30: -```sh +``` $ ls -i # output edited for readability: 10 file1 20 file4 30 file6 10 file2 20 file5 @@ -177,7 +177,7 @@ For everybody: What are the duplicates under my home directory? -```sh +``` find $HOME | ./samefile ``` @@ -185,14 +185,14 @@ For the sysadmin folks: Report all duplicate files under /usr larger than 16k: -```sh +``` find /usr -size +16384c -a -type f | ./samefile ``` For the ftp and WWW admins: How much space is wasted below our site's /pub directory? -```sh +``` find /pub -type f | samefile | awk '{sum += $1} END {print sum}' ``` diff --git a/1998/schweikh3/index.html b/1998/schweikh3/index.html index f4b75609c..e55c1fef1 100644 --- a/1998/schweikh3/index.html +++ b/1998/schweikh3/index.html @@ -141,7 +141,7 @@ Location: DE - Federal Republic of Germ

      To build:

      -
          make all
      +
          make all

      The author stated:

          In the remote event that the input has more than `8192` files with
           the same size (on systems where `sizeof (char *) == 4`, or `4096` when
      @@ -153,11 +153,11 @@ code below.

      If dir is the directory (or a directory tree) where you keep all your favorite pictures off the Internet or from alt.binaries.pictures.*, do

      -
          find dir -type f -print | ./samefile
      +
          find dir -type f -print | ./samefile

      Maybe you will not need to buy another 10 GB disk to store them. :-)

      Try:

      If you’re in this winning entry’s directory:

      -
          ./try.sh
      +
          ./try.sh

      Notice that the tool finds some files that are duplicates.

      Alternate code:

      If you run into the problem that the author described (above) you can redefine @@ -165,7 +165,7 @@ the size as described; this was done with the SZ macro defined in t which if (in the code) is unset will be set to the default, 32767.

      Alternate build:

      If you wish to change the size to say, 55555:

      -
          make clobber SIZE=55555 alt
      +
          make clobber SIZE=55555 alt

      or whatever you wish to redefine it to.

      Judges’ remarks:

      This program is not as smart as to detect identity of JPEG files with the same @@ -181,13 +181,13 @@ Thank God the IEEE does not standardize a coding style…

      What this program does

      This is best explained in the man page. The troff source for this man page can be found in the file samefile.1. To render try:

      -
          `man ./samefile.1
      +
          `man ./samefile.1

      Otherwise:

      SAMEFILE(1) User Manuals SAMEFILE(1)

      NAME

      samefile - find identical files

      SYNOPSIS

      -
          ./samefile
      +
          ./samefile

      DESCRIPTION

      samefile reads a list of file names (one file name per line) from stdin. For each file name pair with identical @@ -219,13 +219,13 @@ the output for a group of identical files with different inode numbers is also minimized. Suppose you have six identical files of size 100 in an inode group consisting of the three inodes with numbers 10, 20 and 30:

      -
          $ ls -i   # output edited for readability:
      -      10 file1     20 file4     30 file6
      -      10 file2     20 file5
      -      10 file3
      -    $ ls | ./samefile
      -    100     file1   file4   =       3       2
      -    100     file1   file6   =       3       1
      +
          $ ls -i   # output edited for readability:
      +      10 file1     20 file4     30 file6
      +      10 file2     20 file5
      +      10 file3
      +    $ ls | ./samefile
      +    100     file1   file4   =       3       2
      +    100     file1   file6   =       3       1

      The sum of the sizes in the first column is the amount of disk space you could gain by making all 6 files links to only one file or remove all but one of the files. To be @@ -245,13 +245,13 @@ more than a couple dozen files of the same size.

      EXAMPLES

      For everybody:

      What are the duplicates under my home directory?

      -
          find $HOME | ./samefile
      +
          find $HOME | ./samefile

      For the sysadmin folks:

      Report all duplicate files under /usr larger than 16k:

      -
          find /usr -size +16384c -a -type f | ./samefile
      +
          find /usr -size +16384c -a -type f | ./samefile

      For the ftp and WWW admins: How much space is wasted below our site’s /pub directory?

      -
          find /pub -type f | samefile | awk '{sum += $1} END {print sum}'
      +
          find /pub -type f | samefile | awk '{sum += $1} END {print sum}'

      EXIT STATUS

      If samefile runs out of memory the exit status is 1, zero otherwise.

      diff --git a/1998/tomtorfs/README.md b/1998/tomtorfs/README.md index 088fb7f15..ef9919984 100644 --- a/1998/tomtorfs/README.md +++ b/1998/tomtorfs/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make all ``` ## To use: -```sh +``` ./tomtorfs filename bitwidth polynom reflected init xor ``` @@ -25,7 +25,7 @@ where: ## Try: -```sh +``` ./try.sh ``` @@ -56,7 +56,7 @@ archiver that uses the CRC-32 algorithm. #### CRC-16: -```sh +``` ./tomtorfs filename 16 1021 0 FFFF 0000 ``` @@ -64,21 +64,21 @@ archiver that uses the CRC-32 algorithm. #### CRC-32: -```sh +``` ./tomtorfs filename 32 04C11DB7 1 FFFFFFFF FFFFFFFF ``` #### XMODEM: -```sh +``` ./tomtorfs filename 16 8408 1 0000 0000 ``` #### ARC: -```sh +``` ./tomtorfs filename 16 8005 1 0000 0000 ``` diff --git a/1998/tomtorfs/index.html b/1998/tomtorfs/index.html index a66769e53..fd465b7ad 100644 --- a/1998/tomtorfs/index.html +++ b/1998/tomtorfs/index.html @@ -141,9 +141,9 @@ Location: ZZ - Unknown location

      To build:

      -
          make all
      +
          make all

      To use:

      -
          ./tomtorfs filename bitwidth polynom reflected init xor
      +
          ./tomtorfs filename bitwidth polynom reflected init xor

      where:

          filename  : file to calculate the CRC of
           bitwidth  : width of the CRC in bits (decimal)
      @@ -152,7 +152,7 @@ Location: ZZ - Unknown location

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      If you don’t believe the program is correct, try and compare the output of the program with the value of CRCs computed by PKZIP or any other @@ -169,13 +169,13 @@ archiver that uses the CRC-32 algorithm.

      xor : value to xor the final CRC with (hexadecimal)

      Examples

      CRC-16:

      -
          ./tomtorfs filename 16 1021 0 FFFF 0000
      +
          ./tomtorfs filename 16 1021 0 FFFF 0000

      CRC-32:

      -
          ./tomtorfs filename 32 04C11DB7 1 FFFFFFFF FFFFFFFF
      +
          ./tomtorfs filename 32 04C11DB7 1 FFFFFFFF FFFFFFFF

      XMODEM:

      -
          ./tomtorfs filename 16 8408 1 0000 0000
      +
          ./tomtorfs filename 16 8408 1 0000 0000

      ARC:

      -
          ./tomtorfs filename 16 8005 1 0000 0000
      +
          ./tomtorfs filename 16 8005 1 0000 0000

      Portability notes

      The program assumes CHAR_BIT==8. Results are undefined if bitwidth > sizeof(unsigned long) * 8. It is also assumed that EOF is -1 and 1 is a valid exit value to indicate failure (replace them with EOF resp. diff --git a/2000/anderson/README.md b/2000/anderson/README.md index f215bbee9..1493b58a8 100644 --- a/2000/anderson/README.md +++ b/2000/anderson/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` echo something | ./anderson ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2000/anderson/index.html b/2000/anderson/index.html index b3f21a1e7..c4a1c7bf1 100644 --- a/2000/anderson/index.html +++ b/2000/anderson/index.html @@ -141,11 +141,11 @@ Location: ZZ - Unknown location

      To build:

      -
          make
      +
          make

      To use:

      -
          echo something | ./anderson
      +
          echo something | ./anderson

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      This small program might be a nice addition to a digital personal organizer; just in case you are stranded on a desert island and need to diff --git a/2000/bellard/README.md b/2000/bellard/README.md index 91e212529..1b04c374f 100644 --- a/2000/bellard/README.md +++ b/2000/bellard/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./bellard ``` diff --git a/2000/bellard/index.html b/2000/bellard/index.html index 7e5fde649..c99e87691 100644 --- a/2000/bellard/index.html +++ b/2000/bellard/index.html @@ -141,9 +141,9 @@ Location: FR - French Republic (

      To build:

      -
          make
      +
          make

      To use:

      -
          ./bellard
      +
          ./bellard

      Judges’ remarks:

      This code is a nice compact example of a Modular Fast Fourier Transform. While its output is very specific, the internal FFT has a wide variety of uses.

      diff --git a/2000/bmeyer/README.md b/2000/bmeyer/README.md index 8f122944b..5f8abc3ff 100644 --- a/2000/bmeyer/README.md +++ b/2000/bmeyer/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./bmeyer ``` @@ -16,7 +16,7 @@ In a video window (white text on black background): -```sh +``` ./try.sh ``` @@ -31,7 +31,7 @@ dashed argument) for compression and decompression! You've been warned. The author recommended on linux/x86, glibc 2.0, libc4/5: -```make +``` bmeyer: bmeyer.c CC -DY="__setfpucw(0x127f)" -O6 $? -o $@ -lm ``` @@ -40,7 +40,7 @@ However many compilers use `-O3` as the maximum level for `-O` optimization. And on linux/x86, glibc 2.1: -```make +``` bmeyer: bmeyer.c gcc -DY='int x=0x127f; __asm__ ("fldcw %0" : : "m" (*&x))' $? -o $@ -lm ``` @@ -80,13 +80,13 @@ on stdin, and it will decompress it to stdout --- as either raw or ASCII .PGM, depending on what format it was compressed from. For example: -```sh +``` ./glicbawls < michael.pgm > michael.glic ``` and then -```sh +``` ./glicbawls < michael.glic > michael.decoded.pgm ``` @@ -104,7 +104,7 @@ If you still have trouble, simply use a terminal or xterm with more than 80 columns, and tell `glicbawls` about it by giving the number of columns as an argument. For example -```sh +``` ./glicbawls 260 lavabus.glic ``` @@ -122,21 +122,21 @@ decoded as 35, 36, 37, 38 or 39. In order to use this mode, simply give the maximum allowed error as an argument, with a dash (`-`) before it. For example: -```sh +``` ./glicbawls -2 < graph.pgm > graph.2.glic ``` will compress in a way that allows decompression with a maximum error of two. You can combine both types of arguments, i.e.: -```sh +``` ./glicbawls -3 180 < graph.pgm >graph.3.glic ``` will compress with a maximum error of 3, using a 180 column terminal for the progress display, and: -```sh +``` ./glicbawls -3 180 < graph.3.glic > graph.3maxerr.pgm ``` diff --git a/2000/bmeyer/index.html b/2000/bmeyer/index.html index 115e8dee0..12e6a62ec 100644 --- a/2000/bmeyer/index.html +++ b/2000/bmeyer/index.html @@ -141,23 +141,23 @@ Location: AU - Commonwealth of Australi

      To build:

      -
          make
      +
          make

      To use:

      -
          ./bmeyer
      +
          ./bmeyer

      Try:

      In a video window (white text on black background):

      -
          ./try.sh
      +
          ./try.sh

      The script will suggest you compare the output of the program with images, prompting you to press any key to continue so that you may do so.

      Judges’ remarks:

      Don’t even think of supplying different compression factors (the dashed argument) for compression and decompression! You’ve been warned.

      The author recommended on linux/x86, glibc 2.0, libc4/5:

      -
          bmeyer: bmeyer.c
      +
          bmeyer: bmeyer.c
                   CC -DY="__setfpucw(0x127f)" -O6 $? -o $@ -lm

      However many compilers use -O3 as the maximum level for -O optimization.

      And on linux/x86, glibc 2.1:

      -
          bmeyer: bmeyer.c
      +
          bmeyer: bmeyer.c
                   gcc -DY='int x=0x127f; __asm__ ("fldcw %0" : : "m" (*&x))'  $? -o $@ -lm

      Compile with the maximum possible optimization on your system. If your system has 80-bit internal representation of floating @@ -184,9 +184,9 @@ output a compressed version to stdout. Feed it a compressed file on stdin, and it will decompress it to stdout — as either raw or ASCII .PGM, depending on what format it was compressed from. For example:

      -
          ./glicbawls < michael.pgm > michael.glic
      +
          ./glicbawls < michael.pgm > michael.glic

      and then

      -
          ./glicbawls < michael.glic > michael.decoded.pgm
      +
          ./glicbawls < michael.glic > michael.decoded.pgm

      As it turns out, glicbawls compresses greyscale images (or, more precisely, “natural” greyscale images) better than any other program I am aware of (with the exception of the not-yet-published @@ -199,7 +199,7 @@ have trouble recognizing the image, try squinting at it ;-).

      If you still have trouble, simply use a terminal or xterm with more than 80 columns, and tell glicbawls about it by giving the number of columns as an argument. For example

      -
          ./glicbawls 260 <lavabus.pgm >lavabus.glic
      +
          ./glicbawls 260 <lavabus.pgm >lavabus.glic

      will allow glicbawls to use up to 260 columns, which makes things much more recognizable.

      Still running out of space? Need to compress those images just a @@ -212,13 +212,13 @@ error of 2 is allowed, an original pixel value of 37 could be decoded as 35, 36, 37, 38 or 39. In order to use this mode, simply give the maximum allowed error as an argument, with a dash (-) before it. For example:

      -
          ./glicbawls -2 < graph.pgm > graph.2.glic
      +
          ./glicbawls -2 < graph.pgm > graph.2.glic

      will compress in a way that allows decompression with a maximum error of two. You can combine both types of arguments, i.e.:

      -
          ./glicbawls -3 180 < graph.pgm >graph.3.glic
      +
          ./glicbawls -3 180 < graph.pgm >graph.3.glic

      will compress with a maximum error of 3, using a 180 column terminal for the progress display, and:

      -
          ./glicbawls -3 180 < graph.3.glic > graph.3maxerr.pgm
      +
          ./glicbawls -3 180 < graph.3.glic > graph.3maxerr.pgm

      will decompress the result on such a terminal.

      But wait, there is more — you can also feed glicbawls .PPM files (i.e. colour images), raw or ASCII, your choice. glicbawls will diff --git a/2000/briddlebane/README.md b/2000/briddlebane/README.md index e6e1b94b9..f2623c3cc 100644 --- a/2000/briddlebane/README.md +++ b/2000/briddlebane/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./briddlebane ``` @@ -19,7 +19,7 @@ equivalent file! You might also like to try: -```sh +``` ./try.sh INSULTS=15 ./try.sh diff --git a/2000/briddlebane/index.html b/2000/briddlebane/index.html index d5d9338c3..b335095a9 100644 --- a/2000/briddlebane/index.html +++ b/2000/briddlebane/index.html @@ -144,16 +144,16 @@ Location: ZZ - Unknown location

      To build:

      -
          make
      +
          make

      To use:

      -
          ./briddlebane
      +
          ./briddlebane

      Try:

      For some fun every time you log in try running this from your .bashrc or equivalent file!

      You might also like to try:

      -
          ./try.sh
      -
      -    INSULTS=15 ./try.sh
      +
          ./try.sh
      +
      +    INSULTS=15 ./try.sh

      Judges’ remarks:

      One could argue that this program was a “diseased dumpster of tripe” but I suspect that would only result in the judges being heckled as a diff --git a/2000/dhyang/README.md b/2000/dhyang/README.md index fe19210fb..045fd18ab 100644 --- a/2000/dhyang/README.md +++ b/2000/dhyang/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./dhyang ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2000/dhyang/index.html b/2000/dhyang/index.html index f37919cb9..88034d1c0 100644 --- a/2000/dhyang/index.html +++ b/2000/dhyang/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      To use:

      -
          ./dhyang
      +
          ./dhyang

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      A beautiful combination of solving several different problems, but mostly, the single most impressive layout we’ve ever seen. Many diff --git a/2000/dlowe/README.md b/2000/dlowe/README.md index 9ab5e8da9..47698db36 100644 --- a/2000/dlowe/README.md +++ b/2000/dlowe/README.md @@ -1,12 +1,12 @@ ## To build: -```sh +``` make ``` The following bit of perl may help determine the values you need: -```sh +``` perl -MConfig -e 'print "$Config{archlibexp}/CORE\n"' ``` @@ -27,14 +27,14 @@ For more detailed information see [2000 dlowe bugs](../../bugs.html#2000_dlowe). ## To use: -```sh +``` ./dlowe [file ...] ``` ## Try: -```sh +``` ./try.sh ``` @@ -126,7 +126,7 @@ or EOF is encountered. ### Examples: -```sh +``` $ echo '12 13 14 15 16 + + + + f' | ./dlowe 70 $ echo '12 13 14 15 16 17 + - * / p' | ./dlowe diff --git a/2000/dlowe/index.html b/2000/dlowe/index.html index c07dd7df3..8d483808c 100644 --- a/2000/dlowe/index.html +++ b/2000/dlowe/index.html @@ -141,9 +141,9 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      The following bit of perl may help determine the values you need:

      -
          perl -MConfig -e 'print "$Config{archlibexp}/CORE\n"'
      +
          perl -MConfig -e 'print "$Config{archlibexp}/CORE\n"'

      … just in case the Makefile does not figure this out for you.

      Bugs and (Mis)features:

      The current status of this entry is:

      @@ -151,9 +151,9 @@ Location: US - United States of America STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2000 dlowe bugs.

      To use:

      -
          ./dlowe [file ...]
      +
          ./dlowe [file ...]

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      When this entry was submitted the rules of the IOCCC did not prohibit the use of embedded language interpreters. The judges considered @@ -213,20 +213,20 @@ or EOF is encountered.

      the results of an operation are really huge (> 10^308) This bug appears to be fixed in perl5.6.0

      Examples:

      -
          $ echo '12 13 14 15 16 + + + + f' | ./dlowe
      -    70
      -    $ echo '12 13 14 15 16 17 + - * / p' | ./dlowe
      -    -0.0515873015873016
      -    $ echo '+' | ./dlowe
      -    stack empty
      -    $ echo '999999999999999 1 + p' | ./dlowe
      -    1e+15
      -    $ echo '99999999999999 1 + p' | ./dlowe
      -    100000000000000
      -    $ echo '12.5 9 % 10 * 15 + f' | ./dlowe
      -    50
      -    $ echo '7 P 6 d P P 8 p' | ./dlowe | tr 876 tpo
      -    poot
      +
          $ echo '12 13 14 15 16 + + + + f' | ./dlowe
      +    70
      +    $ echo '12 13 14 15 16 17 + - * / p' | ./dlowe
      +    -0.0515873015873016
      +    $ echo '+' | ./dlowe
      +    stack empty
      +    $ echo '999999999999999 1 + p' | ./dlowe
      +    1e+15
      +    $ echo '99999999999999 1 + p' | ./dlowe
      +    100000000000000
      +    $ echo '12.5 9 % 10 * 15 + f' | ./dlowe
      +    50
      +    $ echo '7 P 6 d P P 8 p' | ./dlowe | tr 876 tpo
      +    poot

      Code Concept:

      We all know that Perl and other VHLLs (very high level languages) are particularly well-suited for (among other things) string diff --git a/2000/jarijyrki/README.md b/2000/jarijyrki/README.md index a7a0a6861..70205406a 100644 --- a/2000/jarijyrki/README.md +++ b/2000/jarijyrki/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -9,7 +9,7 @@ You will need X11 header files and libraries installed to build this program. ## To use: -```sh +``` ./jarijyrki < infile.info > outfile.info ``` @@ -18,7 +18,7 @@ You will need a system capable of displaying the results of X Window programs. ## Try: -```sh +``` ./jarijyrki < finance.sheet > myedits.info ``` @@ -88,7 +88,7 @@ supports are: ##### Starting -```sh +``` ./jarijyrki < finance.sheet > myedits.info ``` @@ -144,7 +144,7 @@ To start the spreadsheet program with an existing spreadsheet, for instance [finance.sheet](finance.sheet), use the following command line: -```sh +``` ./jarijyrki < finance.sheet ``` @@ -156,7 +156,7 @@ supported by the program. To start the program with an empty sheet, use -```sh +``` ./jarijyrki < /dev/null ``` @@ -171,7 +171,7 @@ output. Hence, when the spreadsheet window has come up, you've made your changes, and you press the ESC key the program finishes. To save the results in a file, the following typical command line would be used: -```sh +``` ./jarijyrki < finance.sheet > myedits.info ``` diff --git a/2000/jarijyrki/index.html b/2000/jarijyrki/index.html index 14a9194e7..2631dba68 100644 --- a/2000/jarijyrki/index.html +++ b/2000/jarijyrki/index.html @@ -144,13 +144,13 @@ Location: FI - Republic of Finland

      To build:

      -
          make
      +
          make

      You will need X11 header files and libraries installed to build this program.

      To use:

      -
          ./jarijyrki < infile.info > outfile.info
      +
          ./jarijyrki < infile.info > outfile.info

      You will need a system capable of displaying the results of X Window programs.

      Try:

      -
          ./jarijyrki < finance.sheet > myedits.info
      +
          ./jarijyrki < finance.sheet > myedits.info

      Then click on cell C3 and type in the following:

          C5 C6 C7 @

      Click on cell D4 and type in the following:

      @@ -190,7 +190,7 @@ supports are:

      2. USAGE INSTRUCTIONS

      2.1. Quick Guide

      Starting
      -
          ./jarijyrki < finance.sheet > myedits.info
      +
          ./jarijyrki < finance.sheet > myedits.info
      Stopping

      Use the ESC key.

      Movement
      @@ -214,14 +214,14 @@ character at the end of the formula; press backspace to delete the last one.

      To start the spreadsheet program with an existing spreadsheet, for instance finance.sheet, use the following command line:

      -
          ./jarijyrki < finance.sheet
      +
          ./jarijyrki < finance.sheet

      The file finance.sheet has been provided as an example. This file contains a set of financial numbers and two graphical entities - a pie chart and a histogram - based on them. We recommend starting the use of the program from this file, as a way to study and learn the formula language supported by the program.

      To start the program with an empty sheet, use

      -
          ./jarijyrki < /dev/null
      +
          ./jarijyrki < /dev/null

      Alternatively, /dev/zero could be used but that may not exist on all systems.

      2.3. Exiting and Saving Spreadsheets

      Normally the user obviously wants to edit the spreadsheet. After the @@ -229,7 +229,7 @@ spreadsheet program finishes, it outputs the edited spreadsheet to the standard output. Hence, when the spreadsheet window has come up, you’ve made your changes, and you press the ESC key the program finishes. To save the results in a file, the following typical command line would be used:

      -
          ./jarijyrki < finance.sheet > myedits.info
      +
          ./jarijyrki < finance.sheet > myedits.info

      2.4. Visual Overview

      On top of the window the Formula Area shows the formula (or text) of the currently selected cell. The program starts with A1 as being the current cell. diff --git a/2000/natori/README.md b/2000/natori/README.md index 8f7ec2f46..db50dd5e8 100644 --- a/2000/natori/README.md +++ b/2000/natori/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -11,14 +11,14 @@ version](#alternate-code) below. ## To use: -```sh +``` ./natori ``` ## Try: -```sh +``` ./try.sh ``` @@ -42,14 +42,14 @@ The author noted that those in the southern hemisphere might want to change To run the alternate code that supports the southern hemisphere: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./natori.alt ``` @@ -65,7 +65,7 @@ versions? Or are there any? ### Alternate try: -```sh +``` ./try.alt.sh ``` diff --git a/2000/natori/index.html b/2000/natori/index.html index 40b6e06bd..f6b9e2044 100644 --- a/2000/natori/index.html +++ b/2000/natori/index.html @@ -141,14 +141,14 @@ Location: JP - Japan

      To build:

      -
          make
      +
          make

      An alt version exists for those in the southern hemisphere (or those who want to see what it would be in the southern hemisphere). See alternate version below.

      To use:

      -
          ./natori
      +
          ./natori

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Try running this on different days, say a few days apart (even better if the Moon phase changes), and each time run it several times in a row (or several times in a day).

      @@ -160,9 +160,9 @@ input or else just by the code itself. Bonus points if you can make it show all. acos(l/2) into acos(-l/2) which we have done in the alternate version.

      Alternate build:

      To run the alternate code that supports the southern hemisphere:

      -
          make alt
      +
          make alt

      Alternate use:

      -
          ./natori.alt
      +
          ./natori.alt

      Try running this on different days, say a few days apart, and each time run it several times in a row (or several times in a day).

      What happens if you run it in the northern hemisphere? Are there any @@ -170,7 +170,7 @@ differences?

      Can you identify any Moon phases that result in the same output of both versions? Or are there any?

      Alternate try:

      -
          ./try.alt.sh
      +
          ./try.alt.sh

      Like with try.sh, try using this multiple times in a row or throughout the day on different days (if different phases of the Moon you’ll see more of a difference, of course).

      diff --git a/2000/primenum/README.md b/2000/primenum/README.md index ddec251f7..705d1c9d0 100644 --- a/2000/primenum/README.md +++ b/2000/primenum/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2000 primenum bugs](../../bugs.html#2000_prim ## To use: -```sh +``` echo n | ./primenum n ``` @@ -27,7 +27,7 @@ NOTE: `n` is an integer. ## Try: -```sh +``` ./try.sh ``` @@ -64,7 +64,7 @@ Instead, the program reads input from `stdin` and returns garbled text on `stdout`. Fortunately, you can recover the original message simply by running the program a second time. Try: -```sh +``` ./primenum n < textfile | ./primenum n > textfile2 diff textfile textfile2 ``` diff --git a/2000/primenum/index.html b/2000/primenum/index.html index d89b97a47..c5113b449 100644 --- a/2000/primenum/index.html +++ b/2000/primenum/index.html @@ -141,16 +141,16 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2000 primenum bugs.

      To use:

      -
          echo n | ./primenum n
      +
          echo n | ./primenum n

      NOTE: n is an integer.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      Don’t read the author remarks until you’re ready for the spoiler. Just stop and read the program; it won’t take long. Once you’ve figured @@ -174,8 +174,8 @@ syntax “mistakes” (e.g. LessThanOrEqualTo) and blatant “erro Instead, the program reads input from stdin and returns garbled text on stdout. Fortunately, you can recover the original message simply by running the program a second time. Try:

      -
          ./primenum n < textfile | ./primenum n > textfile2
      -    diff textfile textfile2
      +
          ./primenum n < textfile | ./primenum n > textfile2
      +    diff textfile textfile2

      where n is the same number (modulo 64). So, the prime number generator is actually a simple text encoder/decoder! Of course, don’t forget that argument, otherwise the “bugs” in the program will cause it to crash!

      diff --git a/2000/rince/README.md b/2000/rince/README.md index d4df7d496..5275e9ca7 100644 --- a/2000/rince/README.md +++ b/2000/rince/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [2000 rince bugs](../../bugs.html#2000_rince). ## To use: -```sh +``` ./rince number number2 ``` @@ -28,7 +28,7 @@ different. ## Try: -```sh +``` ./try.sh ``` @@ -51,7 +51,7 @@ observation. The simplest way to run it is with no arguments. Just type: -```sh +``` ./rince ``` @@ -65,7 +65,7 @@ has a built in time machine. Indeed the program knows the speed of light, which is used to ensure that we see the "live" pictures. Simply specify the fraction of a day to skip forward for each screen refresh. I suggest: -```sh +``` ./rince 0.01 ``` @@ -73,7 +73,7 @@ To display the output (still guessing?) for a given date, specify two arguments. The first argument is as before and the second argument is a Julian day number (given as a fractional component). E.g.: -```sh +``` ./rince 0 2441193.6 ./rince 0.01 2441193.6 ``` @@ -170,7 +170,7 @@ states the following: Thus we can plot Galileo's discoveries using the following three plots: -```sh +``` ./rince 0 $(./dmy2jd 7.8 1 1610) ./rince 0 $(./dmy2jd 8.8 1 1610) ./rince 0 $(./dmy2jd 10.8 1 1610) @@ -180,7 +180,7 @@ However we can go one better by seeing what Galileo would have seen if it wasn't cloudy on the 9th. Try: -```sh +``` ./rince 0 $(./dmy2jd 9.85 1 1610) ``` diff --git a/2000/rince/index.html b/2000/rince/index.html index e00633062..c68115f1e 100644 --- a/2000/rince/index.html +++ b/2000/rince/index.html @@ -141,17 +141,17 @@ Location: GB - United Kingdom of Great

      To build:

      -
          make all
      +
          make all

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2000 rince bugs.

      To use:

      -
          ./rince number number2
      +
          ./rince number number2

      If DISPLAY is not set the program will very likely crash or do something different.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      This will run the program several times with different parameters to show different types of things. See the author’s remarks for more details.

      Judges’ remarks:

      @@ -162,7 +162,7 @@ observation.

      Author’s remarks:

      How to use it

      The simplest way to run it is with no arguments. Just type:

      -
          ./rince
      +
          ./rince

      You will need to have access to X windows, although it doesn’t require desperately high resolution and there are no known limitations on colour depth.

      @@ -171,12 +171,12 @@ or more to be visible. For those that cannot wait that long the program has a built in time machine. Indeed the program knows the speed of light, which is used to ensure that we see the “live” pictures. Simply specify the fraction of a day to skip forward for each screen refresh. I suggest:

      -
          ./rince 0.01
      +
          ./rince 0.01

      To display the output (still guessing?) for a given date, specify two arguments. The first argument is as before and the second argument is a Julian day number (given as a fractional component). E.g.:

      -
          ./rince 0 2441193.6
      -    ./rince 0.01 2441193.6
      +
          ./rince 0 2441193.6
      +    ./rince 0.01 2441193.6

      A Julian day is defined to be the number of days since January 1st in the year -4712 (4713BC), starting at 12 noon GMT.12 To aid conversion from our time (GMT) to Julian day there is a supplementary program named: @@ -248,12 +248,12 @@ states the following:

      Here he could see for himself that somehow, a planet could orbit the sun, and not leave a moon behind!

      Thus we can plot Galileo’s discoveries using the following three plots:

      -
          ./rince 0 $(./dmy2jd  7.8 1 1610)
      -    ./rince 0 $(./dmy2jd  8.8 1 1610)
      -    ./rince 0 $(./dmy2jd 10.8 1 1610)
      +
          ./rince 0 $(./dmy2jd  7.8 1 1610)
      +    ./rince 0 $(./dmy2jd  8.8 1 1610)
      +    ./rince 0 $(./dmy2jd 10.8 1 1610)

      However we can go one better by seeing what Galileo would have seen if it wasn’t cloudy on the 9th. Try:

      -
          ./rince 0 $(./dmy2jd 9.85 1 1610)
      +
          ./rince 0 $(./dmy2jd 9.85 1 1610)

      to see what he was missing out on. I wonder what he’d have made of that!

      Galileo discovered the fourth moon a few days later.

      I’ve tried typing these dates into two Java based Jovian moon plotters, diff --git a/2000/robison/README.md b/2000/robison/README.md index 269ca16df..373a5a921 100644 --- a/2000/robison/README.md +++ b/2000/robison/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./robison ``` diff --git a/2000/robison/index.html b/2000/robison/index.html index e711ca1c5..e2ba496f0 100644 --- a/2000/robison/index.html +++ b/2000/robison/index.html @@ -141,9 +141,9 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      To use:

      -
          ./robison
      +
          ./robison

      Judges’ remarks:

      The program plays almost always reasonably, but does not always detect illegal moves. Try “9 1” as your first move, then “13 2”. Also it diff --git a/2000/schneiderwent/README.md b/2000/schneiderwent/README.md index d6329887a..aafa0d595 100644 --- a/2000/schneiderwent/README.md +++ b/2000/schneiderwent/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./schneiderwent ``` ## Try: -```sh +``` ./schneiderwent schneiderwent.data ./schneiderwent ``` @@ -24,7 +24,7 @@ What's the difference? If you have a long while to spare (and you're bored enough that you could watch paint dry :-) ) you might also try: -```sh +``` ./try.sh ``` @@ -33,7 +33,7 @@ you wish to make it run faster, you can override how long it sleeps per iterations and how many iterations it runs. For instance to make it sleep only 30 seconds and run only twice: -```sh +``` SLEEP=30 ITERATIONS=2 ./try.sh ``` diff --git a/2000/schneiderwent/index.html b/2000/schneiderwent/index.html index 8b50fcc8a..504bee43a 100644 --- a/2000/schneiderwent/index.html +++ b/2000/schneiderwent/index.html @@ -141,21 +141,21 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      To use:

      -
          ./schneiderwent
      +
          ./schneiderwent

      Try:

      -
          ./schneiderwent schneiderwent.data
      -    ./schneiderwent
      +
          ./schneiderwent schneiderwent.data
      +    ./schneiderwent

      What’s the difference?

      If you have a long while to spare (and you’re bored enough that you could watch paint dry :-) ) you might also try:

      -
          ./try.sh
      +
          ./try.sh

      Alternatively, you can check on it later on, to see all the entry does. Or if you wish to make it run faster, you can override how long it sleeps per iterations and how many iterations it runs. For instance to make it sleep only 30 seconds and run only twice:

      -
          SLEEP=30 ITERATIONS=2 ./try.sh
      +
          SLEEP=30 ITERATIONS=2 ./try.sh

      Judges’ remarks:

      Very nice play by the rules and portable text obfuscation. This far surpasses old tricks like adding or subtracting 1 diff --git a/2000/thadgavin/README.md b/2000/thadgavin/README.md index 5dcdf024c..aebc74a41 100644 --- a/2000/thadgavin/README.md +++ b/2000/thadgavin/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make alt ``` @@ -16,7 +16,7 @@ looked like back in 2000 (with a configurable speed). See the ## To use: -```sh +``` ./thadgavin.alt ``` @@ -27,7 +27,7 @@ You can press 'q' at any time to exit. If you have SDL1 installed: -```sh +``` ./thadgavin_sdl ``` @@ -43,13 +43,13 @@ microseconds) for the SDL version. To change the SDL one to something like `15000` you can do: -```sh +``` make SDL_SLEEP=15000 clobber alt ``` and to change the curses one to `40`: -```sh +``` make SLEEP=40 clobber alt ``` @@ -75,14 +75,14 @@ is not a problem there. ### Original build: -```sh +``` make all ``` ### Original use: -```sh +``` ./thadgavin ``` @@ -91,7 +91,7 @@ is not a problem there. If you have SDL1 installed: -```sh +``` ./thadgavin_sdl ``` @@ -110,14 +110,14 @@ less than dazzling. We could not test this entry in DOS mode. Compile using DJGPP as follows: -```sh +``` gcc thadgavin.c -o thadgavin.exe -Wall -lm -O6 -mpentium -fomit-frame-pointer -ffast-math ``` ### To use under Windows, X-Windows or macOS using the Simple DirectMedia Layer: -```sh +``` gcc -O6 -lpthread -g -o thadgavin thadgavin.c -lSDL -DSDL -lm ``` @@ -125,7 +125,7 @@ Compile using DJGPP as follows: ### To use curses: -```sh +``` gcc -O6 -lpthread -g -o thadgavin thadgavin.c -lncurses -lm ``` diff --git a/2000/thadgavin/index.html b/2000/thadgavin/index.html index 0f378f8cb..15468b390 100644 --- a/2000/thadgavin/index.html +++ b/2000/thadgavin/index.html @@ -144,7 +144,7 @@ Location: GB - United Kingdom of Great

      To build:

      -
          make alt
      +
          make alt

      NOTE: if you don’t have curses or SDL1 installed both modes will fail to compile. In that case see the FAQ 3.8 - How do I compile an IOCCC entry that requires SDL1 or SDL2? and FAQ 3.9 - How do I compile an IOCCC entry that @@ -153,11 +153,11 @@ requires (n)curses? for more information.

      looked like back in 2000 (with a configurable speed). See the original code section for the original entry.

      To use:

      -
          ./thadgavin.alt
      +
          ./thadgavin.alt

      You can press ‘q’ at any time to exit.

      Try:

      If you have SDL1 installed:

      -
          ./thadgavin_sdl
      +
          ./thadgavin_sdl

      Whereas the curses version has an early exit the SDL version does not. You will have to kill it yourself.

      You might also wish to reconfigure the speed at which the programs run. The code @@ -167,9 +167,9 @@ redefine the values: SLEEP is how long the program sleeps (in micro between output with curses and SDL_SLEEP is how long it sleeps (also in microseconds) for the SDL version.

      To change the SDL one to something like 15000 you can do:

      -
          make SDL_SLEEP=15000 clobber alt
      +
          make SDL_SLEEP=15000 clobber alt

      and to change the curses one to 40:

      -
          make SLEEP=40 clobber alt
      +
          make SLEEP=40 clobber alt

      Then use the program(s) in the same way.

      The different macros is because the curses version is already much slower and so it’s better to not tie the two values together. You may of course redefine both @@ -184,12 +184,12 @@ typically ctrl-c) as the program does not call endwin(). Using

      Original build:

      -
          make all
      +
          make all

      Original use:

      -
          ./thadgavin
      +
          ./thadgavin

      Original try:

      If you have SDL1 installed:

      -
          ./thadgavin_sdl
      +
          ./thadgavin_sdl

      Judges’ remarks:

      This entry is a nice play by the rules. It can use curses, if the SDL graphic library is not present, and is quite good at that, @@ -198,11 +198,11 @@ less than dazzling. We could not test this entry in DOS mode.

      Authors’ remarks:

      To use under DOS:

      Compile using DJGPP as follows:

      -
          gcc thadgavin.c -o thadgavin.exe -Wall -lm -O6 -mpentium -fomit-frame-pointer -ffast-math
      +
          gcc thadgavin.c -o thadgavin.exe -Wall -lm -O6 -mpentium -fomit-frame-pointer -ffast-math

      To use under Windows, X-Windows or macOS using the Simple DirectMedia Layer:

      -
          gcc -O6 -lpthread -g -o thadgavin thadgavin.c -lSDL -DSDL -lm
      +
          gcc -O6 -lpthread -g -o thadgavin thadgavin.c -lSDL -DSDL -lm

      To use curses:

      -
          gcc -O6 -lpthread -g -o thadgavin thadgavin.c -lncurses -lm
      +
          gcc -O6 -lpthread -g -o thadgavin thadgavin.c -lncurses -lm

      Warnings

      In gcc you might get the following warning:

          thadgavin.c.c:46: warning: passing arg 2 of `SDL_SetColors' from incompatible pointer type
      diff --git a/2000/tomx/README.md b/2000/tomx/README.md index 3520da688..461b3d98f 100644 --- a/2000/tomx/README.md +++ b/2000/tomx/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,14 +10,14 @@ There is an alternate version that compiles [mkentry.c](mkentry.c). See ## To use: -```sh +``` ./tomx ``` ## Try: -```sh +``` ./try.sh ``` @@ -32,14 +32,14 @@ using it as a Makefile and running the code ends up running `mkentry`. ### Alternate build: -```sh +``` make alt ``` ### Alternate try: -```sh +``` ./try.alt.sh ``` diff --git a/2000/tomx/index.html b/2000/tomx/index.html index 117db3d4e..3d7abcc50 100644 --- a/2000/tomx/index.html +++ b/2000/tomx/index.html @@ -141,22 +141,22 @@ Location: NL - Kingdom of the Netherlan

      To build:

      -
          make
      +
          make

      There is an alternate version that compiles mkentry.c. See alternate code.

      To use:

      -
          ./tomx
      +
          ./tomx

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Alternate code:

      This alternate code is based on the author’s remarks with a slight fix so that it will do what it once did, compile and run mkentry.c. You can use it in a similar way as tomx.c, both executing the source file and using it as a Makefile and running the code ends up running mkentry.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate try:

      -
          ./try.alt.sh
      +
          ./try.alt.sh

      Judges’ remarks:

      Polyglots have come and gone, but this was the first one we’d seen where one language used another to perform its tasks. An interesting diff --git a/2001/anonymous/README.md b/2001/anonymous/README.md index 58f85d5a1..39e8c1684 100644 --- a/2001/anonymous/README.md +++ b/2001/anonymous/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -27,14 +27,14 @@ For more detailed information see [2001 anonymous bugs](../../bugs.html#2001_ano ## To use: -```sh +``` ./anonymous x86_program ``` ## Try: -```sh +``` ./try.sh ./anonymous anonymous.bed # if able to compile as a 32-bit (-m32) ELF binary @@ -64,14 +64,14 @@ that :-( ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./anonymous.ten.alt ./anonymous.bed.alt diff --git a/2001/anonymous/index.html b/2001/anonymous/index.html index 71757b9e2..65e05c607 100644 --- a/2001/anonymous/index.html +++ b/2001/anonymous/index.html @@ -141,7 +141,7 @@ Location: GB - United Kingdom of Great

      To build:

      -
          make
      +
          make

      The programs that this program is supposed to act on, anonymous.ten.c and anonymous.bed.c, compiled with make, MUST be compiled as 32-bit ELF binaries. In the case that @@ -155,11 +155,11 @@ whatever your system will compile them as).

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2001 anonymous bugs.

      To use:

      -
          ./anonymous x86_program
      +
          ./anonymous x86_program

      Try:

      -
          ./try.sh
      -
      -    ./anonymous anonymous.bed # if able to compile as a 32-bit (-m32) ELF binary
      +
          ./try.sh
      +
      +    ./anonymous anonymous.bed # if able to compile as a 32-bit (-m32) ELF binary

      NOTE: if the 32-bit version cannot be compiled the script will at least compile anonymous.ten as a 64-bit program (or whatever your system is set to) and run it directly.

      @@ -176,11 +176,11 @@ program or do something terribly wrong like slaughtering all the Imladris! :-) so please don’t do that :-(

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      -
          ./anonymous.ten.alt
      -
      -    ./anonymous.bed.alt
      +
          ./anonymous.ten.alt
      +
      +    ./anonymous.bed.alt

      A 2023 note about the warning from the author:

      The author suggested that this might somewhat destroy the binaries this touches but after the fix of 2023 this was not observed (yet?). It does indeed diff --git a/2001/bellard/README.md b/2001/bellard/README.md index 4f62e47e0..0256da76e 100644 --- a/2001/bellard/README.md +++ b/2001/bellard/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -19,14 +19,14 @@ For more detailed information see [2001 bellard bugs](../../bugs.html#2001_bella ## To use: -```sh +``` ./bellard file ``` ## Try: -```sh +``` ./bellard bellard.otccex.c ``` @@ -47,7 +47,7 @@ program. You can use it by typing: -```sh +``` ./bellard bellard.c [args]... ``` @@ -61,19 +61,19 @@ or by giving the C source to its standard input. - Sample compilation and execution: -```sh +``` ./bellard bellard.otccex.c 10 ``` - Self compilation: -```sh +``` ./bellard bellard.c bellard.otccex.c 10 ``` - Self compilation iterated... -```sh +``` ./bellard bellard.c bellard.c bellard.otccex.c 10 ``` diff --git a/2001/bellard/index.html b/2001/bellard/index.html index 91b5aee0d..ba8de43ec 100644 --- a/2001/bellard/index.html +++ b/2001/bellard/index.html @@ -141,16 +141,16 @@ Location: FR - French Republic (

      To build:

      -
          make
      +
          make

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: INABIAF - please **DO NOT** fix
           STATUS: doesn't work with some platforms - please help us fix

      For more detailed information see 2001 bellard bugs.

      To use:

      -
          ./bellard file
      +
          ./bellard file

      Try:

      -
          ./bellard bellard.otccex.c
      +
          ./bellard bellard.otccex.c

      Judges’ remarks:

      <JUDGES_COMMENTS> :-)

      Author’s remarks:

      @@ -161,7 +161,7 @@ compilable by a standard ANSI C compiler. OTCC compiles, assembles, links and runs C code without the need of any other program.

      You can use it by typing:

      -
          ./bellard bellard.c [args]...
      +
          ./bellard bellard.c [args]...

      or by giving the C source to its standard input.

      args are given to the main() function of bellard.c (argv[0] is bellard.c).

      @@ -169,15 +169,15 @@ program.

      • Sample compilation and execution:
      -
          ./bellard bellard.otccex.c 10
      +
          ./bellard bellard.otccex.c 10
      • Self compilation:
      -
          ./bellard bellard.c bellard.otccex.c 10
      +
          ./bellard bellard.c bellard.otccex.c 10
      • Self compilation iterated…
      -
          ./bellard bellard.c bellard.c bellard.otccex.c 10
      +
          ./bellard bellard.c bellard.c bellard.otccex.c 10

      An alternate syntax is to use it as a script interpreter: you can put #!/usr/local/bin/otcc at the beginning of your C source if you installed otcc at this place.

      diff --git a/2001/cheong/README.md b/2001/cheong/README.md index 2535eba4b..d81e339c0 100644 --- a/2001/cheong/README.md +++ b/2001/cheong/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./cheong digits ``` ## Try: -```sh +``` ./try.sh ``` @@ -36,7 +36,7 @@ Compile normally and run with one argument, an integer with 2n digits. Program will return the integer part of its square root (n-digits). For example, -```sh +``` $ cc -o cheong cheong.c $ ./cheong 1234567890 35136 @@ -52,7 +52,7 @@ This program runs normally on any ANSI C compiler and is ASCII dependent. Strict compiling gives just one unavoidable warning: -```sh +``` gcc -ansi -Wall cheong.c cheong.c:3: warning: third argument of `main' should probably be `char **' ``` diff --git a/2001/cheong/index.html b/2001/cheong/index.html index 7c9c9a176..087c94461 100644 --- a/2001/cheong/index.html +++ b/2001/cheong/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      To use:

      -
          ./cheong digits
      +
          ./cheong digits

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      Be sure to give an even number of digits in the argument. Add a leading 0 if needed.

      @@ -156,17 +156,17 @@ as all good programs should be! :-)

      Compile normally and run with one argument, an integer with 2n digits. Program will return the integer part of its square root (n-digits). For example,

      -
          $ cc -o cheong cheong.c
      -    $ ./cheong 1234567890
      -    35136
      -    $ ./cheong 0200000000000000000000000000
      -    14142135623730
      +
          $ cc -o cheong cheong.c
      +    $ ./cheong 1234567890
      +    35136
      +    $ ./cheong 0200000000000000000000000000
      +    14142135623730

      Deviation from these instructions will cause undefined results. :-)

      Portability

      This program runs normally on any ANSI C compiler and is ASCII dependent.

      Strict compiling gives just one unavoidable warning:

      -
          gcc -ansi -Wall cheong.c
      -    cheong.c:3: warning: third argument of `main' should probably be `char **'
      +
          gcc -ansi -Wall cheong.c
      +    cheong.c:3: warning: third argument of `main' should probably be `char **'

      Obfuscation

      The main obfuscation is the algorithm used to calculate square roots, sometimes known as the longhand method. The basic algorithm is itself diff --git a/2001/coupard/README.md b/2001/coupard/README.md index 5ea683a84..35c98e56a 100644 --- a/2001/coupard/README.md +++ b/2001/coupard/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./coupard ``` ## Try: -```sh +``` ./try.sh ``` @@ -52,7 +52,7 @@ that can do sound, as a lowest-denominator sound I/O interface. To listen to what the program says directly, invoke -```sh +``` ./coupard > /dev/audio ``` @@ -68,7 +68,7 @@ If you want to convert the audio output of the program into another audio format, you can pipe it to [SoX](https://en.wikipedia.org/wiki/SoX) for example (`sox` is the Swiss army knife of Unix audio tools). The command: -```sh +``` ./coupard | sox -c1 -r8000 -tub - -c2 -r44100 -twav test.wav ``` diff --git a/2001/coupard/index.html b/2001/coupard/index.html index 62d61f609..4ac1c3efd 100644 --- a/2001/coupard/index.html +++ b/2001/coupard/index.html @@ -141,11 +141,11 @@ Location: ZZ - Unknown location

      To build:

      -
          make
      +
          make

      To use:

      -
          ./coupard
      +
          ./coupard

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      You may need to run this a few times to understand exactly what is being said. You might even need to look somewhere on your desktop, @@ -170,7 +170,7 @@ fixed-format audio interface that is supported by the majority of Unices that can do sound, as a lowest-denominator sound I/O interface.

      Program usage

      To listen to what the program says directly, invoke

      -
          ./coupard > /dev/audio
      +
          ./coupard > /dev/audio

      The program then speaks out something like

      The time is HH hours MM minutes SS seconds

      @@ -181,7 +181,7 @@ the speakers connected … :-)

      If you want to convert the audio output of the program into another audio format, you can pipe it to SoX for example (sox is the Swiss army knife of Unix audio tools). The command:

      -
          ./coupard | sox -c1 -r8000 -tub - -c2 -r44100 -twav test.wav
      +
          ./coupard | sox -c1 -r8000 -tub - -c2 -r44100 -twav test.wav

      converts the output of the program into a 44.1KHz stereo .WAV file and saves it into test.wav.

      The output format of the program is 8KHz, unsigned 8-bit samples.

      diff --git a/2001/ctk/README.md b/2001/ctk/README.md index 939235595..1d5eaa29b 100644 --- a/2001/ctk/README.md +++ b/2001/ctk/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,7 +10,7 @@ code](#alternate code) below. ## To use: -```sh +``` ./ctk ``` @@ -23,14 +23,14 @@ This alternate version adds to the movement keys `l` for right, `h` for left and ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./ctk.alt ``` diff --git a/2001/ctk/index.html b/2001/ctk/index.html index 359db2b43..3c96895e0 100644 --- a/2001/ctk/index.html +++ b/2001/ctk/index.html @@ -141,18 +141,18 @@ Location: ZZ - Unknown location

      To build:

      -
          make
      +
          make

      There is an alternate version with vi(m) key movements. See alternate code below.

      To use:

      -
          ./ctk
      +
          ./ctk

      Alternate code:

      This alternate version adds to the movement keys l for right, h for left and k for straight.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      -
          ./ctk.alt
      +
          ./ctk.alt

      Judges’ remarks:

      No matter how careful you are, this guy eventually crashes. Most people can make at least one successful road trip without crashing.

      diff --git a/2001/dgbeards/README.md b/2001/dgbeards/README.md index 576fdbc44..857a8bf33 100644 --- a/2001/dgbeards/README.md +++ b/2001/dgbeards/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -21,7 +21,7 @@ For more detailed information see [2001 dgbeards bugs](../../bugs.html#2001_dgbe ## To use: -```sh +``` ./dgbeards ``` @@ -36,14 +36,14 @@ this you can look at the author's remarks and make the change. ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` ./dgbeards.alt ``` diff --git a/2001/dgbeards/index.html b/2001/dgbeards/index.html index 1957e4c97..86c8ebd6d 100644 --- a/2001/dgbeards/index.html +++ b/2001/dgbeards/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      There is an alternate version based on the author’s remarks. See alternate code below for more details.

      Bugs and (Mis)features:

      @@ -149,16 +149,16 @@ code below for more details.

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2001 dgbeards bugs.

      To use:

      -
          ./dgbeards
      +
          ./dgbeards

      Alternate code:

      The author provided a way to speed it up a bit and also how to make it so it doesn’t crash on losing. The idea that it crashes on losing was too good to lose but this alternate version has the former change. If you wish to remove this you can look at the author’s remarks and make the change.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      -
          ./dgbeards.alt
      +
          ./dgbeards.alt

      Try:

      See if you can figure out how to make the computer always lose (‘win’ :-) ). It’s a very simple thing to do. Read the author’s remarks for clues.

      diff --git a/2001/herrmann1/README.md b/2001/herrmann1/README.md index 78cced7e4..62142ebf1 100644 --- a/2001/herrmann1/README.md +++ b/2001/herrmann1/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -19,7 +19,7 @@ For more detailed information see [2001 herrmann1 bugs](../../bugs.html#2001_her ## To use: -```sh +``` ./herrmann1.sh 'prg=file' ``` @@ -30,7 +30,7 @@ need an older compiler perhaps gcc 2.95. ## Try: -```sh +``` ./try.sh ``` @@ -86,7 +86,7 @@ terminal! The info files `herrmann1.turing` and [herrmann1.gcd](herrmann1.gcd) are sample programs for the Turing machine. For example, type -```sh +``` ./herrmann1.sh 'prg=herrmann1.times2' ``` @@ -126,7 +126,7 @@ In the previous example, the Turing machine started on the default tape of the program `times2.turing`. To provide your own tape, type (for example) -```sh +``` ./herrmann1 prg=times2.turing tape="O O O I I I O O O" ``` @@ -155,7 +155,7 @@ number in unary representation. (That is, a row of I's is expected, and one more I is appended to the row.) Let's call it `plus1.turing`. Here's what it could look like: -```c +``` /* Search beginning of number. */ #define start_O O, right, start /* Number found. Move one step to the left. */ @@ -177,7 +177,7 @@ line defining `st2_I` has been left out.) Now, the program can be used with -```sh +``` ./herrmann1.sh 'prg=plus1.turing' 'tape="I I I"' ``` @@ -187,7 +187,7 @@ machine would start on an empty tape (that is, a tape filled with the case for `plus1.turing`). So you might want to provide a default tape by adding a line like -```c +``` #define tape O O O O O I I I I ``` @@ -200,13 +200,13 @@ When writing long programs, the most common errors are to forget to define a state or to misspell one. Let's assume you forgot the line -```c +``` #define start_I I, left, st2 ``` Remove it and type -```sh +``` ./herrmann1 'prg=plus1.turing' ``` diff --git a/2001/herrmann1/index.html b/2001/herrmann1/index.html index a12818c8f..3eac05ae9 100644 --- a/2001/herrmann1/index.html +++ b/2001/herrmann1/index.html @@ -141,19 +141,19 @@ Location: DE - Federal Republic of Germ

      To build:

      -
          make
      +
          make

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: missing files - please provide them
           STATUS: known bug - please help us fix

      For more detailed information see 2001 herrmann1 bugs.

      To use:

      -
          ./herrmann1.sh 'prg=file'
      +
          ./herrmann1.sh 'prg=file'

      NOTE: this entry seems to rely on older versions of gcc for the compilation stage and as such if you wish to see that part like it was designed you will need an older compiler perhaps gcc 2.95.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      There are some clear hints in the source code as to the purpose of this program. Perhaps the only way to figure out what is @@ -192,7 +192,7 @@ terminal!

      For the impatient

      The info files herrmann1.turing and herrmann1.gcd are sample programs for the Turing machine. For example, type

      -
          ./herrmann1.sh 'prg=herrmann1.times2'
      +
          ./herrmann1.sh 'prg=herrmann1.times2'

      and watch the animated Turing machine multiply 8 by two (in unary representation). Here’s a screen shot during compilation:

          /*
      @@ -217,7 +217,7 @@ result.)

      In the previous example, the Turing machine started on the default tape of the program times2.turing. To provide your own tape, type (for example)

      -
          ./herrmann1 prg=times2.turing tape="O O O I I I O O O"
      +
          ./herrmann1 prg=times2.turing tape="O O O I I I O O O"

      (The Os and Is are letters, not digits.) You might prefer to provide only a finite portion of the tape, like I did above. In this case, the remainder of the tape is filled with Os. ;-)

      @@ -234,12 +234,12 @@ better. Simply try some out.

      number in unary representation. (That is, a row of I’s is expected, and one more I is appended to the row.) Let’s call it plus1.turing. Here’s what it could look like:

      -
          /* Search beginning of number. */
      -    #define start_O O, right, start
      -    /* Number found. Move one step to the left. */
      -    #define start_I I, left, st2
      -    /* Write a I and stop */
      -    #define st2_O   I, left, stop
      +
          /* Search beginning of number. */
      +    #define start_O O, right, start
      +    /* Number found. Move one step to the left. */
      +    #define start_I I, left, st2
      +    /* Write a I and stop */
      +    #define st2_O   I, left, stop

      Some explanations: - The tape alphabet is always O and I. - The states can be anything starting with “st”. “start” and @@ -251,21 +251,21 @@ line defining st2_I has been left out.) - The order of the lines is irrelevant. - You may use C-style comments. (Would you have guessed it?)

      Now, the program can be used with

      -
          ./herrmann1.sh 'prg=plus1.turing' 'tape="I I I"'
      +
          ./herrmann1.sh 'prg=plus1.turing' 'tape="I I I"'

      But what happens if no tape is provided? Up to now, the Turing machine would start on an empty tape (that is, a tape filled with Os). For many programs, this doesn’t make much sense (as is the case for plus1.turing). So you might want to provide a default tape by adding a line like

      -
          #define tape O O O O O I I I I
      +
          #define tape O O O O O I I I I

      to your program.

      Debugging

      When writing long programs, the most common errors are to forget to define a state or to misspell one. Let’s assume you forgot the line

      -
          #define start_I I, left, st2
      +
          #define start_I I, left, st2

      Remove it and type

      -
          ./herrmann1 'prg=plus1.turing'
      +
          ./herrmann1 'prg=plus1.turing'

      The output will be

      Undefined state start.

      Tape:

      diff --git a/2001/herrmann2/README.md b/2001/herrmann2/README.md index 250f7c74a..9c6c63b1d 100644 --- a/2001/herrmann2/README.md +++ b/2001/herrmann2/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./herrmann2 ``` ## Try: -```sh +``` ./try.sh ``` @@ -75,7 +75,7 @@ to about 9k. 3D picture, constructed of random characters (with ASCII code between 32 and 126). For example, type -```sh +``` ./herrmann2 < herrmann2.ioccc ``` @@ -86,7 +86,7 @@ new random character, it will take the next one from the argument. When it arrives at the end of the argument, it will start over at the beginning. Example: -```sh +``` ./herrmann2 "234 84 045 5 6765 7487 65190 84 656 254 12 43931 818 0 6542 \ 341 45 567 76967 7244 606 976567 895 81898 095 68678 1843 4650547 \ 565980691 389 04974" < herrmann2.ioccc @@ -122,7 +122,7 @@ get it (if you lost it or if you don't have it already) is to use the program itself on the right picture and with the right argument: -```sh +``` ./herrmann2 \ 'char*d,A[9876];e;b;*ad,a,c; tw,ndr,T; wri; ;*h; _,ar ;on;'\ ' ;l ;i(V)man,n {-!har ; =Aadre(0,&e,o||n -- +,o4,=9,l=b=8,'\ @@ -183,7 +183,7 @@ works.) - When still in doubt about how to judge this program, type -```sh +``` ./herrmann2 < herrmann2.cup ``` diff --git a/2001/herrmann2/index.html b/2001/herrmann2/index.html index 590c127b4..cfdecbd48 100644 --- a/2001/herrmann2/index.html +++ b/2001/herrmann2/index.html @@ -141,11 +141,11 @@ Location: DE - Federal Republic of Germ

      To build:

      -
          make
      +
          make

      To use:

      -
          ./herrmann2
      +
          ./herrmann2

      Try:

      -
          ./try.sh
      +
          ./try.sh

      If you use vi(m) you can see a pattern in herrmann2.cup and [herrmann2.ioccc][(herrmann2.ioccc]) by say:

          /[pon]\
      @@ -177,7 +177,7 @@ to about 9k.

      3D picture, constructed of random characters (with ASCII code between 32 and 126). For example, type

      -
          ./herrmann2 < herrmann2.ioccc
      +
          ./herrmann2 < herrmann2.ioccc
      1. If you want to control the characters used in the output (for example if your picture is to consist only of digits), pass them @@ -186,9 +186,9 @@ new random character, it will take the next one from the argument. When it arrives at the end of the argument, it will start over at the beginning. Example:
      -
          ./herrmann2 "234 84 045 5 6765 7487 65190 84 656 254 12 43931 818 0 6542 \
      -    341 45 567 76967 7244 606 976567 895 81898 095 68678 1843 4650547 \
      -    565980691 389 04974" < herrmann2.ioccc
      +
          ./herrmann2 "234 84 045 5 6765 7487 65190 84 656 254 12 43931 818 0 6542 \
      +    341 45 567 76967 7244 606 976567 895 81898 095 68678 1843 4650547 \
      +    565980691 389 04974" < herrmann2.ioccc

      Some hints to get better results

      • Due to the way these 3D pictures work, the left part of the @@ -216,15 +216,15 @@ get it (if you lost it or if you don’t have it already) is to use the program itself on the right picture and with the right argument:

      -
          ./herrmann2 \
      -    'char*d,A[9876];e;b;*ad,a,c;  tw,ndr,T; wri; ;*h; _,ar  ;on;'\
      -    ' ;l ;i(V)man,n    {-!har  ;   =Aadre(0,&e,o||n -- +,o4,=9,l=b=8,'\
      -    '!( te-*Aim)|(0~l),srand  (l),,!A,d=,b))&&+((A + te-A(&(*)=+ +95>'\
      -    'e?(*& c_*r=5,r+e-r +_:2-19<-+?|(d==d),!n ?*d| *( (char**)+V+), ('\
      -    '  +0,*d-7 ) -r+8)c:7:+++7+! r: and%9- 85! ()-(r+o):(+w,_+ A*(=er'\
      -    'i+(o)+b)),!write,(=_((-b+*h)(1,A+b,!!((((-+, a >T^l,( o-95=+))w?'\
      -    '++  &&r:b<<2+a +w) ((!main(n*n,V) , +-) ),l)),w= +T-->o +o+;{ &!'\
      -    'a;}return _+= ' < herrmann2.ioccc
      +
          ./herrmann2 \
      +    'char*d,A[9876];e;b;*ad,a,c;  tw,ndr,T; wri; ;*h; _,ar  ;on;'\
      +    ' ;l ;i(V)man,n    {-!har  ;   =Aadre(0,&e,o||n -- +,o4,=9,l=b=8,'\
      +    '!( te-*Aim)|(0~l),srand  (l),,!A,d=,b))&&+((A + te-A(&(*)=+ +95>'\
      +    'e?(*& c_*r=5,r+e-r +_:2-19<-+?|(d==d),!n ?*d| *( (char**)+V+), ('\
      +    '  +0,*d-7 ) -r+8)c:7:+++7+! r: and%9- 85! ()-(r+o):(+w,_+ A*(=er'\
      +    'i+(o)+b)),!write,(=_((-b+*h)(1,A+b,!!((((-+, a >T^l,( o-95=+))w?'\
      +    '++  &&r:b<<2+a +w) ((!main(n*n,V) , +-) ),l)),w= +T-->o +o+;{ &!'\
      +    'a;}return _+= ' < herrmann2.ioccc
      • If I had submitted the program last year, I would have said that it has exactly the maximum allowed length: 1536 characters. Now @@ -267,7 +267,7 @@ only needs a logarithmic recursion depth! (Find out how this works.)

      • When still in doubt about how to judge this program, type

      -
          ./herrmann2 < herrmann2.cup
      +
          ./herrmann2 < herrmann2.cup

      and let the result inspire you. ;-)

      Requirements to the compiler / Compatibility

        diff --git a/2001/jason/README.md b/2001/jason/README.md index fdc8a4c6d..5e4bb6eba 100644 --- a/2001/jason/README.md +++ b/2001/jason/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./jason ``` @@ -37,7 +37,7 @@ cause problems. Go ahead, try it! :-) TED Shroyer came up with the idea that made it possible to hide all the text. Thanks, TED. You won. :) -```sh +``` cc -o jason jason.c ./jason you are in a maze of twisty little passages diff --git a/2001/jason/index.html b/2001/jason/index.html index 827a54176..562152aad 100644 --- a/2001/jason/index.html +++ b/2001/jason/index.html @@ -141,9 +141,9 @@ Location: US - United States of America

        To build:

        -
            make
        +
            make

        To use:

        -
            ./jason
        +
            ./jason

        Judges’ remarks:

        You are in a maze of twisty little passages, all alike.

        The really amazing part of this is that it’s a text adventure, and there’s @@ -160,13 +160,13 @@ cause problems. Go ahead, try it! :-)

        Author’s remarks:

        TED Shroyer came up with the idea that made it possible to hide all the text. Thanks, TED. You won. :)

        -
            cc -o jason jason.c
        -    ./jason
        -    you are in a maze of twisty little passages
        -    caves lead:  left forward back
        -    you see
        -       a lamp
        -    > _
        +
            cc -o jason jason.c
        +    ./jason
        +    you are in a maze of twisty little passages
        +    caves lead:  left forward back
        +    you see
        +       a lamp
        +    > _

        This program is a rather nostalgic little labyrinth game. Start out by typing “get lamp”, then use the direction words “left”, “right”, “forward”, and “back” to explore the caves. Note that diff --git a/2001/kev/README.md b/2001/kev/README.md index 23555bd96..d45a0f4ce 100644 --- a/2001/kev/README.md +++ b/2001/kev/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -21,7 +21,7 @@ For more detailed information see [2001 kev bugs](../../bugs.html#2001_kev). ## To use: -```sh +``` ./kev # in one terminal ./kev hostname # in another terminal @@ -32,7 +32,7 @@ NOTE: each player's paddle is at the bottom and the opponent at the top. ## Try: -```sh +``` ./kev # in one terminal ./kev localhost # in another terminal on the same host @@ -41,13 +41,13 @@ NOTE: each player's paddle is at the bottom and the opponent at the top. If you need to change the speed you can reconfigure it like (say for over a network and not the same host): -```sh +``` make clobber SPEED=50 all # original default value which is very fast ``` If you wish to change the port you can do so like: -```sh +``` make clobber PORT=3773 all ``` @@ -58,19 +58,19 @@ syscall with the `l_` macro, changing the `L` variable like one would `PORT`. Of course you can do more than one at the same time. For instance to change the speed and port: -```sh +``` make clobber SPEED=512 PORT=3773 all ``` If you have `xterm` try on one system: -```sh +``` xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev & ``` and then the other, the client system: -```sh +``` xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev localhost& ``` @@ -85,7 +85,7 @@ awkward `,` and `.` keys to move your paddle. ### Alternate build: -```sh +``` make alt ``` @@ -105,13 +105,13 @@ terminal? If you have `xterm` try on one system: -```sh +``` xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev.alt & ``` and then the other, the client system: -```sh +``` xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev.alt localhost& ``` @@ -151,14 +151,14 @@ getting the ball past your opponent's paddle. It's pretty fun! :) Run the server first without any command line arguments, i.e. -```sh +``` ./kev ``` Then run the client with a single command line argument which is the name of the machine running the server, e.g. -```sh +``` ./kev localhost ``` @@ -169,7 +169,7 @@ blocked by a firewall. Here's a good quick example to see it in action on your own machine, assuming you have `Xwindows`: -```sh +``` xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev & xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev localhost& ``` diff --git a/2001/kev/index.html b/2001/kev/index.html index 0646ec5de..799eebf62 100644 --- a/2001/kev/index.html +++ b/2001/kev/index.html @@ -141,7 +141,7 @@ Location: AU - Commonwealth of Australi

        To build:

        -
            make
        +
            make

        There is another version which lets you use the arrow keys rather than the more awkward , and . keys. See alternate code below.

        Bugs and (Mis)features:

        @@ -149,35 +149,35 @@ awkward , and . keys. See al
            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2001 kev bugs.

        To use:

        -
            ./kev # in one terminal
        -
        -    ./kev hostname # in another terminal
        +
            ./kev # in one terminal
        +
        +    ./kev hostname # in another terminal

        NOTE: each player’s paddle is at the bottom and the opponent at the top.

        Try:

        -
            ./kev                   # in one terminal
        -
        -    ./kev localhost         # in another terminal on the same host
        +
            ./kev                   # in one terminal
        +
        +    ./kev localhost         # in another terminal on the same host

        If you need to change the speed you can reconfigure it like (say for over a network and not the same host):

        -
            make clobber SPEED=50 all # original default value which is very fast
        +
            make clobber SPEED=50 all # original default value which is very fast

        If you wish to change the port you can do so like:

        -
            make clobber PORT=3773 all
        +
            make clobber PORT=3773 all

        Of course if you want a port < 1024 you’ll need to be root so don’t do that.

        And if you know what you’re doing you can redefine the call to the socket(2) syscall with the l_ macro, changing the L variable like one would PORT. Of course you can do more than one at the same time. For instance to change the speed and port:

        -
            make clobber SPEED=512 PORT=3773 all
        +
            make clobber SPEED=512 PORT=3773 all

        If you have xterm try on one system:

        -
            xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev &
        +
            xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev &

        and then the other, the client system:

        -
            xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev localhost&
        +
            xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev localhost&

        This might look nicer than just the terminal itself.

        Alternate code:

        This version allows you to use arrow keys on the keyboard rather than the more awkward , and . keys to move your paddle.

        Alternate build:

        -
            make alt
        +
            make alt

        You can reconfigure the macros described above in the same way.

        Alternate use:

        Use kev.alt as you would kev.

        @@ -185,9 +185,9 @@ awkward , and . keys to move your paddle.

        terminal?

        Alternate try:

        If you have xterm try on one system:

        -
            xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev.alt &
        +
            xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev.alt &

        and then the other, the client system:

        -
            xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev.alt localhost&
        +
            xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev.alt localhost&

        Judges’ remarks:

        Continuing with this year’s “retro game” theme, this is another old game; arguably, one of the oldest. Requires a functioning network, and curses.

        @@ -212,17 +212,17 @@ speeds. Each player has a paddle to hit the ball, and you get points for getting the ball past your opponent’s paddle. It’s pretty fun! :)

        RUNNING

        Run the server first without any command line arguments, i.e.

        -
            ./kev
        +
            ./kev

        Then run the client with a single command line argument which is the name of the machine running the server, e.g.

        -
            ./kev localhost
        +
            ./kev localhost

        Make sure that the terminals on both ends are the same size. Also, the TCP port number (by default 5455) specified in the Makefile mustn’t be blocked by a firewall.

        Here’s a good quick example to see it in action on your own machine, assuming you have Xwindows:

        -
            xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev &
        -    xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev localhost&
        +
            xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev &
        +    xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev localhost&

        PLAYING

        Your paddle is the one at the bottom of the screen, your opponent is at the top. To move your paddle left, hold down , (i.e. < diff --git a/2001/ollinger/README.md b/2001/ollinger/README.md index 2e1f80115..28bec6d77 100644 --- a/2001/ollinger/README.md +++ b/2001/ollinger/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./ollinger integer ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2001/ollinger/index.html b/2001/ollinger/index.html index 5471516bc..5f4250b8d 100644 --- a/2001/ollinger/index.html +++ b/2001/ollinger/index.html @@ -141,11 +141,11 @@ Location: FR - French Republic (

        To build:

        -
            make
        +
            make

        To use:

        -
            ./ollinger integer
        +
            ./ollinger integer

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Try the above command in a large window, say 200 chars wide and 100 high (200x100) with a tiny font.

        Judges’ remarks:

        diff --git a/2001/rosten/README.md b/2001/rosten/README.md index 4850b0412..deb0a58cc 100644 --- a/2001/rosten/README.md +++ b/2001/rosten/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2001 rosten bugs](../../bugs.html#2001_rosten ## To use: -```sh +``` ./rosten [number] ``` @@ -30,14 +30,14 @@ NOTE: number is floating point. ## Try: -```sh +``` ./rosten 1.03 ./rosten 1.00 ``` For some abuse, try: -```sh +``` ./rosten 0.99 ``` @@ -57,7 +57,7 @@ cursor) in the wrong way. :-) ### SYNOPSIS -```sh +``` ./rosten [greasiness] ``` @@ -94,7 +94,7 @@ portable, but compile with almost no warnings on most of the compilers tested. It's a kind of shame that none of the compilers do anything like this: -```sh +``` $ make greasymouse cc greasymouse.c -o greasymouse -lX11 greasymouse.c:30: This macro should have more text and spaces in it @@ -142,7 +142,7 @@ the way it's used to. The MIPS compiler suggests an `==` instead of an `=` in expressions such as: -```c +``` &&(a=b) ``` diff --git a/2001/rosten/index.html b/2001/rosten/index.html index 2d97bd752..49dc56c33 100644 --- a/2001/rosten/index.html +++ b/2001/rosten/index.html @@ -141,21 +141,21 @@ Location: GB - United Kingdom of Great

        To build:

        -
            make
        +
            make

        Bugs and (Mis)features:

        The current status of this entry is:

            STATUS: missing files - please provide them

        For more detailed information see 2001 rosten bugs.

        To use:

        -
            ./rosten [number]
        +
            ./rosten [number]

        WARNING: this will mess with your mouse and can make it hard to quit the program. Use at your own risk.

        NOTE: number is floating point.

        Try:

        -
            ./rosten 1.03
        -    ./rosten 1.00
        +
            ./rosten 1.03
        +    ./rosten 1.00

        For some abuse, try:

        -
            ./rosten 0.99
        +
            ./rosten 0.99

        Judges’ remarks:

        Friction can be your friend if it does not rub you (or your mouse cursor) in the wrong way. :-)

        @@ -163,7 +163,7 @@ cursor) in the wrong way. :-)

        NAME

        rosten - make the mouse act as if it has been greased

        SYNOPSIS

        -
            ./rosten [greasiness]
        +
            ./rosten [greasiness]

        DESCRIPTION

        This program is designed primarily to make your X windows interface more obfuscated. Try doing something mouse driven (such as using a mouse @@ -183,15 +183,15 @@ required is a large desk and some good grease.

        portable, but compile with almost no warnings on most of the compilers tested. It’s a kind of shame that none of the compilers do anything like this:

        -
            $ make greasymouse
        -    cc greasymouse.c -o greasymouse -lX11
        -    greasymouse.c:30: This macro should have more text and spaces in it
        -    greasymouse.c:32: This is a really stupid way to perform this operation
        -    greasymouse.c:42: This program would look better with a newline here
        -    greasymouse.c:48: That's a really silly thing to do
        -    greasymouse.c:55: So is that
        -    ...
        -    greasymouse.c:58: This program is rubbish. I'm not going to link it.
        +
            $ make greasymouse
        +    cc greasymouse.c -o greasymouse -lX11
        +    greasymouse.c:30: This macro should have more text and spaces in it
        +    greasymouse.c:32: This is a really stupid way to perform this operation
        +    greasymouse.c:42: This program would look better with a newline here
        +    greasymouse.c:48: That's a really silly thing to do
        +    greasymouse.c:55: So is that
        +    ...
        +    greasymouse.c:58: This program is rubbish. I'm not going to link it.

        The code is best viewed with tab stops every 8 spaces.

        BUGS

        The mouse gets stuck completely if you give it an option of less @@ -213,7 +213,7 @@ would never do a thing like that: I just haven’t used them in the way it’s used to.

        The MIPS compiler suggests an == instead of an = in expressions such as:

        -
            &&(a=b)
        +
            &&(a=b)

        but its suggestions would break my program. It also reckons that r() has no prototype.

        Giving the -pedantic option to the MIPS compiler causes it to generate diff --git a/2001/schweikh/README.md b/2001/schweikh/README.md index 6f0b4c42c..c0b7a466b 100644 --- a/2001/schweikh/README.md +++ b/2001/schweikh/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2001 schweikh bugs](../../bugs.html#2001_schw ## To use: -```sh +``` ./schweikh string string2 ``` @@ -40,7 +40,7 @@ This is supposed to happen. As is written in the ## Try: -```sh +``` ./try.sh ``` @@ -64,7 +64,7 @@ pattern if you are looking for something in the middle. You can use it for your shell scripting needs similar to a silent grep (and without `stdout` redirected to `/dev/null`): -```sh +``` if prog "${VARIABLE}" ''; then echo VARIABLE matches else diff --git a/2001/schweikh/index.html b/2001/schweikh/index.html index 6d3c239a5..94ec92997 100644 --- a/2001/schweikh/index.html +++ b/2001/schweikh/index.html @@ -141,13 +141,13 @@ Location: DE - Federal Republic of Germ

        To build:

        -
            make
        +
            make

        Bugs and (Mis)features:

        The current status of this entry is:

            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2001 schweikh bugs.

        To use:

        -
            ./schweikh string string2
        +
            ./schweikh string string2

        This program will very likely crash or do something else if you do not give it two args.

        Note also that the glob pattern must match the whole string. See the author’s @@ -157,7 +157,7 @@ comments for details and a workaround.

        The Jargon File:

            That's not a bug, that's a feature.

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        Do you get the pattern here?

        Author’s remarks:

        @@ -170,11 +170,11 @@ the whole string, so you may want to use * at the beginning and end pattern if you are looking for something in the middle.

        You can use it for your shell scripting needs similar to a silent grep (and without stdout redirected to /dev/null):

        -
            if prog "${VARIABLE}" '<glob>'; then
        -        echo VARIABLE matches
        -    else
        -        echo no match
        -    fi
        +
            if prog "${VARIABLE}" '<glob>'; then
        +        echo VARIABLE matches
        +    else
        +        echo no match
        +    fi

        Bugs

        There is no way to escape the meta characters. Dammit Jim, I’m a one-liner, not a regexp lib.

        diff --git a/2001/westley/README.md b/2001/westley/README.md index 130a6d2e1..90e05afe9 100644 --- a/2001/westley/README.md +++ b/2001/westley/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -25,7 +25,7 @@ For more detailed information see [2001 westley bugs](../../bugs.html#2001_westl ## To use: -```sh +``` ./westley 2>/dev/null # enter some input, terminate with EOF @@ -37,7 +37,7 @@ For more detailed information see [2001 westley bugs](../../bugs.html#2001_westl ## Try: -```sh +``` ./try.sh ``` @@ -60,7 +60,7 @@ everyone in the face! :-) This is also compiled by default. ### Punch card try: -```sh +``` echo 'Brian Westley does it again!' | ./westley.punch 2>/dev/null ``` @@ -73,7 +73,7 @@ This alternate code might be less portable. ### Alternate build: -```sh +``` make alt ``` @@ -108,7 +108,7 @@ to punch cards - C programs can be written to be "drop proof". Consider the following C program: -```c +``` main(){a();b();c();} a(){printf("A");} b(){printf("B");} @@ -122,7 +122,7 @@ any particular order\*\*; it will always produce `ABC` as output. You can also use global variables: -```c +``` char *greet = "Hello, world!"; char *greet; main(){puts(greet);} ``` @@ -132,7 +132,7 @@ It would be trivial to write an entire C program that is possible to write a program that will always compile but behave differently depending on the line order: -```c +``` test(a,b){return a;} #define test(a,b) test(b,a) main(){if (test(0,1)) printf("T"); else printf("F");} @@ -144,7 +144,7 @@ falls between the declaration of `test()` and its use in you can use the same call to `test()` repeatedly in different lines to return different values: -```c +``` #define test(x,y) test(y,x) main(){int i=0;a(&i);b(&i);c(&i);d(&i);printf("%d\n",i);} a(i)int*i;{if (test(0,1)) *i += 1;} diff --git a/2001/westley/index.html b/2001/westley/index.html index a94053795..bf1377749 100644 --- a/2001/westley/index.html +++ b/2001/westley/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

        To build:

        -
            make
        +
            make

        There are two additional programs based on the author’s remarks and the original version, provided as alternate code as it might be less portable. See sorted code, punch card code and alternate @@ -153,14 +153,14 @@ code below.

        STATUS: main() has only one arg - try and make it have 2 or 3

      For more detailed information see 2001 westley bugs.

      To use:

      -
          ./westley 2>/dev/null
      -    # enter some input, terminate with EOF
      -
      -    echo foo | ./westley 2>/dev/null
      -
      -    ./westley < westley.c 2>/dev/null
      +
          ./westley 2>/dev/null
      +    # enter some input, terminate with EOF
      +
      +    echo foo | ./westley 2>/dev/null
      +
      +    ./westley < westley.c 2>/dev/null

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Sorted code:

      The author stated that one can sort (ignoring leading blanks i.e. sort -b) the code by line and it will always sort the order of the input.

      @@ -171,12 +171,12 @@ code by line and it will always sort the order of the input.

      westley.punch.c code is specifically so that Westley can punch everyone in the face! :-) This is also compiled by default.

      Punch card try:

      -
          echo 'Brian Westley does it again!' | ./westley.punch 2>/dev/null
      +
          echo 'Brian Westley does it again!' | ./westley.punch 2>/dev/null

      Alternate code:

      An alternate version of this entry, westley.alt.c, is provided. This alternate code might be less portable.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      Use westley.alt as you would westley above.

      Judges’ remarks:

      @@ -195,36 +195,36 @@ were becoming obsolete just as C was becoming more popular*; this is rather unfortunate, because C has an advantage over many other languages when it comes to punch cards - C programs can be written to be “drop proof”.

      Consider the following C program:

      -
          main(){a();b();c();}
      -    a(){printf("A");}
      -    b(){printf("B");}
      -    c(){printf("C");}
      +
          main(){a();b();c();}
      +    a(){printf("A");}
      +    b(){printf("B");}
      +    c(){printf("C");}

      This program will compile and run no matter what order the lines are in. If you punch it on cards (one line of code per card, naturally) and drop them, you don’t need to put them in any particular order**; it will always produce ABC as output.

      You can also use global variables:

      -
          char *greet = "Hello, world!";
      -    char *greet; main(){puts(greet);}
      +
          char *greet = "Hello, world!";
      +    char *greet; main(){puts(greet);}

      It would be trivial to write an entire C program that is “drop proof” using the above techniques; surprisingly, it’s possible to write a program that will always compile but behave differently depending on the line order:

      -
          test(a,b){return a;}
      -    #define test(a,b) test(b,a)
      -    main(){if (test(0,1)) printf("T"); else printf("F");}
      +
          test(a,b){return a;}
      +    #define test(a,b) test(b,a)
      +    main(){if (test(0,1)) printf("T"); else printf("F");}

      This program will print out T if the #define statement falls between the declaration of test() and its use in main(), otherwise it will print out F. Furthermore, you can use the same call to test() repeatedly in different lines to return different values:

      -
          #define test(x,y) test(y,x)
      -    main(){int i=0;a(&i);b(&i);c(&i);d(&i);printf("%d\n",i);}
      -    a(i)int*i;{if (test(0,1)) *i += 1;}
      -    b(i)int*i;{if (test(0,1)) *i += 2;}
      -    c(i)int*i;{if (test(0,1)) *i += 4;}
      -    d(i)int*i;{if (test(0,1)) *i += 8;}
      -    test(x,y){return x;}
      +
          #define test(x,y) test(y,x)
      +    main(){int i=0;a(&i);b(&i);c(&i);d(&i);printf("%d\n",i);}
      +    a(i)int*i;{if (test(0,1)) *i += 1;}
      +    b(i)int*i;{if (test(0,1)) *i += 2;}
      +    c(i)int*i;{if (test(0,1)) *i += 4;}
      +    d(i)int*i;{if (test(0,1)) *i += 8;}
      +    test(x,y){return x;}

      If you enter the above program on punch cards, throw them up in the air, gather them up, and run it, you will get a number from 0 to 15 printed out. Now that’s a random diff --git a/2001/williams/README.md b/2001/williams/README.md index aec31762b..e1e46d7ff 100644 --- a/2001/williams/README.md +++ b/2001/williams/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2001 williams bugs](../../bugs.html#2001_will ## To use: -```sh +``` ./williams ``` diff --git a/2001/williams/index.html b/2001/williams/index.html index e3c6337eb..64f36d0b7 100644 --- a/2001/williams/index.html +++ b/2001/williams/index.html @@ -141,13 +141,13 @@ Location: ZZ - Unknown location

      To build:

      -
          make
      +
          make

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: known bug - please help us fix

      For more detailed information see 2001 williams bugs.

      To use:

      -
          ./williams
      +
          ./williams

      Judges’ remarks:

      A strange game. The only winning move is not to play. No, really; you can’t diff --git a/2004/anonymous/README.md b/2004/anonymous/README.md index 84ff70b52..129e7d637 100644 --- a/2004/anonymous/README.md +++ b/2004/anonymous/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./anonymous 'foo' > bar.pgm ``` @@ -21,7 +21,7 @@ images. ## Try: -```sh +``` ./try.sh ``` @@ -107,7 +107,7 @@ The following command thus writes a rendering of the [Ring inscription](https://www.glyphweb.com/arda/r/ringinscription.html) to the file `ring.pgm`: -```sh +``` ./anonymous "ash nazg durhbatuluhk, ash nazg gimbatul, \ ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm ``` diff --git a/2004/anonymous/index.html b/2004/anonymous/index.html index 0dea0b6a3..7fa90e8a9 100644 --- a/2004/anonymous/index.html +++ b/2004/anonymous/index.html @@ -141,9 +141,9 @@ Location: SG - Republic of Singapore

      To build:

      -
          make
      +
          make

      To use:

      -
          ./anonymous 'foo' > bar.pgm
      +
          ./anonymous 'foo' > bar.pgm

      Now open the output using your favourite pgm viewer. If you don’t have a pgm viewer then we suggest the netpbm @@ -151,7 +151,7 @@ toolkit to convert the image to a graphics format that you can view. Most graphical web browsers can display PNG or JPEG images.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      NOTE: technically the text is supposed to be in all lower case but the script does use some upper case letters for demonstration purposes.

      Judges’ remarks:

      @@ -220,8 +220,8 @@ in lower case.

      The following command thus writes a rendering of the Ring inscription to the file ring.pgm:

      -
          ./anonymous "ash nazg durhbatuluhk, ash nazg gimbatul, \
      -        ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm
      +
          ./anonymous "ash nazg durhbatuluhk, ash nazg gimbatul, \
      +        ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm

      The source code assumes the ASCII character set; also, due to space constraints, the program uses rather inefficient algorithms, so it may waste a lot of time and space even when rendering moderately long diff --git a/2004/arachnid/README.md b/2004/arachnid/README.md index 21fd5b2a3..6411587e5 100644 --- a/2004/arachnid/README.md +++ b/2004/arachnid/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -11,20 +11,20 @@ code](#alternate-code) below. ## To use: -```sh +``` ./arachnid [mazefile] ``` ## Try: -```sh +``` ./arachnid arachnid.txt ``` and then try: -```sh +``` ./arachnid arachnid.c ``` @@ -41,7 +41,7 @@ instead. ### Alternate build: -```sh +``` make alt ``` @@ -80,7 +80,7 @@ explorers out there. ### Usage -```sh +``` ./arachnid [mazefile] ``` diff --git a/2004/arachnid/index.html b/2004/arachnid/index.html index dc1def705..7b7ba1dbc 100644 --- a/2004/arachnid/index.html +++ b/2004/arachnid/index.html @@ -141,16 +141,16 @@ Location: NZ - New Zealand

      To build:

      -
          make
      +
          make

      There is an alt version for rogue players, vi(m) users and Dvorak typist (i.e. those who need hljk for moving left, right, down and up. See alternate code below.

      To use:

      -
          ./arachnid [mazefile]
      +
          ./arachnid [mazefile]

      Try:

      -
          ./arachnid arachnid.txt
      +
          ./arachnid arachnid.txt

      and then try:

      -
          ./arachnid arachnid.c
      +
          ./arachnid arachnid.c

      Navigation is through the use of the wasd inverted-T formation on QWERTY keyboards. Rogue players, vi users, and Dvorak typists are invited to get lost (or use the alt version)!

      @@ -158,7 +158,7 @@ invited to get lost (or use the alt version)!

      If you don’t like the wasd movement keys you can try the vi(m) movement keys instead.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      Use arachnid.alt as you would arachnid above.

      Judges’ remarks:

      @@ -181,7 +181,7 @@ Another maze, arachnid.txt has also been provided. Th 255x255, about the largest maze supported, for the particularly insane maze explorers out there.

      Usage

      -
          ./arachnid [mazefile]
      +
          ./arachnid [mazefile]

      You can explore the maze using the w,a,s, and d keys.

      make ``` @@ -10,7 +10,7 @@ will not work with it enabled. ## To use: -```sh +``` ./burley ``` diff --git a/2004/burley/index.html b/2004/burley/index.html index ca3871288..bc28babc1 100644 --- a/2004/burley/index.html +++ b/2004/burley/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      NOTE: We FORCE the use of -O0 even if someone overrides it because this entry will not work with it enabled.

      To use:

      -
          ./burley
      +
          ./burley

      NOTE: you need to input a number first. See judges’ remarks below for information on how to play.

      Judges’ remarks:

      diff --git a/2004/gavare/README.md b/2004/gavare/README.md index 473563536..92ce998fb 100644 --- a/2004/gavare/README.md +++ b/2004/gavare/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,14 +10,14 @@ for more details. ## To use: -```sh +``` ./gavare > ioccc_ray.ppm ``` Open `ioccc_ray.ppm` with a viewer capable of viewing PPM files. Alternatively, if you have ImageMagick installed, you can convert it to a jpeg: -```sh +``` convert ioccc_ray.ppm ioccc_ray.jpg ``` @@ -28,7 +28,7 @@ and then view `ioccc_ray.jpg` in a graphics viewer, editor or web browser. If you have `xv(1)` you can do: -```sh +``` ./gavare | xv - ``` @@ -53,19 +53,19 @@ on `stdout` which theoretically should work in Windows. To build the configurable and unobfuscated versions: -```sh +``` make alt ``` To change the default size from 1024x768 try: -```sh +``` make clobber XX=640 YY=480 alt ``` You might also wish to change the anti-alias setting: -```sh +``` make clobber AA=2 alt ``` @@ -78,7 +78,7 @@ This is not possible with the author's version but it is with the alt versions As the Windows version will not compile on most viewers' systems we do not build it with `make alt`; instead try: -```sh +``` make alt2 ``` diff --git a/2004/gavare/index.html b/2004/gavare/index.html index 8cadf4c3c..2945549cf 100644 --- a/2004/gavare/index.html +++ b/2004/gavare/index.html @@ -141,18 +141,18 @@ Location: SE - Kingdom of Sweden (

      To build:

      -
          make
      +
          make

      There are three alternate versions; see alternate code below for more details.

      To use:

      -
          ./gavare > ioccc_ray.ppm
      +
          ./gavare > ioccc_ray.ppm

      Open ioccc_ray.ppm with a viewer capable of viewing PPM files. Alternatively, if you have ImageMagick installed, you can convert it to a jpeg:

      -
          convert ioccc_ray.ppm ioccc_ray.jpg
      +
          convert ioccc_ray.ppm ioccc_ray.jpg

      and then view ioccc_ray.jpg in a graphics viewer, editor or web browser.

      Try:

      If you have xv(1) you can do:

      -
          ./gavare | xv -
      +
          ./gavare | xv -

      to not worry about writing it to a file and just viewing the image it creates.

      Alternate code:

      The alt code gavare.alt.c allows you to change the size of the @@ -165,18 +165,18 @@ was used during development, which we have included in the file on stdout which theoretically should work in Windows.

      Alternate build:

      To build the configurable and unobfuscated versions:

      -
          make alt
      +
          make alt

      To change the default size from 1024x768 try:

      -
          make clobber XX=640 YY=480 alt
      +
          make clobber XX=640 YY=480 alt

      You might also wish to change the anti-alias setting:

      -
          make clobber AA=2 alt
      +
          make clobber AA=2 alt

      You may of course combine the above two commands and give any combination you wish.

      This is not possible with the author’s version but it is with the alt versions (Windows - see below - and otherwise).

      As the Windows version will not compile on most viewers’ systems we do not build it with make alt; instead try:

      -
          make alt2
      +
          make alt2

      Alternate use:

      Use gavare.alt, gavare.r3 or gavare.alt2 as you would gavare above.

      Judges’ remarks:

      diff --git a/2004/gavin/README.md b/2004/gavin/README.md index 9365781b0..355192b0b 100644 --- a/2004/gavin/README.md +++ b/2004/gavin/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -25,7 +25,7 @@ For more detailed information see [2004 gavin bugs](../../bugs.html#2004_gavin). ## To use: -```sh +``` ./gavin ``` @@ -36,14 +36,14 @@ To enjoy the results (on a Linux/x86 machine) with a floppy drive (remember those? We do!): -```sh +``` su ``` Make a floppy with an ext2 filesystem (`mke2fs /dev/fd0` replacing `fd0` with whatever the floppy device is!), mount it under `/mnt/floppy` and then: -```sh +``` cp kernel fs.tar lilo.conf boot.b /mnt/floppy ``` @@ -51,26 +51,26 @@ NOTE: If the version of your lilo is not 21.4, use the appropriate boot.b file. NOTE: If your floppy drive is not `/dev/fd0`, edit lilo.conf appropriately. -```sh +``` lilo -C /mnt/floppy/lilo.conf ``` Boot from the floppy on an x86 machine with a PS/2 keyboard and mouse. Move the window away from the corner. -```sh +``` vi gavin.c ``` Scroll up and down the file with up-arrow and down-arrow. -```sh +``` sh ``` You can have several shell windows: -```sh +``` vi README.md ./prim ``` @@ -86,7 +86,7 @@ you can use it with `QEMU`. ### Alternate build: -```sh +``` make alt ``` diff --git a/2004/gavin/index.html b/2004/gavin/index.html index 98602f50c..4df5f8f49 100644 --- a/2004/gavin/index.html +++ b/2004/gavin/index.html @@ -141,7 +141,7 @@ Location: ZZ - Unknown location

      To build:

      -
          make
      +
          make

      There is an alternate version for those who wish to use QEMU rather than having to reboot and rely on having a floppy drive (if you even remember what those are :-) ) etc. See alternate code below.

      @@ -152,31 +152,31 @@ to reboot and rely on having a floppy drive (if you even remember what those are STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2004 gavin bugs.

      To use:

      -
          ./gavin
      +
          ./gavin

      Try:

      To enjoy the results (on a Linux/x86 machine) with a floppy drive (remember those? We do!):

      -
          su
      +
          su

      Make a floppy with an ext2 filesystem (mke2fs /dev/fd0 replacing fd0 with whatever the floppy device is!), mount it under /mnt/floppy and then:

      -
          cp kernel fs.tar lilo.conf boot.b /mnt/floppy
      +
          cp kernel fs.tar lilo.conf boot.b /mnt/floppy

      NOTE: If the version of your lilo is not 21.4, use the appropriate boot.b file.

      NOTE: If your floppy drive is not /dev/fd0, edit lilo.conf appropriately.

      -
          lilo -C /mnt/floppy/lilo.conf
      +
          lilo -C /mnt/floppy/lilo.conf

      Boot from the floppy on an x86 machine with a PS/2 keyboard and mouse. Move the window away from the corner.

      -
          vi gavin.c
      +
          vi gavin.c

      Scroll up and down the file with up-arrow and down-arrow.

      -
          sh
      +
          sh

      You can have several shell windows:

      -
          vi README.md
      -    ./prim
      +
          vi README.md
      +    ./prim

      Press and hold any key.

      Alternate code:

      This version’s main difference is that the macro K is redefined to 1 so that you can use it with QEMU.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      The use is mostly the same as gavin except that one initially executes gavin.alt (which make alt will do) and one will have to use QEMU instead. The files diff --git a/2004/hibachi/README.md b/2004/hibachi/README.md index 5e0495890..d75c7b660 100644 --- a/2004/hibachi/README.md +++ b/2004/hibachi/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` cd build; ./hibachi-start.sh & ``` @@ -42,7 +42,7 @@ There is a `hibachi.tgz` file (NOTE: this file was removed by the judges after extraction) that unpacks several support files and a subdirectory tree containing the documentation and examples. It can be viewed by: -```sh +``` tar -zxf hibachi.tgz lynx hibachi/localhost/index.html ``` @@ -58,19 +58,19 @@ To build just the executable: For Cygwin, FreeBSD, Linux (newer), Mac OS X: -```sh +``` gcc -o hibachi hibachi.c ``` For Linux (older): -```sh +``` gcc -DSHUT_WR=1 -o hibachi hibachi.c ``` For SunOS: -```sh +``` gcc -o hibachi hibachi.c -lnsl -lsocket ``` @@ -88,20 +88,20 @@ examples. In which case the preferred build commands are: To start the server on the default port (8008): -```sh +``` cd build; ./hibachi-start.sh & ``` To test the server: -```sh +``` lynx http://localhost:8008/ ``` To stop the server: -```sh +``` kill %1 ``` diff --git a/2004/hibachi/index.html b/2004/hibachi/index.html index 651bd8429..87fca84d8 100644 --- a/2004/hibachi/index.html +++ b/2004/hibachi/index.html @@ -141,9 +141,9 @@ Location: CA - Canada

      To build:

      -
          make
      +
          make

      To use:

      -
          cd build; ./hibachi-start.sh &
      +
          cd build; ./hibachi-start.sh &

      Then use your web browser to visit http://localhost:8008/. When you’re finished make sure to kill hibachi.

      NOTE: you must be in the build directory when running hibachi-start.sh for @@ -163,19 +163,19 @@ so the file does not exist here.

      There is a hibachi.tgz file (NOTE: this file was removed by the judges after extraction) that unpacks several support files and a subdirectory tree containing the documentation and examples. It can be viewed by:

      -
          tar -zxf hibachi.tgz
      -    lynx hibachi/localhost/index.html
      +
          tar -zxf hibachi.tgz
      +    lynx hibachi/localhost/index.html

      Or once Hibachi is running, use a web browser (preferably one that supports images and JavaScript, to view the documentation and try some of the CGI examples) to visit: http://localhost:8008/.

      Building

      To build just the executable:

      For Cygwin, FreeBSD, Linux (newer), Mac OS X:

      -
          gcc -o hibachi hibachi.c
      +
          gcc -o hibachi hibachi.c

      For Linux (older):

      -
          gcc -DSHUT_WR=1 -o hibachi hibachi.c
      +
          gcc -DSHUT_WR=1 -o hibachi hibachi.c

      For SunOS:

      -
          gcc -o hibachi hibachi.c -lnsl -lsocket
      +
          gcc -o hibachi hibachi.c -lnsl -lsocket

      Since some systems place socket and network functions into other libraries, a GNU autoconf configure script has been @@ -185,12 +185,12 @@ examples. In which case the preferred build commands are:

          ./configure [--enable-port=number]
           make

      To start the server on the default port (8008):

      -
          cd build;
      -    ./hibachi-start.sh &
      +
          cd build;
      +    ./hibachi-start.sh &

      To test the server:

      -
          lynx http://localhost:8008/
      +
          lynx http://localhost:8008/

      To stop the server:

      -
          kill %1
      +
          kill %1

      Features

      • Supports virtual hosts.

      • diff --git a/2004/hoyle/README.md b/2004/hoyle/README.md index ce72288ba..905c94ad7 100644 --- a/2004/hoyle/README.md +++ b/2004/hoyle/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./hoyle point ... ``` ## Try: -```sh +``` ./try.sh ``` @@ -47,13 +47,13 @@ passed in. For example, to graph `y = x^2`: -```sh +``` ./hoyle 0 0 1 ``` Note that: -```sh +``` ./hoyle 0 0 2 ``` diff --git a/2004/hoyle/index.html b/2004/hoyle/index.html index 3460a4d6f..2bb08aa74 100644 --- a/2004/hoyle/index.html +++ b/2004/hoyle/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

        To build:

        -
            make
        +
            make

        To use:

        -
            ./hoyle point ...
        +
            ./hoyle point ...

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        The obfuscation functions at several levels. Note the clever use of use of #defines. The #define do(if,else), for example, @@ -167,9 +167,9 @@ passed in. dashes rather than a simple block of Xs.

      For example, to graph y = x^2:

      -
          ./hoyle 0 0 1
      +
          ./hoyle 0 0 1

      Note that:

      -
          ./hoyle 0 0 2
      +
          ./hoyle 0 0 2

      will produce the same graph, since the y-axis is auto scaling.

      make ``` @@ -21,14 +21,14 @@ For more detailed information see [2004 jdalbec bugs](../../bugs.html#2004_jdalb ## To use: -```sh +``` ./jdalbec number ... ``` ## Try: -```sh +``` ./try.sh ``` @@ -43,7 +43,7 @@ which line it is on. ### Alternate build: -```sh +``` make alt ``` @@ -52,7 +52,7 @@ many number of lines to print on a line. Set at default to 11 protons, salt, if you wish to make it silver, 47 (a prime) protons, do: -```sh +``` make clobber Ag=47 alt ``` @@ -60,7 +60,7 @@ though it might be odd to have 47 numbers on a line as it would defeat the purpose. :-) Or if you prefer some prime, golden irony: -```sh +``` make clobber Ag=79 alt ``` @@ -72,7 +72,7 @@ Use `jdalbec.alt` as you would `jdalbec` above. ### Alternate try: -```sh +``` ./try.alt.sh ``` diff --git a/2004/jdalbec/index.html b/2004/jdalbec/index.html index 0622267c6..23f92668e 100644 --- a/2004/jdalbec/index.html +++ b/2004/jdalbec/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      There is an alternate version that allows one to control the number of numbers to print on a line. See alternate code below.

      Bugs and (Mis)features:

      @@ -149,27 +149,27 @@ to print on a line. See alternate code below.

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2004 jdalbec bugs.

      To use:

      -
          ./jdalbec number ...
      +
          ./jdalbec number ...

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Alternate code:

      This version lets you control how many numbers to show on a line before adding a newline as it can be harder to see when there are a lot of numbers. For lines that don’t end up having too many line breaks it also makes it easier to see which line it is on.

      Alternate build:

      -
          make alt
      +
          make alt

      The macro Ag (silver) controls how many number of lines to print on a line. Set at default to 11 protons, salt, if you wish to make it silver, 47 (a prime) protons, do:

      -
          make clobber Ag=47 alt
      +
          make clobber Ag=47 alt

      though it might be odd to have 47 numbers on a line as it would defeat the purpose. :-) Or if you prefer some prime, golden irony:

      -
          make clobber Ag=79 alt
      +
          make clobber Ag=79 alt

      Alternate use:

      Use jdalbec.alt as you would jdalbec above.

      Alternate try:

      -
          ./try.alt.sh
      +
          ./try.alt.sh

      Judges’ remarks:

      We still aren’t sure whether or not this is a useful program, but it’s the first atomic fission we’ve seen in the IOCCC.

      diff --git a/2004/kopczynski/README.md b/2004/kopczynski/README.md index ede111eab..3f45a0bc7 100644 --- a/2004/kopczynski/README.md +++ b/2004/kopczynski/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,14 +10,14 @@ will not work with it enabled. ## To use: -```sh +``` ./kopczynski < input_file ``` ## Try: -```sh +``` ./try.sh ``` @@ -34,14 +34,14 @@ does. ### Alternate build: -```sh +``` make alt ``` ### Alternate try: -```sh +``` ./kopczynski.alt < kopczynski-10 echo $? ``` diff --git a/2004/kopczynski/index.html b/2004/kopczynski/index.html index 919c8fd53..3e9e77cf1 100644 --- a/2004/kopczynski/index.html +++ b/2004/kopczynski/index.html @@ -141,13 +141,13 @@ Location: PL - Republic of Poland

      To build:

      -
          make
      +
          make

      NOTE: We FORCE the use of -O0 even if someone overrides it because this entry will not work with it enabled.

      To use:

      -
          ./kopczynski < input_file
      +
          ./kopczynski < input_file

      Try:

      -
          ./try.sh
      +
          ./try.sh

      What happens if you feed the program source to the program? Can you figure out why?

      Alternate code:

      @@ -155,10 +155,10 @@ why?

      program returned the result as an exit code which is what the alternate version does.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate try:

      -
          ./kopczynski.alt < kopczynski-10
      -    echo $?
      +
          ./kopczynski.alt < kopczynski-10
      +    echo $?

      Judges’ remarks:

      What is in a line? A lot when you obfuscate the way Eryk Kopczynski did it. This small one line program is an outstanding technical diff --git a/2004/newbern/README.md b/2004/newbern/README.md index 7c2de3fd5..74a13a23d 100644 --- a/2004/newbern/README.md +++ b/2004/newbern/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./newbern [file.dat arg] ``` ## Try: -```sh +``` ./try.sh ``` @@ -34,14 +34,14 @@ This is a configurable `banner(1)`-like program. - To convert a character glyph into a data file: -```sh +``` ./newbern char < some_nicely_shaped_text >> data_file ``` - To print a string using glyphs from a data file: -```sh +``` ./newbern data_file a_string ``` diff --git a/2004/newbern/index.html b/2004/newbern/index.html index 707c56f2a..12eac61bf 100644 --- a/2004/newbern/index.html +++ b/2004/newbern/index.html @@ -141,11 +141,11 @@ Location: ZZ - Unknown location

      To build:

      -
          make
      +
          make

      To use:

      -
          ./newbern [file.dat arg]
      +
          ./newbern [file.dat arg]

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      The program is formatted using the same font glyphs as the example data file.

      @@ -155,11 +155,11 @@ data file.

      • To convert a character glyph into a data file:
      -
          ./newbern char < some_nicely_shaped_text >> data_file
      +
          ./newbern char < some_nicely_shaped_text >> data_file
      • To print a string using glyphs from a data file:
      -
          ./newbern data_file a_string
      +
          ./newbern data_file a_string

      Extra functionality

      The program can also act as a Morse encoder, unarguably.

      It also has double-super-secret encryption capabilities. diff --git a/2004/omoikane/README.md b/2004/omoikane/README.md index a56689061..d1234803f 100644 --- a/2004/omoikane/README.md +++ b/2004/omoikane/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./omoikane infile layout outfile ``` @@ -43,7 +43,7 @@ insert a human-readable checksum string in the text itself! `^_^` ### Usage -```sh +``` ./omoikane ``` diff --git a/2004/omoikane/index.html b/2004/omoikane/index.html index 34cf5d461..06e864baa 100644 --- a/2004/omoikane/index.html +++ b/2004/omoikane/index.html @@ -141,9 +141,9 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      To use:

      -
          ./omoikane infile layout outfile
      +
          ./omoikane infile layout outfile

      Try:

          ./try.sh

      Judges’ remarks:

      @@ -161,7 +161,7 @@ Comments refer to it as such.

      strange file names or package .SFVs with your files! Rinia will insert a human-readable checksum string in the text itself! ^_^

      Usage

      -
          ./omoikane <infile> <layout> <outfile>
      +
          ./omoikane <infile> <layout> <outfile>

      All three arguments may reference the same file. All files is assumed to be of ASCII character set.

      Input

      diff --git a/2004/schnitzi/README.md b/2004/schnitzi/README.md index feace3a2c..30dd06415 100644 --- a/2004/schnitzi/README.md +++ b/2004/schnitzi/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./schnitzi ./try.sh ``` @@ -132,13 +132,13 @@ Try one of these methods to get the animation to run: 1. Redirect the output directly to vi, like this: -```sh +``` ./schnitzi < input.dat | vi ``` 2. Redirect the output to a file, like this: -```sh +``` ./schnitzi < input.dat > output.dat ``` diff --git a/2004/schnitzi/index.html b/2004/schnitzi/index.html index 7860a6a97..cb71b101a 100644 --- a/2004/schnitzi/index.html +++ b/2004/schnitzi/index.html @@ -141,11 +141,11 @@ Location: ZZ - Unknown location

      To build:

      -
          make
      +
          make

      To use:

      -
          ./schnitzi <foo | vi -n
      +
          ./schnitzi <foo | vi -n

      Try:

      -
          ./try.sh
      +
          ./try.sh

      NOTE: if you’re one of those who don’t know how to exit vi :-) don’t worry as it will exit for you.

      Judges’ remarks:

      @@ -221,11 +221,11 @@ scene, the other a bit of scrolling text.

      1. Redirect the output directly to vi, like this:
      -
          ./schnitzi < input.dat | vi
      +
          ./schnitzi < input.dat | vi
      1. Redirect the output to a file, like this:
      -
          ./schnitzi < input.dat > output.dat
      +
          ./schnitzi < input.dat > output.dat

      Then, open the output file, select the text, and copy it to your system pasteboard/cut/selection buffer and paste it into vi. The paste is NOT the vi paste command, but diff --git a/2004/sds/README.md b/2004/sds/README.md index d55ecce7a..e26089882 100644 --- a/2004/sds/README.md +++ b/2004/sds/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2004 sds bugs](../../bugs.html#2004_sds). ## To use: -```sh +``` ./sds ``` ## Try: -```sh +``` ./try.sh ``` @@ -63,13 +63,13 @@ decoder. Try it out. Compile the program, then type -```sh +``` ./sds < sds.c ``` You should see the encoder program displayed. Now save it, like: -```sh +``` ./sds < sds.c > encoder.c ``` @@ -82,14 +82,14 @@ standard input, and will output the results on the standard output. You can use it like this (assuming you have a file called remarks): -```sh +``` echo 'Hello, World!' > message ./encoder message < remarks > remarks_msg ``` Then to decode: -```sh +``` ./sds < remarks_msg Hello, World! ``` diff --git a/2004/sds/index.html b/2004/sds/index.html index 0348d1ce7..d1aa5529f 100644 --- a/2004/sds/index.html +++ b/2004/sds/index.html @@ -141,15 +141,15 @@ Location: FI - Republic of Finland

      To build:

      -
          make
      +
          make

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2004 sds bugs.

      To use:

      -
          ./sds
      +
          ./sds

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      Why not use the program to hide another program in the program? It must have seemed reasonable at the time.

      @@ -174,20 +174,20 @@ provide a separate encoding program, you should not be surprised to learn that I opted to steganographically hide the encoder inside the decoder.

      Try it out. Compile the program, then type

      -
          ./sds < sds.c
      +
          ./sds < sds.c

      You should see the encoder program displayed. Now save it, like:

      -
          ./sds < sds.c > encoder.c
      +
          ./sds < sds.c > encoder.c

      Then compile encoder.c. You now have the complete system ready.

      The encoder expects to get a filename as an argument. This filename is the name of the file containing the information to be hidden. It expects the file in which to hide the information to be on the standard input, and will output the results on the standard output.

      You can use it like this (assuming you have a file called remarks):

      -
          echo 'Hello, World!' > message
      -    ./encoder message < remarks > remarks_msg
      +
          echo 'Hello, World!' > message
      +    ./encoder message < remarks > remarks_msg

      Then to decode:

      -
          ./sds < remarks_msg
      -    Hello, World!
      +
          ./sds < remarks_msg
      +    Hello, World!

      C programs are mostly unaffected by adding steganographic content, but it is possible in certain circumstances for whitespace to be changed inside strings where it should be left alone. Plain text diff --git a/2004/vik1/README.md b/2004/vik1/README.md index fe79826bc..72fc61959 100644 --- a/2004/vik1/README.md +++ b/2004/vik1/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./vik1 [arg] ``` ## Try: -```sh +``` ./vik1 ./vik1 a @@ -82,7 +82,7 @@ Compile the source code and link X libraries if necessary. The program takes three options which have to be typed in a specific order as described below. -```sh +``` Usage: ./vik1 ['a']['d'][#] a - Advanced racing in a winter landscape diff --git a/2004/vik1/index.html b/2004/vik1/index.html index efd9cad3d..54c3343bb 100644 --- a/2004/vik1/index.html +++ b/2004/vik1/index.html @@ -141,17 +141,17 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      To use:

      -
          ./vik1 [arg]
      +
          ./vik1 [arg]

      Try:

      -
          ./vik1
      -
      -    ./vik1 a
      -
      -    ./vik1 d2
      -
      -    ./vik1 ad3
      +
          ./vik1
      +
      +    ./vik1 a
      +
      +    ./vik1 d2
      +
      +    ./vik1 ad3

      Can you figure out how to cheat?

      Also see the author’s remarks below for more details on the different modes/options.

      @@ -184,11 +184,11 @@ glance at the feature list he provided below. Amazing!

      Compile the source code and link X libraries if necessary. The program takes three options which have to be typed in a specific order as described below.

      -
          Usage: ./vik1 ['a']['d'][#]
      -
      -    a   - Advanced racing in a winter landscape
      -    d   - Racing in at night in the dark
      -#   - Race track selection 1-3 are valid numbers
      +
          Usage: ./vik1 ['a']['d'][#]
      +
      +    a   - Advanced racing in a winter landscape
      +    d   - Racing in at night in the dark
      +#   - Race track selection 1-3 are valid numbers

      Here are a few examples:

          Command line:               Description:
       
      diff --git a/2004/vik2/README.md b/2004/vik2/README.md
      index a4b81a5b4..2dd20b1b1 100644
      --- a/2004/vik2/README.md
      +++ b/2004/vik2/README.md
      @@ -1,13 +1,13 @@
       ## To build:
       
      -```sh
      +```
           make
       ```
       
       
       ## To use:
       
      -```sh
      +```
           ./vik2
       ```
       
      @@ -127,7 +127,7 @@ speed up the compilation, define the `STOP` symbol to anything from `_3` to
       `_10`. (The default value is `_10` which will make the compilation take some
       time.) Prime numbers up to `2^STOP` will be calculated.
       
      -```sh
      +```
           cpp '-DSTOP=_5' '-DFNAME="tmp1.c"' prog.c tmp1.c
       ```
       
      @@ -135,20 +135,20 @@ Then use `cpp` or any other
       [pre-processor](https://en.wikipedia.org/wiki/C_preprocessor) to do the actual
       work. This will take some time....
       
      -```sh
      +```
           cpp tmp1.c > tmp2.c
       ```
       
       Finally compile the pre-processed file
       
      -```sh
      +```
           cc -O tmp2.c -o prog
       ```
       
       Then run the program to reveal all prime numbers up to 32 (if you used
       `STOP=_5` as above):
       
      -```sh
      +```
           ./vik2
       ```
       
      diff --git a/2004/vik2/index.html b/2004/vik2/index.html
      index decc85989..3a7a9169c 100644
      --- a/2004/vik2/index.html
      +++ b/2004/vik2/index.html
      @@ -141,9 +141,9 @@ Location: US - United States of America
       
       
       

      To build:

      -
          make
      +
          make

      To use:

      -
          ./vik2
      +
          ./vik2

      Judges’ remarks:

      The fun thing about CPP abuses is that, in most cases, running the @@ -234,16 +234,16 @@ symbol must be defined to the name of the output file. If you want to speed up the compilation, define the STOP symbol to anything from _3 to _10. (The default value is _10 which will make the compilation take some time.) Prime numbers up to 2^STOP will be calculated.

      -
          cpp '-DSTOP=_5' '-DFNAME="tmp1.c"' prog.c tmp1.c
      +
          cpp '-DSTOP=_5' '-DFNAME="tmp1.c"' prog.c tmp1.c

      Then use cpp or any other pre-processor to do the actual work. This will take some time….

      -
          cpp tmp1.c > tmp2.c
      +
          cpp tmp1.c > tmp2.c

      Finally compile the pre-processed file

      -
          cc -O tmp2.c -o prog
      +
          cc -O tmp2.c -o prog

      Then run the program to reveal all prime numbers up to 32 (if you used STOP=_5 as above):

      -
          ./vik2
      +
          ./vik2

      Verification

      I wasn’t able to compile the full program which calculates prime numbers up to 1024 using GNU cpp diff --git a/2005/aidan/README.md b/2005/aidan/README.md index 76e94a799..c3af9d722 100644 --- a/2005/aidan/README.md +++ b/2005/aidan/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,7 +10,7 @@ code](#alternate-code). ## To use: -```sh +``` ./aidan < puzzle ./aidan seed @@ -21,7 +21,7 @@ where `seed` is a number. ## Try: -```sh +``` ./try.sh ``` @@ -34,7 +34,7 @@ which is slower, inelegant and not as obscure, as the author put it. ### Alternate build: -```sh +``` make alt ``` @@ -46,7 +46,7 @@ Use `aidan.alt` as you would `aidan` above. ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -139,7 +139,7 @@ Telegraph](https://www.telegraph.co.uk/), a UK newspaper. Now, with modern computers this **can** be solved using brute force, e.g.: -```c +``` #include /* sudoku-bfi.c */ #define S(t) for(n=0;n<9;v[n++]=0);for(n=0;n<81;n++)if(i[n]){z=1< cc -o sudoku-sf sudoku-sf.c ``` or, if using gcc, try: -```sh +``` gcc -O2 -Wall -Wextra -ansi -pedantic-errors -o sudoku-sf sudoku-sf.c ``` #### Testing (optional) -```sh +``` perl ./test-su.perl ``` @@ -211,7 +211,7 @@ really. #### Solving -```sh +``` ./aidan < somefile.txt ``` @@ -232,7 +232,7 @@ though slightly slower. See if you can figure out what it does.) #### Generating -```sh +``` ./sudoku ``` @@ -292,7 +292,7 @@ least 32. (No, that isn't a typo - I did say 15, not 16). Also requires that `cpp` can properly handle something like: -```c +``` #define foo(x,y) x y foo(bar,) ``` diff --git a/2005/aidan/index.html b/2005/aidan/index.html index b8205ee06..939278ce8 100644 --- a/2005/aidan/index.html +++ b/2005/aidan/index.html @@ -141,25 +141,25 @@ Location: GB - United Kingdom of Great

      To build:

      -
          make
      +
          make

      There is an alternate version based on the author’s remarks. See alternate code.

      To use:

      -
          ./aidan < puzzle
      -
      -    ./aidan seed
      +
          ./aidan < puzzle
      +
      +    ./aidan seed

      where seed is a number.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Alternate code:

      This code is formatted differently and is not the approach used by the author which is slower, inelegant and not as obscure, as the author put it.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      Use aidan.alt as you would aidan above.

      Alternate try:

      -
          ./try.alt.sh
      +
          ./try.alt.sh

      Judges’ remarks:

      Are you puzzled about puzzles? This entry might puzzle you more while it puzzles out some puzzles: all in a puzzling way!

      @@ -223,14 +223,14 @@ figure out how to solve them, but there’s a useful tutorial on http://www.sudoku.org.uk/, which is roughly affiliated with the Daily Telegraph, a UK newspaper.

      Now, with modern computers this can be solved using brute force, e.g.:

      -
          #include <stdio.h> /* sudoku-bfi.c */
      -    #define S(t) for(n=0;n<9;v[n++]=0);for(n=0;n<81;n++)if(i[n]){z=1<<i[n];if(v[t]\\
      -    &z)for(;;){if(p<0)goto d;if(i[p]++<9)goto f;i[p]=0;p=s[p];}v[t]|=z;}
      -    int i[82],s[81],v[9],n,p,z;int main(void){for(n=0;n<81;){p=getchar()^48;if(p==
      -    30)p=0;if(p<10)i[n++]=p;}i[81]=0;p=-1;f:S(n%9)S(n/9)S(n%9/3+n/27*3)if(p>80)goto
      -    d;for(n=p;i[++p];);s[p]=n;i[p]=1;goto f;d:z=p<81;printf("\n%s!\n\n",z?"Fail":
      -    "Success");for(n=0;n<81;){p=i[n];printf("%c %s",(p?p|48:'.'),(++n%3?"":n%9?"| "
      -    :n%27?"\n":n%81?"\n------+-------+------\n":"\n\n"));}return z;}
      +
          #include <stdio.h> /* sudoku-bfi.c */
      +    #define S(t) for(n=0;n<9;v[n++]=0);for(n=0;n<81;n++)if(i[n]){z=1<<i[n];if(v[t]\\
      +    &z)for(;;){if(p<0)goto d;if(i[p]++<9)goto f;i[p]=0;p=s[p];}v[t]|=z;}
      +    int i[82],s[81],v[9],n,p,z;int main(void){for(n=0;n<81;){p=getchar()^48;if(p==
      +    30)p=0;if(p<10)i[n++]=p;}i[81]=0;p=-1;f:S(n%9)S(n/9)S(n%9/3+n/27*3)if(p>80)goto
      +    d;for(n=p;i[++p];);s[p]=n;i[p]=1;goto f;d:z=p<81;printf("\n%s!\n\n",z?"Fail":
      +    "Success");for(n=0;n<81;){p=i[n];printf("%c %s",(p?p|48:'.'),(++n%3?"":n%9?"| "
      +    :n%27?"\n":n%81?"\n------+-------+------\n":"\n\n"));}return z;}

      Judges’ note: this was added as aidan.alt.c.

      @@ -259,17 +259,17 @@ also has trouble - it took 66 seconds to solve it - but probably for different reasons. That’s the worst performance I’ve had from brute-force so far!)

      Usage

      Building

      -
          cc -o sudoku-sf sudoku-sf.c
      +
          cc -o sudoku-sf sudoku-sf.c

      or, if using gcc, try:

      -
          gcc -O2 -Wall -Wextra -ansi -pedantic-errors -o sudoku-sf sudoku-sf.c
      +
          gcc -O2 -Wall -Wextra -ansi -pedantic-errors -o sudoku-sf sudoku-sf.c

      Testing (optional)

      -
          perl ./test-su.perl
      +
          perl ./test-su.perl

      Note that this requires Perl 5 (I use 5.8.5, earlier versions untested) and is somewhat slow (should take under a minute on a fairly modern PC - try appending -n 0 if you’re in a hurry). I wrote it mostly for my own benefit, really.

      Solving

      -
          ./aidan < somefile.txt
      +
          ./aidan < somefile.txt

      Input should be the numbers of each row in turn. Empty spaces can be represented as a full stop (.) or zero (0). Other characters are ignored, so you can cut-and-paste either example sudoku puzzle from above into a file and feed that @@ -282,7 +282,7 @@ an extra 15 bytes of (very simple) code to add, so it doesn’t really matter to me. (It’s the same as the normal mode for most input you’re likely to feed it, though slightly slower. See if you can figure out what it does.)

      Generating

      -
          ./sudoku <seed>
      +
          ./sudoku <seed>

      Output is a blank grid, then the solution, then the problem. There’s no control over the difficulty. Sorry. However, all generated sudokus should have exactly one solution - if one doesn’t, that’s a bug.

      @@ -321,8 +321,8 @@ can’t help you figure out where the mistake is, sadly.

      Dependant on ASCII, requires that an int is at least 15 bits and a long at least 32. (No, that isn’t a typo - I did say 15, not 16).

      Also requires that cpp can properly handle something like:

      -
          #define foo(x,y) x y
      -    foo(bar,)
      +
          #define foo(x,y) x y
      +    foo(bar,)

      Apparently, a few can’t (ANSI C specifically doesn’t require that this works, though it usually does). Unfortunately, I didn’t discover this issue until too late. (It was mentioned in the notes for people modifying GCC in the “beware diff --git a/2005/anon/README.md b/2005/anon/README.md index c77a47391..674bb5e0a 100644 --- a/2005/anon/README.md +++ b/2005/anon/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -8,7 +8,7 @@ NOTE: there is an alternate version for vi(m) like movements. See [alternate version](#alternate-code) below. If your terminal has problems with the `stty(1)` commands try: -```sh +``` make anon-no_stty ``` @@ -28,14 +28,14 @@ For more detailed information see [2005 anon bugs](../../bugs.html#2005_anon). ## To use: -```sh +``` ./anon x y [z] ``` ## Try: -```sh +``` ./anon 4 4 ./anon 3 3 3 @@ -48,13 +48,13 @@ hook you) and spending too much time playing. :-) If you want to see this in action you can easily do this: -```sh +``` yes 'please crash on me :-)' | ./anon 4 4 ``` What happens if you specify a larger board? For instance: -```sh +``` yes 'please crash on me :-)' | ./anon 10 10 10 ``` @@ -70,13 +70,13 @@ The alternate version uses `vi(m)` like movement keys. ### Alternate build: -```sh +``` make alt ``` To compile the version without `stty(1)`: -```sh +``` make alt-no_stty ``` @@ -121,13 +121,13 @@ sorted in the order they appear on the screen. The program takes 2 or 3 arguments, specifying the dimensions of the board. For example, to play the original version of the Fifteen Puzzle: -```sh +``` ./anon 4 4 ``` To play with a 3D board, do something like this: -```sh +``` ./anon 3 3 3 ``` @@ -377,7 +377,7 @@ stored in a well-known location in the `MASS`. `if(p,q,r,s)` is, in fact, an `if` statement. :-) It is equivalent to: -```c +``` if (p) { q; r } else {s} ``` @@ -404,7 +404,7 @@ closes the current state and opens a new one behind the programmer's back. variable); `x` and `y-1` define the starting and ending values of `i`, and `z` is the loop body. `Z` is the post-loop code in the current state. For example: -```c +``` for(s,i, 0, 10, some_code , other_code) @@ -412,7 +412,7 @@ is the loop body. `Z` is the post-loop code in the current state. For example: is equivalent to: -```c +``` for (i=0; i<10; i++) { some_code; } diff --git a/2005/anon/index.html b/2005/anon/index.html index 1bd2b5830..bea7bc0f7 100644 --- a/2005/anon/index.html +++ b/2005/anon/index.html @@ -141,39 +141,39 @@ Location: ZZ - Unknown location

      To build:

      -
          make
      +
          make

      NOTE: there is an alternate version for vi(m) like movements. See alternate version below. If your terminal has problems with the stty(1) commands try:

      -
          make anon-no_stty
      +
          make anon-no_stty

      This will compile anon.c as anon to not use stty(1).

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2005 anon bugs.

      To use:

      -
          ./anon x y [z]
      +
          ./anon x y [z]

      Try:

      -
          ./anon 4 4
      -
      -    ./anon 3 3 3
      +
          ./anon 4 4
      +
      +    ./anon 3 3 3

      After a very large number of moves this program will deliberately force itself to destroy its runtime stack. This is the author’s way to prevent you from being frustrated (which might happen as it likes to create unsolvable puzzles just to hook you) and spending too much time playing. :-)

      If you want to see this in action you can easily do this:

      -
          yes 'please crash on me :-)' | ./anon 4 4
      +
          yes 'please crash on me :-)' | ./anon 4 4

      What happens if you specify a larger board? For instance:

      -
          yes 'please crash on me :-)' | ./anon 10 10 10
      +
          yes 'please crash on me :-)' | ./anon 10 10 10

      If you specify more than three args the program might also crash or do something strange. This might also happen if you specify excessively large board dimensions. Try 100 100 100 for instance and see what happens!

      Alternate version:

      The alternate version uses vi(m) like movement keys.

      Alternate build:

      -
          make alt
      +
          make alt

      To compile the version without stty(1):

      -
          make alt-no_stty
      +
          make alt-no_stty

      Alternate use:

      Use anon.alt as you would anon with the change in movements:

          k | Move empty spot up
      @@ -200,9 +200,9 @@ spaces on the board, and the goal is to rearrange them so that they appear
       sorted in the order they appear on the screen.

      The program takes 2 or 3 arguments, specifying the dimensions of the board. For example, to play the original version of the Fifteen Puzzle:

      -
          ./anon 4 4
      +
          ./anon 4 4

      To play with a 3D board, do something like this:

      -
          ./anon 3 3 3
      +
          ./anon 3 3 3

      WARNING: do NOT run the program with more than 3 command-line arguments. This will trigger a bug that will cause it to crash or do something strange. :-)

      @@ -394,7 +394,7 @@ allocation. It’s the only state that needs to return a value from the boolean expression, since once the MASS is initialized any return value can simply be stored in a well-known location in the MASS.

      if(p,q,r,s) is, in fact, an if statement. :-) It is equivalent to:

      -
          if (p) { q; r } else {s}
      +
          if (p) { q; r } else {s}

      Why are q and r split up? Because it’s cleaner (in whatever twisted sense of the word that can be applied to an IOCCC entry) to implement using boolean expressions. Keep in mind that all statements are assumed to evaluate to @@ -415,14 +415,14 @@ closes the current state and opens a new one behind the programmer’s back. i is the index variable (well, the index into the MASS of the index variable); x and y-1 define the starting and ending values of i, and z is the loop body. Z is the post-loop code in the current state. For example:

      -
          for(s,i, 0, 10,
      -    some_code       ,
      -    other_code)
      +
          for(s,i, 0, 10,
      +    some_code       ,
      +    other_code)

      is equivalent to:

      -
          for (i=0; i&lt;10; i++) {
      -            some_code;
      -    }
      -    other_code;
      +
          for (i=0; i&lt;10; i++) {
      +            some_code;
      +    }
      +    other_code;

      Note the “wrong” indentation in the former: the author prefers to write it that way, since the analogy to the usual for loop is clearer. This is why it’s easier to understand the pre-CPP code, since after CPP, the macro reshuffles diff --git a/2005/boutines/README.md b/2005/boutines/README.md index 33e34fb0f..3470383de 100644 --- a/2005/boutines/README.md +++ b/2005/boutines/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -15,20 +15,20 @@ require it?](../../faq.html#imagemagick). Look here to find some [SVG Viewer Implementations](https://www.w3.org/Graphics/SVG/WG/wiki/Implementations). -```sh +``` ./boutines < input > output.svg ``` ## Try: -```sh +``` ./try.sh ``` If `ruby` is installed [try.sh](try.sh) will generate an SVG file by: -```sh +``` ruby -e '20.times{puts "#{rand} #{rand}"}' | ./boutines > test.svg ``` @@ -75,7 +75,7 @@ an [SVG](https://www.w3.org/TR/SVG11/expanded-toc.html) stream. This will possibly save a compressed SVG file and may be useful: -```sh +``` ./boutines | gzip > result.svg.gz ``` diff --git a/2005/boutines/index.html b/2005/boutines/index.html index d9d1a30a1..7788b2e7a 100644 --- a/2005/boutines/index.html +++ b/2005/boutines/index.html @@ -141,7 +141,7 @@ Location: FR - French Republic (

      To build:

      -
          make
      +
          make

      To use:

      You will need an SVG viewer or a converter like ImageMagick’s convert. @@ -149,11 +149,11 @@ See FAQ 3.17 - How do I compile and install require it?.

      Look here to find some SVG Viewer Implementations.

      -
          ./boutines < input > output.svg
      +
          ./boutines < input > output.svg

      Try:

      -
          ./try.sh
      +
          ./try.sh

      If ruby is installed try.sh will generate an SVG file by:

      -
          ruby -e '20.times{puts "#{rand} #{rand}"}' | ./boutines > test.svg
      +
          ruby -e '20.times{puts "#{rand} #{rand}"}' | ./boutines > test.svg

      It will also create an SVG file with the file input.txt.

      The script will check if convert is available and if so it will try converting the SVG file(s) to PNG file(s) which you should be able to view in most any @@ -178,7 +178,7 @@ square.

      A Voronoi diagram of the set as an SVG stream.

      This will possibly save a compressed SVG file and may be useful:

      -
          ./boutines | gzip > result.svg.gz
      +
          ./boutines | gzip > result.svg.gz

      Input consists of a list of floating points values separated by whitespaces (ranging preferably in [0,1]). Alternating a horizontal coordinate, a whitespace then the other coordinate (pointing downwards in the resulting diff --git a/2005/chia/README.md b/2005/chia/README.md index 39d05ac22..7818566e7 100644 --- a/2005/chia/README.md +++ b/2005/chia/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./chia ``` diff --git a/2005/chia/index.html b/2005/chia/index.html index aa6347830..034a4da96 100644 --- a/2005/chia/index.html +++ b/2005/chia/index.html @@ -141,9 +141,9 @@ Location: SG - Republic of Singapore

      To build:

      -
          make
      +
          make

      To use:

      -
          ./chia
      +
          ./chia

      Judges’ remarks:

      Have you had your morning cup of Java? You might want a second cup before parsing this entry. And give your C diff --git a/2005/giljade/README.md b/2005/giljade/README.md index d46c0f8a3..287ad9e97 100644 --- a/2005/giljade/README.md +++ b/2005/giljade/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -21,21 +21,21 @@ For more detailed information see [2005 giljade bugs](../../bugs.html#2005_gilja ## To use: -```sh +``` ./giljade ``` ## Try: -```sh +``` ./try.sh ``` ### Self-test feature to try: -```sh +``` ./giljade > out ./giljade out ``` @@ -52,7 +52,7 @@ Control-F. If you really understand expressions, then understand this: -```c +``` s=s^(b=s&s-1^s) ``` diff --git a/2005/giljade/index.html b/2005/giljade/index.html index 4e4ec12a3..fe88f4053 100644 --- a/2005/giljade/index.html +++ b/2005/giljade/index.html @@ -141,7 +141,7 @@ Location: IL - State of Israel (

      To build:

      -
          make
      +
          make

      NOTE: We FORCE the use of -O0 even if someone overrides it because this entry will not work with it enabled.

      Bugs and (Mis)features:

      @@ -149,12 +149,12 @@ will not work with it enabled.

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2005 giljade bugs.

      To use:

      -
          ./giljade
      +
          ./giljade

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Self-test feature to try:

      -
          ./giljade > out
      -    ./giljade out
      +
          ./giljade > out
      +    ./giljade out

      NOTE: try.sh will ask you if you wish to do this.

      Judges’ remarks:

      This entry takes editorial in how it deals with its output. After using vi(1) @@ -162,7 +162,7 @@ will not work with it enabled.

      output. We especially recommend it on a 78 column xterm while leaning on Control-F.

      If you really understand expressions, then understand this:

      -
          s=s^(b=s&s-1^s)
      +
          s=s^(b=s&s-1^s)

      … and understand why it is found in the source code.

      Author’s remarks:

      So what do we have here ?

      diff --git a/2005/jetro/README.md b/2005/jetro/README.md index ada4b5791..377961547 100644 --- a/2005/jetro/README.md +++ b/2005/jetro/README.md @@ -6,14 +6,14 @@ haven't already. If you have SDL installed: -```sh +``` make ``` ## To use: -```sh +``` ./jetro ``` diff --git a/2005/jetro/index.html b/2005/jetro/index.html index 38e6ec4bb..083fae0e5 100644 --- a/2005/jetro/index.html +++ b/2005/jetro/index.html @@ -145,9 +145,9 @@ Location: FI - Republic of Finland for information on how to install it if you haven’t already.

      If you have SDL installed:

      -
          make
      +
          make

      To use:

      -
          ./jetro
      +
          ./jetro

      Judges’ remarks:

      We have seen entries with SDL graphics in the past, now it’s time for SDL sound. This entry can even be run on a computer without a sound card with an diff --git a/2005/klausler/README.md b/2005/klausler/README.md index 4a0d22772..6584b6226 100644 --- a/2005/klausler/README.md +++ b/2005/klausler/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./klausler arg1 arg2 | head ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2005/klausler/index.html b/2005/klausler/index.html index 3c3b17bdc..3583f4859 100644 --- a/2005/klausler/index.html +++ b/2005/klausler/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      To use:

      -
          ./klausler arg1 arg2 | head
      +
          ./klausler arg1 arg2 | head

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      To reduce the size of the source, include other people’s data. That is what Peter suggests when he describes how to generate diff --git a/2005/mikeash/README.md b/2005/mikeash/README.md index aa183e382..1b4f288c2 100644 --- a/2005/mikeash/README.md +++ b/2005/mikeash/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2005 mikeash bugs](../../bugs.html#2005_mikea ## To use: -```sh +``` ./mikeash ``` @@ -28,7 +28,7 @@ under 64-bit (x86_64, arm64) machines too. ## Try: -```sh +``` ./try.sh ``` @@ -67,7 +67,7 @@ functions. Try: -```sh +``` echo '(format t "~s" (+ 2 2 ))' | ./mikeash ``` @@ -76,7 +76,7 @@ the lack of a newline are due to the somewhat broken implementation of the format function. More sophisticated arithmetic expressions may be used: -```sh +``` echo '(format t "~s" (* (+ 2 2 ) (- 5 (/ 9 3 ))))' | ./mikeash ``` @@ -130,7 +130,7 @@ nowhere near Basically, the [LISP][] interpreter is good for some basic math operations, and for running itself. To do the latter, try this: -```sh +``` ./mikeash < mikeash.c > mikeash2.c diff mikeash.c mikeash2.c ``` diff --git a/2005/mikeash/index.html b/2005/mikeash/index.html index 65544d691..714fad6d0 100644 --- a/2005/mikeash/index.html +++ b/2005/mikeash/index.html @@ -141,17 +141,17 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2005 mikeash bugs.

      To use:

      -
          ./mikeash
      +
          ./mikeash

      NOTE: the author stated that they tested this under i386 machines but this works under 64-bit (x86_64, arm64) machines too.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      Having problems speaking code? Do you LISP? Parenthetically speaking, this entry takes advantage of C99 features, while @@ -175,12 +175,12 @@ constant string, due to different string escape semantics in C and Lisp, and some implicit integer-to-pointer conversions due to the implicitly-declared functions.

      Try:

      -
          echo '(format t "~s" (+ 2 2 ))' | ./mikeash
      +
          echo '(format t "~s" (+ 2 2 ))' | ./mikeash

      You should see 4" echoed on your command prompt. The " after the 4 and the lack of a newline are due to the somewhat broken implementation of the format function. More sophisticated arithmetic expressions may be used:

      -
          echo '(format t "~s" (* (+ 2 2 ) (- 5 (/ 9 3 ))))' | ./mikeash
      +
          echo '(format t "~s" (* (+ 2 2 ) (- 5 (/ 9 3 ))))' | ./mikeash

      This evaluates the expression (2+2) * (5 - 9/3) giving the correct result, 8" (with the same issue of no newline after the "). Note that due to the highly ad-hoc nature of the tokenizer, the spaces before the closing parentheses @@ -219,8 +219,8 @@ nowhere near

    Basically, the LISP interpreter is good for some basic math operations, and for running itself. To do the latter, try this:

    -
        ./mikeash < mikeash.c > mikeash2.c
    -    diff mikeash.c mikeash2.c
    +
        ./mikeash < mikeash.c > mikeash2.c
    +    diff mikeash.c mikeash2.c

    The program can also be run from an implementation of common lisp. To do this, run the common lisp compiler and then type the following command:

    diff --git a/2005/mynx/README.md b/2005/mynx/README.md index 176f16747..ce5b08d53 100644 --- a/2005/mynx/README.md +++ b/2005/mynx/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -21,7 +21,7 @@ For more detailed information see [2005 mynx bugs](../../bugs.html#2005_mynx). ## To use: -```sh +``` ./mynx http:// ``` @@ -31,7 +31,7 @@ the issue of https. ## Try: -```sh +``` ./mynx http://www.textfiles.com ./mynx manual.html @@ -58,7 +58,7 @@ must just appreciate the entry for what it once was. ### Alternate build: -```sh +``` make alt ``` @@ -68,7 +68,7 @@ must just appreciate the entry for what it once was. Use `mynx.alt` as you would `mynx`. You'd have to specify a port at the end of the URL like: -```sh +``` ./mynx.alt https://www.ioccc.org:443 ``` @@ -92,13 +92,13 @@ it inspired me to try my hand at writing the client side complement. A typical build command would be: -```sh +``` cc -o mynx mynx.c ``` While some others like to be a little different: -```sh +``` cc -o mynx mynx.c -lnsl -lsocket ``` @@ -107,13 +107,13 @@ example, which is kinda of useful when you consider how many OSes put all the network functions in a variety of places. So a simpler build command sequence would be: -```sh +``` cd source ; ./configure ; make ``` After which, the rest of the documentation can be read by saying: -```sh +``` ./mynx ../manual.html ``` diff --git a/2005/mynx/index.html b/2005/mynx/index.html index 3cb72131c..afba61089 100644 --- a/2005/mynx/index.html +++ b/2005/mynx/index.html @@ -141,7 +141,7 @@ Location: CA - Canada

    To build:

    -
        make
    +
        make

    There is an alternate version that scans for (ONLY scans) the string https as a starting point. See alternate code below.

    Bugs and (Mis)features:

    @@ -149,13 +149,13 @@ as a starting point. See alternate code below.

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 2005 mynx bugs.

    To use:

    -
        ./mynx http://<domain>
    +
        ./mynx http://<domain>

    You can specify a port by appending to the domain :port. See notes below on the issue of https.

    Try:

    -
        ./mynx http://www.textfiles.com
    -
    -    ./mynx manual.html
    +
        ./mynx http://www.textfiles.com
    +
    +    ./mynx manual.html

    Alternate code:

    Obviously this will not work with https as it only scans for http in the URL (if not specified it tries to open it as a local file). But even if it scanned @@ -171,11 +171,11 @@ to either come up with a pipeline (or some other command line) that allows it to work with https or to update the code to support https they may. Otherwise you must just appreciate the entry for what it once was.

    Alternate build:

    -
        make alt
    +
        make alt

    Alternate use:

    Use mynx.alt as you would mynx. You’d have to specify a port at the end of the URL like:

    -
        ./mynx.alt https://www.ioccc.org:443
    +
        ./mynx.alt https://www.ioccc.org:443

    but again unless you have a clever workaround or hack to the problem, this sadly won’t work.

    Judges’ remarks:

    @@ -188,16 +188,16 @@ get a functioning LAMP stack.

    I was rather impressed by last year’s mini webserver. So much so that it inspired me to try my hand at writing the client side complement.

    A typical build command would be:

    -
        cc -o mynx mynx.c
    +
        cc -o mynx mynx.c

    While some others like to be a little different:

    -
        cc -o mynx mynx.c -lnsl -lsocket
    +
        cc -o mynx mynx.c -lnsl -lsocket

    I even managed to figure out a basic configure script, given last year’s example, which is kinda of useful when you consider how many OSes put all the network functions in a variety of places. So a simpler build command sequence would be:

    -
        cd source ; ./configure ; make
    +
        cd source ; ./configure ; make

    After which, the rest of the documentation can be read by saying:

    -
        ./mynx ../manual.html
    +
        ./mynx ../manual.html
    make ``` @@ -10,14 +10,14 @@ setting binary mode on `stdout`. See [alternate code](#alternate-code) below. ## To use: -```sh +``` ./persano p q [num frames] ``` ## Try: -```sh +``` ./try.sh ``` @@ -49,7 +49,7 @@ Use `persano.alt` as you would `persano` above. ### Alternate try: -```sh +``` ./persano.alt 3 16 > knot3-16.gif ``` @@ -80,7 +80,7 @@ knots](https://en.wikipedia.org/wiki/Torus_knot) to standard output. ### SYNOPSIS -```sh +``` ./persano p q [num frames] ``` @@ -98,14 +98,14 @@ cutting it [^1], until it ends up looking just like a circle embedded in R3 [^2] Sample usage: -```sh +``` ./persano 3 2 1 > foo.gif ``` writes a non-animated GIF (a single frame) stream of a rendered trefoil knot to the file `foo.gif`. -```sh +``` ./persano 5 2 ``` diff --git a/2005/persano/index.html b/2005/persano/index.html index c3bb029d3..12ae28eef 100644 --- a/2005/persano/index.html +++ b/2005/persano/index.html @@ -141,13 +141,13 @@ Location: BR - Federative Republic of B

    To build:

    -
        make
    +
        make

    There is an alternate version of this entry which should work for Windows by setting binary mode on stdout. See alternate code below.

    To use:

    -
        ./persano p q [num frames]
    +
        ./persano p q [num frames]

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Open the GIF files with a viewer capable of displaying animated GIFs and watch closely at the bottom of the picture (you may need to use gifsicle - a great tool to @@ -162,7 +162,7 @@ let it work with Windows.

    Alternate use:

    Use persano.alt as you would persano above.

    Alternate try:

    -
        ./persano.alt 3 16 > knot3-16.gif
    +
        ./persano.alt 3 16 > knot3-16.gif

    Follow the same instructions, using different tools if necessary, as the above try section.

    Judges’ remarks:

    @@ -179,7 +179,7 @@ linker option).

    knot writes animated GIF images of rendered torus knots to standard output.

    SYNOPSIS

    -
        ./persano p q [num frames]
    +
        ./persano p q [num frames]

    DESCRIPTION

    A (p,q)-torus knot is a closed, non-intersecting curve on the surface of a @@ -190,10 +190,10 @@ resulting curve will not be a knot (that is, imagining the resulting cu a loop of rubber, there will be a way to bend, twist and stretch it, without cutting it 1, until it ends up looking just like a circle embedded in R3 2).

    Sample usage:

    -
        ./persano 3 2 1 > foo.gif
    +
        ./persano 3 2 1 > foo.gif

    writes a non-animated GIF (a single frame) stream of a rendered trefoil knot to the file foo.gif.

    -
        ./persano 5 2
    +
        ./persano 5 2

    writes a GIF stream with a rendering of Solomon’s Seal knot to standard output; since the number of frames is not specified, an animation with diff --git a/2005/sykes/README.md b/2005/sykes/README.md index ffe3e7576..771e47a32 100644 --- a/2005/sykes/README.md +++ b/2005/sykes/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2005 sykes bugs](../../bugs.html#2005_sykes). ## To use: -```sh +``` ./sykes binary_file ``` ## Try: -```sh +``` ./try.sh ``` @@ -44,7 +44,7 @@ We downloaded the [ROM](https://en.wikipedia.org/wiki/ROM_image) contents to use the [emulator](https://en.wikipedia.org/wiki/Emulator) in [PET](https://en.wikipedia.org/wiki/Commodore_PET) mode as follows: -```sh +``` wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-c000.901465-01.bin wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-d000.901465-02.bin wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/edit-2-n.901447-24.bin @@ -53,7 +53,7 @@ the [emulator](https://en.wikipedia.org/wiki/Emulator) in We then created: -```sh +``` dd bs=2k count=1 if=/dev/zero of=nullfill.bin ``` @@ -79,7 +79,7 @@ Compile the program, then test the [6502](https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description) [emulation](https://en.wikipedia.org/wiki/Emulator) like this: -```sh +``` ./sykes 6502test ``` @@ -105,7 +105,7 @@ Make sure you have a [terminal window](https://en.wikipedia.org/wiki/Terminal_emulator) of 40x25 chars or bigger, and then run the emulator like this: -```sh +``` ./sykes pet.rom ``` @@ -119,13 +119,13 @@ You should see the startup message. Try typing in some There is an optional numeric parameter, which controls the speed. For a slower cursor blink, try -```sh +``` ./sykes pet.rom 6 ``` and for faster -```sh +``` ./sykes pet.rom 2 ``` @@ -191,7 +191,7 @@ Supplied as a demonstration is a compiled-for-[6502](https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description) version a chess program (heh, I found a use for a previous losing entry :) ). Try: -```sh +``` ./sykes chess ``` @@ -306,7 +306,7 @@ from the Internet. This is to avoid directly infringing any copyright. What does this do? -```sh +``` ./sykes pet.rom -1 ``` diff --git a/2005/sykes/index.html b/2005/sykes/index.html index fd7caecff..ce4fe537e 100644 --- a/2005/sykes/index.html +++ b/2005/sykes/index.html @@ -141,15 +141,15 @@ Location: FI - Republic of Finland

    To build:

    -
        make
    +
        make

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 2005 sykes bugs.

    To use:

    -
        ./sykes binary_file
    +
        ./sykes binary_file

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    For those who fondly remember their first PET, this entry will start you @@ -160,12 +160,12 @@ after the C pre-processor gets finished with it!

    We downloaded the ROM contents to use the emulator in PET mode as follows:

    -
        wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-c000.901465-01.bin
    -    wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-d000.901465-02.bin
    -    wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/edit-2-n.901447-24.bin
    -    wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/kernal-2.901465-03.bin
    +
        wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-c000.901465-01.bin
    +    wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-d000.901465-02.bin
    +    wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/edit-2-n.901447-24.bin
    +    wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/kernal-2.901465-03.bin

    We then created:

    -
        dd bs=2k count=1 if=/dev/zero of=nullfill.bin
    +
        dd bs=2k count=1 if=/dev/zero of=nullfill.bin

    For your convenience, we have added the above mentioned files to this entry directory. They were used to form the pet.rom file.

    Author’s remarks:

    @@ -180,7 +180,7 @@ to not infringe the rules.

    Compile the program, then test the 6502 emulation like this:

    -
        ./sykes 6502test
    +
        ./sykes 6502test

    A basic test is done for each instruction and addressing mode, all tests should pass. At the end of the tests, it loops forever - break out with control-C.

    @@ -196,15 +196,15 @@ Transactor.

    Make sure you have a terminal window of 40x25 chars or bigger, and then run the emulator like this:

    -
        ./sykes pet.rom
    +
        ./sykes pet.rom

    You should see the startup message. Try typing in some BASIC - for instance:

        PRINT "HELLO, WORLD"

    There is an optional numeric parameter, which controls the speed. For a slower cursor blink, try

    -
        ./sykes pet.rom 6
    +
        ./sykes pet.rom 6

    and for faster

    -
        ./sykes pet.rom 2
    +
        ./sykes pet.rom 2

    The default is 4.

    The control keys are as follows:

        ^A HOME
    @@ -243,7 +243,7 @@ The filenames must be upper case in order to be loaded by the emulator.

    Supplied as a demonstration is a compiled-for-6502 version a chess program (heh, I found a use for a previous losing entry :) ). Try:

    -
        ./sykes chess
    +
        ./sykes chess

    It works as you would expect (it plays very badly). There’s no castling or en-passant, and to win you must actually take the opponent’s king.

    You can write your own programs too, any 6502 @@ -327,7 +327,7 @@ course, the pet.rom is not my work. So I ask the user to download i from the Internet. This is to avoid directly infringing any copyright.

    Finally

    What does this do?

    -
        ./sykes pet.rom -1
    +
        ./sykes pet.rom -1

    Have fun!

    make ``` ## To use: -```sh +``` ./timwi < bf_program ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2005/timwi/index.html b/2005/timwi/index.html index a39b3a351..459bd2844 100644 --- a/2005/timwi/index.html +++ b/2005/timwi/index.html @@ -141,11 +141,11 @@ Location: DE - Federal Republic of Germ

    To build:

    -
        make
    +
        make

    To use:

    -
        ./timwi < bf_program
    +
        ./timwi < bf_program

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    Unlike most BF interpreters that we have been receiving for the last few years, this one, in our opinion, is the diff --git a/2005/toledo/README.md b/2005/toledo/README.md index 590089412..e417df988 100644 --- a/2005/toledo/README.md +++ b/2005/toledo/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./toledo [a ...] ``` ## Try: -```sh +``` ./toledo a ./toledo a b ``` @@ -30,7 +30,7 @@ Two alternate versions of this entry, [toledo2.c](toledo2.c) and To compile the alternate versions: -```sh +``` make alt ``` @@ -63,7 +63,7 @@ This is a [chess](https://en.wikipedia.org/wiki/Chess) program, it can work in two modes: two-players, and one player (always white) against the machine. To get the first mode, run the program without arguments: -```sh +``` ./toledo ``` @@ -71,14 +71,14 @@ The other mode is accessible running the program with one argument (5-[ply](https://en.wikipedia.org/wiki/Ply_(game_theory)) analysis): -```sh +``` ./toledo a ``` Two arguments for 6-[ply](https://en.wikipedia.org/wiki/Ply_(game_theory)) analysis: -```sh +``` ./toledo a b ``` diff --git a/2005/toledo/index.html b/2005/toledo/index.html index 2230a9bdb..67590a05e 100644 --- a/2005/toledo/index.html +++ b/2005/toledo/index.html @@ -141,18 +141,18 @@ Location: MX - United Mexican States

    To build:

    -
        make
    +
        make

    To use:

    -
        ./toledo [a ...]
    +
        ./toledo [a ...]

    Try:

    -
        ./toledo a
    -    ./toledo a b
    +
        ./toledo a
    +    ./toledo a b

    Alternate code:

    Two alternate versions of this entry, toledo2.c and toledo3.c are provided.

    Alternate build:

    To compile the alternate versions:

    -
        make alt
    +
        make alt

    Alternate use:

    Use Use toledo2 and toledo3 as you would toledo above.

    Judges’ remarks:

    @@ -170,14 +170,14 @@ single function.

    This is a chess program, it can work in two modes: two-players, and one player (always white) against the machine. To get the first mode, run the program without arguments:

    -
        ./toledo
    +
        ./toledo

    The other mode is accessible running the program with one argument (5-ply analysis):

    -
        ./toledo a
    +
        ./toledo a

    Two arguments for 6-ply analysis:

    -
        ./toledo a b
    +
        ./toledo a b

    And each successive argument will analyze one ply more. There is no ply limit, but beyond 7 ply is very slow, try it at your own risk and computing diff --git a/2005/vik/README.md b/2005/vik/README.md index 95b6acf58..60ff99348 100644 --- a/2005/vik/README.md +++ b/2005/vik/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./vik [file.map] ``` ## Try: -```sh +``` ./vik maze.map ``` @@ -60,7 +60,7 @@ Compile the source code and link in [X libraries](https://en.wikipedia.org/wiki/Xlib) if necessary. The program takes three options which have to be typed in a specific order as described below. -```sh +``` ./vik [-w ] [mapfile] ``` @@ -75,20 +75,20 @@ where: Start the engine using a built in labyrinth and texture bitmaps: -```sh +``` ./vik ``` Start the engine and loads the labyrinth defined in the file [maze.map](maze.map): -```sh +``` ./vik maze.map ``` Start the engine using [maze.map](maze.map) in a window that is 400 pixels wide: -```sh +``` ./vik -w 400 maze.map ``` diff --git a/2005/vik/index.html b/2005/vik/index.html index 18d77889f..f92ae5ecc 100644 --- a/2005/vik/index.html +++ b/2005/vik/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

    To build:

    -
        make
    +
        make

    To use:

    -
        ./vik [file.map]
    +
        ./vik [file.map]

    Try:

    -
        ./vik maze.map
    +
        ./vik maze.map

    Judges’ remarks:

    An amazing use of the X libraries with twisty code passages, all different. One risks running in code path circles as main() is called again and again. Be @@ -177,18 +177,18 @@ backward).

    Compile the source code and link in X libraries if necessary. The program takes three options which have to be typed in a specific order as described below.

    -
        ./vik [-w <width>] [mapfile]
    +
        ./vik [-w <width>] [mapfile]

    where:

        width   - Specifies the width of the window
         mapfile - Filename containing a map

    Examples

    Start the engine using a built in labyrinth and texture bitmaps:

    -
        ./vik
    +
        ./vik

    Start the engine and loads the labyrinth defined in the file maze.map:

    -
        ./vik maze.map
    +
        ./vik maze.map

    Start the engine using maze.map in a window that is 400 pixels wide:

    -
        ./vik -w 400 maze.map
    +
        ./vik -w 400 maze.map

    Note that the mapfile has to be the last argument and the -w option if present has to be the first. The map definition files and the bitmap files should be located in the current directory.

    diff --git a/2005/vince/README.md b/2005/vince/README.md index cfd3975be..ead138c22 100644 --- a/2005/vince/README.md +++ b/2005/vince/README.md @@ -3,14 +3,14 @@ Before building, make sure that you have the OpenGL development libraries installed. -```sh +``` make ``` ## To use: -```sh +``` ./vince ``` @@ -31,7 +31,7 @@ also has the recursive `CPP` macro (which sneaked in accidentally) removed. To compile this alternate version: -```sh +``` make alt ``` diff --git a/2005/vince/index.html b/2005/vince/index.html index b7d8e34f2..c7a368846 100644 --- a/2005/vince/index.html +++ b/2005/vince/index.html @@ -143,9 +143,9 @@ Location: US - United States of America

    To build:

    Before building, make sure that you have the OpenGL development libraries installed.

    -
        make
    +
        make

    To use:

    -
        ./vince
    +
        ./vince

    Try:

    When running this in the program’s window try hitting space a few times and see what happens!

    @@ -154,7 +154,7 @@ what happens!

    also has the recursive CPP macro (which sneaked in accidentally) removed.

    Alternate build:

    To compile this alternate version:

    -
        make alt
    +
        make alt

    Alternate use:

    Use vince.alt as you would vince above.

    Alternate try:

    diff --git a/2006/birken/README.md b/2006/birken/README.md index 22445ac14..b5d9f3724 100644 --- a/2006/birken/README.md +++ b/2006/birken/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2006 birken bugs](../../bugs.html#2006_birken ## To use: -```sh +``` ./birken < file.tofu ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2006/birken/index.html b/2006/birken/index.html index ef786662f..ca01f809c 100644 --- a/2006/birken/index.html +++ b/2006/birken/index.html @@ -141,15 +141,15 @@ Location: US - United States of America

    To build:

    -
        make
    +
        make

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: uses gets() - change to fgets() if possible

    For more detailed information see 2006 birken bugs.

    To use:

    -
        ./birken < file.tofu
    +
        ./birken < file.tofu

    Try:

    -
        ./try.sh
    +
        ./try.sh

    etc.

    Judges’ remarks:

    Q: EDAMAME?

    diff --git a/2006/borsanyi/README.md b/2006/borsanyi/README.md index e49720212..c1c68cea7 100644 --- a/2006/borsanyi/README.md +++ b/2006/borsanyi/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2006 borsanyi bugs](../../bugs.html#2006_bors ## To use: -```sh +``` ./borsanyi string > file.gif ``` ## Try: -```sh +``` ./try.sh ``` @@ -68,7 +68,7 @@ used. A typical email address is stored in less than 1-2 kilobytes. ### Usage: -```sh +``` make all ./borsanyi my@example.com > email.gif my_favourite_gif_viewer email.gif diff --git a/2006/borsanyi/index.html b/2006/borsanyi/index.html index 020d2cfce..fbd719fdf 100644 --- a/2006/borsanyi/index.html +++ b/2006/borsanyi/index.html @@ -141,15 +141,15 @@ Location: DE - Federal Republic of Germ

    To build:

    -
        make
    +
        make

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 2006 borsanyi bugs.

    To use:

    -
        ./borsanyi string > file.gif
    +
        ./borsanyi string > file.gif

    Try:

    -
        ./try.sh
    +
        ./try.sh

    We recommend you input for the filename example.gif and for the string ioccc@example.com. The script will not overwrite files. It runs the program in a loop until you answer that you do not wish to make another.

    @@ -175,9 +175,9 @@ line. To avoid complications with patent issues the Usage: -
        make all
    -    ./borsanyi my@example.com > email.gif
    -    my_favourite_gif_viewer email.gif
    +
        make all
    +    ./borsanyi my@example.com > email.gif
    +    my_favourite_gif_viewer email.gif

    The address cannot be longer than 42 characters, and may consist of the characters: a-z_A-Z0-9@.-.

    The program is (like email addresses are) case insensitive.

    diff --git a/2006/grothe/README.md b/2006/grothe/README.md index 0ef56dd95..f7ede74fc 100644 --- a/2006/grothe/README.md +++ b/2006/grothe/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./grothe carrier_freq pixelclock horizontal_total < some_input.txt ``` @@ -16,7 +16,7 @@ Put on your "electronic ears" and then try: -```sh +``` ./try.sh ``` @@ -50,13 +50,13 @@ parameters: If you have `xvidtune` installed you can get the `pixelclock` and `horizontal_total` with the following command -```sh +``` xvidtune -show | head -n 1 | awk '{ print "pixelclock " $2 * 1000000 " horizontal_total = " $6 }' ``` Example from my laptops: -```sh +``` ./grothe 65000000 10000000 1344 < twinkle.txt ``` diff --git a/2006/grothe/index.html b/2006/grothe/index.html index f575407ae..0ff4542e9 100644 --- a/2006/grothe/index.html +++ b/2006/grothe/index.html @@ -141,12 +141,12 @@ Location: US - United States of America

    To build:

    -
        make
    +
        make

    To use:

    -
        ./grothe carrier_freq pixelclock horizontal_total < some_input.txt
    +
        ./grothe carrier_freq pixelclock horizontal_total < some_input.txt

    Try:

    Put on your “electronic ears” and then try:

    -
        ./try.sh
    +
        ./try.sh

    You may find using a tunable scanning electronic ear helps.

    Judges’ remarks:

    @@ -165,9 +165,9 @@ parameters:

    horizontal_total - total scan along the horizontal axis

    If you have xvidtune installed you can get the pixelclock and horizontal_total with the following command

    -
        xvidtune -show | head -n 1 | awk '{ print "pixelclock " $2 * 1000000 " horizontal_total = " $6 }'
    +
        xvidtune -show | head -n 1 | awk '{ print "pixelclock " $2 * 1000000 " horizontal_total = " $6 }'

    Example from my laptops:

    -
        ./grothe 65000000 10000000 1344 < twinkle.txt
    +
        ./grothe 65000000 10000000 1344 < twinkle.txt

    Even if the user gets a setting off, the sound will usually be able to be heard on AM at a multiple of the original frequency.

    diff --git a/2006/hamre/README.md b/2006/hamre/README.md index 87d012e3a..df2e650e3 100644 --- a/2006/hamre/README.md +++ b/2006/hamre/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./hamre math_expression_string ``` ## Try: -```sh +``` ./try.sh ``` @@ -42,7 +42,7 @@ supported operators are: `+`, `-` (binary and unary), `*`, `/` and `()`. Run it by supplying an expression as the first argument, and the normalized result will be written to `stdout`. -```sh +``` ./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2' 2/3 ``` diff --git a/2006/hamre/index.html b/2006/hamre/index.html index c108e650d..270228d34 100644 --- a/2006/hamre/index.html +++ b/2006/hamre/index.html @@ -141,11 +141,11 @@ Location: NO - Kingdom of Norway (

    To build:

    -
        make
    +
        make

    To use:

    -
        ./hamre math_expression_string
    +
        ./hamre math_expression_string

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    An irrationally coded source presents rational things!

    A rational person might want to attempt the @@ -162,8 +162,8 @@ an obfuscated one.

    supported operators are: +, - (binary and unary), *, / and (). Run it by supplying an expression as the first argument, and the normalized result will be written to stdout.

    -
        ./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2'
    -    2/3
    +
        ./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2'
    +    2/3

    If you do not supply an argument, the calculator will crash. Other arguments are ignored. Supplying more arguments may further limit the number of nested operators supported.

    diff --git a/2006/meyer/README.md b/2006/meyer/README.md index 93831e729..3e0afc604 100644 --- a/2006/meyer/README.md +++ b/2006/meyer/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./meyer [SEED] ``` ## Try: -```sh +``` ./meyer [SEED] ``` @@ -75,7 +75,7 @@ you write is what it does'). It may be tempting to think that might do something similar as -```c +``` struct not_an_object o; ``` @@ -100,7 +100,7 @@ implementation in a popular object-oriented programming language. ### Starting the game -```sh +``` ./meyer [SEED] ``` diff --git a/2006/meyer/index.html b/2006/meyer/index.html index e57f9884e..c5d8d5501 100644 --- a/2006/meyer/index.html +++ b/2006/meyer/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

    To build:

    -
        make
    +
        make

    To use:

    -
        ./meyer [SEED]
    +
        ./meyer [SEED]

    Try:

    -
        ./meyer [SEED]
    +
        ./meyer [SEED]

    For your first input try:

        a 0 1

    where a is the row (a-i), 0 is the column (0-8) and 1 is the @@ -183,7 +183,7 @@ it is obvious, that object-oriented code isn’t ‘WYWIWID’ (‘ you write is what it does’). It may be tempting to think that

        Object o;

    might do something similar as

    -
        struct not_an_object o;
    +
        struct not_an_object o;

    But this program reveals that it doesn’t. Even worse, this program only reveals the tip of the iceberg, what kind of black magic is involved in a simple declaration of an object.

    @@ -201,7 +201,7 @@ and poly

    It is left as an exercise to the reader to find a corresponding implementation in a popular object-oriented programming language.

    Starting the game

    -
        ./meyer [SEED]
    +
        ./meyer [SEED]

    Gameplay

    It is a sudoku based game. The goal of the game is to be able to do the last valid ‘move’.

    diff --git a/2006/monge/README.md b/2006/monge/README.md index ce795898f..a876a978d 100644 --- a/2006/monge/README.md +++ b/2006/monge/README.md @@ -2,7 +2,7 @@ Make sure you have the SDL1 (not SDL2!) development environment installed. -```sh +``` make ``` @@ -24,7 +24,7 @@ For more detailed information see [2006 monge bugs](../../bugs.html#2006_monge). ## To use: -```sh +``` ./monge expression ... ``` @@ -33,7 +33,7 @@ Incorrect formulas will ungracefully crash the program. ## Try: -```sh +``` ./try.sh ``` @@ -49,7 +49,7 @@ as the number of iterations to perform. To use the default values, the same as [monge.c](monge.c), just do: -```sh +``` make alt ``` @@ -58,13 +58,13 @@ of the variables `W`, `H` and `I`. The defaults are (respectively) 400, 300 and \128. If you wish to change the image size to 500x500 but keep the iterations the same then do: -```sh +``` make clobber WIDTH=500 HEIGHT=500 alt ``` If you wish to keep the dimensions the same but change the iterations to 512: -```sh +``` make clobber ITERATIONS=512 alt ``` @@ -82,7 +82,7 @@ Use `monge.alt` exactly as you would `monge` above. ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -109,13 +109,13 @@ effort to work on both `i386` and `x86_64`. Portable it is! :) 0. Compile using the Makefile, or just run: -```sh +``` gcc monge.c -o monge -O3 `sdl-config --libs --cflags` ``` 1. Run: -```sh +``` ./monge "z = 0" "z = z*z + c; Abs2(z) < 4" ``` @@ -171,49 +171,49 @@ Here are a few examples of fractals you can draw: - Mandelbrot: -```sh +``` ./monge "z=1" "z=z*z+c; Abs2(z)<4" ``` - Mandelbrot (return time variation): -```sh +``` ./monge "z=c" "z=z*z+c; Abs2(z-c)>0.0001" ``` - Julia, for `c=0.31+i*0.5`: -```sh +``` ./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z)<4" ``` - Julia (return time variation), `for c=0.31+i*0.5`: -```sh +``` ./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z-c)>0.0001" ``` - Newton, for `x^3-1`: -```sh +``` ./monge "z=c" "p=z; z=0.6666*z+0.3333/(z*z); Abs2(p-z) > 0.001" ``` - Newton-Mandelbrot: -```sh +``` ./monge "z=0" "p=z; z=z-(z*z*z + (c-1)*z - c)/(3*z*z+c-1); Abs2(p-z) > 0.001" ``` - Phoenix, Mandelbrot version: -```sh +``` ./monge "z=0; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4" ``` - Phoenix, Julia version for `c=0.56667-i*0.5`: -```sh +``` ./monge "z=c; c=0.56667-i*0.5; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4" ``` diff --git a/2006/monge/index.html b/2006/monge/index.html index 0a436f931..8354793cf 100644 --- a/2006/monge/index.html +++ b/2006/monge/index.html @@ -142,7 +142,7 @@ Location: IT - Italian Republic (<

    To build:

    Make sure you have the SDL1 (not SDL2!) development environment installed.

    -
        make
    +
        make

    There is alternate version that lets you redefine the width and height and number of iterations to use. See Alternate code below.

    Bugs and (Mis)features:

    @@ -151,23 +151,23 @@ of iterations to use. See Alternate code below.

    For more detailed information see 2006 monge bugs.

    To use:

    -
        ./monge expression ...
    +
        ./monge expression ...

    Incorrect formulas will ungracefully crash the program.

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Alternate code:

    This alternate code lets you specify the width and height of the image as well as the number of iterations to perform.

    Alternate build:

    To use the default values, the same as monge.c, just do:

    -
        make alt
    +
        make alt

    But if you wish to actually make use of it you will want to redefine one or more of the variables W, H and I. The defaults are (respectively) 400, 300 and \128. If you wish to change the image size to 500x500 but keep the iterations the same then do:

    -
        make clobber WIDTH=500 HEIGHT=500 alt
    +
        make clobber WIDTH=500 HEIGHT=500 alt

    If you wish to keep the dimensions the same but change the iterations to 512:

    -
        make clobber ITERATIONS=512 alt
    +
        make clobber ITERATIONS=512 alt

    If you specify a value less than 1 for any of these it sets it back to the default. The value 1 was selected arbitrarily and such a small number as 1 will not do anything useful but as long as it’s at least 1 it’ll not be redefined. @@ -176,7 +176,7 @@ anyway.

    Alternate use:

    Use monge.alt exactly as you would monge above.

    Alternate try:

    -
        ./try.alt.sh
    +
        ./try.alt.sh

    Judges’ remarks:

    For those who are familiar with the previous IOCCC entries, this program is best described as “1994/tvr meets @@ -193,11 +193,11 @@ effort to work on both i386 and x86_64. Portable it is

    1. Compile using the Makefile, or just run:
    -
        gcc monge.c -o monge -O3 `sdl-config --libs --cflags`
    +
        gcc monge.c -o monge -O3 `sdl-config --libs --cflags`
    1. Run:
    -
        ./monge "z = 0" "z = z*z + c; Abs2(z) < 4"
    +
        ./monge "z = 0" "z = z*z + c; Abs2(z) < 4"
    1. Keep clicking with left or right button to zoom in or out.

    2. Use the number pad + and - to increase/decrease the iteration count when @@ -240,35 +240,35 @@ as you like (as understood by the C function isspace()).

      • Mandelbrot:
      -
          ./monge "z=1" "z=z*z+c; Abs2(z)<4"
      +
          ./monge "z=1" "z=z*z+c; Abs2(z)<4"
      • Mandelbrot (return time variation):
      -
          ./monge "z=c" "z=z*z+c; Abs2(z-c)>0.0001"
      +
          ./monge "z=c" "z=z*z+c; Abs2(z-c)>0.0001"
      • Julia, for c=0.31+i*0.5:
      -
          ./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z)<4"
      +
          ./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z)<4"
      • Julia (return time variation), for c=0.31+i*0.5:
      -
          ./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z-c)>0.0001"
      +
          ./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z-c)>0.0001"
      • Newton, for x^3-1:
      -
          ./monge "z=c" "p=z; z=0.6666*z+0.3333/(z*z); Abs2(p-z) > 0.001"
      +
          ./monge "z=c" "p=z; z=0.6666*z+0.3333/(z*z); Abs2(p-z) > 0.001"
      • Newton-Mandelbrot:
      -
          ./monge "z=0" "p=z; z=z-(z*z*z + (c-1)*z - c)/(3*z*z+c-1); Abs2(p-z) > 0.001"
      +
          ./monge "z=0" "p=z; z=z-(z*z*z + (c-1)*z - c)/(3*z*z+c-1); Abs2(p-z) > 0.001"
      • Phoenix, Mandelbrot version:
      -
          ./monge "z=0; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4"
      +
          ./monge "z=0; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4"
      • Phoenix, Julia version for c=0.56667-i*0.5:
      -
          ./monge "z=c; c=0.56667-i*0.5; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4"
      +
          ./monge "z=c; c=0.56667-i*0.5; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4"

      Compilation and portability

      This program will only work on x86 (with an x87 FPU) or x86_64 machines, but it requires the SDL library.

      diff --git a/2006/night/README.md b/2006/night/README.md index 9bd86c18c..30866c181 100644 --- a/2006/night/README.md +++ b/2006/night/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,7 +10,7 @@ code](#alternate-code) section below. ## To use: -```sh +``` ./night ``` @@ -23,7 +23,7 @@ keys. ### Alternate build: -```sh +``` make alt ``` @@ -129,7 +129,7 @@ to deobfuscate. Keypad support was removed to save space. To restore, modify the following two macros to: -```c +``` #define ATG srand(time(0)); initscr(); cbreak(); noecho(); start_color(); keypad(stdscr,1); #define AGG A&2?KEY_UP:KEY_DOWN:A&1?KEY_RIGHT:KEY_LEFT ``` diff --git a/2006/night/index.html b/2006/night/index.html index 092edb520..ec15ce4fe 100644 --- a/2006/night/index.html +++ b/2006/night/index.html @@ -141,16 +141,16 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      There is an alternate version that supports arrow keys. See the alternate code section below.

      To use:

      -
          ./night
      +
          ./night

      Alternate code:

      This version allows you to use arrow keys instead of the more awkward wasd keys.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      Use night.alt as you would night above.

      Judges’ remarks:

      @@ -217,8 +217,8 @@ preprocessed code is over 80KB in length, hindering the preprocessor’s ability to deobfuscate.

      Keypad support was removed to save space. To restore, modify the following two macros to:

      -
          #define ATG srand(time(0)); initscr(); cbreak(); noecho(); start_color(); keypad(stdscr,1);
      -    #define AGG A&2?KEY_UP:KEY_DOWN:A&1?KEY_RIGHT:KEY_LEFT
      +
          #define ATG srand(time(0)); initscr(); cbreak(); noecho(); start_color(); keypad(stdscr,1);
      +    #define AGG A&2?KEY_UP:KEY_DOWN:A&1?KEY_RIGHT:KEY_LEFT

      Code on!

      make alt ``` @@ -11,7 +11,7 @@ code](#original-code) below. ## To use: -```sh +``` ./slone.alt ``` @@ -24,7 +24,7 @@ problematic for some people, can be configured to different speeds by way of the value used in `usleep()`. The default is `75000` but you can easily change it. To do so try: -```sh +``` make clobber SLEEP=70000 clobber alt ./sloane.alt ``` @@ -32,7 +32,7 @@ it. To do so try: If you wish to make it like the original, as if the below [Original code](#original-code) was being used, you can do: -```sh +``` make SLEEP=0 clobber alt ./sloane.alt ``` @@ -46,14 +46,14 @@ Should you wish to see the original you may do so with the original code, ### Original build: -```sh +``` make clobber all ``` ### Original use: -```sh +``` ./sloane ``` diff --git a/2006/sloane/index.html b/2006/sloane/index.html index 21c88db9d..e9c676afb 100644 --- a/2006/sloane/index.html +++ b/2006/sloane/index.html @@ -141,31 +141,31 @@ Location: US - United States of America

      To build:

      -
          make alt
      +
          make alt

      We recommend the alt version so that you can see what this looked like back in 2006. If you wish to see the original faster version see original code below.

      To use:

      -
          ./slone.alt
      +
          ./slone.alt

      Try:

      The alternate version, which we recommend that you use in order to see what is happening with modern systems, and to not flash too quickly, which can be problematic for some people, can be configured to different speeds by way of the value used in usleep(). The default is 75000 but you can easily change it. To do so try:

      -
          make clobber SLEEP=70000 clobber alt
      -    ./sloane.alt
      +
          make clobber SLEEP=70000 clobber alt
      +    ./sloane.alt

      If you wish to make it like the original, as if the below Original code was being used, you can do:

      -
          make SLEEP=0 clobber alt
      -    ./sloane.alt
      +
          make SLEEP=0 clobber alt
      +    ./sloane.alt

      Original code:

      Should you wish to see the original you may do so with the original code, sloane.c.

      Original build:

      -
          make clobber all
      +
          make clobber all

      Original use:

      -
          ./sloane
      +
          ./sloane

      WARNING: if you are easily overstimulated with fast movement or have photosensitivity please be careful running this version and instead see the above!

      diff --git a/2006/stewart/README.md b/2006/stewart/README.md index f7c787689..b83423947 100644 --- a/2006/stewart/README.md +++ b/2006/stewart/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./stewart width_and_height iterations file > file.xbm convert file.xbm file.png ``` @@ -29,7 +29,7 @@ NOTE: `convert(1)` belongs to [ImageMagick](https://imagemagick.org/index.php). ## Try: -```sh +``` ./try.sh ``` @@ -58,7 +58,7 @@ a reasonably experienced user who can parse formats in their mind. :-) The program should be run with the following -```sh +``` ./stewart ``` @@ -77,7 +77,7 @@ are 3. Wrong arguments will cause the program to bomb out. #### Example: -```sh +``` ./stewart 1024 1000000 gasket > gasket.xbm ``` diff --git a/2006/stewart/index.html b/2006/stewart/index.html index 04ac81666..96b549c93 100644 --- a/2006/stewart/index.html +++ b/2006/stewart/index.html @@ -141,10 +141,10 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      To use:

      -
          ./stewart width_and_height iterations file > file.xbm
      -    convert file.xbm file.png
      +
          ./stewart width_and_height iterations file > file.xbm
      +    convert file.xbm file.png

      where file is one of:

          altar box box2 box3 build carpet circles cross cross2 cross3
           crystal curve diamonds diamonds2 dragon dragon2 dragon3
      @@ -154,7 +154,7 @@ Location: US - United States of America
       

      NOTE: you cannot specify a different width from height; it’s one number.

      NOTE: convert(1) belongs to ImageMagick.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      After running the program on a few files it will ask you if you wish to run it on the remaining files.

      The script will try converting the xbm files created by the program to png @@ -171,7 +171,7 @@ a reasonably experienced user who can parse formats in their mind. :-)

      Author’s remarks:

      Execution

      The program should be run with the following

      -
          ./stewart <m> <n> <ifs>
      +
          ./stewart <m> <n> <ifs>

      where:

          m   = The size of the picture (picture will be m X m in size).
           n   = The number of iterations to run (More will make for a
      @@ -181,7 +181,7 @@ a reasonably experienced user who can parse formats in their mind. :-)

      on standard out. Minimal checking is done on the arguments mainly that there are 3. Wrong arguments will cause the program to bomb out.

      Example:

      -
          ./stewart 1024 1000000 gasket > gasket.xbm
      +
          ./stewart 1024 1000000 gasket > gasket.xbm

      Compilation/Testing

      The program compiles without warning with gcc -ansi -Wall. lint also seems to like the code. This must be a bug in lint.

      diff --git a/2006/sykes1/README.md b/2006/sykes1/README.md index 0f04c6c3c..d51e17857 100644 --- a/2006/sykes1/README.md +++ b/2006/sykes1/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -22,7 +22,7 @@ For more detailed information see [2006 sykes1 bugs](../../bugs.html#2006_sykes1 ## To use: -```sh +``` ./sykes1 ``` @@ -31,7 +31,7 @@ Next point your browser to the file: `sykes1.html`. ## Try: -```sh +``` ./sykes1 10 ``` @@ -39,7 +39,7 @@ Refresh your browser. You might also try: -```sh +``` ./try.sh ``` @@ -52,7 +52,7 @@ If you have all day :-) and wish to find out how fast your machine can solve the maximum: -```sh +``` time ./sykes1 19186 ``` @@ -81,7 +81,7 @@ This alternate code is based on the author's remarks. ### Alternate build: -```sh +``` make alt ``` @@ -96,7 +96,7 @@ Use `sykes1.alt` as you would `sykes1` above. The [try.sh](try.sh) script will use both versions to show some differences. You can do so like: -```sh +``` ./try.sh ``` @@ -106,7 +106,7 @@ can do so like: Read the [sykes1.html](sykes1.html) page source. Now then read the C source. Confused? :-) If it's not clear try: -```sh +``` diff -s sykes1.c sykes1.html ``` @@ -138,7 +138,7 @@ need to be very lucky indeed to stumble across a solution. Compile the program, then test that it works: -```sh +``` ./sykes1 ``` @@ -154,7 +154,7 @@ cube. Rendered in glorious 3D color. Want to see another solution? Try: -```sh +``` ./sykes1 some_number ``` @@ -165,7 +165,7 @@ Try some more - there are exactly `19186` solutions to choose from. If you have a fast machine you might try the last solution: -```sh +``` ./sykes1 19186 ``` @@ -178,7 +178,7 @@ The implementation is an optimized recursive algorithm that tries to fit the pieces into the cube one by one. The cube pieces are defined near the start of the program: -```c +``` int s[ ] = { 186, 94, 1426, 3098 ,1047 , 122 , 1082 , 3083 , 1039 , 569 , 527 , 1054 , 531 } ; @@ -233,7 +233,7 @@ the pieces, and provided that a solution is possible, it will be found. For example, if you modify line 13 of the source like this, the program will solve for a different piece set: -```c +``` int s[ ] = { 187, 94, 402, 3098 ``` diff --git a/2006/sykes1/index.html b/2006/sykes1/index.html index 1464395d8..009463410 100644 --- a/2006/sykes1/index.html +++ b/2006/sykes1/index.html @@ -141,7 +141,7 @@ Location: FI - Republic of Finland

      To build:

      -
          make
      +
          make

      There is an alt version based on the author’s remarks. The try.sh script will compile and use both but if you wish to see the alternate version specifically see the Alternate code section below.

      @@ -150,18 +150,18 @@ specifically see the Alternate code section below.
          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2006 sykes1 bugs.

      To use:

      -
          ./sykes1
      +
          ./sykes1

      Next point your browser to the file: sykes1.html.

      Try:

      -
          ./sykes1 10
      +
          ./sykes1 10

      Refresh your browser.

      You might also try:

      -
          ./try.sh
      +
          ./try.sh

      This will run both the original entry and the alt code to show some differences.

      Also try:

      If you have all day :-) and wish to find out how fast your machine can solve the maximum:

      -
          time ./sykes1 19186
      +
          time ./sykes1 19186

      This was done on a Rocky Linux 9.2 server with Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz with 16 cores (via HyperThreading):

          real        6m35.524s
           user        6m35.159s
      @@ -173,17 +173,17 @@ maximum:

      Alternate code:

      This alternate code is based on the author’s remarks.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      Use sykes1.alt as you would sykes1 above.

      Alternate try:

      The try.sh script will use both versions to show some differences. You can do so like:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      Read the sykes1.html page source. Now then read the C source. Confused? :-) If it’s not clear try:

      -
          diff -s sykes1.c sykes1.html
      +
          diff -s sykes1.c sykes1.html

      For extra credit, understand what happens when you give this entry an negative number argument, and why.

      See the author’s remarks for how to make your own shapes as well.

      @@ -200,7 +200,7 @@ together. I have not known anyone to solve it in this way - you would need to be very lucky indeed to stumble across a solution.

      Instructions

      Compile the program, then test that it works:

      -
          ./sykes1
      +
          ./sykes1

      Shortly you should see the first solution pop out on your screen. It shows you how to build the cube piece by piece, rendered in glorious 3D ASCII.

      @@ -210,20 +210,20 @@ open the file sykes1.html. This html file is just a co the browser display for you a nice animated GIF, showing you how to build the cube. Rendered in glorious 3D color.

      Want to see another solution? Try:

      -
          ./sykes1 some_number
      +
          ./sykes1 some_number

      The program will discard solutions up to the number, and output numbered solution. Refresh your browser window to see the new solution.

      Try some more - there are exactly 19186 solutions to choose from.

      If you have a fast machine you might try the last solution:

      -
          ./sykes1 19186
      +
          ./sykes1 19186

      On my machine this takes about half an hour to run.

      Implementation

      The implementation is an optimized recursive algorithm that tries to fit the pieces into the cube one by one. The cube pieces are defined near the start of the program:

      -
          int s[ ] = { 186, 94, 1426, 3098
      -            ,1047 , 122 , 1082 , 3083 , 1039
      -            , 569 , 527 , 1054 , 531  }  ;
      +
          int s[ ] = { 186, 94, 1426, 3098
      +            ,1047 , 122 , 1082 , 3083 , 1039
      +            , 569 , 527 , 1054 , 531  }  ;

      Each piece is a bitmap, and represents a 3x3x3 cube.

      For instance the first piece is 186 - this is 010111010 in binary. Written out like this you can see that it is the cross shaped piece:

      @@ -256,7 +256,7 @@ shape:

      the pieces, and provided that a solution is possible, it will be found.

      For example, if you modify line 13 of the source like this, the program will solve for a different piece set:

      -
          int s[ ] = { 187, 94, 402, 3098
      +
          int s[ ] = { 187, 94, 402, 3098

      And of course you can make your own.

      After the pieces are defined, the first thing the program does it to fit them into a 4x4 cube. It collects every possible placing of each diff --git a/2006/sykes2/README.md b/2006/sykes2/README.md index 0ca475207..c0d579da2 100644 --- a/2006/sykes2/README.md +++ b/2006/sykes2/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./sykes2 ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2006/sykes2/index.html b/2006/sykes2/index.html index c72553191..1b20fc885 100644 --- a/2006/sykes2/index.html +++ b/2006/sykes2/index.html @@ -141,11 +141,11 @@ Location: FI - Republic of Finland

      To build:

      -
          make
      +
          make

      To use:

      -
          ./sykes2
      +
          ./sykes2

      Try:

      -
          ./try.sh
      +
          ./try.sh

      This will repeatedly remake the program and run it then sleep for one second for a nice show of time.

      Judges’ Comments:

      diff --git a/2006/toledo1/README.md b/2006/toledo1/README.md index 14eaa3579..9f3907dfd 100644 --- a/2006/toledo1/README.md +++ b/2006/toledo1/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./toledo1 [0-9][0-9] ``` @@ -16,7 +16,7 @@ where `[0-9][0-9]` is a two digit number. ## Try: -```sh +``` ./try.sh ``` @@ -38,7 +38,7 @@ visit the 64 squares without repeating them? If not, this program does it, just run it with an argument giving initial position. -```sh +``` ./toledo1 11 # start is A8 ./toledo1 18 # start is H8 ./toledo1 81 # start is A1 diff --git a/2006/toledo1/index.html b/2006/toledo1/index.html index 76abcfbf4..b7d1f3158 100644 --- a/2006/toledo1/index.html +++ b/2006/toledo1/index.html @@ -141,12 +141,12 @@ Location: MX - United Mexican States

      To build:

      -
          make
      +
          make

      To use:

      -
          ./toledo1 [0-9][0-9]
      +
          ./toledo1 [0-9][0-9]

      where [0-9][0-9] is a two digit number.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      For most of the arguments (e.g. those above) the resulting path is not circular, but at least one starting point yields a circular path.

      @@ -157,11 +157,11 @@ be expected, and some dump core?

      visit the 64 squares without repeating them?

      If not, this program does it, just run it with an argument giving initial position.

      -
          ./toledo1 11       # start is A8
      -    ./toledo1 18       # start is H8
      -    ./toledo1 81       # start is A1
      -    ./toledo1 88       # start is H1
      -    ./toledo1 44       # start is D5
      +
          ./toledo1 11       # start is A8
      +    ./toledo1 18       # start is H8
      +    ./toledo1 81       # start is A1
      +    ./toledo1 88       # start is H1
      +    ./toledo1 44       # start is D5

      It will print move order. The algorithm is so simple that you can read it in the source code. At the first glance it can appear checkered. Nevertheless, don’t be dismayed, jar, jar. :-)

      diff --git a/2006/toledo2/README.md b/2006/toledo2/README.md index 7e9d6e67d..3d6b31c4c 100644 --- a/2006/toledo2/README.md +++ b/2006/toledo2/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -22,7 +22,7 @@ For more detailed information see [2006 toledo2 bugs](../../bugs.html#2006_toled ## To use: -```sh +``` ./toledo2 ``` @@ -33,7 +33,7 @@ does not seem to happen in macOS or linux in 2023. ## Try: -```sh +``` ./toledo2 ``` @@ -56,7 +56,7 @@ functions in place of `read(2)` and `write(2)`. ### Alternate build: -```sh +``` make alt ``` @@ -112,7 +112,7 @@ Journal](https://en.wikipedia.org/wiki/Dr._Dobb%27s_Journal). Type using uppercase letters. Here are three example programs. Press Enter after each line: -```basic +``` 10 PRINT "Hello, world!" LIST RUN @@ -155,7 +155,7 @@ from the `SOURCE` directory: To import them, you must run the emulator with an argument, by example: -```sh +``` ./toledo2 DDT.COM ``` diff --git a/2006/toledo2/index.html b/2006/toledo2/index.html index b109fe00f..5572e5c3a 100644 --- a/2006/toledo2/index.html +++ b/2006/toledo2/index.html @@ -141,7 +141,7 @@ Location: MX - United Mexican States

      To build:

      -
          make
      +
          make

      There is alternate code that is based on the author’s notes for DOS/Windows. This cannot be tested by us, not even to compile, but it appears that it should be fine, after the proper header files were added.

      @@ -150,12 +150,12 @@ that it should be fine, after the proper header files were added.

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2006 toledo2 bugs.

      To use:

      -
          ./toledo2
      +
          ./toledo2

      To end execution press ctrl-z. As mentioned in the author’s remarks and in the below section, it is supposed to crash on termination though some noted this does not seem to happen in macOS or linux in 2023.

      Try:

      -
          ./toledo2
      +
          ./toledo2

      and then type in the following:

          10 PRINT "HELLO WORLD!"
           LIST
      @@ -165,7 +165,7 @@ does not seem to happen in macOS or linux in 2023.

      This version, as noted, should work for DOS/Windows. It uses non-standard functions in place of read(2) and write(2).

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      The author noted that for PC/DOS you will have to add ANSI.SYS to your CONFIG.SYS but this is also something we can’t test.

      @@ -203,7 +203,7 @@ the very first volume of 10 PRINT "Hello, world!" +
          10 PRINT "Hello, world!"
           LIST
           RUN
       
      @@ -236,7 +236,7 @@ from the SOURCE directory:

      PIP.COM STAT.COM SUBMIT.COM XSUB.COM

      To import them, you must run the emulator with an argument, by example:

      -
          ./toledo2 DDT.COM
      +
          ./toledo2 DDT.COM

      When the > prompt appears, do:

          IMPORT DDT.COM

      When it ends, do HALT, so the file is closed, and you can start diff --git a/2006/toledo3/README.md b/2006/toledo3/README.md index 9a1a0bab4..7542733db 100644 --- a/2006/toledo3/README.md +++ b/2006/toledo3/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -11,14 +11,14 @@ tested with Windows. See [alternate code](#alternate-code) below. ## To use: -```sh +``` ./toledo3 [1 | 2 | 3 [b]] ``` ## Try: -```sh +``` ./toledo3 1 ``` @@ -62,7 +62,7 @@ So I managed to do a graphical X11 chess program ('`WYSIAIE`', or 'What You See Is An IOCCC Entry'). Pointing and clicking to move pieces is the only required action, and of course the command-line options: -```sh +``` ./toledo3 # Two-players mode (useful if you don't have a board at hand) ./toledo3 1 # Human white - Computer black, level 1 (fast) ./toledo3 2 # Human white - Computer black, level 2 (medium) @@ -97,7 +97,7 @@ number generator. Because it is resource-hungry, I strongly recommend to compile it using maximum optimization. With GCC you can use: -```sh +``` gcc -O3 -fexpensive-optimizations prog.c -o prog -lX11 ``` diff --git a/2006/toledo3/index.html b/2006/toledo3/index.html index e0282106f..2a913a8a8 100644 --- a/2006/toledo3/index.html +++ b/2006/toledo3/index.html @@ -141,14 +141,14 @@ Location: MX - United Mexican States

      To build:

      -
          make
      +
          make

      The author provided two alternate versions, one which adds a status bar and another that makes it text only. The author also provided a version that they tested with Windows. See alternate code below.

      To use:

      -
          ./toledo3 [1 | 2 | 3 [b]]
      +
          ./toledo3 [1 | 2 | 3 [b]]

      Try:

      -
          ./toledo3 1
      +
          ./toledo3 1

      Alternate code:

      The author provided two additional versions, toledo3-sbar.c and toledo3-txt.c. Respectively these create a status bar and @@ -172,13 +172,13 @@ the code for Deep Blue.

      So I managed to do a graphical X11 chess program (‘WYSIAIE’, or ‘What You See Is An IOCCC Entry’). Pointing and clicking to move pieces is the only required action, and of course the command-line options:

      -
          ./toledo3        # Two-players mode (useful if you don't have a board at hand)
      -    ./toledo3 1      # Human white - Computer black, level 1 (fast)
      -    ./toledo3 2      # Human white - Computer black, level 2 (medium)
      -    ./toledo3 3      # Human white - Computer black, level 3 (slow)
      -    ./toledo3 1 b    # Human black - Computer white, level 1 (fast)
      -    ./toledo3 2 b    # Human black - Computer white, level 2 (medium)
      -    ./toledo3 3 b    # Human black - Computer white, level 3 (slow)
      +
          ./toledo3        # Two-players mode (useful if you don't have a board at hand)
      +    ./toledo3 1      # Human white - Computer black, level 1 (fast)
      +    ./toledo3 2      # Human white - Computer black, level 2 (medium)
      +    ./toledo3 3      # Human white - Computer black, level 3 (slow)
      +    ./toledo3 1 b    # Human black - Computer white, level 1 (fast)
      +    ./toledo3 2 b    # Human black - Computer white, level 2 (medium)
      +    ./toledo3 3 b    # Human black - Computer white, level 3 (slow)

      The computer will check that your moves are legal. Full legal chess moves are allowed, except minor promotions on human side.

      The game will continue up to its logical conclusion, you make @@ -196,7 +196,7 @@ optimizations use valuable IOCCC characters.

      number generator.

      Because it is resource-hungry, I strongly recommend to compile it using maximum optimization. With GCC you can use:

      -
          gcc -O3 -fexpensive-optimizations prog.c -o prog -lX11
      +
          gcc -O3 -fexpensive-optimizations prog.c -o prog -lX11

      KNOWN “FEATURES”

      1. Because this is my second X11 program (the first was diff --git a/2011/akari/README.md b/2011/akari/README.md index 5211680d7..e4136da81 100644 --- a/2011/akari/README.md +++ b/2011/akari/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./akari [ input_file | - ] [ output_file | - ] [even] ``` ## Try: -```sh +``` ./try.sh ``` @@ -56,7 +56,7 @@ keep odd pixels on odd [scanlines](https://en.wikipedia.org/wiki/Scan_line). ### Examples: -```sh +``` gcc akari.c -o akari ./akari < example.ppm > odd_output.ppm ./akari - - even < example.ppm > even_output.ppm @@ -82,7 +82,7 @@ Anything that is not parsable as `PGM` or `PPM` will be downsampled as ASCII art. Since the source code is formatted as ASCII art, it's only natural to try: -```sh +``` ./akari akari.c akari2.c ``` @@ -91,7 +91,7 @@ By default, this second program reads text from `stdin` and writes expanded output to `stdout`. If the extra argument is specified, the output text will also pass through a rot13 filter. -```sh +``` gcc akari2.c -o akari2 ./akari2 < input.txt > expanded_output.txt ./akari2 rot13 < input.txt > expanded_and_rot13_output.txt @@ -100,20 +100,20 @@ output text will also pass through a rot13 filter. You can combine the two programs together to have just a regular rot13 filter: -```sh +``` ./akari2 rot13 < input.txt | ./akari > rot13.txt ``` Of course, we wouldn't stop with just 2 programs, you can downsample the source *again* and get yet another C program: -```sh +``` ./akari < akari.c | ./akari > akari3.c ``` We must go deeper: -```sh +``` ./akari < akari.c | ./akari | ./akari > akari4.c ``` diff --git a/2011/akari/index.html b/2011/akari/index.html index dbcddc3a5..087128ddc 100644 --- a/2011/akari/index.html +++ b/2011/akari/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

        To build:

        -
            make
        +
            make

        To use:

        -
            ./akari [ input_file | - ] [ output_file | - ]  [even]
        +
            ./akari [ input_file | - ] [ output_file | - ]  [even]

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        Akari is an image downsampling utility that accepts 3 input formats:

          @@ -171,10 +171,10 @@ will read from stdin.

          scanlines. By default Akari will keep odd pixels on odd scanlines.

          Examples:

          -
              gcc akari.c -o akari
          -    ./akari < example.ppm > odd_output.ppm
          -    ./akari - - even < example.ppm > even_output.ppm
          -    ./akari example.ppm odd_output.ppm
          +
              gcc akari.c -o akari
          +    ./akari < example.ppm > odd_output.ppm
          +    ./akari - - even < example.ppm > even_output.ppm
          +    ./akari example.ppm odd_output.ppm

          Akari accepts 3 input formats:

          • PGM @@ -192,22 +192,22 @@ the included example.ppm.

            Anything that is not parsable as PGM or PPM will be downsampled as ASCII art. Since the source code is formatted as ASCII art, it’s only natural to try:

            -
                ./akari akari.c akari2.c
            +
                ./akari akari.c akari2.c

            akari2.c is also a valid C program, and accepts up to 1 argument. By default, this second program reads text from stdin and writes expanded output to stdout. If the extra argument is specified, the output text will also pass through a rot13 filter.

            -
                gcc akari2.c -o akari2
            -    ./akari2 < input.txt > expanded_output.txt
            -    ./akari2 rot13 < input.txt > expanded_and_rot13_output.txt
            +
                gcc akari2.c -o akari2
            +    ./akari2 < input.txt > expanded_output.txt
            +    ./akari2 rot13 < input.txt > expanded_and_rot13_output.txt

            You can combine the two programs together to have just a regular rot13 filter:

            -
                ./akari2 rot13 < input.txt | ./akari > rot13.txt
            +
                ./akari2 rot13 < input.txt | ./akari > rot13.txt

            Of course, we wouldn’t stop with just 2 programs, you can downsample the source again and get yet another C program:

            -
                ./akari < akari.c | ./akari > akari3.c
            +
                ./akari < akari.c | ./akari > akari3.c

            We must go deeper:

            -
                ./akari < akari.c | ./akari | ./akari > akari4.c
            +
                ./akari < akari.c | ./akari | ./akari > akari4.c

            akari3.c and akari4.c are still (mostly valid) C programs. gcc -Wall will output a few warnings, but still produce output executables. The output executables each print a message to stdout.

            diff --git a/2011/blakely/README.md b/2011/blakely/README.md index b100c2ab1..d607d4ea2 100644 --- a/2011/blakely/README.md +++ b/2011/blakely/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -9,20 +9,20 @@ Zoom out and make your terminal window 53 or more lines deep. -```sh +``` ./blakely < blakely.c | head -300 ``` ## Try: -```sh +``` ./try.sh ``` For those who have a lot of time, try: -```sh +``` ./blakely < t0_3.dat ``` @@ -40,7 +40,7 @@ is a [Garden of Eden](http://en.wikipedia.org/wiki/Garden_of_Eden_%28cellular_au If you have enough time to spare, put the plan of your garden in a text file, and run: -```sh +``` ./blakely - < garden.txt ``` @@ -54,7 +54,7 @@ over tabs. In order to see the main feature of the code, type: -```sh +``` ./blakely < blakely.c ``` @@ -72,7 +72,7 @@ layout of the source-code is such that it evolves to a digital representation of the first 15 decimal places of pi after 4 time steps. This was setup using the other feature of the program which can be demonstrated as follows: -```sh +``` ./blakely - < 3.dat ``` @@ -81,7 +81,7 @@ more grids (taking a few minutes to display the last). Waiting for any more grids will take a substantial amount of time. The final grid has been put into [evolve_to_3.dat](evolve_to_3.dat), and if you type -```sh +``` ./blakely < evolve_to_3.dat ``` diff --git a/2011/blakely/index.html b/2011/blakely/index.html index 2110056ac..382bd9d76 100644 --- a/2011/blakely/index.html +++ b/2011/blakely/index.html @@ -141,14 +141,14 @@ Location: GB - United Kingdom of Great

            To build:

            -
                make
            +
                make

            To use:

            Zoom out and make your terminal window 53 or more lines deep.

            -
                ./blakely < blakely.c | head -300
            +
                ./blakely < blakely.c | head -300

            Try:

            -
                ./try.sh
            +
                ./try.sh

            For those who have a lot of time, try:

            -
                ./blakely < t0_3.dat
            +
                ./blakely < t0_3.dat

            though one might or might not need to kill it, depending on your boredom threshold.

            Judges’ remarks:

            @@ -158,14 +158,14 @@ if given its own source as input, and allows to check if your garden is a Garden of Eden, all in one source.

            If you have enough time to spare, put the plan of your garden in a text file, and run:

            -
                ./blakely - < garden.txt
            +
                ./blakely - < garden.txt

            Author’s remarks:

            This program uses a well-known algorithm in order to display pi to fifteen decimal places. The source-layout itself demonstrates the importance of using the correct amount of whitespace in code and the clear superiority of spaces over tabs.

            In order to see the main feature of the code, type:

            -
                ./blakely < blakely.c
            +
                ./blakely < blakely.c

            and wait for about four seconds before using Ctrl-C (or whatever) to end the program. The results are best viewed in a terminal window at least 60 characters high and wide. Alternatively, redirect the output to a separate file @@ -176,12 +176,12 @@ Life”, using standard input as a starting grid. The layout of the source-code is such that it evolves to a digital representation of the first 15 decimal places of pi after 4 time steps. This was setup using the other feature of the program which can be demonstrated as follows:

            -
                ./blakely - < 3.dat
            +
                ./blakely - < 3.dat

            The program will first display the grid given in 3.dat, and then three more grids (taking a few minutes to display the last). Waiting for any more grids will take a substantial amount of time. The final grid has been put into evolve_to_3.dat, and if you type

            -
                ./blakely < evolve_to_3.dat
            +
                ./blakely < evolve_to_3.dat

            then the 3 will reappear after three time steps.

            As should now be clear, this use of the program will attempt to evolve a given setup backwards in time according to the Life rules. The resulting grid is clearly not diff --git a/2011/borsanyi/README.md b/2011/borsanyi/README.md index f932b7a1f..064418901 100644 --- a/2011/borsanyi/README.md +++ b/2011/borsanyi/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2011 borsanyi bugs](../../bugs.html#2011_bors ## To use: -```sh +``` ./borsanyi < some_data_file ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2011/borsanyi/index.html b/2011/borsanyi/index.html index cd9a6dbcb..7ddc790a6 100644 --- a/2011/borsanyi/index.html +++ b/2011/borsanyi/index.html @@ -141,15 +141,15 @@ Location: DE - Federal Republic of Germ

            To build:

            -
                make
            +
                make

            Bugs and (Mis)features:

            The current status of this entry is:

                STATUS: INABIAF - please **DO NOT** fix

            For more detailed information see 2011 borsanyi bugs.

            To use:

            -
                ./borsanyi < some_data_file
            +
                ./borsanyi < some_data_file

            Try:

            -
                ./try.sh
            +
                ./try.sh

            Judges’ remarks:

            This is a nice quick histogram plotter. A useful utility when you need to look at the distribution of some diff --git a/2011/dlowe/README.md b/2011/dlowe/README.md index f228ed7d8..ec7638b56 100644 --- a/2011/dlowe/README.md +++ b/2011/dlowe/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -19,7 +19,7 @@ For more detailed information see [2011 dlowe bugs](../../bugs.html#2011_dlowe). ## To use: -```sh +``` ./dlowe - corpus1/ [...] corpus0/ < start.net > trained.net ``` @@ -27,7 +27,7 @@ NOTE: In the above command, the directory args MUST end in a `/`. Then to use `trained.net`: -```sh +``` ./dlowe file [file ...] < trained.net ``` @@ -36,7 +36,7 @@ Then to use `trained.net`: Try these pre-trained networks: -```sh +``` ./try.sh ``` @@ -44,7 +44,7 @@ NOTE: The `dlowe-aux-data/` directory, which [try.sh](try.sh) refers to, was created by: -```sh +``` tar -jxf dlowe-aux-data.tar.bz2 ``` @@ -63,7 +63,7 @@ on the C code of entries that were supplied to the 20Th IOCCC. The `ioccc-winlose-trained.net` was trained using the [earlystop.pl](earlystop.pl) tool: -```sh +``` rm -f ioccc-winlose-trained.net ./earlystop.pl ioccc-winlose-trained.net ioccc_won_training/ ioccc_lost_training/ ioccc_won_test/ ioccc_lost_test/ ``` @@ -101,7 +101,7 @@ The resulting `ioccc-winlose-trained.net` file was included in the The [dlowe.c](dlowe.c) was explicitly excluded from this trailing set, so this test is interesting: -```sh +``` ./dlowe dlowe.c < dlowe-aux-data/ioccc-winlose-trained.net ``` @@ -127,7 +127,7 @@ data sets on which to test: We created the [english-trained.net](dlowe-aux-data/english-trained.net) as follows: -```sh +``` ./dlowe -8000 dlowe-aux-data/english-1/ dlowe-aux-data/english-0/ < /dev/null > dlowe-aux-data/english-trained.net ``` @@ -139,7 +139,7 @@ We created the [english-trained.net](dlowe-aux-data/english-trained.net) as foll We created the [png-trained.net](dlowe-aux-data/png-trained.net) as follows: -```sh +``` ./dlowe -8000 png-1/ png-0/ < /dev/null > dlowe-aux-data/png-trained.net ``` @@ -151,7 +151,7 @@ We created the [png-trained.net](dlowe-aux-data/png-trained.net) as follows: We created the [xor-trained.net](dlowe-aux-data/xor-trained.net) as follows: -```sh +``` ./dlowe -8000 dlowe-aux-data/xor-1/ dlowe-aux-data/xor-0/ < /dev/null > dlowe-aux-data/xor-trained.net ``` @@ -189,7 +189,7 @@ The neurons' activation function is the logistic function `1 / (1 + e ^ -x)`. ### Classifying -```sh +``` ./dlowe file [file ...] < trained.net ``` @@ -205,7 +205,7 @@ trained, but it's geared toward interpretation as a *probability* or a ### Training -```sh +``` ./dlowe - corpus1/ [...] corpus0/ < start.net > end.net ``` diff --git a/2011/dlowe/index.html b/2011/dlowe/index.html index 7edb919fa..7630a1d6b 100644 --- a/2011/dlowe/index.html +++ b/2011/dlowe/index.html @@ -141,23 +141,23 @@ Location: US - United States of America

            To build:

            -
                make
            +
                make

            Bugs and (Mis)features:

            The current status of this entry is:

                STATUS: missing or dead link - please provide them
                 STATUS: INABIAF - please **DO NOT** fix

            For more detailed information see 2011 dlowe bugs.

            To use:

            -
                ./dlowe -<n_iterations> corpus1/ [...] corpus0/ < start.net > trained.net
            +
                ./dlowe -<n_iterations> corpus1/ [...] corpus0/ < start.net > trained.net

            NOTE: In the above command, the directory args MUST end in a /.

            Then to use trained.net:

            -
                ./dlowe file [file ...] < trained.net
            +
                ./dlowe file [file ...] < trained.net

            Try:

            Try these pre-trained networks:

            -
                ./try.sh
            +
                ./try.sh

            NOTE: The dlowe-aux-data/ directory, which try.sh refers to, was created by:

            -
                tar -jxf dlowe-aux-data.tar.bz2
            +
                tar -jxf dlowe-aux-data.tar.bz2

            Judges’ remarks:

            This entry is a ghoulish example of a brain (dead?) neural network classifier. It comes with a set of corpora for you to try.

            @@ -166,8 +166,8 @@ It comes with a set of corpora for you to try.

            on the C code of entries that were supplied to the 20Th IOCCC.

            The ioccc-winlose-trained.net was trained using the earlystop.pl tool:

            -
                rm -f ioccc-winlose-trained.net
            -    ./earlystop.pl ioccc-winlose-trained.net ioccc_won_training/ ioccc_lost_training/ ioccc_won_test/ ioccc_lost_test/
            +
                rm -f ioccc-winlose-trained.net
            +    ./earlystop.pl ioccc-winlose-trained.net ioccc_won_training/ ioccc_lost_training/ ioccc_won_test/ ioccc_lost_test/

            where:

            • ioccc_won_training/ @@ -191,7 +191,7 @@ that did not win were flushed to /dev/null.

              dlowe-aux-data.tar.bz2 tarball.

              The dlowe.c was explicitly excluded from this trailing set, so this test is interesting:

              -
                  ./dlowe dlowe.c < dlowe-aux-data/ioccc-winlose-trained.net
              +
                  ./dlowe dlowe.c < dlowe-aux-data/ioccc-winlose-trained.net

              NOTE: this is done in try.sh.

              The match of dlowe.c to the lose/win trailed network was:

                  dlowe.c 0.125108
              @@ -203,7 +203,7 @@ mean it will win or lose a future IOCCC. On the other hand … it just might!

              While we cannot supply you with the losing IOCCC source code, the author did supply a number data sets on which to test:

              We created the english-trained.net as follows:

              -
                  ./dlowe -8000 dlowe-aux-data/english-1/ dlowe-aux-data/english-0/ < /dev/null > dlowe-aux-data/english-trained.net
              +
                  ./dlowe -8000 dlowe-aux-data/english-1/ dlowe-aux-data/english-0/ < /dev/null > dlowe-aux-data/english-trained.net
              • dlowe-aux-data/english-0/ Non-English (French) text

              • @@ -211,7 +211,7 @@ Non-English (French) text

                English (non-French) text

              We created the png-trained.net as follows:

              -
                  ./dlowe -8000 png-1/ png-0/ < /dev/null > dlowe-aux-data/png-trained.net
              +
                  ./dlowe -8000 png-1/ png-0/ < /dev/null > dlowe-aux-data/png-trained.net
              • dlowe-aux-data/png-0/ Non-png (gif) images

              • @@ -219,7 +219,7 @@ Non-png (gif) images

                png (non-gif) images

              We created the xor-trained.net as follows:

              -
                  ./dlowe -8000 dlowe-aux-data/xor-1/ dlowe-aux-data/xor-0/ < /dev/null > dlowe-aux-data/xor-trained.net
              +
                  ./dlowe -8000 dlowe-aux-data/xor-1/ dlowe-aux-data/xor-0/ < /dev/null > dlowe-aux-data/xor-trained.net
              • dlowe-aux-data/xor-0 Data that XORs to 0

              • @@ -242,7 +242,7 @@ which can be trained, using on-line neuron.

                The neurons’ activation function is the logistic function 1 / (1 + e ^ -x).

                Classifying

                -
                    ./dlowe file [file ...] < trained.net
                +
                    ./dlowe file [file ...] < trained.net

                To classify files, one specifies a trained network (on stdin) and one or more files to classify. The program will output one line per successfully-classified file to stderr, with the filename and the classification: a number between 0 @@ -251,7 +251,7 @@ and 1.

                trained, but it’s geared toward interpretation as a probability or a confidence.

                Training

                -
                    ./dlowe -<n_iterations> corpus1/ [...] corpus0/ < start.net > end.net
                +
                    ./dlowe -<n_iterations> corpus1/ [...] corpus0/ < start.net > end.net

                NOTE: The directory args must end in a / for them to work.

                To train a network, one specifies a starting network (on stdin), two or more corpora (directories containing training data), and the number of training diff --git a/2011/eastman/README.md b/2011/eastman/README.md index 986f6994a..16143d677 100644 --- a/2011/eastman/README.md +++ b/2011/eastman/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./eastman ``` @@ -19,7 +19,7 @@ NOTE: to restore your cursor in your shell, try `reset`. Run the program. Quit it (ctrl-c/intr). Resize your terminal window. Run it again. Try doing this a number of times with different sizes each time. -```sh +``` ./eastman ``` @@ -60,7 +60,7 @@ program is running, though. It only checks the size once, when it starts up. To compile: -```sh +``` cc -lm eastman.c ``` diff --git a/2011/eastman/index.html b/2011/eastman/index.html index d37b07e6f..513b183c5 100644 --- a/2011/eastman/index.html +++ b/2011/eastman/index.html @@ -141,14 +141,14 @@ Location: US - United States of America

                To build:

                -
                    make
                +
                    make

                To use:

                -
                    ./eastman
                +
                    ./eastman

                NOTE: to restore your cursor in your shell, try reset.

                Try:

                Run the program. Quit it (ctrl-c/intr). Resize your terminal window. Run it again. Try doing this a number of times with different sizes each time.

                -
                    ./eastman
                +
                    ./eastman

                NOTE: to restore your cursor in your shell, try reset.

                Judges’ remarks:

                This round program will generate a classic spherical result!

                @@ -173,7 +173,7 @@ is also just part of the texture, not an actual raytraced shadow.

                so try enlarging the window to get higher resolution. Don’t resize while the program is running, though. It only checks the size once, when it starts up.

                To compile:

                -
                    cc -lm eastman.c
                +
                    cc -lm eastman.c

                Portability

                It should be completely portable. I’ve tested with gcc on Mac OS X 10.7 (Lion) and Fedora 10. I would expect it to work in any Unix-like environment.

                diff --git a/2011/fredriksson/README.md b/2011/fredriksson/README.md index d244e27d3..562108af2 100644 --- a/2011/fredriksson/README.md +++ b/2011/fredriksson/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2011 fredriksson bugs](../../bugs.html#2011_f ## To use: -```sh +``` ./fredriksson [-icvtnk#] regexp < file ``` ## Try: -```sh +``` ./try.sh ``` @@ -55,7 +55,7 @@ Implements a variant of `grep`. To search regexp from file, do: -```sh +``` ./fredriksson [-icvtnk#] regexp < file ``` @@ -123,13 +123,13 @@ expressions by putting `]` as the first character, and putting `-` last. Just say -```sh +``` ./fredriksson -k3 cat < file ``` * Like with `cat`, you can append line numbers too: -```sh +``` ./fredriksson -nk3 cat < file ``` @@ -173,7 +173,7 @@ Just say * Depending on the file, it might require a lot of stack space. If the program segfaults (because of this), say -```sh +``` ulimit -s unlimited ``` @@ -207,7 +207,7 @@ Just say extracts and builds that, and then calls it. More precisely, the command to build is -```sh +``` gcc -O3 ag.c -o ag ``` @@ -260,14 +260,14 @@ Just say * No numerical values, other than in the initialized char array, try -```sh +``` ./fredriksson -ck0 [0-9] < fredriksson.c ``` This should print 1, as there is a number `3` in the char array (only). You can also try -```sh +``` ./fredriksson -ck0 [0-9] < ag.c ``` diff --git a/2011/fredriksson/index.html b/2011/fredriksson/index.html index f93f25ed1..f2fb75be6 100644 --- a/2011/fredriksson/index.html +++ b/2011/fredriksson/index.html @@ -141,15 +141,15 @@ Location: FI - Republic of Finland

                To build:

                -
                    make
                +
                    make

                Bugs and (Mis)features:

                The current status of this entry is:

                    STATUS: INABIAF - please **DO NOT** fix

                For more detailed information see 2011 fredriksson bugs.

                To use:

                -
                    ./fredriksson [-icvtnk#] regexp < file
                +
                    ./fredriksson [-icvtnk#] regexp < file

                Try:

                -
                    ./try.sh
                +
                    ./try.sh

                NOTE: you need to be allowed to change your stack size or else the last command in the script would likely cause the program to dump core, which is why the script checks the exit code of ulimit first.

                @@ -165,7 +165,7 @@ program and calls it. As an exercise, try writing the compressor.

                Implements a variant of grep.

                Usage

                To search regexp from file, do:

                -
                    ./fredriksson [-icvtnk#] regexp < file
                +
                    ./fredriksson [-icvtnk#] regexp < file

                Pipes might not work, see the section Limitations. The options -i, -c, -v and -n are the classic ones:

                  @@ -220,11 +220,11 @@ expressions by putting ] as the first character, and putting
                • You can use this in place of cat. Just say
                -
                    ./fredriksson -k3 cat < file
                +
                    ./fredriksson -k3 cat < file
                • Like with cat, you can append line numbers too:
                -
                    ./fredriksson -nk3 cat < file
                +
                    ./fredriksson -nk3 cat < file

                Other features

                • It is assumed that the user knows how to feed correct input to the @@ -256,7 +256,7 @@ you can easily use long long instead,

                • Depending on the file, it might require a lot of stack space. If the program segfaults (because of this), say

                -
                    ulimit -s unlimited
                +
                    ulimit -s unlimited

                cross your fingers, hope it is enough, and try again.

                • Assumes C99 standard, because of the one very long line. Most C compilers @@ -284,7 +284,7 @@ as well as its name and commands to build and run it, all extracts and builds that, and then calls it. More precisely, the command to build is

                -
                    gcc -O3 ag.c -o ag
                +
                    gcc -O3 ag.c -o ag

                To change that you need to edit the char array p[] and (possibly) two specially encoded constants, -~('('*'(') and 'C'*' '-'-'. The extracted source (ag.c) is obfuscated as well.

                @@ -333,10 +333,10 @@ Two’s complement representation of integers is also abused. E.g. instead of writing x++ or x-1, it is much better to write x=-~x and ~-x.

              • No numerical values, other than in the initialized char array, try

              -
                  ./fredriksson -ck0 [0-9] < fredriksson.c
              +
                  ./fredriksson -ck0 [0-9] < fredriksson.c

              This should print 1, as there is a number 3 in the char array (only). You can also try

              -
                  ./fredriksson -ck0 [0-9] < ag.c
              +
                  ./fredriksson -ck0 [0-9] < ag.c

              after running fredriksson at least once (since this generates that ag.c file), and this should print 0.

                diff --git a/2011/goren/README.md b/2011/goren/README.md index cd1afbbd9..ecc7bd32d 100644 --- a/2011/goren/README.md +++ b/2011/goren/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` echo "some text" | ./goren ``` ## Try: -```sh +``` ./try.sh ``` @@ -27,13 +27,13 @@ In the words of [René François Ghislain Magritte Magritte](http://en.wikipedia One may ask the surrealist question: -```sh +``` echo 'If | is just a representation of a pipe, then how can data stuff it?' | ./goren ``` However if one takes a firm stand and declares: -```sh +``` echo '| is just a representation of a pipe because I say so! So stuff it!' | ./goren ``` diff --git a/2011/goren/index.html b/2011/goren/index.html index 2e1dd2c39..147a961dc 100644 --- a/2011/goren/index.html +++ b/2011/goren/index.html @@ -141,11 +141,11 @@ Location: IL - State of Israel (

                To build:

                -
                    make
                +
                    make

                To use:

                -
                    echo "some text" | ./goren
                +
                    echo "some text" | ./goren

                Try:

                -
                    ./try.sh
                +
                    ./try.sh

                Judges’ remarks:

                In the words of René François Ghislain Magritte Magritte:

                @@ -153,9 +153,9 @@ Location: IL - State of Israel (

                One may ask the surrealist question:

                -
                    echo 'If | is just a representation of a pipe, then how can data stuff it?' | ./goren
                +
                    echo 'If | is just a representation of a pipe, then how can data stuff it?' | ./goren

                However if one takes a firm stand and declares:

                -
                    echo '| is just a representation of a pipe because I say so! So stuff it!' | ./goren
                +
                    echo '| is just a representation of a pipe because I say so! So stuff it!' | ./goren

                something happens! Why?

                Author’s remarks:

                This program was written in homage to Rene diff --git a/2011/hamaji/README.md b/2011/hamaji/README.md index e6eafe694..06bc5da0c 100644 --- a/2011/hamaji/README.md +++ b/2011/hamaji/README.md @@ -1,27 +1,27 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./hamaji < a_nonogram_file ``` ## Try: -```sh +``` ./try.sh ``` If you have perl installed you should be able to reproduce [dragon.nono](dragon.nono) like: -```sh +``` perl c2nono.pl hamaji.c | ./hamaji ``` @@ -181,7 +181,7 @@ with the well obfuscated code. This program uses two C99 features. One line comments and `long long`. GCC's `-ansi -pedantic` check should pass: -```sh +``` cc -ansi -pedantic -std=c99 hamaji.c ``` @@ -196,7 +196,7 @@ memory layout, undefined evaluation order (e.g., `a[i++]=i`), etc. This program won't work if the size of `long long` literal is less than 8. By grepping the source code of gcc -```sh +``` grep LONG_LONG_TYPE_SIZE gcc/config/*/* ``` @@ -224,7 +224,7 @@ was randomly generated. The [codegolf.nono](codegolf.nono) and You can reproduce [dragon.nono](dragon.nono) from [hamaji.c](hamaji.c) using [c2nono.pl](c2nono.pl): -```sh +``` perl c2nono.pl hamaji.c | ./hamaji ``` diff --git a/2011/hamaji/index.html b/2011/hamaji/index.html index e7c0dd93f..2ff3a983f 100644 --- a/2011/hamaji/index.html +++ b/2011/hamaji/index.html @@ -144,14 +144,14 @@ Location: JP - Japan

                To build:

                -
                    make
                +
                    make

                To use:

                -
                    ./hamaji < a_nonogram_file
                +
                    ./hamaji < a_nonogram_file

                Try:

                -
                    ./try.sh
                +
                    ./try.sh

                If you have perl installed you should be able to reproduce dragon.nono like:

                -
                    perl c2nono.pl hamaji.c | ./hamaji
                +
                    perl c2nono.pl hamaji.c | ./hamaji

                Judges’ remarks:

                This program solves Nonograms which is also known as “Paint by Numbers”.

                @@ -260,7 +260,7 @@ with the well obfuscated code.

                Portability

                This program uses two C99 features. One line comments and long long. GCC’s -ansi -pedantic check should pass:

                -
                    cc -ansi -pedantic -std=c99 hamaji.c
                +
                    cc -ansi -pedantic -std=c99 hamaji.c

                I checked my program with gcc-4.6.2 on linux, llvm-gcc-4.2 on Mac, and clang-3.0 on Mac.

                Note that the behavior of scanf(3) differs on linux and mac, but this @@ -269,7 +269,7 @@ program supports both semantics.

                memory layout, undefined evaluation order (e.g., a[i++]=i), etc. This program won’t work if the size of long long literal is less than 8. By grepping the source code of gcc

                -
                    grep LONG_LONG_TYPE_SIZE gcc/config/*/*
                +
                    grep LONG_LONG_TYPE_SIZE gcc/config/*/*

                I found long long may be 32bit integers only on AVR.

                A few more things

                This code is considered as a new year’s postcard in @@ -287,7 +287,7 @@ was randomly generated. The codegolf.nono and https://web.archive.org/web/20130218055139/http://codegolf.com/paint-by-numbers.

                You can reproduce dragon.nono from hamaji.c using c2nono.pl:

                -
                    perl c2nono.pl hamaji.c | ./hamaji
                +
                    perl c2nono.pl hamaji.c | ./hamaji
                make ``` ## To use: -```sh +``` ./hou 'expression' ``` ## Try: -```sh +``` ./try.sh ``` @@ -32,7 +32,7 @@ source code. What does it mean? The calculator obeys the precedence rules and allows parenthesis. -```sh +``` ./hou '1+2*3' ./hou '(1+2)*3' ``` @@ -41,7 +41,7 @@ What exactly does the text formatting do? What does this evaluate to in C? -```c +``` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ ``` diff --git a/2011/hou/index.html b/2011/hou/index.html index ec07eb888..f560962d5 100644 --- a/2011/hou/index.html +++ b/2011/hou/index.html @@ -141,11 +141,11 @@ Location: CN - People’s Republic of C

                To build:

                -
                    make
                +
                    make

                To use:

                -
                    ./hou 'expression'
                +
                    ./hou 'expression'

                Try:

                -
                    ./try.sh
                +
                    ./try.sh

                As the script asks you, what does the last one mean? Can you get it to report a different value? Hint: it’s in this file, kind of.

                Judges’ remarks:

                @@ -154,11 +154,11 @@ warnings under the most strict pedantic mode of gcc and clang.

                The first example, along with the correct result appears in the source code. What does it mean?

                The calculator obeys the precedence rules and allows parenthesis.

                -
                    ./hou '1+2*3'
                -    ./hou '(1+2)*3'
                +
                    ./hou '1+2*3'
                +    ./hou '(1+2)*3'

                What exactly does the text formatting do?

                What does this evaluate to in C?

                -
                    +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
                +
                    +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+

                Self documenting source

                Comments would almost be redundant. :-}

                The ASCII art is valid C code

                diff --git a/2011/konno/README.md b/2011/konno/README.md index 17fc889f6..da53d68cc 100644 --- a/2011/konno/README.md +++ b/2011/konno/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./konno lower_case_word ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2011/konno/index.html b/2011/konno/index.html index f5ae5e431..fa985c6a1 100644 --- a/2011/konno/index.html +++ b/2011/konno/index.html @@ -141,11 +141,11 @@ Location: JP - Japan

                To build:

                -
                    make
                +
                    make

                To use:

                -
                    ./konno lower_case_word
                +
                    ./konno lower_case_word

                Try:

                -
                    ./try.sh
                +
                    ./try.sh

                Judges’ remarks:

                This tiny program outputs what looks like a tiny keyboard. OK, so the letters are missing. But that is no problem because diff --git a/2011/richards/README.md b/2011/richards/README.md index 37fabfe56..f4f6ca68b 100644 --- a/2011/richards/README.md +++ b/2011/richards/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2011 richards bugs](../../bugs.html#2011_rich ## To use: -```sh +``` echo expression | ./richards ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2011/richards/index.html b/2011/richards/index.html index caad3fa9d..32dcf6e33 100644 --- a/2011/richards/index.html +++ b/2011/richards/index.html @@ -141,15 +141,15 @@ Location: US - United States of America

                To build:

                -
                    make
                +
                    make

                Bugs and (Mis)features:

                The current status of this entry is:

                    STATUS: doesn't work with some platforms - please help us fix

                For more detailed information see 2011 richards bugs.

                To use:

                -
                    echo expression | ./richards
                +
                    echo expression | ./richards

                Try:

                -
                    ./try.sh
                +
                    ./try.sh

                Judges’ remarks:

                Oh no, yet another dc-style calculator? (see diff --git a/2011/toledo/README.md b/2011/toledo/README.md index 03a441569..c9c92d985 100644 --- a/2011/toledo/README.md +++ b/2011/toledo/README.md @@ -2,7 +2,7 @@ If you have X11 installed: -```sh +``` make ``` @@ -13,7 +13,7 @@ Windows](toledo.alt2.c). See [Alternate code](#alternate-code) below. ## To use: -```sh +``` ./toledo ``` @@ -49,7 +49,7 @@ but you can change them about however you like, even with other keys. For instance to swap `LEFT` and `RIGHT`: -```sh +``` make clobber LEFT=XK_Right:XK_d RIGHT=XK_Left:XK_a alt ``` @@ -75,7 +75,7 @@ the source early on, right before the code gets hard to follow, or using the Like Oscar's previous winning X11 program for the 19th IOCCC, if you remove both the X11 include files and replace them with -```c +``` #include "layer.c" ``` diff --git a/2011/toledo/index.html b/2011/toledo/index.html index f793cdca8..611225179 100644 --- a/2011/toledo/index.html +++ b/2011/toledo/index.html @@ -142,12 +142,12 @@ Location: MX - United Mexican StatesTo build:

                If you have X11 installed:

                -
                    make
                +
                    make

                There are two alternate versions, one that lets you reconfigure the controls and size and another that should work for Windows. See Alternate code below.

                To use:

                -
                    ./toledo
                +
                    ./toledo

                Alternate code:

                The first alt version, toledo.alt.c, allows you to reconfigure the controls and the dimensions more easily.

                @@ -168,7 +168,7 @@ have the right names you can define the macros FIRE, FORWARD< HEIGHT= 288

      but you can change them about however you like, even with other keys. For instance to swap LEFT and RIGHT:

      -
          make clobber LEFT=XK_Right:XK_d RIGHT=XK_Left:XK_a alt
      +
          make clobber LEFT=XK_Right:XK_d RIGHT=XK_Left:XK_a alt

      but you can specify something completely else and you can pick and choose which controls you wish to redefine. You might also wish to change the dimensions of the game, WIDTH and HEIGHT which have an arbitrarily selected lower limit as @@ -184,7 +184,7 @@ the source early on, right before the code gets hard to follow, or using the alternate version.

      Like Oscar’s previous winning X11 program for the 19th IOCCC, if you remove both the X11 include files and replace them with

      -
          #include "layer.c"
      +
          #include "layer.c"

      you ought to be able to compile and run this program on Windows. NOTE: this is what toledo.alt2.c is for.

      Author’s remarks:

      diff --git a/2011/vik/README.md b/2011/vik/README.md index 34d0add56..a23661849 100644 --- a/2011/vik/README.md +++ b/2011/vik/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -21,20 +21,20 @@ For more detailed information see [2011 vik bugs](../../bugs.html#2011_vik). ## To use: -```sh +``` ./vik file.mod > audio_file.raw ``` If you have `mplayer(1)`: -```sh +``` ./vik file.mod | mplayer -demuxer rawaudio - ``` Alternatively, you can convert the file to a WAV: -```sh +``` ./vik file.mod > file.raw; ./raw2wav file.raw > file.wav ``` @@ -43,7 +43,7 @@ and then play `file.wav` with a program that can play WAV files. ## Try: -```sh +``` ./try.sh ``` @@ -66,7 +66,7 @@ This version is based on the author's remarks and it should work for Windows. Assuming that `make` is similar enough try: -```sh +``` make alt ``` @@ -87,7 +87,7 @@ initialization for? Does it take your system a long time to compile? You may want to do: -```sh +``` cc -S vik.c ``` @@ -153,7 +153,7 @@ Bertilsson, also known as Deelite: Compiling for Unix systems (including cygwin) is straight forward: -```sh +``` gcc -o vik vik.c ``` @@ -162,13 +162,13 @@ Compiling for Unix systems (including cygwin) is straight forward: #### Convert MOD file to raw 44.1kHz stereo audio file -```sh +``` ./vik mad_world.mod > audio_file.raw ``` #### Listen to the MOD file (streaming to mplayer) -```sh +``` ./vik randowan.mod | mplayer -demuxer rawaudio - ``` @@ -210,7 +210,7 @@ Microsoft compilers adds a carriage return to newlines, and to compile the program with this platform, the following line can be added after the main declaration in order for the program to run correctly: -```c +``` _setmode(_fileno(stdout), 0x8000); ``` diff --git a/2011/vik/index.html b/2011/vik/index.html index db3ec9ef8..1b20de803 100644 --- a/2011/vik/index.html +++ b/2011/vik/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      There is an alternate version that should work for Windows. See alternate code below.

      Bugs and (Mis)features:

      @@ -149,14 +149,14 @@ code below.

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2011 vik bugs.

      To use:

      -
          ./vik file.mod > audio_file.raw
      +
          ./vik file.mod > audio_file.raw

      If you have mplayer(1):

      -
          ./vik file.mod | mplayer -demuxer rawaudio -
      +
          ./vik file.mod | mplayer -demuxer rawaudio -

      Alternatively, you can convert the file to a WAV:

      -
          ./vik file.mod > file.raw; ./raw2wav file.raw > file.wav
      +
          ./vik file.mod > file.raw; ./raw2wav file.raw > file.wav

      and then play file.wav with a program that can play WAV files.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      The script checks that you have mplayer(1) installed and if it is it will pipe vik to mplayer. In this case it will also use raw2wav to convert the file to a WAV file. If mplayer(1) cannot be found it will just use raw2wav. This @@ -168,7 +168,7 @@ Archive.

      This version is based on the author’s remarks and it should work for Windows.

      Alternate build:

      Assuming that make is similar enough try:

      -
          make alt
      +
          make alt

      Alternate use:

      Use vik.alt as you would vik above.

      Judges’ remarks:

      @@ -178,7 +178,7 @@ in a most pleasing manner if you don’t like tremolo or vibrato.

      initialized 32MB array. Can you tell what that partial initialization for?

      Does it take your system a long time to compile? You may want to do:

      -
          cc -S vik.c
      +
          cc -S vik.c

      and examine the resulting assembly file vik.s. On some platforms the assembly file is about 128MB in size!

      NOTE: The randowan.mod and mad_world.mod files were @@ -225,12 +225,12 @@ Bertilsson, also known as Deelite:

    Build

    Compiling for Unix systems (including cygwin) is straight forward:

    -
        gcc -o vik vik.c
    +
        gcc -o vik vik.c

    Usage

    Convert MOD file to raw 44.1kHz stereo audio file

    -
        ./vik mad_world.mod > audio_file.raw
    +
        ./vik mad_world.mod > audio_file.raw

    Listen to the MOD file (streaming to mplayer)

    -
        ./vik randowan.mod | mplayer -demuxer rawaudio -
    +
        ./vik randowan.mod | mplayer -demuxer rawaudio -

    (Don’t forget the last - as it makes mplayer read from stdin.)

    Obfuscation

    The IOCCC rules did not put a limit on the entropy of the source code, @@ -256,7 +256,7 @@ that the program relies on writing binary data to stdout.

    Microsoft compilers adds a carriage return to newlines, and to compile the program with this platform, the following line can be added after the main declaration in order for the program to run correctly:

    -
        _setmode(_fileno(stdout), 0x8000);
    +
        _setmode(_fileno(stdout), 0x8000);

    NOTE: this is what the alternate version is for.

    Limitations

    The program only runs when a valid MOD file is passed as argument. If diff --git a/2011/zucker/README.md b/2011/zucker/README.md index 50d371113..35e73d2a7 100644 --- a/2011/zucker/README.md +++ b/2011/zucker/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,7 +10,7 @@ binary mode from text mode. See [alternate code](#alternate-code) below. ## To use: -```sh +``` ./zucker > image.ppm ``` @@ -19,7 +19,7 @@ Now open `image.ppm` with your image viewer of choice. ## Try: -```sh +``` ./try.sh ``` @@ -36,7 +36,7 @@ that distinguish binary and text. ### Alternate build: -```sh +``` make alt ``` @@ -68,7 +68,7 @@ This entry uses no local variables. None! At! All! This program makes pretty pictures. To see the default output, try running -```sh +``` ./zucker > ioccc2011.ppm ``` @@ -82,7 +82,7 @@ Netpbm files, and are available on multiple platforms. With macOS you can type at the command line: -```sh +``` open ioccc2021.ppm ``` @@ -90,7 +90,7 @@ and it will open image in the default application Preview.app. To use ImageMagick you might do something like: -```sh +``` convert ioccc2011.ppm ioccc2011.png ``` @@ -98,7 +98,7 @@ and then open `ioccc2011.png` in your viewer of choice. To use GraphicsMagick you might do something like: -```sh +``` gm convert ioccc2011.ppm ioccc2011.png ``` @@ -107,14 +107,14 @@ and then open `ioccc2011.png` in your viewer of choice. Aside from the default image, you may create your own by running the program as follows: -```sh +``` ./zucker "your text" > image.ppm ``` To mitigate long runtime, the program can be invoked in a "preview" mode by appending `-preview` to the command line arguments, like so: -```sh +``` ./zucker faster\! -preview > image.ppm ``` diff --git a/2011/zucker/index.html b/2011/zucker/index.html index 2adca8c1b..c6a87851f 100644 --- a/2011/zucker/index.html +++ b/2011/zucker/index.html @@ -141,14 +141,14 @@ Location: US - United States of America

    To build:

    -
        make
    +
        make

    There is an alternate version which should work for Windows which distinguishes binary mode from text mode. See alternate code below.

    To use:

    -
        ./zucker > image.ppm
    +
        ./zucker > image.ppm

    Now open image.ppm with your image viewer of choice.

    Try:

    -
        ./try.sh
    +
        ./try.sh

    After running try.sh, open the PPM images ioccc.ppm, hello.ppm and image2.ppm with your image viewer of choice.

    Alternate code:

    @@ -156,7 +156,7 @@ binary mode from text mode. See alternate code bel binary mode on stdout which the author noted would be necessary for systems that distinguish binary and text.

    Alternate build:

    -
        make alt
    +
        make alt

    Alternate use:

    Use zucker.alt as you would zucker above.

    Alternate try:

    @@ -170,7 +170,7 @@ The vector font is proportional.

    What it does:

    This program makes pretty pictures. To see the default output, try running

    -
        ./zucker > ioccc2011.ppm
    +
        ./zucker > ioccc2011.ppm

    On the author’s 2.5 GHz MacBook Pro, this command takes approximately 1 minute and 18 seconds to run – your runtime may vary. You will need an image viewer capable of displaying Netpbm images in @@ -179,20 +179,20 @@ well; otherwise ImageMagick and/or GraphicsMagick are both capable of displaying Netpbm files, and are available on multiple platforms.

    With macOS you can type at the command line:

    -
        open ioccc2021.ppm
    +
        open ioccc2021.ppm

    and it will open image in the default application Preview.app.

    To use ImageMagick you might do something like:

    -
        convert ioccc2011.ppm ioccc2011.png
    +
        convert ioccc2011.ppm ioccc2011.png

    and then open ioccc2011.png in your viewer of choice.

    To use GraphicsMagick you might do something like:

    -
        gm convert ioccc2011.ppm ioccc2011.png
    +
        gm convert ioccc2011.ppm ioccc2011.png

    and then open ioccc2011.png in your viewer of choice.

    Aside from the default image, you may create your own by running the program as follows:

    -
        ./zucker "your text" > image.ppm
    +
        ./zucker "your text" > image.ppm

    To mitigate long runtime, the program can be invoked in a “preview” mode by appending -preview to the command line arguments, like so:

    -
        ./zucker faster\! -preview > image.ppm
    +
        ./zucker faster\! -preview > image.ppm

    If your platform distinguishes between binary and text streams, you may need to insert some code to reopen standard output in binary mode at the start of main() (the provided alternate version will set binary mode diff --git a/2012/blakely/README.md b/2012/blakely/README.md index ab4f26ecc..d2cbcae27 100644 --- a/2012/blakely/README.md +++ b/2012/blakely/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2012 blakely bugs](../../bugs.html#2012_blake ## To use: -```sh +``` ./blakely "RPN formula" resolution > output.gif ``` ## Try: -```sh +``` ./try.sh ``` @@ -59,7 +59,7 @@ output to `stdout`. The program should be run as: -```sh +``` ./blakely xy* 32 > pic.gif ``` @@ -105,7 +105,7 @@ resolution of `ripple.gif` to 250 took ~35 minutes to render on an [i7 processor](https://en.wikipedia.org/wiki/Intel_Core#Core_i7). -```sh +``` ./blakely xy* 32 > saddle.gif ./blakely xx*yy*1++d5*ct/ 64 > ripple.gif diff --git a/2012/blakely/index.html b/2012/blakely/index.html index 350ebca77..16c3f074c 100644 --- a/2012/blakely/index.html +++ b/2012/blakely/index.html @@ -141,15 +141,15 @@ Location: GB - United Kingdom of Great

    To build:

    -
        make
    +
        make

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 2012 blakely bugs.

    To use:

    -
        ./blakely "RPN formula" resolution > output.gif
    +
        ./blakely "RPN formula" resolution > output.gif

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    Several IOCCC themes (RPN calculator, animated @@ -169,7 +169,7 @@ resolution, and an animated GIF showing a fly-around of the resulting surface is output to stdout.

    Usage

    The program should be run as:

    -
        ./blakely xy* 32 > pic.gif
    +
        ./blakely xy* 32 > pic.gif

    where the first parameter is a RPN expression, and the second is the width of the required GIF, up @@ -201,9 +201,9 @@ and more complex expressions take longer to compute. For example, increasing the resolution of ripple.gif to 250 took ~35 minutes to render on an i7 processor.

    -
        ./blakely xy* 32 > saddle.gif
    -
    -    ./blakely xx*yy*1++d5*ct/ 64 > ripple.gif
    +
        ./blakely xy* 32 > saddle.gif
    +
    +    ./blakely xx*yy*1++d5*ct/ 64 > ripple.gif

    Algorithm

    A generic root-finding algorithm to find the point of intersection between a ray and the surface is done using a simple forward search from the eye. In order to diff --git a/2012/deckmyn/README.md b/2012/deckmyn/README.md index ca689c5c1..c8bb59a8f 100644 --- a/2012/deckmyn/README.md +++ b/2012/deckmyn/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2012 deckmyn bugs](../../bugs.html#2012_deckm ## To use: -```sh +``` ./deckmyn "$(cat deckmyn.c)" "$(cat musicfile.txt)" > sheetmusic.pbm ``` ## Try: -```sh +``` ./try.sh ``` @@ -59,13 +59,13 @@ You need the source code and example input (either one of the example files, or manual input as below) ready and a program capable of showing [.pbm bitmap format](https://en.wikipedia.org/wiki/Netpbm) images. -```sh +``` ./deckmyn "`cat deckmyn.c`" "`cat example_greensleeves`" > greensleeves.pbm ``` If you have macOS you can open the image like: -```sh +``` open greensleeves.pbm ``` @@ -73,13 +73,13 @@ If you have macOS you can open the image like: normally open an image. -```sh +``` ./deckmyn "`cat deckmyn.c`" "KF m44c4 c4 g4 g4 : a4 a4 g2 :; " > short_bass.pbm ``` If you have macOS you can open the image like: -```sh +``` open short_bass.pbm ``` diff --git a/2012/deckmyn/deckmyn.html b/2012/deckmyn/deckmyn.html index dec702532..6d918bcaf 100644 --- a/2012/deckmyn/deckmyn.html +++ b/2012/deckmyn/deckmyn.html @@ -124,7 +124,7 @@

    USER MANUAL

    Calling the program

    -
        ./deckmyn "`cat deckmyn.c`" "`cat musicfile`" > output.pbm
    +
        ./deckmyn "`cat deckmyn.c`" "`cat musicfile`" > output.pbm

    Then display output.pbm.

    This minimalistic music notator expects two command line arguments. The first is the font description embedded in the source code. Notice that you don’t pass the @@ -186,7 +186,7 @@ clef. "K" followed by any other letter will just default to a stand

    Examples

    Blank music paper (with G clef):

    -
        ./deckmyn "`cat deckmyn.c`" "sz sa x  s1 x  s1 x  s1 x  s1 x  s1 "> blank.pbm
    +
        ./deckmyn "`cat deckmyn.c`" "sz sa x  s1 x  s1 x  s1 x  s1 x  s1 "> blank.pbm

    With an F clef:

        ./deckmyn "`cat deckmyn.c`" "KF sz sa x  s1 x  s1 x  s1 x  s1 x  s1 "> blank.pbm

    Notice how only the first staff (or any staff) needs to have the full length.

    diff --git a/2012/deckmyn/deckmyn.md b/2012/deckmyn/deckmyn.md index d4abfc72c..aad09ef7c 100644 --- a/2012/deckmyn/deckmyn.md +++ b/2012/deckmyn/deckmyn.md @@ -3,7 +3,7 @@ ## Calling the program -```sh +``` ./deckmyn "`cat deckmyn.c`" "`cat musicfile`" > output.pbm ``` @@ -85,7 +85,7 @@ musical element of a line is only 2 characters! Blank music paper (with G clef): -```sh +``` ./deckmyn "`cat deckmyn.c`" "sz sa x s1 x s1 x s1 x s1 x s1 "> blank.pbm ``` diff --git a/2012/deckmyn/index.html b/2012/deckmyn/index.html index 365b7d385..fefe82e17 100644 --- a/2012/deckmyn/index.html +++ b/2012/deckmyn/index.html @@ -141,15 +141,15 @@ Location: BE - Kingdom of Belgium

    To build:

    -
        make
    +
        make

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 2012 deckmyn bugs.

    To use:

    -
        ./deckmyn "$(cat deckmyn.c)" "$(cat musicfile.txt)" > sheetmusic.pbm
    +
        ./deckmyn "$(cat deckmyn.c)" "$(cat musicfile.txt)" > sheetmusic.pbm

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    The C of this entry is definitely sharp. The program cleverly uses its own source at runtime to define the notes, time signature and accidental bitmaps.

    @@ -168,14 +168,14 @@ is not done in the author’s remarks, however.

    You need the source code and example input (either one of the example files, or manual input as below) ready and a program capable of showing .pbm bitmap format images.

    -
        ./deckmyn "`cat deckmyn.c`" "`cat example_greensleeves`" > greensleeves.pbm
    +
        ./deckmyn "`cat deckmyn.c`" "`cat example_greensleeves`" > greensleeves.pbm

    If you have macOS you can open the image like:

    -
        open greensleeves.pbm
    +
        open greensleeves.pbm

    … otherwise, you’ll have to open it in your viewer of choice how you would normally open an image.

    -
        ./deckmyn "`cat deckmyn.c`" "KF m44c4 c4 g4 g4 :  a4 a4 g2 :; " > short_bass.pbm
    +
        ./deckmyn "`cat deckmyn.c`" "KF m44c4 c4 g4 g4 :  a4 a4 g2 :; " > short_bass.pbm

    If you have macOS you can open the image like:

    -
        open short_bass.pbm
    +
        open short_bass.pbm

    … otherwise, you’ll have to open it in your viewer of choice how you would normally open an image.

    Description

    diff --git a/2012/dlowe/README.md b/2012/dlowe/README.md index 11db8ad08..e43821d11 100644 --- a/2012/dlowe/README.md +++ b/2012/dlowe/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2012 dlowe bugs](../../bugs.html#2012_dlowe). ## To use: -```sh +``` ./dlowe ``` ## Try: -```sh +``` ./dlowe ``` diff --git a/2012/dlowe/index.html b/2012/dlowe/index.html index 5acb40183..ee710ddb1 100644 --- a/2012/dlowe/index.html +++ b/2012/dlowe/index.html @@ -141,15 +141,15 @@ Location: US - United States of America

    To build:

    -
        make
    +
        make

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 2012 dlowe bugs.

    To use:

    -
        ./dlowe
    +
        ./dlowe

    Try:

    -
        ./dlowe
    +
        ./dlowe

    Watch for a while if you like, then press a key within the window.

    Use up and down keys to escape death.

    Judges’ remarks:

    diff --git a/2012/endoh1/README.md b/2012/endoh1/README.md index e04f7c43b..5c293ad15 100644 --- a/2012/endoh1/README.md +++ b/2012/endoh1/README.md @@ -1,5 +1,5 @@ -```sh +``` make ``` @@ -14,7 +14,7 @@ section below for more details. ## To use: -```sh +``` ./endoh1 < file ``` @@ -25,7 +25,7 @@ see what this looks like not going so fast then you might wish to try the ## Try: -```sh +``` ./try.bw.sh endoh1.c ./try.sh endoh1.c @@ -50,7 +50,7 @@ the fluid and change the behaviour of the fluid. The file For the default values, try: -```sh +``` make alt ``` @@ -59,13 +59,13 @@ one can more easily go through the list of files to see them all in succession, for fun. That is controlled by the variable `TIMER` at compilation. For instance if you wish to change the value to 5: -```sh +``` make clobber TIMER=5 alt ``` If you want to disable the alarm time, set it to 0: -```sh +``` make clobber TIMER=0 alt ``` @@ -76,7 +76,7 @@ see and to not flash too quickly. The code protects against a value < 0 and defaults to 12321 but you can change it to. For instance to slow it down you could increase the sleep time from `12321` to `50000`: -```sh +``` make clobber SLEEP=50000 alt ``` @@ -84,7 +84,7 @@ could increase the sleep time from `12321` to `50000`: If you wish to speed it up you might decrease the sleep time from `12321` to `9999`: -```sh +``` make clobber SLEEP=9999 alt ``` @@ -97,7 +97,7 @@ viscosity factor, you should redefine the values `GRAVITY`, `PRESSURE` and/or `VISCOSITY` macros, respectively. For instance if you wish to change the viscosity and pressure factors but leave the other values alone: -```sh +``` make clobber VISCOSITY=X PRESSURE=Y alt ``` @@ -111,13 +111,13 @@ You might also wish to try redefining the macros `G`, `P` and/or `V`. For instance: -```sh +``` make clobber GRAVITY=5 PRESSURE=5 VISCOSITY=5 alt ``` You might try even: -```sh +``` make clobber GRAVITY=I alt ``` @@ -141,7 +141,7 @@ and `endoh1_color` above. To see two different ways run on the source file and each of the text files, try: -```sh +``` ./try.alt.sh ``` @@ -149,7 +149,7 @@ The second run of each will be with the gravity factor set to `I`. To see the same thing but in the original uncoloured version, try: -```sh +``` ./try.alt.bw.sh ``` @@ -178,7 +178,7 @@ entry](https://web.archive.org/web/20230711134609/https://whatif.xkcd.com/6/). **DO NOT FORGET** `-DG=1 -DP=4 -DV=8` and make your terminal window larger than 80 x 25. -```sh +``` cc endoh1.c -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -o endoh1 -lm ./endoh1 < endoh1.c ./endoh1 < logo.txt @@ -246,7 +246,7 @@ to build with no warning. Under these conditions, it should be portable. At least, recent compilers with `-std=c99 -Wall -W -Wextra -pedantic` say nothing. -```sh +``` 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 diff --git a/2012/endoh1/index.html b/2012/endoh1/index.html index 593e4ac9e..00248180a 100644 --- a/2012/endoh1/index.html +++ b/2012/endoh1/index.html @@ -140,7 +140,7 @@ Location: JP - Japan -
        make
    +
        make

    There are two alt versions that let you control the compile time variables that control the fluid behaviour and the added variables to speed up or slow down the fluid as well as setting a timeout (if not 0): one for the original black and @@ -149,19 +149,19 @@ judges at the time of the contest). Another version is the deobfuscated version provided by the author as well. See the Alternate code section below for more details.

    To use:

    -
        ./endoh1 < file
    +
        ./endoh1 < file

    WARNING: if you’re sensitive to/don’t like flashing colours/text or just want to see what this looks like not going so fast then you might wish to try the Alternate code instead.

    Try:

    -
        ./try.bw.sh endoh1.c
    -    ./try.sh endoh1.c
    -
    -    ./try.bw.sh pour-out.txt
    -    ./try.sh pour-out.txt
    -
    -    ./try.bw.sh fountain.txt
    -    ./try.sh fountain.txt
    +
        ./try.bw.sh endoh1.c
    +    ./try.sh endoh1.c
    +
    +    ./try.bw.sh pour-out.txt
    +    ./try.sh pour-out.txt
    +
    +    ./try.bw.sh fountain.txt
    +    ./try.sh fountain.txt

    Alternate code:

    The files endoh1.alt.c and endoh1_color.alt.c correspond to endoh1.c and @@ -170,39 +170,39 @@ the fluid and change the behaviour of the fluid. The file endoh1.alt2.c is deobfuscated and was provided by the author.

    Alternate build:

    For the default values, try:

    -
        make alt
    +
        make alt

    In the alt versions a default time of 10 seconds is set as an alarm so that one can more easily go through the list of files to see them all in succession, for fun. That is controlled by the variable TIMER at compilation. For instance if you wish to change the value to 5:

    -
        make clobber TIMER=5 alt
    +
        make clobber TIMER=5 alt

    If you want to disable the alarm time, set it to 0:

    -
        make clobber TIMER=0 alt
    +
        make clobber TIMER=0 alt

    It cannot be < 0 or > 60 (arbitrarily selected).

    The SLEEP variable is to delay the time between updates to make it easier to see and to not flash too quickly. The code protects against a value < 0 and defaults to 12321 but you can change it to. For instance to slow it down you could increase the sleep time from 12321 to 50000:

    -
        make clobber SLEEP=50000 alt
    +
        make clobber SLEEP=50000 alt

    If you wish to speed it up you might decrease the sleep time from 12321 to 9999:

    -
        make clobber SLEEP=9999 alt
    +
        make clobber SLEEP=9999 alt

    WARNING: the lower the value the faster it will flash so be careful if you’re sensitive to this.

    If you wish to change the gravity factor, pressure factor and/or viscosity factor, you should redefine the values GRAVITY, PRESSURE and/or VISCOSITY macros, respectively. For instance if you wish to change the viscosity and pressure factors but leave the other values alone:

    -
        make clobber VISCOSITY=X PRESSURE=Y alt
    +
        make clobber VISCOSITY=X PRESSURE=Y alt

    where X and Y are numbers or the letter I and which are, respectively, the viscosity and pressure factors. There is no attempt to check the value or type because doing so prevents the macros from being defined to I which would prevent the author’s remarks about it from being done.

    You might also wish to try redefining the macros G, P and/or V. For instance:

    -
        make clobber GRAVITY=5 PRESSURE=5 VISCOSITY=5 alt
    +
        make clobber GRAVITY=5 PRESSURE=5 VISCOSITY=5 alt

    You might try even:

    -
        make clobber GRAVITY=I alt
    +
        make clobber GRAVITY=I alt

    See the author’s remarks for details on these macros where:

        G = GRAVITY
         P = PRESSURE
    @@ -213,10 +213,10 @@ and endoh1_color above.

    Alternate try:

    To see two different ways run on the source file and each of the text files, try:

    -
        ./try.alt.sh
    +
        ./try.alt.sh

    The second run of each will be with the gravity factor set to I.

    To see the same thing but in the original uncoloured version, try:

    -
        ./try.alt.bw.sh
    +
        ./try.alt.bw.sh

    Judges’ remarks:

    Let’s play Jeopardy!

    A: An obfuscated program that deals with complex numbers and produces animated ASCII graphics. @@ -231,12 +231,12 @@ entry.

    Synopsis

    DO NOT FORGET -DG=1 -DP=4 -DV=8 and make your terminal window larger than 80 x 25.

    -
        cc 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
    +
        cc 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

        ,___. ,.       ,.    ,.   ,___. ,.              ,.       ,.
         |/--' ||       `'    ||   |/--' `'              ||       |\_.
    @@ -284,9 +284,9 @@ comments. It also uses usleep(3), which may require -D_BSD_SO
     to build with no warning. Under these conditions, it should be portable.
     At least, recent compilers with -std=c99 -Wall -W -Wextra -pedantic say
     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
    +
        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) diff --git a/2012/endoh2/README.md b/2012/endoh2/README.md index 6cd78564c..d66080869 100644 --- a/2012/endoh2/README.md +++ b/2012/endoh2/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./endoh2 > pi.c gcc -o pi pi.c ./pi > 314.c @@ -15,7 +15,7 @@ and: -```sh +``` ./endoh2 e > e.c\ gcc -o e e.c ./e > 271.c @@ -26,7 +26,7 @@ and: ## Try: -```sh +``` ./try.sh ``` @@ -112,7 +112,7 @@ characters and not requiring a return in `main()`. In fact, recent compilers with `-std=c99 -Wall -W -Wextra -pedantic` would say nothing. -```sh +``` gcc -std=c99 -Wall -W -Wextra -pedantic spigot.c clang -std=c99 -Wall -W -Wextra -pedantic spigot.c ``` @@ -123,7 +123,7 @@ and gcc-4.5.3 and clang-3.1 on Cygwin. ### Synopsis -```sh +``` cc endoh2.c -o endoh2 ./endoh2 > pi.c diff --git a/2012/endoh2/index.html b/2012/endoh2/index.html index cda0cd404..e692b6d51 100644 --- a/2012/endoh2/index.html +++ b/2012/endoh2/index.html @@ -141,18 +141,18 @@ Location: JP - Japan

    To build:

    -
        make
    +
        make

    To use:

    -
        ./endoh2 > pi.c
    -    gcc -o pi pi.c
    -    ./pi > 314.c
    +
        ./endoh2 > pi.c
    +    gcc -o pi pi.c
    +    ./pi > 314.c

    and:

    -
        ./endoh2 e > e.c\
    -    gcc -o e e.c
    -    ./e > 271.c
    +
        ./endoh2 e > e.c\
    +    gcc -o e e.c
    +    ./e > 271.c

    …

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    A pi/e @@ -213,32 +213,32 @@ willy-nilly.

    warning, it requires two C99 features: allow string literal to be more than 509 characters and not requiring a return in main(). In fact, recent compilers with -std=c99 -Wall -W -Wextra -pedantic would say nothing.

    -
        gcc -std=c99 -Wall -W -Wextra -pedantic spigot.c
    -    clang -std=c99 -Wall -W -Wextra -pedantic spigot.c
    +
        gcc -std=c99 -Wall -W -Wextra -pedantic spigot.c
    +    clang -std=c99 -Wall -W -Wextra -pedantic spigot.c

    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.

    Synopsis

    -
        cc endoh2.c -o endoh2
    -
    -    ./endoh2 > pi.c
    -    cat pi.c
    -
    -    cc pi.c     -o pi     ; ./pi     > 314.c     ; cat 314.c
    -    cc 314.c    -o 314    ; ./314    > 3141.c    ; cat 3141.c
    -    cc 3141.c   -o 3141   ; ./3141   > 31415.c   ; cat 31415.c
    -    cc 31415.c  -o 31415  ; ./31415  > 314159.c  ; cat 314159.c
    -    cc 314159.c -o 314159 ; ./314159 > 3141592.c ; cat 3141592.c
    -    etc...
    -
    -    ./endoh2 e > e.c
    -    cat e.c
    -
    -    cc e.c      -o e      ; ./e      > 271.c     ; cat 271.c
    -    cc 271.c    -o 271    ; ./271    > 2718.c    ; cat 2718.c
    -    cc 2718.c   -o 2718   ; ./2718   > 27182.c   ; cat 27182.c
    -    cc 27182.c  -o 27182  ; ./27182  > 271828.c  ; cat 271828.c
    -    cc 271828.c -o 271828 ; ./271828 > 2718281.c ; cat 2718281.c
    -    etc...
    +
        cc endoh2.c -o endoh2
    +
    +    ./endoh2 > pi.c
    +    cat pi.c
    +
    +    cc pi.c     -o pi     ; ./pi     > 314.c     ; cat 314.c
    +    cc 314.c    -o 314    ; ./314    > 3141.c    ; cat 3141.c
    +    cc 3141.c   -o 3141   ; ./3141   > 31415.c   ; cat 31415.c
    +    cc 31415.c  -o 31415  ; ./31415  > 314159.c  ; cat 314159.c
    +    cc 314159.c -o 314159 ; ./314159 > 3141592.c ; cat 3141592.c
    +    etc...
    +
    +    ./endoh2 e > e.c
    +    cat e.c
    +
    +    cc e.c      -o e      ; ./e      > 271.c     ; cat 271.c
    +    cc 271.c    -o 271    ; ./271    > 2718.c    ; cat 2718.c
    +    cc 2718.c   -o 2718   ; ./2718   > 27182.c   ; cat 27182.c
    +    cc 27182.c  -o 27182  ; ./27182  > 271828.c  ; cat 271828.c
    +    cc 271828.c -o 271828 ; ./271828 > 2718281.c ; cat 2718281.c
    +    etc...

    You can do make everything for the process (with no cat).

    Note: The executable may return a failure (non-zero) exit status unless -std=c99 option is given.

    diff --git a/2012/grothe/README.md b/2012/grothe/README.md index 2c570f5f3..ed8e02736 100644 --- a/2012/grothe/README.md +++ b/2012/grothe/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -9,7 +9,7 @@ To create a shared secret shared among `M` people with `N+1` needed to reconstruct: -```sh +``` ./grothe -secret 1-/dev/urandom 2-/dev/urandom ... \ N-/dev/urandom 1+shared1 2+shared2 ... M+sharedM ``` @@ -17,14 +17,14 @@ To create a shared secret shared among `M` people with `N+1` needed to reconstru To reconstruct the original (an arbitrary combination of `N+1` or more shared files with their proper numbers): -```sh +``` ./grothe I-sharedI J-sharedJ K-sharedK ... +reconstructed ``` ## Try: -```sh +``` ./try.sh ``` @@ -75,7 +75,7 @@ To share a secret. For example: To split a secret into 4 pieces of which at least 3 will be needed to get it (in this case the cookie recipe) back: -```sh +``` ./grothe \ -cookie_recipe.txt\ 1-/dev/urandom 2-/dev/urandom\ @@ -84,7 +84,7 @@ this case the cookie recipe) back: To put the recipe back together using the first, second and fourth pieces: -```sh +``` ./grothe \ 1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat +cookie_recipe_restore.txt diff --git a/2012/grothe/index.html b/2012/grothe/index.html index 25c9864fb..f7c2c2d66 100644 --- a/2012/grothe/index.html +++ b/2012/grothe/index.html @@ -144,16 +144,16 @@ Location: FR - French Republic (

    To build:

    -
        make
    +
        make

    To use:

    To create a shared secret shared among M people with N+1 needed to reconstruct:

    -
        ./grothe -secret 1-/dev/urandom 2-/dev/urandom ... \
    -        N-/dev/urandom 1+shared1 2+shared2 ... M+sharedM
    +
        ./grothe -secret 1-/dev/urandom 2-/dev/urandom ... \
    +        N-/dev/urandom 1+shared1 2+shared2 ... M+sharedM

    To reconstruct the original (an arbitrary combination of N+1 or more shared files with their proper numbers):

    -
        ./grothe I-sharedI J-sharedJ K-sharedK ... +reconstructed
    +
        ./grothe I-sharedI J-sharedJ K-sharedK ... +reconstructed

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    Also known as ‘Best abuse of the judging process’.

    The IOCCC 2012 submission page didn’t enforce the 2048 meaningful character @@ -184,14 +184,14 @@ into 3 parts and require two of them be available to extract the original recipe

    Example usage

    To split a secret into 4 pieces of which at least 3 will be needed to get it (in this case the cookie recipe) back:

    -
        ./grothe \
    -        -cookie_recipe.txt\
    -        1-/dev/urandom 2-/dev/urandom\
    -        1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat
    +
        ./grothe \
    +        -cookie_recipe.txt\
    +        1-/dev/urandom 2-/dev/urandom\
    +        1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat

    To put the recipe back together using the first, second and fourth pieces:

    -
        ./grothe \
    -        1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat
    -        +cookie_recipe_restore.txt
    +
        ./grothe \
    +        1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat
    +        +cookie_recipe_restore.txt

    Limitations

    The program is limited to 256 input and output files and will slow down dramatically when you get past 20-50 inputs and outputs.

    diff --git a/2012/hamano/README.md b/2012/hamano/README.md index eb2504327..c1a283eae 100644 --- a/2012/hamano/README.md +++ b/2012/hamano/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./hamano < textfile > output.pdf ``` ## Try: -```sh +``` ./try.sh ``` @@ -30,7 +30,7 @@ README.md! That procedure looks like: -```sh +``` ./hamano < README.md > hint.pdf cc -xc hint.pdf -o hint ./hint @@ -40,7 +40,7 @@ Another PDF generated is an obfuscated `Hello World!` program (obfuscated inside the PDF). Once this is done it will compile the PDF as if it was C (itself!). It will look like: -```sh +``` echo 'int main(){puts("Hello World!");}' | ./hamano > hello.pdf cc -xc hello.pdf -o hello ./hello | cc -Wno-implicit-function-declaration -xc - -o ./hello2 diff --git a/2012/hamano/index.html b/2012/hamano/index.html index 2f24a4c77..411e2181f 100644 --- a/2012/hamano/index.html +++ b/2012/hamano/index.html @@ -141,11 +141,11 @@ Location: JP - Japan

    To build:

    -
        make
    +
        make

    To use:

    -
        ./hamano < textfile > output.pdf
    +
        ./hamano < textfile > output.pdf

    Try:

    -
        ./try.sh
    +
        ./try.sh

    The script will generate a number of PDF files and it will suggest you look at them as well. You can read hint.pdf with a PDF reader like acroread hint.pdf or evince hint.pdf. With macOS you can do open hint.pdf which by default @@ -155,17 +155,17 @@ directly instead.

    the PDF file will then be compiled as C (itself!) and executed so that it shows README.md!

    That procedure looks like:

    -
        ./hamano < README.md > hint.pdf
    -    cc -xc hint.pdf -o hint
    -    ./hint
    +
        ./hamano < README.md > hint.pdf
    +    cc -xc hint.pdf -o hint
    +    ./hint

    Another PDF generated is an obfuscated Hello World! program (obfuscated inside the PDF). Once this is done it will compile the PDF as if it was C (itself!). It will look like:

    -
        echo 'int main(){puts("Hello World!");}' | ./hamano > hello.pdf
    -    cc -xc hello.pdf -o hello
    -    ./hello | cc -Wno-implicit-function-declaration -xc - -o ./hello2
    -
    -    ./hello2
    +
        echo 'int main(){puts("Hello World!");}' | ./hamano > hello.pdf
    +    cc -xc hello.pdf -o hello
    +    ./hello | cc -Wno-implicit-function-declaration -xc - -o ./hello2
    +
    +    ./hello2

    although the CFLAGS will be what is in the Makefile as it uses the helper rules hint.pdf, hint, hello.pdf and hello to do this.

    Judges’ remarks:

    diff --git a/2012/hou/README.md b/2012/hou/README.md index 4e6394a86..19e567c29 100644 --- a/2012/hou/README.md +++ b/2012/hou/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./hou syntax-file file-to-process ``` ## Try: -```sh +``` ./try.sh ``` @@ -80,7 +80,7 @@ The following regular expression operators are supported: For example, one can use the following expression to match a certain declaration statement in [hou.c](hou.c): -```re +``` "char"[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*(,[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*)*; ``` @@ -89,7 +89,7 @@ The regex engine is also algorithmically efficient. To illustrate the point, hang for the competing Perl engine while matching itself. Try to compare these two engines: -```sh +``` ./hou ansi.txt ansi.txt perl patho.pl < ansi.txt ``` diff --git a/2012/hou/hint.html b/2012/hou/hint.html index 55e16949f..5a7b599f2 100644 --- a/2012/hou/hint.html +++ b/2012/hou/hint.html @@ -124,9 +124,9 @@

    Judges’ comments:

    To build:

    -
        make hou
    +
        make hou

    To run:

    -
        ./hou syntax-file file-to-process
    +
        ./hou syntax-file file-to-process

    Try (Unix):

    The results are best viewed in a 80x25 console with ANSI colors.

        less hou.c
    @@ -170,12 +170,12 @@ in the regular expression by escaping it with [] or ““.

    The following regular expression operators are supported:

        () [] * + ? | ""

    For example, one can use the following expression to match a certain declaration statement in hou.c:

    -
        "char"[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*(,[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*)*;
    +
        "char"[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*(,[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*)*;

    The regex engine is also algorithmically efficient. To illustrate the point, ansi.txt contains a pathological expression [2] that guarantees a hang for the competing Perl engine while matching itself. Try to compare these two engines:

    -
        ./hou ansi.txt ansi.txt
    -    perl patho.pl < ansi.txt
    +
        ./hou ansi.txt ansi.txt
    +    perl patho.pl < ansi.txt

    Finally, there are a few limitations…

    • The only escape sequence supported is and it doesn’t work in [].
    • diff --git a/2012/hou/hint.md b/2012/hou/hint.md index 7fb416b18..64124bc35 100644 --- a/2012/hou/hint.md +++ b/2012/hou/hint.md @@ -2,13 +2,13 @@ ### To build: -```sh +``` make hou ``` ### To run: -```sh +``` ./hou syntax-file file-to-process ``` @@ -81,7 +81,7 @@ The following regular expression operators are supported: For example, one can use the following expression to match a certain declaration statement in hou.c: -```c +``` "char"[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*(,[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*)*; ``` @@ -89,7 +89,7 @@ The regex engine is also algorithmically efficient. To illustrate the point, ansi.txt contains a pathological expression [2] that guarantees a hang for the competing Perl engine while matching itself. Try to compare these two engines: -```sh +``` ./hou ansi.txt ansi.txt perl patho.pl < ansi.txt ``` diff --git a/2012/hou/index.html b/2012/hou/index.html index 00ba9ac2c..ba46b41f6 100644 --- a/2012/hou/index.html +++ b/2012/hou/index.html @@ -141,11 +141,11 @@ Location: CN - People’s Republic of C

      To build:

      -
          make
      +
          make

      To use:

      -
          ./hou syntax-file file-to-process
      +
          ./hou syntax-file file-to-process

      Try:

      -
          ./try.sh
      +
          ./try.sh

      View the remarks.htm file in your web browser.

      The result is best viewed in a 80x25 console with ANSI colors.

      Try (Windows):

      @@ -183,13 +183,13 @@ in the regular expression by escaping it with [] or ""
          () [] * + ? | ""

      For example, one can use the following expression to match a certain declaration statement in hou.c:

      -
              "char"[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*(,[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*)*;
      +
              "char"[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*(,[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*)*;

      The regex engine is also algorithmically efficient. To illustrate the point, ansi.txt contains a pathological expression 1 that guarantees a hang for the competing Perl engine while matching itself. Try to compare these two engines:

      -
          ./hou ansi.txt ansi.txt
      -    perl patho.pl < ansi.txt
      +
          ./hou ansi.txt ansi.txt
      +    perl patho.pl < ansi.txt

      Limitations

      Finally, there are a few limitations…

        diff --git a/2012/kang/README.md b/2012/kang/README.md index 44bf535ce..708428292 100644 --- a/2012/kang/README.md +++ b/2012/kang/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,14 +10,14 @@ See [Alternate code](#alternate-code) below for the (fun) rationale here. ## To use: -```sh +``` echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang ``` ## Try: -```sh +``` ./try.sh # try various languages ./en.sh # English 0 through 13 @@ -43,14 +43,14 @@ subtlety of this entry even more. ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang.alt echo vier | ./kang.alt @@ -61,7 +61,7 @@ subtlety of this entry even more. ### Alternate try: -```sh +``` ./try.alt.sh # try various languages ./en.alt.sh # English 0 through 13 @@ -88,13 +88,13 @@ We've added a linefeed to the print format for convenience. Can you explain why: -```sh +``` echo f hundr|./kang ``` correctly reports 500 but: -```sh +``` echo hundr|./kang ``` diff --git a/2012/kang/index.html b/2012/kang/index.html index 67dbb256f..e50d09433 100644 --- a/2012/kang/index.html +++ b/2012/kang/index.html @@ -141,17 +141,17 @@ Location: KR - Republic of Korea (

        To build:

        -
            make
        +
            make

        There is alternate code which fixes some German at the expense of other German. See Alternate code below for the (fun) rationale here.

        To use:

        -
            echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang
        +
            echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang

        Try:

        -
            ./try.sh # try various languages
        -
        -    ./en.sh # English 0 through 13
        -
        -    ./de.sh # German 0 through 13 with both umlauts and without (additional 'e')
        +
            ./try.sh # try various languages
        +
        +    ./en.sh # English 0 through 13
        +
        +    ./de.sh # German 0 through 13 with both umlauts and without (additional 'e')

        How does it have no u or o in a string in the source code and yet it gets uno right?

        Alternate code:

        @@ -164,19 +164,19 @@ deal with it :-) It also breaks other words too and this happens only for one letter change. With this one should hopefully be able to really appreciate the subtlety of this entry even more.

        Alternate build:

        -
            make alt
        +
            make alt

        Alternate use:

        -
            echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang.alt
        -
        -    echo vier | ./kang.alt
        -
        -    echo uno | ./kang.alt
        +
            echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang.alt
        +
        +    echo vier | ./kang.alt
        +
        +    echo uno | ./kang.alt

        Alternate try:

        -
            ./try.alt.sh # try various languages
        -
        -    ./en.alt.sh # English 0 through 13
        -
        -    ./de.alt.sh # German 0 through 13 with both umlauts and without (additional 'e')
        +
            ./try.alt.sh # try various languages
        +
        +    ./en.alt.sh # English 0 through 13
        +
        +    ./de.alt.sh # German 0 through 13 with both umlauts and without (additional 'e')

        What does it get right? What does it get wrong? How does it compare to the original entry without the change of f to v?

        Finally why does it get wrong what it gets wrong?

        @@ -188,9 +188,9 @@ German, Italian, Russian, and Spanish numerals.

        colloquial year numbers of the last millennium.

        We’ve added a linefeed to the print format for convenience.

        Can you explain why:

        -
            echo f hundr|./kang
        +
            echo f hundr|./kang

        correctly reports 500 but:

        -
            echo hundr|./kang
        +
            echo hundr|./kang

        does not report 100, instead printing 0?

        Author’s remarks:

        Synopsis

        diff --git a/2012/konno/README.md b/2012/konno/README.md index 26e23b138..e5e962e3f 100644 --- a/2012/konno/README.md +++ b/2012/konno/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,14 +10,14 @@ code](#alternate-code) below. ## To use: -```sh +``` ./konno N ``` ## Try: -```sh +``` ./try.sh # you can also specify numbers to try before the random and preselected ones: @@ -36,7 +36,7 @@ This alternate code is an unobfuscated version of the winning code. ### Alternate build: -```sh +``` make alt ``` @@ -64,7 +64,7 @@ patterns. Try: -```sh +``` ./konno 30 ./konno 90 ./konno 102 @@ -79,13 +79,13 @@ There are 256 (from 0 through 255) possible rules. This program uses bit operations. I think -```c +``` 7&O<>!o+29 ``` is an interesting operation. This isn't equal to -```c +``` 7&O>>29 ``` diff --git a/2012/konno/index.html b/2012/konno/index.html index a99b7b092..8ee6dfef5 100644 --- a/2012/konno/index.html +++ b/2012/konno/index.html @@ -141,23 +141,23 @@ Location: JP - Japan

        To build:

        -
            make
        +
            make

        There is an unobfuscated version of this entry. See Alternate code below.

        To use:

        -
            ./konno N
        +
            ./konno N

        Try:

        -
            ./try.sh
        -
        -    # you can also specify numbers to try before the random and preselected ones:
        -    ./try.sh 111 222 333 444 555 666 777 888 999
        +
            ./try.sh
        +
        +    # you can also specify numbers to try before the random and preselected ones:
        +    ./try.sh 111 222 333 444 555 666 777 888 999

        Try running try.sh a number of times as the first part randomly selects ten numbers to try.

        Alternate code:

        An alternate version of this entry, konno.alt.c, is provided. This alternate code is an unobfuscated version of the winning code.

        Alternate build:

        -
            make alt
        +
            make alt

        Alternate use:

        Use konno.alt as you would konno above.

        Judges’ remarks:

        @@ -170,17 +170,17 @@ This alternate code is an unobfuscated version of the winning code.

        automaton patterns.

        Try:

        -
            ./konno 30
        -    ./konno 90
        -    ./konno 102
        -    ./konno 109
        -    ./konno 165
        +
            ./konno 30
        +    ./konno 90
        +    ./konno 102
        +    ./konno 109
        +    ./konno 165

        There are 256 (from 0 through 255) possible rules.

        Obfuscation

        This program uses bit operations. I think

        -
            7&O<<!o>>!o+29
        +
            7&O<<!o>>!o+29

        is an interesting operation. This isn’t equal to

        -
            7&O>>29
        +
            7&O>>29

        operation. What is the operation doing?

        Limitation

        This program assumes that the size of int is 4.

        diff --git a/2012/omoikane/README.md b/2012/omoikane/README.md index c1c427f9a..50820868c 100644 --- a/2012/omoikane/README.md +++ b/2012/omoikane/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -12,7 +12,7 @@ theoretically work with Windows which distinguishes binary and text. See ## To use: -```sh +``` ./nyaruko [seed.txt] < original.bin > output.c bash output.c > key.c perl output.c > data.c @@ -30,7 +30,7 @@ binary itself. ## Try: -```sh +``` ./try.sh ``` @@ -53,13 +53,13 @@ binary mode on `stdin` and `stdout`. For the first version: -```sh +``` make alt ``` For the second version: -```sh +``` make alt2 ``` @@ -73,7 +73,7 @@ Use `nyaruko.alt` or `nyaruko.alt2` as you would `nyaruko` above. For the first alternate version: -```sh +``` ./try.alt.sh ``` @@ -93,7 +93,7 @@ The judges have nothing to add that has not already been written about in the `Nyaruko` is a binary to text filter. Given some input on `stdin`, `Nyaruko` will produce C code that reproduces this input on `stdout`: -```sh +``` ./nyaruko < original.bin > output.c gcc output.c -o output ./output > regenerated.bin @@ -102,7 +102,7 @@ The judges have nothing to add that has not already been written about in the Output is encrypted, but both key and data are included in the output. To separate the key from the data, run these commands: -```sh +``` bash output.c > key.c perl output.c > data.c ``` @@ -114,7 +114,7 @@ why the code is formatted the way it is. To combine the key and data, concatenate them together in either order: -```sh +``` cat key.c data.c > output.c cat data.c key.c > output.c ``` @@ -123,7 +123,7 @@ By default, `Nyaruko` generates a unique random key for every message, using `/dev/urandom` as the seed. If given an extra command line argument, `Nyaruko` will seed using that file instead of `/dev/urandom`: -```sh +``` ./nyaruko seed.txt < input.bin > output.c ``` diff --git a/2012/omoikane/index.html b/2012/omoikane/index.html index 09df3b63e..9a37122da 100644 --- a/2012/omoikane/index.html +++ b/2012/omoikane/index.html @@ -141,25 +141,25 @@ Location: US - United States of America

        To build:

        -
            make
        +
            make

        There is an alternate version that will read from the compiled file itself, in case you don’t have a /dev/urandom file. There is also a version that should theoretically work with Windows which distinguishes binary and text. See alternate code below.

        To use:

        -
            ./nyaruko [seed.txt] < original.bin > output.c
        -    bash output.c > key.c
        -    perl output.c > data.c
        -
        -    cat key.c data.c > output.c
        -
        -    cc output.c -o output
        -    ./output > regenerated.bin
        +
            ./nyaruko [seed.txt] < original.bin > output.c
        +    bash output.c > key.c
        +    perl output.c > data.c
        +
        +    cat key.c data.c > output.c
        +
        +    cc output.c -o output
        +    ./output > regenerated.bin

        NOTE: if your OS does not have /dev/urandom then you should specify a seed file or use the alternate version which reads in the compiled binary itself.

        Try:

        -
            ./try.sh
        +
            ./try.sh

        The script try.sh will check if you have perl before trying to use the perl parts of the script.

        Alternate code:

        @@ -171,14 +171,14 @@ is like the first except it also should theoretically work with Windows, setting binary mode on stdin and stdout.

        Alternate build:

        For the first version:

        -
            make alt
        +
            make alt

        For the second version:

        -
            make alt2
        +
            make alt2

        Alternate use:

        Use nyaruko.alt or nyaruko.alt2 as you would nyaruko above.

        Alternate try:

        For the first alternate version:

        -
            ./try.alt.sh
        +
            ./try.alt.sh

        We have no way to test the second version, sorry (tm Canada :-) )!

        Judges’ remarks:

        The judges have nothing to add that has not already been written about in the @@ -187,24 +187,24 @@ binary mode on stdin and stdout.

        Usage

        Nyaruko is a binary to text filter. Given some input on stdin, Nyaruko will produce C code that reproduces this input on stdout:

        -
            ./nyaruko < original.bin > output.c
        -    gcc output.c -o output
        -    ./output > regenerated.bin
        +
            ./nyaruko < original.bin > output.c
        +    gcc output.c -o output
        +    ./output > regenerated.bin

        Output is encrypted, but both key and data are included in the output. To separate the key from the data, run these commands:

        -
            bash output.c > key.c
        -    perl output.c > data.c
        +
            bash output.c > key.c
        +    perl output.c > data.c

        The key-less data.c still compiles, but produces a different message on stdout instead of the original input. This message is a hint to why the code is formatted the way it is.

        To combine the key and data, concatenate them together in either order:

        -
            cat key.c data.c > output.c
        -    cat data.c key.c > output.c
        +
            cat key.c data.c > output.c
        +    cat data.c key.c > output.c

        By default, Nyaruko generates a unique random key for every message, using /dev/urandom as the seed. If given an extra command line argument, Nyaruko will seed using that file instead of /dev/urandom:

        -
            ./nyaruko seed.txt < input.bin > output.c
        +
            ./nyaruko seed.txt < input.bin > output.c

        This makes the output key deterministic, allowing the same key to be shared across different files. On operating systems that do not have /dev/urandom, users should always specify this extra seed argument to avoid indeterministic diff --git a/2012/tromp/README.md b/2012/tromp/README.md index 56362ffbe..e14d41860 100644 --- a/2012/tromp/README.md +++ b/2012/tromp/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all # On a 64-bit machine (default) make tromp32 # On a 32-bit machine @@ -20,7 +20,7 @@ For more detailed information see [2012 tromp bugs](../../bugs.html#2012_tromp). ## To use: -```sh +``` ./tromp [-b] ``` @@ -29,7 +29,7 @@ Use `./tromp32` as you would `./tromp` if on a 32-bit machine. ## To use: -```sh +``` cat ascii-prog.blc data | ./tromp -b cat binary-prog.Blc data | ./tromp ``` @@ -37,7 +37,7 @@ Use `./tromp32` as you would `./tromp` if on a 32-bit machine. ## Try: -```sh +``` ./try.sh ``` @@ -113,7 +113,7 @@ identity function. When its encoding `0010` is fed into the universal machine, it will simply copy the input to the output (well, not that simply, since each byte is smashed to bits and rebuilt from scratch). Voila: a half byte cat: -```sh +``` $ echo " Hello, world" | ./tromp Hello, world ``` @@ -122,7 +122,7 @@ Since the least significant 4 bits of the first byte are just arbitrary padding that is ignored by the program, any character from ASCII 32 (space) through 47 (`/`) will do, e.g.: -```sh +``` $ echo "*Hello, world" | ./tromp Hello, world ``` @@ -134,7 +134,7 @@ If the input doesn't start with a valid program, that is, if the interpreter reaches end-of-file during program parsing, it will crash in some way. E.g. the following might dump core: -```sh +``` echo -n "U" | ./tromp ``` @@ -143,7 +143,7 @@ closed, that is, variable `n` can only appear within at least `n` enclosing lambdas. For instance, here the term `\ 5` is not closed, causing the interpreter to crash when looking into a null-pointer environment: -```sh +``` echo ">Hello, world" | ./tromp ``` @@ -200,7 +200,7 @@ The byte oriented BLC8 version weighs in at 43 bytes (shown in hexadecimal). ``` -```sh +``` $ (cat uni8.Blc; echo " Ni hao") | ./tromp Ni hao ``` @@ -225,7 +225,7 @@ Even shorter than the self-interpreter is this prime number sieve in 167 bits The `n`th bit in the output indicates whether n is prime: -```sh +``` $ cat primes.blc | ./tromp -b | head -c 70 0011010100010100010100010000010100000100010100010000010000010100000100 ``` @@ -265,7 +265,7 @@ The program `hilbert.Blc`, at 143 bytes, is a very twisty "one-liner" (shown in It expects `n` arbitrary characters of input, and draws a space filling [Hilbert curve](https://en.wikipedia.org/wiki/Hilbert_curve) of order `n`: -```sh +``` $ (cat hilbert.Blc; echo -n "1") | ./tromp _ | | @@ -344,7 +344,7 @@ Writing BLC programs can be made slightly less painful with this parser that translates single-letter-variable lambda calculus into BLC: -```sh +``` $ echo "\f\x f (f (f x))" > three $ cat parse.Blc three | ./tromp 000001110011100111010 @@ -358,21 +358,21 @@ into BLC8: So we could assemble an input reversing program as -```sh +``` echo "\a a ((\b b b) (\b \c \d \e d (b b) (\f f c e))) (\b \c c)" > reverse cat parse.Blc reverse | ./tromp > reverse.blc ``` and change it to BLC8 with -```sh +``` $ cat deflate.Blc reverse.blc | ./tromp > rev.Blc $ wc rev.Blc 0 1 9 rev.Blc ``` and then try it out with: -```sh +``` $ cat rev.Blc - | ./tromp Hello, world! ^D @@ -384,7 +384,7 @@ and then try it out with: BLC8 program `symbolic.Blc` shows individual reduction steps on symbolic lambda terms. Here it is used to show the calculation of 2^3 in Church numerals: -```sh +``` $ echo "(\f\x f (f (f x))) (\f\x f (f x))" > threetwo $ cat parse.Blc threetwo | ./tromp > threetwo.blc $ cat symbolic.Blc threetwo.blc | ./tromp @@ -412,7 +412,7 @@ Taking only the first line of output gives us a sort of BLC disassembler, an exact inverse of the above assembler. The prime number sieve disassembles as follows: -```sh +``` $ cat symbolic.Blc primes.blc | ./tromp | head -1 \a (\b b (b ((\c c c) (\c \d \e e (\f \g g) ((\f c c f ((\g g g) (\g f (g g)))) (\f \g \h \i i g (h (d f))))) (\c \d \e b (e c))))) (\b \c c (\d \e d) b) ``` @@ -421,7 +421,7 @@ Hardly any less obfuscated... The last line of -```sh +``` cat symbolic.Blc primes.blc | ./tromp | head -16 ``` @@ -459,7 +459,7 @@ under the interpreter perform much worse than that same program written in Haske Our interpreter copes well with extra levels of interpretation: -```sh +``` $ time cat primes.blc | ./tromp -b | head -c 210 > /dev/null real 0m0.043s $ time cat uni.blc primes.blc | ./tromp -b | head -c 210 > /dev/null diff --git a/2012/tromp/index.html b/2012/tromp/index.html index 4303c1a0b..a8870d1cc 100644 --- a/2012/tromp/index.html +++ b/2012/tromp/index.html @@ -141,21 +141,21 @@ Location: US - United States of America

        To build:

        -
            make all            # On a 64-bit machine (default)
        -
        -    make tromp32                # On a 32-bit machine
        +
            make all            # On a 64-bit machine (default)
        +
        +    make tromp32                # On a 32-bit machine

        Bugs and (Mis)features:

        The current status of this entry is:

            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2012 tromp bugs.

        To use:

        -
            ./tromp [-b]
        +
            ./tromp [-b]

        Use ./tromp32 as you would ./tromp if on a 32-bit machine.

        To use:

        -
            cat ascii-prog.blc data | ./tromp -b
        -    cat binary-prog.Blc data | ./tromp
        +
            cat ascii-prog.blc data | ./tromp -b
        +    cat binary-prog.Blc data | ./tromp

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        The judges dare to say that the data files this entry is processing are more obfuscated than the entry itself.

        @@ -206,23 +206,23 @@ notation) which is the identity function. When its encoding 0010 is fed into the universal machine, it will simply copy the input to the output (well, not that simply, since each byte is smashed to bits and rebuilt from scratch). Voila: a half byte cat:

        -
            $ echo " Hello, world" | ./tromp
        -    Hello, world
        +
            $ echo " Hello, world" | ./tromp
        +    Hello, world

        Since the least significant 4 bits of the first byte are just arbitrary padding that is ignored by the program, any character from ASCII 32 (space) through 47 (/) will do, e.g.:

        -
            $ echo "*Hello, world" | ./tromp
        -    Hello, world
        +
            $ echo "*Hello, world" | ./tromp
        +    Hello, world

        Bad programs

        If the input doesn’t start with a valid program, that is, if the interpreter reaches end-of-file during program parsing, it will crash in some way. E.g. the following might dump core:

        -
            echo -n "U" | ./tromp
        +
            echo -n "U" | ./tromp

        Furthermore, the interpreter requires the initial encoded lambda term to be closed, that is, variable n can only appear within at least n enclosing lambdas. For instance, here the term \ 5 is not closed, causing the interpreter to crash when looking into a null-pointer environment:

        -
            echo ">Hello, world" | ./tromp
        +
            echo ">Hello, world" | ./tromp

        will likely dump core.

        Since these properties can be checked when creating BLC programs, @@ -265,8 +265,8 @@ as a self interpreter in BLC it is downright minuscule at 232 bits (29 bytes):

    -
        $ (cat uni8.Blc; echo " Ni hao") | ./tromp
    -    Ni hao
    +
        $ (cat uni8.Blc; echo " Ni hao") | ./tromp
    +    Ni hao

    A prime number sieve

    Even shorter than the self-interpreter is this prime number sieve in 167 bits (under 21 bytes):

    @@ -281,8 +281,8 @@ as a self interpreter in BLC it is downright minuscule at 232 bits (29 bytes):

    The nth bit in the output indicates whether n is prime:

    -
        $ cat primes.blc | ./tromp -b | head -c 70
    -    0011010100010100010100010000010100000100010100010000010000010100000100
    +
        $ cat primes.blc | ./tromp -b | head -c 70
    +    0011010100010100010100010000010100000100010100010000010000010100000100

    For those who prefer to digest their primes in decimal, there is oddindices.Blc, which will print the indices of all odd characters (with LSB = 1) @@ -308,43 +308,43 @@ separated by a given character:

    60 8191a00167fb cbcfdf65f7c0 a20

    It expects n arbitrary characters of input, and draws a space filling Hilbert curve of order n:

    -
        $  (cat hilbert.Blc; echo -n "1") | ./tromp
    -     _
    -    | |
    -
    -    $ (cat hilbert.Blc; echo -n "12") | ./tromp
    -     _   _
    -    | |_| |
    -    |_   _|
    -     _| |_
    -
    -    $ (cat hilbert.Blc; echo -n "123") | ./tromp
    -     _   _   _   _
    -    | |_| | | |_| |
    -    |_   _| |_   _|
    -     _| |_____| |_
    -    |  ___   ___  |
    -    |_|  _| |_  |_|
    -     _  |_   _|  _
    -    | |___| |___| |
    -
    -    $ (cat hilbert.Blc; echo -n "1234") | ./tromp
    -     _   _   _   _   _   _   _   _
    -    | |_| | | |_| | | |_| | | |_| |
    -    |_   _| |_   _| |_   _| |_   _|
    -     _| |_____| |_   _| |_____| |_
    -    |  ___   ___  | |  ___   ___  |
    -    |_|  _| |_  |_| |_|  _| |_  |_|
    -     _  |_   _|  _   _  |_   _|  _
    -    | |___| |___| |_| |___| |___| |
    -    |_   ___   ___   ___   ___   _|
    -     _| |_  |_|  _| |_  |_|  _| |_
    -    |  _  |  _  |_   _|  _  |  _  |
    -    |_| |_| | |___| |___| | |_| |_|
    -     _   _  |  ___   ___  |  _   _
    -    | |_| | |_|  _| |_  |_| | |_| |
    -    |_   _|  _  |_   _|  _  |_   _|
    -     _| |___| |___| |___| |___| |_
    +
        $  (cat hilbert.Blc; echo -n "1") | ./tromp
    +     _
    +    | |
    +
    +    $ (cat hilbert.Blc; echo -n "12") | ./tromp
    +     _   _
    +    | |_| |
    +    |_   _|
    +     _| |_
    +
    +    $ (cat hilbert.Blc; echo -n "123") | ./tromp
    +     _   _   _   _
    +    | |_| | | |_| |
    +    |_   _| |_   _|
    +     _| |_____| |_
    +    |  ___   ___  |
    +    |_|  _| |_  |_|
    +     _  |_   _|  _
    +    | |___| |___| |
    +
    +    $ (cat hilbert.Blc; echo -n "1234") | ./tromp
    +     _   _   _   _   _   _   _   _
    +    | |_| | | |_| | | |_| | | |_| |
    +    |_   _| |_   _| |_   _| |_   _|
    +     _| |_____| |_   _| |_____| |_
    +    |  ___   ___  | |  ___   ___  |
    +    |_|  _| |_  |_| |_|  _| |_  |_|
    +     _  |_   _|  _   _  |_   _|  _
    +    | |___| |___| |_| |___| |___| |
    +    |_   ___   ___   ___   ___   _|
    +     _| |_  |_|  _| |_  |_|  _| |_
    +    |  _  |  _  |_   _|  _  |  _  |
    +    |_| |_| | |___| |___| | |_| |_|
    +     _   _  |  ___   ___  |  _   _
    +    | |_| | |_|  _| |_  |_| | |_| |
    +    |_   _|  _  |_   _|  _  |_   _|
    +     _| |___| |___| |___| |___| |_

    A Brainfuck interpreter

    The smallest known BF interpreter is written in… you guessed it, BLC, @@ -370,56 +370,56 @@ followed by a ], followed by the input for the Brainfuck program.A BLC assembler

    Writing BLC programs can be made slightly less painful with this parser that translates single-letter-variable lambda calculus into BLC:

    -
        $ echo "\f\x f (f (f x))" > three
    -    $ cat parse.Blc three | ./tromp
    -    000001110011100111010
    +
        $ echo "\f\x f (f (f x))" > three
    +    $ cat parse.Blc three | ./tromp
    +    000001110011100111010

    Converting between bits and bytes

    The program inflate.Blc and its inverse deflate.Blc allow us to translate between BLC and BLC8. If you assemble a byte oriented program, you’ll need to compact it into BLC8:

    So we could assemble an input reversing program as

    -
        echo "\a a ((\b b b) (\b \c \d \e d (b b) (\f f c e))) (\b \c c)" > reverse
    -    cat parse.Blc reverse | ./tromp > reverse.blc
    +
        echo "\a a ((\b b b) (\b \c \d \e d (b b) (\f f c e))) (\b \c c)" > reverse
    +    cat parse.Blc reverse | ./tromp > reverse.blc

    and change it to BLC8 with

    -
        $ cat deflate.Blc reverse.blc | ./tromp > rev.Blc
    -    $ wc rev.Blc
    -        0 1 9 rev.Blc
    +
        $ cat deflate.Blc reverse.blc | ./tromp > rev.Blc
    +    $ wc rev.Blc
    +        0 1 9 rev.Blc

    and then try it out with:

    -
        $ cat rev.Blc - | ./tromp
    -    Hello, world!
    -    ^D
    -    !dlrow ,olleH
    +
        $ cat rev.Blc - | ./tromp
    +    Hello, world!
    +    ^D
    +    !dlrow ,olleH

    Symbolic Lambda Calculus reduction

    BLC8 program symbolic.Blc shows individual reduction steps on symbolic lambda terms. Here it is used to show the calculation of 2^3 in Church numerals:

    -
        $ echo "(\f\x f (f (f x))) (\f\x f (f x))" > threetwo
    -    $ cat parse.Blc threetwo | ./tromp > threetwo.blc
    -    $ cat symbolic.Blc threetwo.blc | ./tromp
    -    (\a \b a (a (a b))) (\a \b a (a b))
    -    \a (\b \c b (b c)) ((\b \c b (b c)) ((\b \c b (b c)) a))
    -    \a \b (\c \d c (c d)) ((\c \d c (c d)) a) ((\c \d c (c d)) ((\c \d c (c d)) a) b)
    -    \a \b (\c (\d \e d (d e)) a ((\d \e d (d e)) a c)) ((\c \d c (c d)) ((\c \d c (c d)) a) b)
    -    \a \b (\c \d c (c d)) a ((\c \d c (c d)) a ((\c \d c (c d)) ((\c \d c (c d)) a) b))
    -    \a \b (\c a (a c)) ((\c \d c (c d)) a ((\c \d c (c d)) ((\c \d c (c d)) a) b))
    -    \a \b a (a ((\c \d c (c d)) a ((\c \d c (c d)) ((\c \d c (c d)) a) b)))
    -    \a \b a (a ((\c a (a c)) ((\c \d c (c d)) ((\c \d c (c d)) a) b)))
    -    \a \b a (a (a (a ((\c \d c (c d)) ((\c \d c (c d)) a) b))))
    -    \a \b a (a (a (a ((\c (\d \e d (d e)) a ((\d \e d (d e)) a c)) b))))
    -    \a \b a (a (a (a ((\c \d c (c d)) a ((\c \d c (c d)) a b)))))
    -    \a \b a (a (a (a ((\c a (a c)) ((\c \d c (c d)) a b)))))
    -    \a \b a (a (a (a (a (a ((\c \d c (c d)) a b))))))
    -    \a \b a (a (a (a (a (a ((\c a (a c)) b))))))
    -    \a \b a (a (a (a (a (a (a (a b)))))))
    +
        $ echo "(\f\x f (f (f x))) (\f\x f (f x))" > threetwo
    +    $ cat parse.Blc threetwo | ./tromp > threetwo.blc
    +    $ cat symbolic.Blc threetwo.blc | ./tromp
    +    (\a \b a (a (a b))) (\a \b a (a b))
    +    \a (\b \c b (b c)) ((\b \c b (b c)) ((\b \c b (b c)) a))
    +    \a \b (\c \d c (c d)) ((\c \d c (c d)) a) ((\c \d c (c d)) ((\c \d c (c d)) a) b)
    +    \a \b (\c (\d \e d (d e)) a ((\d \e d (d e)) a c)) ((\c \d c (c d)) ((\c \d c (c d)) a) b)
    +    \a \b (\c \d c (c d)) a ((\c \d c (c d)) a ((\c \d c (c d)) ((\c \d c (c d)) a) b))
    +    \a \b (\c a (a c)) ((\c \d c (c d)) a ((\c \d c (c d)) ((\c \d c (c d)) a) b))
    +    \a \b a (a ((\c \d c (c d)) a ((\c \d c (c d)) ((\c \d c (c d)) a) b)))
    +    \a \b a (a ((\c a (a c)) ((\c \d c (c d)) ((\c \d c (c d)) a) b)))
    +    \a \b a (a (a (a ((\c \d c (c d)) ((\c \d c (c d)) a) b))))
    +    \a \b a (a (a (a ((\c (\d \e d (d e)) a ((\d \e d (d e)) a c)) b))))
    +    \a \b a (a (a (a ((\c \d c (c d)) a ((\c \d c (c d)) a b)))))
    +    \a \b a (a (a (a ((\c a (a c)) ((\c \d c (c d)) a b)))))
    +    \a \b a (a (a (a (a (a ((\c \d c (c d)) a b))))))
    +    \a \b a (a (a (a (a (a ((\c a (a c)) b))))))
    +    \a \b a (a (a (a (a (a (a (a b)))))))

    As expected, the resulting normal form is Church numeral 8.

    Taking only the first line of output gives us a sort of BLC disassembler, an exact inverse of the above assembler. The prime number sieve disassembles as follows:

    -
        $ cat symbolic.Blc primes.blc | ./tromp | head -1
    -    \a (\b b (b ((\c c c) (\c \d \e e (\f \g g) ((\f c c f ((\g g g) (\g f (g g)))) (\f \g \h \i i g (h (d f))))) (\c \d \e b (e c))))) (\b \c c (\d \e d) b)
    +
        $ cat symbolic.Blc primes.blc | ./tromp | head -1
    +    \a (\b b (b ((\c c c) (\c \d \e e (\f \g g) ((\f c c f ((\g g g) (\g f (g g)))) (\f \g \h \i i g (h (d f))))) (\c \d \e b (e c))))) (\b \c c (\d \e d) b)

    Hardly any less obfuscated…

    The last line of

    -
        cat symbolic.Blc primes.blc | ./tromp | head -16
    +
        cat symbolic.Blc primes.blc | ./tromp | head -16

    starts out as

        \a \b b (\c \d c) (\c c (\d \e d) (\d d (\e \f f) (\e e (\f \g g) ((\f (\g \h \i

    The \a is for ignoring the rest of the input (to which the universal machine @@ -444,16 +444,16 @@ Syntax which relies on the highly optimized Haskell runtime system for evaluation. Of course individual BLC programs running under the interpreter perform much worse than that same program written in Haskell.

    Our interpreter copes well with extra levels of interpretation:

    -
        $ time cat primes.blc | ./tromp -b | head -c 210 > /dev/null
    -    real    0m0.043s
    -    $ time cat uni.blc primes.blc | ./tromp -b | head -c 210 > /dev/null
    -    real    0m0.191s
    -    $ time cat uni.blc uni.blc primes.blc | ./tromp -b | head -c 210 > /dev/null
    -    real    0m1.919s
    -    $ time cat uni.blc uni.blc uni.blc primes.blc | ./tromp -b | head -c 210 > /dev/null
    -    real    0m23.514s
    -    $ time cat uni.blc uni.blc uni.blc uni.blc primes.blc | ./tromp -b | head -c 210 > /dev/null
    -    real    4m52.700s
    +
        $ time cat primes.blc | ./tromp -b | head -c 210 > /dev/null
    +    real    0m0.043s
    +    $ time cat uni.blc primes.blc | ./tromp -b | head -c 210 > /dev/null
    +    real    0m0.191s
    +    $ time cat uni.blc uni.blc primes.blc | ./tromp -b | head -c 210 > /dev/null
    +    real    0m1.919s
    +    $ time cat uni.blc uni.blc uni.blc primes.blc | ./tromp -b | head -c 210 > /dev/null
    +    real    0m23.514s
    +    $ time cat uni.blc uni.blc uni.blc uni.blc primes.blc | ./tromp -b | head -c 210 > /dev/null
    +    real    4m52.700s

    Obfuscation

    Obfuscation is due entirely to conciseness. Some questions to ponder:

    Which of the term space codes 0, 1, 2, 3 serve multiple purposes?

    diff --git a/2012/vik/README.md b/2012/vik/README.md index bf71396a2..3e6a8450a 100644 --- a/2012/vik/README.md +++ b/2012/vik/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -25,38 +25,38 @@ For more detailed information see [2012 vik bugs](../../bugs.html#2012_vik). To embed text (from file or command line): -```sh +``` ./vik e base.png filename > encodedimg.png ``` or -```sh +``` ./vik e base.png SomeRandomText > encodedimg.png ``` To extract the embedded text: -```sh +``` ./vik d encodedimg.png ``` To embed a PNG into another: -```sh +``` ./vik e base.png source.png > encodedimg.png ``` To extract the embedded PNG: -```sh +``` ./vik d encodedimg.png > restored.png ``` ## Try: -```sh +``` ./try.sh ``` @@ -68,7 +68,7 @@ For those few who might use Windows this alternate code might work. ### Alternate build: -```sh +``` make alt ``` @@ -116,7 +116,7 @@ possible to get the bitmap data from the extracted image, and run it through any of the previous winning brainfuck interpreters, but I thought it would be easier to include an interpreter in the program to avoid the hassle: -```sh +``` ./vik e ioccc.png chocolate.png > encodedimg.png ./vik b encodedimg.png ``` @@ -125,7 +125,7 @@ It is of course also possible to embed a [brainfuck](https://en.wikipedia.org/wiki/Brainfuck) program as a text file (as explained above) and decode it, e.g.: -```sh +``` ./vik e ioccc.png .+[.+] > encodedimg.png ./vik b encodedimg.png ``` @@ -154,7 +154,7 @@ compile the program on this platform, the following line can be added after the variable declarations in the main declaration in order to run correctly: -```c +``` _setmode(_fileno(stdout), 0x8000); ``` diff --git a/2012/vik/index.html b/2012/vik/index.html index 2db153246..76d85455d 100644 --- a/2012/vik/index.html +++ b/2012/vik/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

    To build:

    -
        make
    +
        make

    This entry requires Zlib.

    There is an alternate version which might work for Windows. See Alternate code section below.

    @@ -151,21 +151,21 @@ code section below.

    For more detailed information see 2012 vik bugs.

    To use:

    To embed text (from file or command line):

    -
        ./vik e base.png filename > encodedimg.png
    +
        ./vik e base.png filename > encodedimg.png

    or

    -
        ./vik e base.png SomeRandomText > encodedimg.png
    +
        ./vik e base.png SomeRandomText > encodedimg.png

    To extract the embedded text:

    -
        ./vik d encodedimg.png
    +
        ./vik d encodedimg.png

    To embed a PNG into another:

    -
        ./vik e base.png source.png > encodedimg.png
    +
        ./vik e base.png source.png > encodedimg.png

    To extract the embedded PNG:

    -
        ./vik d encodedimg.png > restored.png
    +
        ./vik d encodedimg.png > restored.png

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Alternate code:

    For those few who might use Windows this alternate code might work.

    Alternate build:

    -
        make alt
    +
        make alt

    Alternate use:

    Use vik.alt as you would vik above.

    Judges’ remarks:

    @@ -196,13 +196,13 @@ into another image and extracted, the bitmap data is also a valid possible to get the bitmap data from the extracted image, and run it through any of the previous winning brainfuck interpreters, but I thought it would be easier to include an interpreter in the program to avoid the hassle:

    -
        ./vik e ioccc.png chocolate.png > encodedimg.png
    -    ./vik b encodedimg.png
    +
        ./vik e ioccc.png chocolate.png > encodedimg.png
    +    ./vik b encodedimg.png

    It is of course also possible to embed a brainfuck program as a text file (as explained above) and decode it, e.g.:

    -
        ./vik e ioccc.png .+[.+] > encodedimg.png
    -    ./vik b encodedimg.png
    +
        ./vik e ioccc.png .+[.+] > encodedimg.png
    +    ./vik b encodedimg.png

    Obfuscation

    I really wanted to keep the program simple, so instead of adding multiple macros or helper methods that can be confusing, I placed all functionality in the @@ -221,7 +221,7 @@ binary data to stdout.

    compile the program on this platform, the following line can be added after the variable declarations in the main declaration in order to run correctly:

    -
        _setmode(_fileno(stdout), 0x8000);
    +
        _setmode(_fileno(stdout), 0x8000);

    NOTE: this is what the Alternate code does.

    Limitations

    The program doesn’t have many error checks so passing in invalid arguments diff --git a/2012/zeitak/README.md b/2012/zeitak/README.md index 09c2eaef3..af170b91f 100644 --- a/2012/zeitak/README.md +++ b/2012/zeitak/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,7 +10,7 @@ code](#alternate-code) below. ## To use: -```sh +``` ./zeitak < file ``` @@ -21,7 +21,7 @@ text files that are not code. ## Try: -```sh +``` make test ``` @@ -38,7 +38,7 @@ understand this extremely subtle entry. ### Alternate build: -```sh +``` make alt ``` @@ -92,7 +92,7 @@ around it's position. * Ignores parenthesis inside strings or character constants, so no errors will be detected in the following line: -```c +``` printf(")"); ``` @@ -104,7 +104,7 @@ around it's position. * Escapes (e.g. `\"`) are ignored, so the following line will produce an error: -```c +``` printf("\""); ``` diff --git a/2012/zeitak/index.html b/2012/zeitak/index.html index 8e61349b1..caa66c1b6 100644 --- a/2012/zeitak/index.html +++ b/2012/zeitak/index.html @@ -141,16 +141,16 @@ Location: IL - State of Israel (

    To build:

    -
        make
    +
        make

    There is an alternate version that is slightly deobfuscated. See alternate code below.

    To use:

    -
        ./zeitak < file
    +
        ./zeitak < file

    where file is the file to be checked for nesting errors. For example, you may try incorrect.c and the program itself. You may also run it on text files that are not code.

    Try:

    -
        make test
    +
        make test

    NOTE: the program prints an error and exits on the first nesting error so it will not detect multiple issues.

    Alternate code:

    @@ -158,7 +158,7 @@ will not detect multiple issues.

    deobfuscated by the author. You may find reading it helpful in your attempt to understand this extremely subtle entry.

    Alternate build:

    -
        make alt
    +
        make alt

    Alternate use:

    Use zeitak.alt as you would zeitak above.

    Judges’ remarks:

    @@ -188,7 +188,7 @@ around it’s position.

  • Ignores parenthesis inside strings or character constants, so no errors will be detected in the following line:
  • -
        printf(")");
    +
        printf(")");
    @@ -197,7 +197,7 @@ will be detected in the following line:
  • Escapes (e.g. \") are ignored, so the following line will produce an error:
  • -
        printf("\"");
    +
        printf("\"");

    Obfuscation

    IOCCC entries already contain entries without digits, control-flow keywords and certain operators in their source. This entry has an diff --git a/2013/README.md b/2013/README.md index 7b830f0cc..b9960cb1d 100644 --- a/2013/README.md +++ b/2013/README.md @@ -43,13 +43,13 @@ had to print a value 2053 or less when the `-i` flag was used. Several people discovered an undocumented feature in that certain comments such as: -```c +``` ///* ``` or: -```c +``` *\ / ``` diff --git a/2013/birken/README.md b/2013/birken/README.md index c0f903d53..e6b3901a7 100644 --- a/2013/birken/README.md +++ b/2013/birken/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make alt ``` @@ -11,7 +11,7 @@ version see the [original code](#original-code) section below. ## To use: -```sh +``` ./birken.alt < 17_columns_wide_paint_by_numbers_file ``` @@ -30,7 +30,7 @@ it should you wish (see below). To see the program run on each text file, try: -```sh +``` ./try.alt.sh ``` @@ -44,7 +44,7 @@ other entries where this was made an alternate version it is configurable at compile time. If you wish to speed it up by 100% you can instead do: -```sh +``` make clobber SLEEP=7500 alt ``` @@ -55,7 +55,7 @@ If you wish to speed that up 200% (300% total) you can use instead try ctrl-c to terminate the program early but note that the terminal is likely to be messed up. In that case try: -```sh +``` reset ``` @@ -70,7 +70,7 @@ hard to see the art of the entry but you may do so if you wish. ### Original build: -```sh +``` make all ``` @@ -84,7 +84,7 @@ Use `birken` as you would `birken.alt` above. To use the demo script with the original code, try: -```sh +``` ./try.sh ``` @@ -96,7 +96,7 @@ PLEASE be careful if you are sensitive to flashing colours! This program also wins the "Most amusing abuse of the iocccsize tool" award; although not the absolute best: it is possible to achieve 0 by writing: -```c +``` /* *\ /.... ``` @@ -319,7 +319,7 @@ This program demonstrates how to exploit a bug in IOCCC size tool version If that line is added to the top of any program, the tool will report a size of 8. -```sh +``` $ ./iocccsize -i < prog.c 8 ``` @@ -327,7 +327,7 @@ If that line is added to the top of any program, the tool will report a size of When that line is deleted from this program, the tool properly reports the secondary size limit of the program as 2048. -```sh +``` $ ./iocccsize -i < birken.c 2048 ``` @@ -357,7 +357,7 @@ Carefully selected variable names also yielded wonderful expressions like `l=0`, `O=0`, `O=1` and `while(O)`. `"Tetris"` also makes a second appearance of sorts: -```c +``` [T][e][t]--; while(R+i) { s ``` diff --git a/2013/birken/index.html b/2013/birken/index.html index d02aeee5c..0c3c55d2c 100644 --- a/2013/birken/index.html +++ b/2013/birken/index.html @@ -141,12 +141,12 @@ Location: US - United States of America

    To build:

    -
        make alt
    +
        make alt

    We recommend that you use the alt version first to see what this entry looked like back in 2013 (with a configurable speed). If you wish to use the original version see the original code section below.

    To use:

    -
        ./birken.alt < 17_columns_wide_paint_by_numbers_file
    +
        ./birken.alt < 17_columns_wide_paint_by_numbers_file

    NOTE: if your terminal is messed up after running this (perhaps from exiting before it finishes) try using reset to restore the terminal. This will clear the screen.

    @@ -157,7 +157,7 @@ be problematic for some people, can be configured to different speeds by way of the value used in usleep(3). The default is 13500 but you can reconfigure it should you wish (see below).

    To see the program run on each text file, try:

    -
        ./try.alt.sh
    +
        ./try.alt.sh

    If you have perl installed it will also try a random run.

    Finding the ‘right’ default value was a fine line; the default, 15000 microseconds (0.015 seconds), will take quite a while to finish but it allows @@ -165,30 +165,30 @@ one to more easily see what is going on. Even easier to see would be 25000 but these values make it quite slow and one could easily lose interest. Like some other entries where this was made an alternate version it is configurable at compile time. If you wish to speed it up by 100% you can instead do:

    -
        make clobber SLEEP=7500 alt
    +
        make clobber SLEEP=7500 alt

    and then try birken.alt as above.

    If you wish to speed that up 200% (300% total) you can use instead try SLEEP=3750. Doing this you might find the right value to your liking; use ctrl-c to terminate the program early but note that the terminal is likely to be messed up. In that case try:

    -
        reset
    +
        reset

    to make it sane again (running to completion will do that for you).

    Original code:

    The original code will run faster with modern systems which is likely to make it hard to see the art of the entry but you may do so if you wish.

    Original build:

    -
        make all
    +
        make all

    Original use:

    Use birken as you would birken.alt above.

    Original try:

    To use the demo script with the original code, try:

    -
        ./try.sh
    +
        ./try.sh

    PLEASE be careful if you are sensitive to flashing colours!

    Judges’ remarks:

    This program also wins the “Most amusing abuse of the iocccsize tool” award; although not the absolute best: it is possible to achieve 0 by writing:

    -
        /* *\
    -    /....
    +
        /* *\
    +    /....

    The game of Tetris had been used in many endeavors, from studying algorithmic complexity to treating PTSD and @@ -346,12 +346,12 @@ call to fflush(3) (N.B: see birken.alt.c 2013-07-30-v17. The first line of the program is reproduced below.

    char_ = “’”“/”;

    If that line is added to the top of any program, the tool will report a size of 8.

    -
        $ ./iocccsize -i < prog.c
    -    8
    +
        $ ./iocccsize -i < prog.c
    +    8

    When that line is deleted from this program, the tool properly reports the secondary size limit of the program as 2048.

    -
        $ ./iocccsize -i < birken.c
    -    2048
    +
        $ ./iocccsize -i < birken.c
    +    2048

    Although this bug provides an easy means of circumventing contest rule 2, as demonstrated from the size value, this entry is not necessarily striving for a ‘worst abuse of the rules’ award.

    @@ -371,7 +371,7 @@ Pajitnov’s original 1984

    Carefully selected variable names also yielded wonderful expressions like l=0, O=0, O=1 and while(O). "Tetris" also makes a second appearance of sorts:

    -
        [T][e][t]--; while(R+i) { s
    +
        [T][e][t]--; while(R+i) { s

    The source is formatted to resemble the Tetris play-field mid-game. It is also an homage to all the past IOCCC entries formatted as a compact diff --git a/2013/cable1/README.md b/2013/cable1/README.md index 235235141..60ccaaaba 100644 --- a/2013/cable1/README.md +++ b/2013/cable1/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./cable1 name group1 group2 ``` ## Try: -```sh +``` ./try.sh ``` @@ -26,39 +26,39 @@ We need not limit ourselves to the two major political parties in the US today. Let us consider: -```sh +``` ./cable1 Cooper Mac PC ``` Simon works for Apple, so you would expect Mac. :-) Landon is a long time Mac user: -```sh +``` ./cable1 Noll Mac PC ``` That works too! Now Leo brings PCs to the IOCCC judging for cross-platform testing: -```sh +``` ./cable1 Broukhis Mac PC ``` We can test other people. The late Steve Jobs: -```sh +``` ./cable1 Jobs Mac PC ``` That works! How about Bill? -```sh +``` ./cable1 Gates Mac PC ``` A PC guy as expected. What about that other Steve? -```sh +``` ./cable1 Ballmer Mac PC ``` diff --git a/2013/cable1/index.html b/2013/cable1/index.html index c8628621a..522b95ae6 100644 --- a/2013/cable1/index.html +++ b/2013/cable1/index.html @@ -141,28 +141,28 @@ Location: US - United States of America

    To build:

    -
        make
    +
        make

    To use:

    -
        ./cable1 name group1 group2
    +
        ./cable1 name group1 group2

    Try:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    Partisan may be defined as a strong supporter of a cause, party or person. We need not limit ourselves to the two major political parties in the US today.

    Let us consider:

    -
        ./cable1 Cooper Mac PC
    +
        ./cable1 Cooper Mac PC

    Simon works for Apple, so you would expect Mac. :-) Landon is a long time Mac user:

    -
        ./cable1 Noll Mac PC
    +
        ./cable1 Noll Mac PC

    That works too! Now Leo brings PCs to the IOCCC judging for cross-platform testing:

    -
        ./cable1 Broukhis Mac PC
    +
        ./cable1 Broukhis Mac PC

    We can test other people. The late Steve Jobs:

    -
        ./cable1 Jobs Mac PC
    +
        ./cable1 Jobs Mac PC

    That works! How about Bill?

    -
        ./cable1 Gates Mac PC
    +
        ./cable1 Gates Mac PC

    A PC guy as expected. What about that other Steve?

    -
        ./cable1 Ballmer Mac PC
    +
        ./cable1 Ballmer Mac PC

    Humm .. maybe there is a hidden reason he is leaving the late Micro$oft? :-) Why late? Because:

    diff --git a/2013/cable2/README.md b/2013/cable2/README.md index 2c90d9ac5..fceb15381 100644 --- a/2013/cable2/README.md +++ b/2013/cable2/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2013 cable2 bugs](../../bugs.html#2013_cable2 ## To use: -```sh +``` ./cable2 file.bmp [color] ``` @@ -27,7 +27,7 @@ For more detailed information see [2013 cable2 bugs](../../bugs.html#2013_cable2 For different OCR examples: -```sh +``` ./try.sh ``` diff --git a/2013/cable2/index.html b/2013/cable2/index.html index 23f3e1b2d..4a91727d0 100644 --- a/2013/cable2/index.html +++ b/2013/cable2/index.html @@ -141,16 +141,16 @@ Location: US - United States of America

    To build:

    -
        make
    +
        make

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 2013 cable2 bugs.

    To use:

    -
        ./cable2 file.bmp [color]
    +
        ./cable2 file.bmp [color]

    Try:

    For different OCR examples:

    -
        ./try.sh
    +
        ./try.sh

    Judges’ remarks:

    We can confirm that this is the first time the IOCCC has been used to peer-review a new research. We had quite a bit of fun with a sharpie and a diff --git a/2013/cable3/README.md b/2013/cable3/README.md index dc211d824..b3c876d8e 100644 --- a/2013/cable3/README.md +++ b/2013/cable3/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,14 +10,14 @@ available. See the [Alternate code](#alternate-code) section below. ## To use: -```sh +``` ./cable3 bios-image-file floppy-image-file [harddisk-image-file] ``` ## Try: -```sh +``` ./cable3.sh ``` @@ -46,7 +46,7 @@ An alternate version, which should compile in Windows, is provided. Assuming `make` is available and will function: -```sh +``` make alt ``` @@ -173,7 +173,7 @@ non-UNIX platforms. For example, for Windows/MS Visual Studio, instead of the Makefile definition of KB, use something slightly different - add the following entry to the Preprocessor Definitions list in the Project Properties page: -```c +``` KB=(kb=H(8),kbhit())&&(r[1190]=getch(),H(7)) ``` @@ -189,7 +189,7 @@ offsets) this is not the case, and to run successfully on these systems, you will need to explicitly declare these functions by adding the appropriate include to the top of the source: -```c +``` #include ``` @@ -197,7 +197,7 @@ NOTE: this has been done in [cable3.c](cable3.c). ### Usage -```sh +``` ./cable3 bios-image-file floppy-image-file [harddisk-image-file] ``` @@ -205,7 +205,7 @@ PLEASE NOTE that under Unices the keyboard must be in raw mode for the emulator to work properly. Therefore the emulator is best run from a shell script that looks something like: -```sh +``` stty cbreak raw -echo min 0 ./cable3 bios floppy.img harddisk.img stty cooked echo @@ -223,7 +223,7 @@ put the keyboard into raw mode (and afterwards it needs to be put back to cooked). So, run the emulator using something like this script (provided as [cable3.sh](cable3.sh)): -```sh +``` stty cbreak raw -echo min 0 ./cable3 bios fd.img stty cooked echo @@ -237,7 +237,7 @@ whole bunch of software which is in the included file `hd.img`. For the more adventurous, you can start off with (for example) a blank 40MB image file called hd.img made using e.g. Makefile. Then use: -```sh +``` stty cbreak raw -echo min 0 ./cable3 bios fd.img hd.img stty cooked echo diff --git a/2013/cable3/index.html b/2013/cable3/index.html index 4609a6b90..62718c749 100644 --- a/2013/cable3/index.html +++ b/2013/cable3/index.html @@ -141,13 +141,13 @@ Location: US - United States of America

    To build:

    -
        make
    +
        make

    An alternate version that should compile in Windows/MS Visual Studio is available. See the Alternate code section below.

    To use:

    -
        ./cable3 bios-image-file floppy-image-file [harddisk-image-file]
    +
        ./cable3 bios-image-file floppy-image-file [harddisk-image-file]

    Try:

    -
        ./cable3.sh
    +
        ./cable3.sh

    NOTE: to quit the program type QUITEMU. You might have to be at the top level directory of the drive, A: or C:.

    To send an Alt+XXX key combination, press (^A / Ctrl+A) then the key, so @@ -162,7 +162,7 @@ combinations are left for the discovery of the user.

    An alternate version, which should compile in Windows, is provided.

    Alternate build:

    Assuming make is available and will function:

    -
        make alt
    +
        make alt

    Alternate use:

    Use cable3.alt as you would cable3 above.

    Judges’ remarks:

    @@ -264,7 +264,7 @@ has no stty. Therefore the Makefile includes a -D opti non-UNIX platforms. For example, for Windows/MS Visual Studio, instead of the Makefile definition of KB, use something slightly different - add the following entry to the Preprocessor Definitions list in the Project Properties page:

    -
        KB=(kb=H(8),kbhit())&&(r[1190]=getch(),H(7))
    +
        KB=(kb=H(8),kbhit())&&(r[1190]=getch(),H(7))

    NOTE: this is done in the Alternate code.

    POSIX portability note

    The code as supplied uses implicit function declarations for POSIX file I/O and @@ -273,16 +273,16 @@ architecture. For some systems (e.g. 32-bit Mac OS X, which uses 64-bit file offsets) this is not the case, and to run successfully on these systems, you will need to explicitly declare these functions by adding the appropriate include to the top of the source:

    -
        #include <unistd.h>
    +
        #include <unistd.h>

    NOTE: this has been done in cable3.c.

    Usage

    -
        ./cable3 bios-image-file floppy-image-file [harddisk-image-file]
    +
        ./cable3 bios-image-file floppy-image-file [harddisk-image-file]

    PLEASE NOTE that under Unices the keyboard must be in raw mode for the emulator to work properly. Therefore the emulator is best run from a shell script that looks something like:

    -
        stty cbreak raw -echo min 0
    -    ./cable3 bios floppy.img harddisk.img
    -    stty cooked echo
    +
        stty cbreak raw -echo min 0
    +    ./cable3 bios floppy.img harddisk.img
    +    stty cooked echo

    See the cable3.sh script.

    To use the emulator - floppy mode only

    The simplest use of the emulator is with a single floppy boot disk image, like @@ -291,17 +291,17 @@ the fd.img provided, which is a FreeDOS boot disk.

    put the keyboard into raw mode (and afterwards it needs to be put back to cooked). So, run the emulator using something like this script (provided as cable3.sh):

    -
        stty cbreak raw -echo min 0
    -    ./cable3 bios fd.img
    -    stty cooked echo
    +
        stty cbreak raw -echo min 0
    +    ./cable3 bios fd.img
    +    stty cooked echo

    To use the emulator - floppy + HD mode

    Easiest to start with is to try a ready-made 40MB hard disk image containing a whole bunch of software which is in the included file hd.img.

    For the more adventurous, you can start off with (for example) a blank 40MB image file called hd.img made using e.g. Makefile. Then use:

    -
        stty cbreak raw -echo min 0
    -    ./cable3 bios fd.img hd.img
    -    stty cooked echo
    +
        stty cbreak raw -echo min 0
    +    ./cable3 bios fd.img hd.img
    +    stty cooked echo

    Preparing the hard disk for use in the emulator is done just like a real PC. Boot the emulator, and use FDISK to partition the hard disk. When it’s done FDISK will reboot the emulator. Then you can use FORMAT C: and you are done. The diff --git a/2013/dlowe/README.md b/2013/dlowe/README.md index ca89a1feb..2bc4747e9 100644 --- a/2013/dlowe/README.md +++ b/2013/dlowe/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2013 dlowe bugs](../../bugs.html#2013_dlowe). ## To use: -```sh +``` ./dlowe [number...] ``` @@ -27,13 +27,13 @@ where `[number...]` is one or more number, space separated. ## Try: -```sh +``` ./try.sh ``` What is different about the above if you do something like: -```sh +``` echo 'IOCCC winning entry 2013/dlowe' > ioccc.txt ./try.sh rm -f ioccc.txt @@ -43,7 +43,7 @@ What is different about the above if you do something like: To make it simpler to see try showing just the different line like: -```sh +``` ./diff.sh ``` @@ -58,7 +58,7 @@ with one argument or when all arguments are equal? For extra fun, compile and run [fun.c](fun.c): -```c +``` #include int main() { printf("%d %d %d\n", (int)(-1.0/0.0), (int)(0.0/0.0), (int)(1.0/0.0)); @@ -91,7 +91,7 @@ Which one is correct? :) NOTE: `make all` will compile [fun.c](fun.c) but to provide a different compiler you can do something like: -```sh +``` make CC=clang fun ``` @@ -105,7 +105,7 @@ A tiny implementation of command-line ### Synopsis -```sh +``` $ ./sparkl 0 1 2 3 4 5 6 7 ▁▂▃▄▅▆▇▉ @@ -115,7 +115,7 @@ A tiny implementation of command-line NOTE: this has been provided in [slflen.sh](slflen.sh) so you can try: -```sh +``` ./slflen.sh ``` diff --git a/2013/dlowe/index.html b/2013/dlowe/index.html index f6206ae06..fece14ead 100644 --- a/2013/dlowe/index.html +++ b/2013/dlowe/index.html @@ -141,33 +141,33 @@ Location: US - United States of America

    To build:

    -
        make
    +
        make

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 2013 dlowe bugs.

    To use:

    -
        ./dlowe [number...]
    +
        ./dlowe [number...]

    where [number...] is one or more number, space separated.

    Try:

    -
        ./try.sh
    +
        ./try.sh

    What is different about the above if you do something like:

    -
        echo 'IOCCC winning entry 2013/dlowe' > ioccc.txt
    -    ./try.sh
    -    rm -f ioccc.txt
    +
        echo 'IOCCC winning entry 2013/dlowe' > ioccc.txt
    +    ./try.sh
    +    rm -f ioccc.txt

    ?

    To make it simpler to see try showing just the different line like:

    -
        ./diff.sh
    +
        ./diff.sh

    Judges’ remarks:

    We liked how this entry used Unicode, specifically UTF-8, in a somewhat obfuscated way.

    Also, why doesn’t it crash but instead produces a correct output when called with one argument or when all arguments are equal?

    For extra fun, compile and run fun.c:

    -
        #include <stdio.h>
    -    int main() {
    -        printf("%d %d %d\n", (int)(-1.0/0.0), (int)(0.0/0.0), (int)(1.0/0.0));
    -    }
    +
        #include <stdio.h>
    +    int main() {
    +        printf("%d %d %d\n", (int)(-1.0/0.0), (int)(0.0/0.0), (int)(1.0/0.0));
    +    }

    with gcc and clang.

    With GCC (4.7.2), we get

        -2147483648 -2147483648 -2147483648
    @@ -178,19 +178,19 @@ with one argument or when all arguments are equal?

    Which one is correct? :)

    NOTE: make all will compile fun.c but to provide a different compiler you can do something like:

    -
        make CC=clang fun
    +
        make CC=clang fun

    Author’s remarks:

    sparkl

    A tiny implementation of command-line sparkline data visualization.

    Synopsis

    -
        $ ./sparkl 0 1 2 3 4 5 6 7
    -    ▁▂▃▄▅▆▇▉
    -
    -    $ echo "sparkline of file lengths: $(wc -c * | awk '{print $1}' | xargs ./sparkl)"
    -    sparkline of file sizes: ▁▁▁▃▃▂▁▂▁▁▉
    +
        $ ./sparkl 0 1 2 3 4 5 6 7
    +    ▁▂▃▄▅▆▇▉
    +
    +    $ echo "sparkline of file lengths: $(wc -c * | awk '{print $1}' | xargs ./sparkl)"
    +    sparkline of file sizes: ▁▁▁▃▃▂▁▂▁▁▉

    NOTE: this has been provided in slflen.sh so you can try:

    -
        ./slflen.sh
    +
        ./slflen.sh

    instead (which try.sh also uses).

    Description

    This is a handy little tool for visualizing numeric series from the diff --git a/2013/endoh1/README.md b/2013/endoh1/README.md index ea5c9b256..e6308563d 100644 --- a/2013/endoh1/README.md +++ b/2013/endoh1/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,20 +18,20 @@ For more detailed information see [2013 endoh1 bugs](../../bugs.html#2013_endoh1 ## To use: -```sh +``` ./endoh1 [file.lazy] ``` ## Try: -```sh +``` ./try.sh ``` You might also enjoy running: -```sh +``` cc -E endoh1.c | less ``` @@ -50,7 +50,7 @@ This entry can be considered an abuse of the GCC's optimizer; it takes GCC about ### Remarks -```sh +``` less endoh1.c gcc -o endoh1 endoh1.c ./endoh1 @@ -66,7 +66,7 @@ especially, [Lazy K][2]. This program will shine when it is used as a library. For example, [hello.lazy](hello.lazy) is a "Hello world" program written in Lazy K. -```sh +``` $ lazy hello.lazy Hello, world! ``` @@ -75,7 +75,7 @@ where `lazy` is [a reference implementation of Lazy K][3]. At the same time, [hello.lazy](hello.lazy) is *a valid C program* that uses [endoh1.c](endoh1.c) as a library. -```sh +``` $ gcc -o hello -xc hello.lazy $ ./hello Hello, world! @@ -136,7 +136,7 @@ I confirmed that the program successfully worked with the following compilers: Recent compilers with `-Wall -W -Wextra -pedantic` say nothing. -```sh +``` gcc -Wall -W -Wextra -pedantic prog.c clang -Wall -W -Wextra -pedantic prog.c tcc -Wall -W -Wextra -pedantic prog.c @@ -173,7 +173,7 @@ combinator calculus. The rewriting rules are shown in the shape of the code. Consider a sequence of function applications in C: -```c +``` s(x)(x)(x)(x)... ``` @@ -182,7 +182,7 @@ type", such as `typedef f (*f)();`. So, I used a heavily nested function pointer type: -```c +``` typedef void *(*(*(*...(*(f))()...)())()) ``` @@ -207,7 +207,7 @@ However, no type in C is callable and has a reference at the same time. So, I addressed this issue by generating many function definitions statically by (ab)using macros: -```c +``` void *x1; void f1(void *y) { return apply(x1, y); } void *x2; void f2(void *y) { return apply(x2, y); } void *x3; void f3(void *y) { return apply(x3, y); } diff --git a/2013/endoh1/index.html b/2013/endoh1/index.html index 505ac2017..80a75356b 100644 --- a/2013/endoh1/index.html +++ b/2013/endoh1/index.html @@ -141,17 +141,17 @@ Location: JP - Japan

    To build:

    -
        make
    +
        make

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 2013 endoh1 bugs.

    To use:

    -
        ./endoh1 [file.lazy]
    +
        ./endoh1 [file.lazy]

    Try:

    -
        ./try.sh
    +
        ./try.sh

    You might also enjoy running:

    -
        cc -E endoh1.c | less
    +
        cc -E endoh1.c | less

    Judges’ remarks:

    We liked this entry because it can serve as a standalone program as well as an include file; and, as usual, because its input data is at least as obfuscated as @@ -160,23 +160,23 @@ the program itself.

    4x longer to compile it with -O3 than without, compared to clang’s 2x.

    Author’s remarks:

    Remarks

    -
        less endoh1.c
    -    gcc -o endoh1 endoh1.c
    -    ./endoh1
    +
        less endoh1.c
    +    gcc -o endoh1 endoh1.c
    +    ./endoh1

    … Isn’t there any more to it?

    Yes, of course.

    This is a tool for C programmers to play the SKI combinator calculus, especially, Lazy K.

    This program will shine when it is used as a library. For example, hello.lazy is a “Hello world” program written in Lazy K.

    -
        $ lazy hello.lazy
    -    Hello, world!
    +
        $ lazy hello.lazy
    +    Hello, world!

    where lazy is a reference implementation of Lazy K. At the same time, hello.lazy is a valid C program that uses endoh1.c as a library.

    -
        $ gcc -o hello -xc hello.lazy
    -    $ ./hello
    -    Hello, world!
    +
        $ gcc -o hello -xc hello.lazy
    +    $ ./hello
    +    Hello, world!

    In other words, this program is a kind of polyglot.

    The usage is simple: you just have to wrap Lazy K program with #include "endoh1.c". Note that # is a comment in Lazy K.

    Obfuscation

    @@ -210,9 +210,9 @@ section.

    Recent compilers with -Wall -W -Wextra -pedantic say nothing.

    -
        gcc -Wall -W -Wextra -pedantic prog.c
    -    clang -Wall -W -Wextra -pedantic prog.c
    -    tcc -Wall -W -Wextra -pedantic prog.c
    +
        gcc -Wall -W -Wextra -pedantic prog.c
    +    clang -Wall -W -Wextra -pedantic prog.c
    +    tcc -Wall -W -Wextra -pedantic prog.c

    I think it will work on almost all platforms. I confirmed:

    • Ubuntu Linux
    • @@ -235,11 +235,11 @@ evaluates it.

      combinator calculus. The rewriting rules are shown in the shape of the code.

      Abuse of function pointers

      Consider a sequence of function applications in C:

      -
          s(x)(x)(x)(x)...
      +
          s(x)(x)(x)(x)...

      What type should s have? Unfortunately, C does not provide a “recursive type”, such as typedef f (*f)();.

      So, I used a heavily nested function pointer type:

      -
          typedef void *(*(*(*...(*(f))()...)())())
      +
          typedef void *(*(*(*...(*(f))()...)())())

      This limits how many arguments one function can be consecutively applied to. But you can increase the number by tweaking the definition of macro p.

      Code duplication by macros

      @@ -255,11 +255,11 @@ environment which is a reference to non-local variable.

      (It is feasible by dynamic code generation, but it is far from portable.)

      So, I addressed this issue by generating many function definitions statically by (ab)using macros:

      -
          void *x1; void f1(void *y) { return apply(x1, y); }
      -    void *x2; void f2(void *y) { return apply(x2, y); }
      -    void *x3; void f3(void *y) { return apply(x3, y); }
      -    ...
      -    void *(h[]) = { f1, f2, f3, ... }
      +
          void *x1; void f1(void *y) { return apply(x1, y); }
      +    void *x2; void f2(void *y) { return apply(x2, y); }
      +    void *x3; void f3(void *y) { return apply(x3, y); }
      +    ...
      +    void *(h[]) = { f1, f2, f3, ... }

      and by allotting each of them when a closure is needed.

      This leads to another limitation: the number of pre-defined closures limits how many identifiers (S K I) one program can use.

      diff --git a/2013/endoh2/README.md b/2013/endoh2/README.md index c50d13277..21ba12f91 100644 --- a/2013/endoh2/README.md +++ b/2013/endoh2/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` make check ``` @@ -23,7 +23,7 @@ download one or both before exiting. ## Try: -```sh +``` less jpeg.c ``` diff --git a/2013/endoh2/index.html b/2013/endoh2/index.html index 010651feb..b9f6c66bd 100644 --- a/2013/endoh2/index.html +++ b/2013/endoh2/index.html @@ -141,9 +141,9 @@ Location: JP - Japan

      To build:

      -
          make
      +
          make

      To use:

      -
          make check
      +
          make check

      You’ll need to have both Ruby and ImageMagick installed to run all the automated checks.

      @@ -152,7 +152,7 @@ section to enjoy the entry. The Makefile check

      Try:

      -
          less jpeg.c
      +
          less jpeg.c

      Next look at jpeg.jpg in an image viewer program.

      Judges’ remarks:

      This is a program which, when fed its own source, generates a program that diff --git a/2013/endoh3/README.md b/2013/endoh3/README.md index 8a09ac4f8..9bf023360 100644 --- a/2013/endoh3/README.md +++ b/2013/endoh3/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2013 endoh3 bugs](../../bugs.html#2013_endoh3 ## To use: -```sh +``` ./endoh3 ``` @@ -29,7 +29,7 @@ system up for this or if you want to verify that everything is oky. ## Try: -```sh +``` ./try.sh ./try.sh ABC @@ -75,7 +75,7 @@ notation](http://en.wikipedia.org/wiki/ABC_notation). Try: -```sh +``` cc -o endoh3 endoh3.c echo "CDEFGABc" | ./endoh3 > /dev/dsp ``` @@ -83,20 +83,20 @@ Try: If `/dev/dsp` is not available on your system, use an OSS sound wrapper such as `padsp` or `aoss`: -```sh +``` echo "CDEFGABc" | ./endoh3 | padsp tee /dev/dsp > /dev/null ``` If you are using Mac OS X, try [sox](http://sox.sourceforge.net/) like so: -```sh +``` echo "CDEFGABc" | ./endoh3 | sox -q -traw -r8000 -b8 -e unsigned-integer - -tcoreaudio ``` If that does not work, use the attached script to convert the output into a wave file format: -```sh +``` echo "CDEFGABc" | ./endoh3 | ruby wavify.rb > cde.wav ``` @@ -107,7 +107,7 @@ You can also enjoy some music scores that I attached. With `/dev/dsp` you can do so like: -```sh +``` cat twinkle.abc | ./endoh3 > /dev/dsp cat menuet.abc | ./endoh3 > /dev/dsp ``` @@ -185,7 +185,7 @@ You know, it is ["the famous song"](http://en.wikipedia.org/wiki/4%E2%80%B233%E2 Here is a magical expression which I found by brute-force: -```c +``` (c % 32 + 5) * 9 / 5 % 13 + n / 32 * 12 - 22 ``` @@ -228,7 +228,7 @@ frequency by multiplying the value by `n` times. Finally, the following code generates a saw wave: -```c +``` for(c = 0; c < len; c++) putchar(a = n * D); ``` diff --git a/2013/endoh3/index.html b/2013/endoh3/index.html index d9215a9b9..e9ecb5719 100644 --- a/2013/endoh3/index.html +++ b/2013/endoh3/index.html @@ -141,24 +141,24 @@ Location: JP - Japan

      To build:

      -
          make
      +
          make

      Bugs and (Mis)features:

      The current status of this entry is:

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2013 endoh3 bugs.

      To use:

      -
          ./endoh3
      +
          ./endoh3

      This program plays sound. See FAQ 3.10 - How do I compile and use an IOCCC entry that requires sound? if you do not know how to set your system up for this or if you want to verify that everything is oky.

      Try:

      -
          ./try.sh
      -
      -    ./try.sh ABC
      -
      -    ./try.sh test.abc yankee.abc
      -
      -    ./try.sh *.abc
      +
          ./try.sh
      +
      +    ./try.sh ABC
      +
      +    ./try.sh test.abc yankee.abc
      +
      +    ./try.sh *.abc

      The script will check for SoX first and next padsp from PulseAudio and finally if neither are found if you have ruby(1) installed it’ll use the included ruby script to convert it to a WAV file for you to play.

      @@ -180,21 +180,21 @@ will remain the same for historical purposes.

      This is a sound synthesizer for a subset of ABC music notation.

      Try:

      -
          cc -o endoh3 endoh3.c
      -    echo "CDEFGABc" | ./endoh3 > /dev/dsp
      +
          cc -o endoh3 endoh3.c
      +    echo "CDEFGABc" | ./endoh3 > /dev/dsp

      If /dev/dsp is not available on your system, use an OSS sound wrapper such as padsp or aoss:

      -
          echo "CDEFGABc" | ./endoh3 | padsp tee /dev/dsp > /dev/null
      +
          echo "CDEFGABc" | ./endoh3 | padsp tee /dev/dsp > /dev/null

      If you are using Mac OS X, try sox like so:

      -
          echo "CDEFGABc" | ./endoh3 | sox -q -traw -r8000 -b8 -e unsigned-integer - -tcoreaudio
      +
          echo "CDEFGABc" | ./endoh3 | sox -q -traw -r8000 -b8 -e unsigned-integer - -tcoreaudio

      If that does not work, use the attached script to convert the output into a wave file format:

      -
          echo "CDEFGABc" | ./endoh3 | ruby wavify.rb > cde.wav
      +
          echo "CDEFGABc" | ./endoh3 | ruby wavify.rb > cde.wav

      and play cde.wav.

      You can also enjoy some music scores that I attached. With /dev/dsp you can do so like:

      -
          cat twinkle.abc | ./endoh3 > /dev/dsp
      -    cat menuet.abc | ./endoh3 > /dev/dsp
      +
          cat twinkle.abc | ./endoh3 > /dev/dsp
      +    cat menuet.abc | ./endoh3 > /dev/dsp

      but you should be able to modify it a way to meet your system requirements as described above.

      Obfuscation

      @@ -257,7 +257,7 @@ But I do not attach it to protect you from W****r.

      You know, it is “the famous song”.

      Spoiler

      Here is a magical expression which I found by brute-force:

      -
          (c % 32 + 5) * 9 / 5 % 13 + n / 32 * 12 - 22
      +
          (c % 32 + 5) * 9 / 5 % 13 + n / 32 * 12 - 22

      Interestingly, it converts an ASCII number of ABC notes to the corresponding tone number.

          'C' (ASCII  67) =>  3
      @@ -287,7 +287,7 @@ found this approximation by using the 
          for(c = 0; c < len; c++) putchar(a = n * D);
      +
          for(c = 0; c < len; c++) putchar(a = n * D);

      where D is a frequency and a is a variable whose type is char. By assigning float to char variable, the implicit type conversion is performed from float to char (modulo 256).

      diff --git a/2013/endoh4/README.md b/2013/endoh4/README.md index 7931913a8..926ebb01b 100644 --- a/2013/endoh4/README.md +++ b/2013/endoh4/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -8,7 +8,7 @@ If you wish to change the size (see the [Author's remarks](#authors-remarks) below) you can do so with the `SIZE` variable. For instance you can do: -```sh +``` make clobber SIZE=50,50 all ``` @@ -29,7 +29,7 @@ For more detailed information see [2013 endoh4 bugs](../../bugs.html#2013_endoh4 ## To use: -```sh +``` ./endoh4 < file ./endoh4.sh file ``` @@ -41,7 +41,7 @@ line it will feed to the program [endoh4.c](endoh4.c). ## Try: -```sh +``` ./endoh4.sh cube.txt ``` @@ -51,13 +51,13 @@ The author recommends the use of xterm. For an example, if you are a football/soccer fan, try: -```sh +``` ./endoh4.sh solids/archimedian-solid/a11-truncated-icosahedron.txt ``` You can provide more than one file: -```sh +``` ./endoh4.sh solids/archimedian-solid/a11-truncated-icosahedron.txt cube.txt ``` @@ -66,7 +66,7 @@ Hit ctrl-c/intr to go to the next file. If you wish to change the size to `50,50` without passing any arg: -```sh +``` SIZE=50,50 ./endoh4.sh ``` @@ -115,7 +115,7 @@ clang, and tcc. It should not trigger warnings with `-pedantic` and `-Wextra`. You may want to use `tput` to hide the terminal cursor. -```sh +``` tput civis ./endoh4 < cube.txt tput cnorm @@ -123,7 +123,7 @@ You may want to use `tput` to hide the terminal cursor. or -```sh +``` ./endoh4.sh cube.txt ``` @@ -131,14 +131,14 @@ or You can change the screen size. Let the aspect ratio be about 3:1. -```sh +``` cc -DS=120,40 -o endoh4 endoh4.c ``` The shape of this code is the geometric net of a regular tetrahedron. So, try: -```sh +``` ./endoh4 < endoh4.c # or ./endoh4.sh ``` diff --git a/2013/endoh4/index.html b/2013/endoh4/index.html index 8c2d04e2b..333487111 100644 --- a/2013/endoh4/index.html +++ b/2013/endoh4/index.html @@ -141,10 +141,10 @@ Location: JP - Japan

      To build:

      -
          make
      +
          make

      If you wish to change the size (see the Author’s remarks below) you can do so with the SIZE variable. For instance you can do:

      -
          make clobber SIZE=50,50 all
      +
          make clobber SIZE=50,50 all

      but you can also do this directly with the endoh4.sh script as described below.

      Bugs and (Mis)features:

      @@ -152,22 +152,22 @@ described below.

          STATUS: INABIAF - please **DO NOT** fix

      For more detailed information see 2013 endoh4 bugs.

      To use:

      -
          ./endoh4 < file
      -    ./endoh4.sh file
      +
          ./endoh4 < file
      +    ./endoh4.sh file

      The second form is preferable as it will temporarily make the cursor invisible as recommended by the author. If no file is specified in the ./endoh4.sh command line it will feed to the program endoh4.c.

      Try:

      -
          ./endoh4.sh cube.txt
      +
          ./endoh4.sh cube.txt

      Hit ctrl-c to end the program.

      The author recommends the use of xterm.

      For an example, if you are a football/soccer fan, try:

      -
          ./endoh4.sh solids/archimedian-solid/a11-truncated-icosahedron.txt
      +
          ./endoh4.sh solids/archimedian-solid/a11-truncated-icosahedron.txt

      You can provide more than one file:

      -
          ./endoh4.sh solids/archimedian-solid/a11-truncated-icosahedron.txt cube.txt
      +
          ./endoh4.sh solids/archimedian-solid/a11-truncated-icosahedron.txt cube.txt

      Hit ctrl-c/intr to go to the next file.

      If you wish to change the size to 50,50 without passing any arg:

      -
          SIZE=50,50 ./endoh4.sh
      +
          SIZE=50,50 ./endoh4.sh

      Not specifying a file feeds endoh4.c to the program.

      Judges’ remarks:

      This program is formatted as the net for a tetrahedron (hint: try feeding the @@ -203,17 +203,17 @@ triangulated) clang, and tcc. It should not trigger warnings with -pedantic and -Wextra.

      Tips

      You may want to use tput to hide the terminal cursor.

      -
          tput civis
      -    ./endoh4 < cube.txt
      -    tput cnorm
      +
          tput civis
      +    ./endoh4 < cube.txt
      +    tput cnorm

      or

      -
          ./endoh4.sh cube.txt
      +
          ./endoh4.sh cube.txt

      Bonuses

      You can change the screen size. Let the aspect ratio be about 3:1.

      -
          cc -DS=120,40 -o endoh4 endoh4.c
      +
          cc -DS=120,40 -o endoh4 endoh4.c

      The shape of this code is the geometric net of a regular tetrahedron. So, try:

      -
          ./endoh4 < endoh4.c # or ./endoh4.sh
      +
          ./endoh4 < endoh4.c # or ./endoh4.sh

      The solids/ directory includes various solid data:

      • Platonic solids
      • diff --git a/2013/hou/README.md b/2013/hou/README.md index 750552e6e..47e9ad813 100644 --- a/2013/hou/README.md +++ b/2013/hou/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make all ``` @@ -18,7 +18,7 @@ For more detailed information see [2013 hou bugs](../../bugs.html#2013_hou). ## To use: -```sh +``` ./hou [scene-file-name] [options] ``` @@ -29,7 +29,7 @@ effects should be more or less recognizable when you see 16. ## Try: -```sh +``` ./try.sh ``` @@ -62,7 +62,7 @@ This program will loop infinitely while progressively refining a NOTE: the author refers to [a.c](a.c), placed in a gzipped file `a.c.gz`. We do not include it but it can be generated like: -```sh +``` cc -Wall hou.c -o hou -lm ./hou > a.c ``` @@ -78,7 +78,7 @@ needing to create a temporary file. This program is a programmable rendering engine with a built-in default scene. The standard command line is: -```sh +``` ./hou [scene-file-name] [options] ``` diff --git a/2013/hou/index.html b/2013/hou/index.html index e3033f503..67c6bc0cf 100644 --- a/2013/hou/index.html +++ b/2013/hou/index.html @@ -141,18 +141,18 @@ Location: CN - People’s Republic of C

        To build:

        -
            make all
        +
            make all

        Bugs and (Mis)features:

        The current status of this entry is:

            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2013 hou bugs.

        To use:

        -
            ./hou [scene-file-name] [options]
        +
            ./hou [scene-file-name] [options]

        Follow the instructions in stdout, preferably with an auto-refreshing PPM image viewer ready. Refresh the image every time the output refreshes, all effects should be more or less recognizable when you see 16.

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Try opening the file noted by the program then let the program run a while and every so often reopen the file, to see how it changes. The author suggests that you leave the program running overnight to see what happens. If however you do @@ -181,15 +181,15 @@ program.

        raytraced image.

        NOTE: the author refers to a.c, placed in a gzipped file a.c.gz. We do not include it but it can be generated like:

        -
            cc -Wall hou.c -o hou -lm
        -    ./hou > a.c
        +
            cc -Wall hou.c -o hou -lm
        +    ./hou > a.c

        but there is no need to do this as the Makefile takes care of it without even needing to create a temporary file.

        Author’s remarks:

        Using hou

        This program is a programmable rendering engine with a built-in default scene. The standard command line is:

        -
            ./hou [scene-file-name] [options]
        +
            ./hou [scene-file-name] [options]

        As hou runs, it writes a progressively refining image to a ppm file specified in the scene. The initialization may take a while, but once it’s done, a rough preview should be available in seconds. Leave hou running for the night, and you diff --git a/2013/index.html b/2013/index.html index 8cb8a403b..5028bcaf5 100644 --- a/2013/index.html +++ b/2013/index.html @@ -155,10 +155,10 @@ authors submitted very different styles of entries.

        had to print a value 2053 or less when the -i flag was used.

        Several people discovered an undocumented feature in that certain comments such as:

        -
                ///*
        +
                ///*

        or:

        -
                *\
        -        /
        +
                *\
        +        /

        were not correctly parsed by the tool. The guidelines stated:

            In cases where the above summary and the algorithm implemented by
             the IOCCC size tool source code conflict, the algorithm implemented
        diff --git a/2013/mills/README.md b/2013/mills/README.md
        index 074cf671b..1ef786457 100644
        --- a/2013/mills/README.md
        +++ b/2013/mills/README.md
        @@ -1,6 +1,6 @@
         ## To build:
         
        -```sh
        +```
             make
         ```
         
        @@ -18,14 +18,14 @@ For more detailed information see [2013 mills bugs](../../bugs.html#2013_mills).
         
         ## To use:
         
        -```sh
        +```
             ./mills
         ```
         
         
         ## Try:
         
        -```sh
        +```
             ./mills &
         ```
         
        @@ -61,7 +61,7 @@ while you are there, click on an ad.  They could use the money.
         
         It would be possible to fix this by adding
         
        -```c
        +```
             n=1,setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&n,sizeof n),
         ```
         
        diff --git a/2013/mills/index.html b/2013/mills/index.html
        index a5b12c9cb..515044e05 100644
        --- a/2013/mills/index.html
        +++ b/2013/mills/index.html
        @@ -141,15 +141,15 @@ Location: US - United States of America
         
         
         

        To build:

        -
            make
        +
            make

        Bugs and (Mis)features:

        The current status of this entry is:

            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2013 mills bugs.

        To use:

        -
            ./mills
        +
            ./mills

        Try:

        -
            ./mills &
        +
            ./mills &

        While that is running, point your favorite browser at: http://localhost:8224.

        Judges’ remarks:

        @@ -170,7 +170,7 @@ doing so. For details as to why this is necessary, feel free to Google "TIME_WAIT", "SO_REUSEADDR" and "SO_REUSEPORT" (with the quotes). And while you are there, click on an ad. They could use the money.

        It would be possible to fix this by adding

        -
            n=1,setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&n,sizeof n),
        +
            n=1,setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&n,sizeof n),

        at an appropriate spot in the code (an exercise left to the reader). However, as this limitation is documented, it is not technically a bug.

        Details of Operation

        diff --git a/2013/misaka/README.md b/2013/misaka/README.md index 559d9029c..26db6c50d 100644 --- a/2013/misaka/README.md +++ b/2013/misaka/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,7 +10,7 @@ information on all of these builds. ## To use: -```sh +``` ./horizontal_cat [files...] > [output] ./vertical_cat [files...] > [output] ``` @@ -20,19 +20,19 @@ information on all of these builds. To understand the various intermediate source files that are built, try: -```sh +``` make understanding ``` Also try: -```sh +``` ./try.sh ``` NOTE: Use - for standard input. For example: -```sh +``` ./vertical_cat - - ``` @@ -69,7 +69,7 @@ judging this entry. `Misaka` is a file concatenation utility, with at least two modes of operation: -```sh +``` cc misaka.c -o horizontal_cat ./horizontal_cat [files...] > [output] @@ -94,7 +94,7 @@ files vertically. I thought the lack of horizontal concatenation must have been an oversight, so I implemented this utility: -```sh +``` cc misaka.c -o horizontal_cat ./horizontal_cat files... ``` @@ -109,7 +109,7 @@ can specify `-` multiple times to get `stdin` multiplied horizontally. For example, if you have `seq(1)` in your shell, you can add line numbers to both sides of [misaka.c](misaka.c) like this: -```sh +``` seq -f ' %.0f ' 45 | ./horizontal_cat - misaka.c - ``` @@ -126,7 +126,7 @@ files vertically, so I included a vertical mode. But supporting vertical mode with command line options would be no fun. Instead, vertical mode is enabled by concatenating the source code horizontally: -```sh +``` ./horizontal_cat misaka.c misaka.c > misaka2.c gcc misaka2.c -o vertical_cat ./vertical_cat files... @@ -135,7 +135,7 @@ enabled by concatenating the source code horizontally: `vertical_cat` works more or less like `cat`, except you can use `vertical_cat` to duplicate `stdin`: -```sh +``` ./vertical_cat - - ``` @@ -147,7 +147,7 @@ was just more [cats](https://rationalwiki.org/wiki/Fun:Cat). So I implemented one more mode, this one is enabled by concatenating [misaka.c](misaka.c) vertically: -```sh +``` ./vertical_cat misaka.c misaka.c > misaka3.c gcc misaka3.c -o long_cat ./long_cat @@ -157,7 +157,7 @@ vertically: exponentially longer by concatenating more files vertically (up to 31 levels high, depending on `sizeof(int)` for your compiler): -```sh +``` ./vertical_cat misaka.c misaka.c misaka.c > misaka4.c gcc misaka4.c -o loong_cat @@ -171,7 +171,7 @@ high, depending on `sizeof(int)` for your compiler): If your terminal has really thin fonts, you can also make this output fatter by concatenating files horizontally: -```sh +``` ./vertical_cat misaka.c misaka.c | ./horizontal_cat - - > misaka7.c gcc misaka7.c -o long_fat_cat @@ -182,7 +182,7 @@ by concatenating files horizontally: Output width is determined by the first level of stacked programs, so a triangle like the following will not have horizontally expanded output: -```sh +``` ./horizontal_cat misaka.c misaka.c | ./vertical_cat misaka.c - > misaka9.c gcc misaka9.c -o same_as_long_cat ``` @@ -192,7 +192,7 @@ together, you can feed the source to a [brainfuck](https://en.wikipedia.org/wiki/Brainfuck) interpreter to get an overview of how the programs are stacked. Example: -```sh +``` perl bf.pl misaka9.c ``` diff --git a/2013/misaka/index.html b/2013/misaka/index.html index 8a78e5137..a11fa152f 100644 --- a/2013/misaka/index.html +++ b/2013/misaka/index.html @@ -141,19 +141,19 @@ Location: US - United States of America

        To build:

        -
            make
        +
            make

        This will build a bunch of versions of the code. See the author’s details for information on all of these builds.

        To use:

        -
            ./horizontal_cat [files...] > [output]
        -    ./vertical_cat [files...] > [output]
        +
            ./horizontal_cat [files...] > [output]
        +    ./vertical_cat [files...] > [output]

        Try:

        To understand the various intermediate source files that are built, try:

        -
            make understanding
        +
            make understanding

        Also try:

        -
            ./try.sh
        +
            ./try.sh

        NOTE: Use - for standard input. For example:

        -
            ./vertical_cat - -
        +
            ./vertical_cat - -

        Judges’ remarks:

        There is more to cat than mere cats. Be they tall, fat, long or squat, this source code is sure to amuse.

        @@ -176,12 +176,12 @@ judging this entry.

        Overview

        Misaka is a file concatenation utility, with at least two modes of operation:

        -
            cc misaka.c -o horizontal_cat
        -    ./horizontal_cat [files...] > [output]
        -
        -    ./horizontal_cat misaka.c misaka.c > misaka2.c
        -    cc misaka2.c -o vertical_cat
        -    ./vertical_cat [files...] > [output]
        +
            cc misaka.c -o horizontal_cat
        +    ./horizontal_cat [files...] > [output]
        +
        +    ./horizontal_cat misaka.c misaka.c > misaka2.c
        +    cc misaka2.c -o vertical_cat
        +    ./vertical_cat [files...] > [output]

        Where [files...] is a list of text file names. Use - to read from stdin.

        Details

        Horizontal cat

        @@ -192,8 +192,8 @@ concatenating files, that function only seem to work if I wanted to concatenate files vertically.

        I thought the lack of horizontal concatenation must have been an oversight, so I implemented this utility:

        -
            cc misaka.c -o horizontal_cat
        -    ./horizontal_cat files...
        +
            cc misaka.c -o horizontal_cat
        +    ./horizontal_cat files...

        horizontal_cat concatenates files horizontally and write the output to stdout. Each input file is padded with spaces on the right so that the original text alignments are preserved.

        @@ -202,7 +202,7 @@ Unlike cat, horizontal_cat loads all input to memory f can specify - multiple times to get stdin multiplied horizontally. For example, if you have seq(1) in your shell, you can add line numbers to both sides of misaka.c like this:

        -
            seq -f '  %.0f  ' 45 | ./horizontal_cat - misaka.c -
        +
            seq -f '  %.0f  ' 45 | ./horizontal_cat - misaka.c -

        Vertical cat

        Because horizontal_cat must know the maximum width of all files before writing any output, all files must be processed at least twice. To support @@ -212,47 +212,47 @@ writing any output, all files must be processed at least twice. To support files vertically, so I included a vertical mode. But supporting vertical mode with command line options would be no fun. Instead, vertical mode is enabled by concatenating the source code horizontally:

        -
            ./horizontal_cat misaka.c misaka.c > misaka2.c
        -    gcc misaka2.c -o vertical_cat
        -    ./vertical_cat files...
        +
            ./horizontal_cat misaka.c misaka.c > misaka2.c
        +    gcc misaka2.c -o vertical_cat
        +    ./vertical_cat files...

        vertical_cat works more or less like cat, except you can use vertical_cat to duplicate stdin:

        -
            ./vertical_cat - -
        +
            ./vertical_cat - -

        Long cat

        After horizontal_cat and vertical_cat, I thought, maybe all I really wanted was just more cats. So I implemented one more mode, this one is enabled by concatenating misaka.c vertically:

        -
            ./vertical_cat misaka.c misaka.c > misaka3.c
        -    gcc misaka3.c -o long_cat
        -    ./long_cat
        +
            ./vertical_cat misaka.c misaka.c > misaka3.c
        +    gcc misaka3.c -o long_cat
        +    ./long_cat

        long_cat outputs ASCII art of a cat to stdout. You can make this cat exponentially longer by concatenating more files vertically (up to 31 levels high, depending on sizeof(int) for your compiler):

        -
            ./vertical_cat misaka.c misaka.c misaka.c > misaka4.c
        -    gcc misaka4.c -o loong_cat
        -
        -    ./vertical_cat misaka.c misaka.c misaka.c misaka.c > misaka5.c
        -    gcc misaka5.c -o loooong_cat
        -
        -    ./vertical_cat misaka.c misaka.c misaka.c misaka.c misaka.c > misaka6.c
        -    gcc misaka6.c -o loooooooong_cat
        +
            ./vertical_cat misaka.c misaka.c misaka.c > misaka4.c
        +    gcc misaka4.c -o loong_cat
        +
        +    ./vertical_cat misaka.c misaka.c misaka.c misaka.c > misaka5.c
        +    gcc misaka5.c -o loooong_cat
        +
        +    ./vertical_cat misaka.c misaka.c misaka.c misaka.c misaka.c > misaka6.c
        +    gcc misaka6.c -o loooooooong_cat

        If your terminal has really thin fonts, you can also make this output fatter by concatenating files horizontally:

        -
            ./vertical_cat misaka.c misaka.c | ./horizontal_cat - - > misaka7.c
        -    gcc misaka7.c -o long_fat_cat
        -
        -    ./vertical_cat misaka.c misaka.c | ./horizontal_cat - - - > misaka8.c
        -    gcc misaka8.c -o long_faat_cat
        +
            ./vertical_cat misaka.c misaka.c | ./horizontal_cat - - > misaka7.c
        +    gcc misaka7.c -o long_fat_cat
        +
        +    ./vertical_cat misaka.c misaka.c | ./horizontal_cat - - - > misaka8.c
        +    gcc misaka8.c -o long_faat_cat

        Output width is determined by the first level of stacked programs, so a triangle like the following will not have horizontally expanded output:

        -
            ./horizontal_cat misaka.c misaka.c | ./vertical_cat misaka.c - > misaka9.c
        -    gcc misaka9.c -o same_as_long_cat
        +
            ./horizontal_cat misaka.c misaka.c | ./vertical_cat misaka.c - > misaka9.c
        +    gcc misaka9.c -o same_as_long_cat

        Finally, if you lost track of how many misaka.c you have stacked together, you can feed the source to a brainfuck interpreter to get an overview of how the programs are stacked. Example:

        -
            perl bf.pl misaka9.c
        +
            perl bf.pl misaka9.c

        This outputs:

            MISAKA
             MISAKA MISAKA
        diff --git a/2013/morgan1/README.md b/2013/morgan1/README.md index 769a6fc7a..e47c4e898 100644 --- a/2013/morgan1/README.md +++ b/2013/morgan1/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` echo "YYYY/MM/DD" | ./morgan1 ``` @@ -23,7 +23,7 @@ follows: ## Try: -```sh +``` ./try.sh ``` diff --git a/2013/morgan1/index.html b/2013/morgan1/index.html index 2cbd8de12..7a71fc459 100644 --- a/2013/morgan1/index.html +++ b/2013/morgan1/index.html @@ -141,9 +141,9 @@ Location: FR - French Republic (

        To build:

        -
            make
        +
            make

        To use:

        -
            echo "YYYY/MM/DD" | ./morgan1
        +
            echo "YYYY/MM/DD" | ./morgan1

        where YYYY is the four digit year, MM is the two digit month and DD is two digit day of the month. The arrow keys control the shifting of the date as follows:

        @@ -154,7 +154,7 @@ follows:

      • Down : go backwards 20 days.

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Use the same keys as described above to change the dates each time the program window is in focus.

      Judges’ remarks:

      diff --git a/2013/morgan2/README.md b/2013/morgan2/README.md index 3bb1022b4..71fde4f8f 100644 --- a/2013/morgan2/README.md +++ b/2013/morgan2/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -9,13 +9,13 @@ For the console version (ncurses): -```sh +``` ./morgan2 ``` For the graphical version (X11): -```sh +``` ./morgan2 X ``` diff --git a/2013/morgan2/index.html b/2013/morgan2/index.html index 4af053e2d..995583ac3 100644 --- a/2013/morgan2/index.html +++ b/2013/morgan2/index.html @@ -141,12 +141,12 @@ Location: FR - French Republic (

      To build:

      -
          make
      +
          make

      To use:

      For the console version (ncurses):

      -
          ./morgan2
      +
          ./morgan2

      For the graphical version (X11):

      -
          ./morgan2 X
      +
          ./morgan2 X

      Judges’ remarks:

      The judges enjoyed playing the game almost to completion; if we remember correctly, we managed to place 59 or 60 dominoes. We wonder, what would be diff --git a/2013/robison/README.md b/2013/robison/README.md index 06ab26a79..64d09cef4 100644 --- a/2013/robison/README.md +++ b/2013/robison/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./robison # enter an expression @@ -17,7 +17,7 @@ ## Try: -```sh +``` ./try.sh ``` diff --git a/2013/robison/index.html b/2013/robison/index.html index c6bd3c42f..69c81236d 100644 --- a/2013/robison/index.html +++ b/2013/robison/index.html @@ -141,14 +141,14 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      To use:

      -
          ./robison
      -    # enter an expression
      -
      -    echo expression | ./robison
      +
          ./robison
      +    # enter an expression
      +
      +    echo expression | ./robison

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Judges’ remarks:

      Of integers this prog does a lot,
      plus minus, div times (and what not).

      diff --git a/2014/birken/README.md b/2014/birken/README.md index 11443e28b..0e877e99d 100644 --- a/2014/birken/README.md +++ b/2014/birken/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -11,7 +11,7 @@ there is a firewall issue, and also lets you redefine the timing constant, ## To use: -```sh +``` ./prog < some_secret_or_something ./prog http://host[:port] @@ -20,19 +20,19 @@ there is a firewall issue, and also lets you redefine the timing constant, ## Try: -```sh +``` ./prog < README.md ``` or maybe: -```sh +``` echo "IOCCC 2014!" | ./prog ``` Next, try in another terminal, as the above one is running: -```sh +``` ./prog http://127.0.0.1:1701 ``` @@ -55,13 +55,13 @@ described by the author. See [configuration](#configuration) below. To specify the port to say, 31337, try: -```sh +``` make clobber PORT=31337 alt ``` To change the timing constant, `STARDATE`, try: -```sh +``` make clobber TIME=5000000 alt ``` @@ -101,26 +101,26 @@ the server. ## To use web server -```sh +``` ./prog < secret_file_to_be_downloaded ``` Try using the program's source code as the secret file: -```sh +``` ./prog < prog.c ``` ## To use client-side downloader -```sh +``` ./prog http://host[:port] ``` The optional port defaults to 1701. If the web server instance is started on the same box, try: -```sh +``` ./prog http://127.0.0.1:1701 ``` @@ -246,7 +246,7 @@ numerical values. For space considerations, the following include statements were dropped resulting in compiler warnings: -```c +``` #include #include #include diff --git a/2014/birken/index.html b/2014/birken/index.html index 1a669a18c..dd9432f4e 100644 --- a/2014/birken/index.html +++ b/2014/birken/index.html @@ -144,20 +144,20 @@ Location: US - United States of America

      To build:

      -
          make
      +
          make

      There is alternate code that lets you redefine the port to bind to, in case there is a firewall issue, and also lets you redefine the timing constant, STARDATE. See Alternate code below.

      To use:

      -
          ./prog < some_secret_or_something
      -
      -    ./prog http://host[:port]
      +
          ./prog < some_secret_or_something
      +
      +    ./prog http://host[:port]

      Try:

      -
          ./prog < README.md
      +
          ./prog < README.md

      or maybe:

      -
          echo "IOCCC 2014!" | ./prog
      +
          echo "IOCCC 2014!" | ./prog

      Next, try in another terminal, as the above one is running:

      -
          ./prog http://127.0.0.1:1701
      +
          ./prog http://127.0.0.1:1701

      What happens if you specify instead of a regular file something like /dev/null ?

      But there’s more! Try opening in a browser the same address and then see what @@ -168,9 +168,9 @@ problem for some reason, and it also allows you to change the timing as described by the author. See configuration below.

      Alternate build:

      To specify the port to say, 31337, try:

      -
          make clobber PORT=31337 alt
      +
          make clobber PORT=31337 alt

      To change the timing constant, STARDATE, try:

      -
          make clobber TIME=5000000 alt
      +
          make clobber TIME=5000000 alt

      You can combine them both of course.

      Alternate use:

      Use prog.alt as you would prog above. Remember that ports < 1024 are @@ -194,14 +194,14 @@ a client-side downloader. The hidden transmitted data cannot be reconstructed or even detected from the binary content of the traffic between the client and the server.

      To use web server

      -
          ./prog < secret_file_to_be_downloaded
      +
          ./prog < secret_file_to_be_downloaded

      Try using the program’s source code as the secret file:

      -
          ./prog < prog.c
      +
          ./prog < prog.c

      To use client-side downloader

      -
          ./prog http://host[:port]
      +
          ./prog http://host[:port]

      The optional port defaults to 1701. If the web server instance is started on the same box, try:

      -
          ./prog http://127.0.0.1:1701
      +
          ./prog http://127.0.0.1:1701

      It will incrementally display the contents of the hidden file at a rate of approximately 1 baud.

      The client-side downloader will automatically terminate if the web server is @@ -296,15 +296,15 @@ numerical values.

      Compiler warnings

      For space considerations, the following include statements were dropped resulting in compiler warnings:

      -
          #include <asm/byteorder.h>
      -    #include <ctype.h>
      -    #include <netinet/in.h>
      -    #include <stdlib.h>
      -    #include <string.h>
      -    #include <sys/select.h>
      -    #include <sys/socket.h>
      -    #include <sys/types.h>
      -    #include <sys/unistd.h>
      +
          #include <asm/byteorder.h>
      +    #include <ctype.h>
      +    #include <netinet/in.h>
      +    #include <stdlib.h>
      +    #include <string.h>
      +    #include <sys/select.h>
      +    #include <sys/socket.h>
      +    #include <sys/types.h>
      +    #include <sys/unistd.h>

      It may be necessary to restore some of these under certain environments.

      make ``` @@ -12,14 +12,14 @@ code](#alternate-code) below. ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./prog ``` @@ -36,7 +36,7 @@ recognisable and also to let you reconfigure the coordinates. ### Alternate build: -```sh +``` make alt ``` @@ -45,7 +45,7 @@ If you wish to redefine the coordinates you can do so by defining `X1`, `X2`, For instance: -```sh +``` make clobber X1=-3 X2=2 Y1=-2.3 Y2=2.3 alt ``` @@ -59,7 +59,7 @@ Use `prog.alt` as you would `prog`. ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -94,7 +94,7 @@ The usage of recognizable elements from the C programming language in the application source code is intentionally kept to a bare minimum. If this phrase would not be true, the application would be the following: -```c +``` double _[]={-2 ,1,-1.3 ,1.3, 0, 0,0,0 ,0 ,0,50, 80, 0,0,0 ,255 diff --git a/2014/deak/index.html b/2014/deak/index.html index 411177387..23d4020de 100644 --- a/2014/deak/index.html +++ b/2014/deak/index.html @@ -141,15 +141,15 @@ Location: ZZ - Unknown location

      To build:

      -
          make
      +
          make

      There is an alternate version that the author provided but fixed in 2023 to compile with modern systems and to allow one to reconfigure the constants X1, X2, Y1 and Y2 (which were magic numbers). See Alternate code below.

      To use:

      -
          ./prog
      +
          ./prog

      Try:

      -
          ./prog
      +
          ./prog

      Try changing bounding box coordinates in the source to explore various regions of the fractal.

      Alternate code:

      @@ -157,16 +157,16 @@ various regions of the fractal.

      easily see the difference in what it might look like if the C was more recognisable and also to let you reconfigure the coordinates.

      Alternate build:

      -
          make alt
      +
          make alt

      If you wish to redefine the coordinates you can do so by defining X1, X2, Y1 and/or Y2, which default to: -2, 1, -1.3 and 1.3 respectively. For instance:

      -
          make clobber X1=-3 X2=2 Y1=-2.3 Y2=2.3 alt
      +
          make clobber X1=-3 X2=2 Y1=-2.3 Y2=2.3 alt

      You may pick and choose which ones to redefine.

      Alternate use:

      Use prog.alt as you would prog.

      Alternate try:

      -
          ./try.alt.sh
      +
          ./try.alt.sh

      Judges’ remarks:

      We consider this entry a tribute to all “Abuse of the C preprocessor” and Mandelbrot fractal drawing entries we’ve seen over the years.

      @@ -186,25 +186,25 @@ drawer. There are tools much better suited for drawing fractals.

      The usage of recognizable elements from the C programming language in the application source code is intentionally kept to a bare minimum. If this phrase would not be true, the application would be the following:

      -
          double                                 _[]={-2
      -    ,1,-1.3                ,1.3,  0,         0,0,0
      -    ,0               ,0,50, 80,     0,0,0     ,255
      -    ,               8,0};    int      main       (
      -                   int j) {if (j==  1 ){ if(
      -           _[12]      >_[10]  )_[17]=1 ;}  if
      -       (_[13] >_[11     ] ||_[17]==1)  return 1
      -     ;_[6]   =  _ [13] / _[11]*(_[1]-_[   0])
      -    +_[  0];  _ [7]=_[12]/_[10]*(_[3]-_[2] )+_
      -    [2];_[8]=_[9]=_[14]=0;l2:_[4]=_[8] * _ [8]
      -    ;_[  5]=  _ [9]*_[9];_[9]=2*_[8]*_[9]+ _[7
      -     ];_[8   ]  = _ [ 4 ]-_[5]+_[6];_[14   ]++
      -       ;if((_ [14]<     _ [15])&&(_[4]+ _[ 5]
      -           <_[16      ])) goto l2;  putchar(
      -                   " #@*+   "[( int)  _[14]%
      -    5             ]);_ [13   ] ++ ;   main       (
      -    0)               ;_[12]++;      _[13]       =0
      -    ;if(_                [17]    !=1)      putchar
      -    (0xa);                               main(1);}
      +
          double                                 _[]={-2
      +    ,1,-1.3                ,1.3,  0,         0,0,0
      +    ,0               ,0,50, 80,     0,0,0     ,255
      +    ,               8,0};    int      main       (
      +                   int j) {if (j==  1 ){ if(
      +           _[12]      >_[10]  )_[17]=1 ;}  if
      +       (_[13] >_[11     ] ||_[17]==1)  return 1
      +     ;_[6]   =  _ [13] / _[11]*(_[1]-_[   0])
      +    +_[  0];  _ [7]=_[12]/_[10]*(_[3]-_[2] )+_
      +    [2];_[8]=_[9]=_[14]=0;l2:_[4]=_[8] * _ [8]
      +    ;_[  5]=  _ [9]*_[9];_[9]=2*_[8]*_[9]+ _[7
      +     ];_[8   ]  = _ [ 4 ]-_[5]+_[6];_[14   ]++
      +       ;if((_ [14]<     _ [15])&&(_[4]+ _[ 5]
      +           <_[16      ])) goto l2;  putchar(
      +                   " #@*+   "[( int)  _[14]%
      +    5             ]);_ [13   ] ++ ;   main       (
      +    0)               ;_[12]++;      _[13]       =0
      +    ;if(_                [17]    !=1)      putchar
      +    (0xa);                               main(1);}

      The application expects no parameters, the only way you can change the behaviour is to modify the source code at the indicated location: the line /* <-- Configure here: X1, X2, Y1, Y2 */ is intentionally not obfuscated so diff --git a/2014/endoh1/README.md b/2014/endoh1/README.md index cc5cac99b..d00af19ec 100644 --- a/2014/endoh1/README.md +++ b/2014/endoh1/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog > foo.c ``` ## Try: -```sh +``` ./try.sh ``` @@ -36,14 +36,14 @@ What is the difference between running `./prog` and `main`? Big terminals with tiny fonts have their uses in certain cases. One of them is: -```sh +``` make treacl ./treacl ``` which is shorthand for: -```sh +``` ./prog < prog.c > treacle.c make treacle ./treacle diff --git a/2014/endoh1/index.html b/2014/endoh1/index.html index c681be18c..f2e8d1c8d 100644 --- a/2014/endoh1/index.html +++ b/2014/endoh1/index.html @@ -141,11 +141,11 @@ Location: JP - Japan

      To build:

      -
          make
      +
          make

      To use:

      -
          ./prog > foo.c
      +
          ./prog > foo.c

      Try:

      -
          ./try.sh
      +
          ./try.sh

      The script will ask you if you wish to run make rake but this is not necessary to fully enjoy the entry. make rake will run the rake.sh script and then prog if all is built okay. If rake is not installed then it will check @@ -159,12 +159,12 @@ build main.c.

      Judges’ remarks:

      Big terminals with tiny fonts have their uses in certain cases. One of them is:

      -
          make treacl
      -    ./treacl
      +
          make treacl
      +    ./treacl

      which is shorthand for:

      -
          ./prog < prog.c > treacle.c
      -    make treacle
      -    ./treacle
      +
          ./prog < prog.c > treacle.c
      +    make treacle
      +    ./treacle

      When using a smartphone to read the output, you may need to step back to see the bigger picture because that picture is worth more than 1000 words.

      diff --git a/2014/endoh1/spoilers.html b/2014/endoh1/spoilers.html index 73b94ffe5..8f35d653b 100644 --- a/2014/endoh1/spoilers.html +++ b/2014/endoh1/spoilers.html @@ -134,7 +134,7 @@ the program!

      How did I achieve that?

      It is known that we can mitigate the quine restriction by eval. For example, this is a quine written in Ruby:

      -
          eval s="print 'eval s='; p s"
      +
          eval s="print 'eval s='; p s"

      Note that print appears just once in the program.

      To emulate this approach in C, I adopted the following structure.

          char s[]="<main code>int main() { <VM code> }";
      @@ -230,8 +230,8 @@ renaming and automatic register allocation only for this purpose.

    • gen-prog.c generates prog.c based on main.c.

    You can run the process by rake command. ruby-minisat gem is needed.

    -
        $ gem install ruby-minisat
    -    $ rake
    +
        $ gem install ruby-minisat
    +    $ rake

    Tools

    I checked that the following QR code readers can read the output of my program.

      @@ -243,13 +243,13 @@ found at https://play.google.com/store/apps/details?id=com.google.zxing.client.android but it appears to no longer exist.

      You can use tool.rb to convert the output to a png file.

      -
          ./main Hello | ruby tool.rb > hello.png
      -
      -    $ zbarimg -q hello.png
      -    QR-Code:Hello
      -
      -    $ ruby tool.rb prog.c
      -    $ ruby tool.rb prog.c | ruby tool.rb
      +
          ./main Hello | ruby tool.rb > hello.png
      +
      +    $ zbarimg -q hello.png
      +    QR-Code:Hello
      +
      +    $ ruby tool.rb prog.c
      +    $ ruby tool.rb prog.c | ruby tool.rb

      Limitations

      • QR code error correction level is fixed to L (Low).
      • diff --git a/2014/endoh1/spoilers.md b/2014/endoh1/spoilers.md index cbd9e6be5..9b6a7c5e8 100644 --- a/2014/endoh1/spoilers.md +++ b/2014/endoh1/spoilers.md @@ -18,7 +18,7 @@ Do you think that it is possible to write QR code encoder in C within *1kB*? It is known that we can mitigate the quine restriction by `eval`. For example, this is a quine written in Ruby: -```ruby +``` eval s="print 'eval s='; p s" ``` @@ -122,7 +122,7 @@ The compiler tool chain is the following. You can run the process by `rake` command. `ruby-minisat` gem is needed. -```sh +``` $ gem install ruby-minisat $ rake ``` @@ -145,7 +145,7 @@ but it appears to no longer exist. You can use [tool.rb](tool.rb) to convert the output to a png file. -```sh +``` ./main Hello | ruby tool.rb > hello.png $ zbarimg -q hello.png diff --git a/2014/endoh2/README.md b/2014/endoh2/README.md index a50b8ac12..09de3a71d 100644 --- a/2014/endoh2/README.md +++ b/2014/endoh2/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog < input > output ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2014/endoh2/index.html b/2014/endoh2/index.html index 4782ca187..f1836437e 100644 --- a/2014/endoh2/index.html +++ b/2014/endoh2/index.html @@ -141,11 +141,11 @@ Location: JP - Japan

        To build:

        -
            make
        +
            make

        To use:

        -
            ./prog < input > output
        +
            ./prog < input > output

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        If you look closely at the source, you will see code that appears to puts C code that includes itself. How and why? Perhaps it is diff --git a/2014/maffiodo1/README.md b/2014/maffiodo1/README.md index 4fc3a9559..9318eca63 100644 --- a/2014/maffiodo1/README.md +++ b/2014/maffiodo1/README.md @@ -3,7 +3,7 @@ This entry requires SDL to be installed. See [FAQ 3.8](../../faq.html#SDL) if you don't know how to do this for your system. -```sh +``` make ``` @@ -21,7 +21,7 @@ For more detailed information see [2014 maffiodo1 bugs](../../bugs.html#2014_maf ## To use: -```sh +``` cat game.level | ./prog 320 200 800 300 128 144 game.rgba game.wav 10343679 ``` @@ -41,7 +41,7 @@ note on macOS. ## Try: -```sh +``` ./giana.sh ./mario.sh @@ -61,7 +61,7 @@ try: If you wish to change the width and height, defaulting at 640 x 480, say to 800 x 800, try: -```sh +``` ROWS=800 COLS=800 ./mario.sh ROWS=800 COLS=800 ./giana.sh @@ -92,14 +92,14 @@ immediately take effect. Use `tabsize=4` to see the magic. -```sh +``` expand -t 4 prog.c ``` The program returns 0 if the player wins or *non-zero* if the player loses so you can test it and make something useful (or not), like this: -```sh +``` cat mario.level | ./prog 320 200 800 300 128 144 mario.rgba mario8.wav 10343679 && telnet telehack.com 23 ``` @@ -228,7 +228,7 @@ You can input as many objects as you want but the maximum number of objects handled by the program is 333. You can modify this value by editing the source here: -```c +``` C[333*7],d=333; ``` diff --git a/2014/maffiodo1/index.html b/2014/maffiodo1/index.html index 26f81ed02..58dd9b127 100644 --- a/2014/maffiodo1/index.html +++ b/2014/maffiodo1/index.html @@ -143,13 +143,13 @@ Location: IT - Italian Republic (<

        To build:

        This entry requires SDL to be installed. See FAQ 3.8 if you don’t know how to do this for your system.

        -
            make
        +
            make

        Bugs and (Mis)features:

        The current status of this entry is:

            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2014 maffiodo1 bugs.

        To use:

        -
            cat game.level | ./prog 320 200 800 300 128 144 game.rgba game.wav 10343679
        +
            cat game.level | ./prog 320 200 800 300 128 144 game.rgba game.wav 10343679

        The parameters to the program are:

        1. Window width.
        2. @@ -164,9 +164,9 @@ don’t know how to do this for your system.

          note on macOS.

        Try:

        -
            ./giana.sh
        -
        -    ./mario.sh
        +
            ./giana.sh
        +
        +    ./mario.sh

        If you end up telnetting to the server (feature of mario.sh) you can try:

            ls # show files including games
        @@ -175,9 +175,9 @@ try:

        starwars # animated Star Wars 'film'

        If you wish to change the width and height, defaulting at 640 x 480, say to 800 x 800, try:

        -
            ROWS=800 COLS=800 ./mario.sh
        -
        -    ROWS=800 COLS=800 ./giana.sh
        +
            ROWS=800 COLS=800 ./mario.sh
        +
        +    ROWS=800 COLS=800 ./giana.sh

        Judges’ remarks:

        A classic for a particular generation. Like all good programs, being data driven means you can do fun things in small spaces.

        @@ -191,10 +191,10 @@ immediately take effect.

        Author’s remarks:

        Remarks

        Use tabsize=4 to see the magic.

        -
            expand -t 4 prog.c
        +
            expand -t 4 prog.c

        The program returns 0 if the player wins or non-zero if the player loses so you can test it and make something useful (or not), like this:

        -
            cat mario.level | ./prog 320 200 800 300 128 144 mario.rgba mario8.wav 10343679 && telnet telehack.com 23
        +
            cat mario.level | ./prog 320 200 800 300 128 144 mario.rgba mario8.wav 10343679 && telnet telehack.com 23

        and type in: starwars

        This is an engine for platform game. It can be used to create @@ -288,7 +288,7 @@ to create.

        You can input as many objects as you want but the maximum number of objects handled by the program is 333. You can modify this value by editing the source here:

        -
            C[333*7],d=333;
        +
            C[333*7],d=333;

        Each row has six columns:

        1. Screen X : x position of the object in the level.
        2. diff --git a/2014/maffiodo2/README.md b/2014/maffiodo2/README.md index 263750a94..cd0256e5c 100644 --- a/2014/maffiodo2/README.md +++ b/2014/maffiodo2/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -21,14 +21,14 @@ For more detailed information see [2014 maffiodo2 bugs](../../bugs.html#2014_maf ## To use: -```sh +``` ./prog arg ``` ## Try: -```sh +``` ./try.sh ``` @@ -41,14 +41,14 @@ as fun but it's 121 bytes instead of 140. ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` cat image.rgb | ./prog.alt ``` @@ -91,7 +91,7 @@ The program will crash if run without parameters. If you have a terminal geometry than is different from the common 80x25 you can modify the *output width* by changing the value of the first variable: -```c +``` d=80, ``` @@ -99,14 +99,14 @@ modify the *output width* by changing the value of the first variable: Type this: -```sh +``` cat image.rgb | ./prog " .:;Y0" ``` You can use your own image. Convert the image to a raw RGB image. Using ImageMagick it's very simple: -```sh +``` convert -geometry 80x source.jpg image.rgb ``` @@ -116,7 +116,7 @@ program is the *conversion ramp*. You can use different ramps or create your own These are some ramps you can try: -```sh +``` ./prog " :1" ./prog " .:;Y0" ./prog " .:-=+*#%@" @@ -127,7 +127,7 @@ These are some ramps you can try: An alternative version of this program is only 121bytes long: -```c +``` d=80,e,j;g(){j+=getchar();}main(){for(;;){j=0;g();if(j<0)break;g(g());putchar(" .:#@"[j/3*5>>8]);if(!(++e%d))puts("");}} ``` diff --git a/2014/maffiodo2/index.html b/2014/maffiodo2/index.html index 4db3fb827..2b31cc991 100644 --- a/2014/maffiodo2/index.html +++ b/2014/maffiodo2/index.html @@ -141,7 +141,7 @@ Location: IT - Italian Republic (<

          To build:

          -
              make
          +
              make

          There is a 121 byte version provided by the author. See Alternate code below.

          Bugs and (Mis)features:

          @@ -149,16 +149,16 @@ code below.

              STATUS: INABIAF - please **DO NOT** fix

          For more detailed information see 2014 maffiodo2 bugs.

          To use:

          -
              ./prog arg
          +
              ./prog arg

          Try:

          -
              ./try.sh
          +
              ./try.sh

          Alternate code:

          This shorter version is provided by the author. It has a fixed ramp and so not as fun but it’s 121 bytes instead of 140.

          Alternate build:

          -
              make alt
          +
              make alt

          Alternate use:

          -
              cat image.rgb | ./prog.alt
          +
              cat image.rgb | ./prog.alt

          Judges’ remarks:

          On the face of it :-) given what this program does one might wonder what makes this winning entry special. But when you realize the source is small enough for posting @@ -185,24 +185,24 @@ from stdin and print the ASCII ART to stdout.

          Screen size

          If you have a terminal geometry than is different from the common 80x25 you can modify the output width by changing the value of the first variable:

          -
              d=80,
          +
              d=80,

          Something to try

          Type this:

          -
              cat image.rgb | ./prog "  .:;Y0"
          +
              cat image.rgb | ./prog "  .:;Y0"

          You can use your own image. Convert the image to a raw RGB image. Using ImageMagick it’s very simple:

          -
              convert -geometry 80x source.jpg image.rgb
          +
              convert -geometry 80x source.jpg image.rgb

          This program require one parameter or it will crash. The parameter of the program is the conversion ramp. You can use different ramps or create your own (for example using some letters of your name).

          These are some ramps you can try:

          -
              ./prog " :1"
          -    ./prog "  .:;Y0"
          -    ./prog " .:-=+*#%@"
          -    ./prog "   .,:!-iots&8%#@$"
          +
              ./prog " :1"
          +    ./prog "  .:;Y0"
          +    ./prog " .:-=+*#%@"
          +    ./prog "   .,:!-iots&8%#@$"

          121 byte version

          An alternative version of this program is only 121bytes long:

          -
              d=80,e,j;g(){j+=getchar();}main(){for(;;){j=0;g();if(j<0)break;g(g());putchar(" .:#@"[j/3*5>>8]);if(!(++e%d))puts("");}}
          +
              d=80,e,j;g(){j+=getchar();}main(){for(;;){j=0;g();if(j<0)break;g(g());putchar(" .:#@"[j/3*5>>8]);if(!(++e%d))puts("");}}

          This alternative version has a fixed ramp. It’s smaller but it’s not so fun to use…

          make ``` ## To use: -```sh +``` ./prog [arg ..] ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2014/morgan/index.html b/2014/morgan/index.html index 52bd24006..f7ead3afd 100644 --- a/2014/morgan/index.html +++ b/2014/morgan/index.html @@ -141,11 +141,11 @@ Location: FR - French Republic (

          To build:

          -
              make
          +
              make

          To use:

          -
              ./prog [arg ..]
          +
              ./prog [arg ..]

          Try:

          -
              ./try.sh
          +
              ./try.sh

          Judges’ remarks:

          Think of this as a Maker Faire’s make. :-)

          It works reasonably well. While not super ultra-featured, it does fair well diff --git a/2014/sinon/README.md b/2014/sinon/README.md index 4ab27d50e..21fca6b31 100644 --- a/2014/sinon/README.md +++ b/2014/sinon/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./hecate.sh ./glock.sh @@ -16,7 +16,7 @@ ## Try: -```sh +``` ./try.sh ``` @@ -41,7 +41,7 @@ under one minute. To start, compile and run the program. To resume, compile and run the output repeatedly until you have won/lost the game. For example: -```sh +``` cp prog.c run.c gcc -O0 run.c -o run && ./run | tee run.c gcc -O2 run.c -o run && ./run | tee run.c @@ -106,7 +106,7 @@ a primary input. that there are no files named "run" and "run.c" in current directory (they will be overwritten) and run: -```sh +``` perl prog.c | bash ``` diff --git a/2014/sinon/index.html b/2014/sinon/index.html index 3f0da5d4e..75412c006 100644 --- a/2014/sinon/index.html +++ b/2014/sinon/index.html @@ -141,13 +141,13 @@ Location: US - United States of America

          To build:

          -
              make
          +
              make

          To use:

          -
              ./hecate.sh
          -
          -    ./glock.sh
          +
              ./hecate.sh
          +
          +    ./glock.sh

          Try:

          -
              ./try.sh
          +
              ./try.sh

          This script will ask you if you wish to try again after each run. Type in any character other than y or Y to exit at this point.

          Judges’ remarks:

          @@ -160,10 +160,10 @@ or unspecified behavior?

          under one minute.

          To start, compile and run the program. To resume, compile and run the output repeatedly until you have won/lost the game. For example:

          -
              cp prog.c run.c
          -    gcc -O0 run.c -o run && ./run | tee run.c
          -    gcc -O2 run.c -o run && ./run | tee run.c
          -    ...
          +
              cp prog.c run.c
          +    gcc -O0 run.c -o run && ./run | tee run.c
          +    gcc -O2 run.c -o run && ./run | tee run.c
          +    ...

          Details

          Sinon is played by compiling and running the output repeatedly. Two factors determine what actions are taken:

          @@ -211,7 +211,7 @@ a primary input.

          Sinon has a demo mode that plays the game automatically. Make sure that there are no files named “run” and “run.c” in current directory (they will be overwritten) and run:

          -
              perl prog.c | bash
          +
              perl prog.c | bash

          File size and CRC32 of prog.c are embedded in line 7.

          Process for making Sinon is included in spoiler.html.

          Layout of this code is based on Asada Shino, also known as “Sinon”, diff --git a/2014/skeggs/README.md b/2014/skeggs/README.md index e3f6a624d..450b1f4d6 100644 --- a/2014/skeggs/README.md +++ b/2014/skeggs/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog ``` diff --git a/2014/skeggs/index.html b/2014/skeggs/index.html index 61990b927..83e11cfba 100644 --- a/2014/skeggs/index.html +++ b/2014/skeggs/index.html @@ -141,9 +141,9 @@ Location: US - United States of America

          To build:

          -
              make
          +
              make

          To use:

          -
              ./prog
          +
              ./prog

          HINT: Try pressing the left and right arrow keys as needed. Also try pressing space/enter to select options. Pressing Q or Escape may end the fun before you are ready. :-)

          diff --git a/2014/vik/README.md b/2014/vik/README.md index 4cee168f8..117183dd4 100644 --- a/2014/vik/README.md +++ b/2014/vik/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -22,7 +22,7 @@ For more detailed information see [2014 vik bugs](../../bugs.html#2014_vik). ## To use: -```sh +``` echo foo | ./prog > audio_file.raw echo foo | ./prog | mplayer -demuxer rawaudio - @@ -31,7 +31,7 @@ For more detailed information see [2014 vik bugs](../../bugs.html#2014_vik). ## Try: -```sh +``` ./try.sh ``` @@ -44,7 +44,7 @@ instructions on how to get it to work with Windows. ### Alternate build: -```sh +``` make alt ``` @@ -59,13 +59,13 @@ Use `prog.alt` as you would `prog` above as well as below. This program sets a new tone for obfuscation. But do you understand what it says about obfuscation? Perhaps: -```sh +``` ./prog < prog.c > prog.raw ``` might speak to your coding style? If not, then perhaps: -```sh +``` ./prog < README.md | mplayer -demuxer rawaudio - ``` @@ -87,7 +87,7 @@ Don't forget the last '`-`' as it makes `mplayer(1)` read from `stdin`. ## Convert audio file with Morse signals to text -```sh +``` ./prog e < audio_file.raw ``` @@ -106,7 +106,7 @@ Microsoft compilers add a carriage return to newlines, and to compile the program with this platform, the following line can be added to `main()` before any code in order for the program to run correctly: -```c +``` _setmode(_fileno(stdout), 0x8000); ``` diff --git a/2014/vik/index.html b/2014/vik/index.html index cec2d9147..f069e3609 100644 --- a/2014/vik/index.html +++ b/2014/vik/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

          To build:

          -
              make
          +
              make

          There is an alternate version that will theoretically work with Windows compilers (if anything in Windows works :-) ). See the Alternate code section below.

          @@ -150,24 +150,24 @@ code section below.

              STATUS: known bug - please help us fix

          For more detailed information see 2014 vik bugs.

          To use:

          -
              echo foo | ./prog > audio_file.raw
          -
          -    echo foo | ./prog | mplayer -demuxer rawaudio -
          +
              echo foo | ./prog > audio_file.raw
          +
          +    echo foo | ./prog | mplayer -demuxer rawaudio -

          Try:

          -
              ./try.sh
          +
              ./try.sh

          Alternate code:

          The alternate code, prog.alt.c, is based on the author’s instructions on how to get it to work with Windows.

          Alternate build:

          -
              make alt
          +
              make alt

          Alternate use:

          Use prog.alt as you would prog above as well as below.

          Judges’ remarks:

          This program sets a new tone for obfuscation. But do you understand what it says about obfuscation? Perhaps:

          -
              ./prog < prog.c > prog.raw
          +
              ./prog < prog.c > prog.raw

          might speak to your coding style? If not, then perhaps:

          -
              ./prog < README.md | mplayer -demuxer rawaudio -
          +
              ./prog < README.md | mplayer -demuxer rawaudio -

          might help? :-)

          Author’s remarks:

          Remarks

          @@ -177,7 +177,7 @@ I can tell, there are at least six chocolate references in this program.

          Via streaming to mplayer(1), you can listen to the Morse audio.

          Don’t forget the last ‘-’ as it makes mplayer(1) read from stdin.

          Convert audio file with Morse signals to text

          -
              ./prog e < audio_file.raw
          +
              ./prog e < audio_file.raw

          or alternatively pass a .wav file as input.

          The preferred input format 44.1kHz stereo, but it does a decent job on mono input and different frequencies as well.

          @@ -187,7 +187,7 @@ the program relies on writing binary data to stdout.

          Microsoft compilers add a carriage return to newlines, and to compile the program with this platform, the following line can be added to main() before any code in order for the program to run correctly:

          -
              _setmode(_fileno(stdout), 0x8000);
          +
              _setmode(_fileno(stdout), 0x8000);

          NOTE: see the alternate code for this.

          Known Issues

          The program uses a quite simple algorithm for detecting tone on and off events diff --git a/2014/wiedijk/README.md b/2014/wiedijk/README.md index 12785a580..a5b70fe87 100644 --- a/2014/wiedijk/README.md +++ b/2014/wiedijk/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./try.sh ``` @@ -22,7 +22,7 @@ By default that will use `indent(1)` found by the shell `type -P indent` and `sed(1)` found by the shell `type -P sed` but if you want to change these, say to try a different beautifier, you can do it like: -```sh +``` INDENT=bcpp ./try.sh ``` diff --git a/2014/wiedijk/index.html b/2014/wiedijk/index.html index 10b81cb71..3a43b987b 100644 --- a/2014/wiedijk/index.html +++ b/2014/wiedijk/index.html @@ -141,15 +141,15 @@ Location: NL - Kingdom of the Netherlan

          To build:

          -
              make
          +
              make

          To use:

          -
              ./prog
          +
              ./prog

          Try:

          -
              ./try.sh
          +
              ./try.sh

          By default that will use indent(1) found by the shell type -P indent and sed(1) found by the shell type -P sed but if you want to change these, say to try a different beautifier, you can do it like:

          -
              INDENT=bcpp ./try.sh
          +
              INDENT=bcpp ./try.sh

          which would change it to use bcpp(1) instead of indent(1). Do similar for sed(1) only use the name SED.

          Judges’ remarks:

          diff --git a/2015/burton/README.md b/2015/burton/README.md index 7e336f4d6..cb6fcc0bc 100644 --- a/2015/burton/README.md +++ b/2015/burton/README.md @@ -1,19 +1,19 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog "expression" ``` or: -```sh +``` ./prog ``` @@ -22,13 +22,13 @@ Type in expressions on standard input. ## Try: -```sh +``` ./try.sh ``` Notice how the script reads in from a file. If you type just: -```sh +``` ./prog ``` @@ -37,7 +37,7 @@ it will prompt you in the same way. Send ctrl-c to exit. Finally, if you wish to read the man page: -```sh +``` man ./calc.1 ``` @@ -51,7 +51,7 @@ author's remarks below. ### Alternate build: -```sh +``` make alt ``` @@ -109,7 +109,7 @@ Yes, this is another calculator program. However, unlike any other calculator source code the author is aware of, this one contains no digits. At all. Anywhere. As in -```sh +``` grep '[0-9]' prog.c || echo no digits! ``` @@ -222,7 +222,7 @@ With `-Wall -std=c99`, both are quite noisy, and all can be ignored: If the program name begins with an `e`, it echoes `stdin` to `stdout`. This allows for a convenient test suite: -```sh +``` ln -sf prog eprog PATH=. eprog < test.in | diff - test.out ``` diff --git a/2015/burton/index.html b/2015/burton/index.html index 1d410a944..687a19a71 100644 --- a/2015/burton/index.html +++ b/2015/burton/index.html @@ -141,25 +141,25 @@ Location: US - United States of America

          To build:

          -
              make
          +
              make

          To use:

          -
              ./prog "expression"
          +
              ./prog "expression"

          or:

          -
              ./prog
          +
              ./prog

          Type in expressions on standard input.

          Try:

          -
              ./try.sh
          +
              ./try.sh

          Notice how the script reads in from a file. If you type just:

          -
              ./prog
          +
              ./prog

          it will prompt you in the same way. Send ctrl-c to exit.

          Finally, if you wish to read the man page:

          -
              man ./calc.1
          +
              man ./calc.1

          Alternate code:

          An alternate version of this entry, prog.alt.c, is provided. This alternate code is discussed in the “prog.c vs prog.alt.c” section of the author’s remarks below.

          Alternate build:

          -
              make alt
          +
              make alt

          Alternate use:

          Use prog.alt as you would prog above.

          Judges’ remarks:

          @@ -189,7 +189,7 @@ corrected by adding -fsigned-char to the compile line.

          Yes, this is another calculator program.

          However, unlike any other calculator source code the author is aware of, this one contains no digits. At all. Anywhere. As in

          -
              grep '[0-9]' prog.c || echo no digits!
          +
              grep '[0-9]' prog.c || echo no digits!

          Nor are the digits simply obfuscated. There are no character constants. There is only one single, short string, and it does not contain any obfuscated digits. And yet the output is in decimal and hexadecimal, and it accepts octal, decimal, @@ -265,8 +265,8 @@ To stifle these complaints:

          Test Suite:

          If the program name begins with an e, it echoes stdin to stdout. This allows for a convenient test suite:

          -
              ln -sf prog eprog
          -    PATH=. eprog < test.in | diff - test.out
          +
              ln -sf prog eprog
          +    PATH=. eprog < test.in | diff - test.out

          Spoilers:

          If you do not want to puzzle out how it works, see spoilers.html.

          make ``` To change the dimensions you can use the `WIDTH` and `HEIGHT` variables when compiling (default 1024 x 800): -```sh +``` make clobber WIDTH=640 HEIGHT=480 ``` @@ -22,14 +22,14 @@ code](#alternate-code) below. ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./prog ``` @@ -77,7 +77,7 @@ This alt version does this for you. ### Alternate build: -```sh +``` make alt ``` @@ -174,7 +174,7 @@ 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) ``` diff --git a/2015/dogon/index.html b/2015/dogon/index.html index b94523632..17a1afcd0 100644 --- a/2015/dogon/index.html +++ b/2015/dogon/index.html @@ -141,19 +141,19 @@ Location: IL - State of Israel (

          To build:

          -
              make
          +
              make

          To change the dimensions you can use the WIDTH and HEIGHT variables when compiling (default 1024 x 800):

          -
              make clobber WIDTH=640 HEIGHT=480
          +
              make clobber WIDTH=640 HEIGHT=480

          to make the game 640 x 480. Obviously changing it to non numbers or negative numbers or too large numbers will cause problems.

          There is an alternate version that is based on the author’s suggestion to change a value in order to see a bug that they avoided in their entry. See Alternate code below.

          To use:

          -
              ./prog
          +
              ./prog

          Try:

          -
              ./prog
          +
              ./prog

          Press and hold the Left Arrow key until you turn 90-degrees to the left.

          When you see a long tunnel, press the function key F2.

          Use the Up, Down, Left and Right keys to change your path.

          @@ -176,7 +176,7 @@ again.

          direction of the main tunnel.

          This alt version does this for you.

          Alternate build:

          -
              make alt
          +
              make alt

          Alternate use:

          Use prog.alt as you would prog above.

          Alternate try:

          @@ -246,7 +246,7 @@ 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:
      -
          *(a&1?&C:&B)-=(.05 -a/2%2*.1)*!(a-1&4092^3920)
      +
          *(a&1?&C:&B)-=(.05 -a/2%2*.1)*!(a-1&4092^3920)

      Precision issues:

      The entry, on purpose, (see the section about SIMD below) does not use enough bits of precision, so sometimes the ray will miss the intersection of two voxel diff --git a/2015/duble/README.md b/2015/duble/README.md index b93c41b44..a66439c62 100644 --- a/2015/duble/README.md +++ b/2015/duble/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,14 +10,14 @@ See [Alternate code](#alternate-code) below. ## To use: -```sh +``` echo Some text | ./prog ``` ## Try: -```sh +``` ./try.sh ``` @@ -34,7 +34,7 @@ author in the '[prog.c](prog.c) vs [prog.alt.c](prog.alt.c)' section of their re ### Alternate build: -```sh +``` make alt ``` @@ -84,13 +84,13 @@ been shortened in this file. If you have `clang`: -```sh +``` CC=clang make -e ``` Otherwise (gcc): -```sh +``` make ``` @@ -116,7 +116,7 @@ needed in this case). #### Basic mode: -```sh +``` $ echo 'I am testing this thing.' | ./prog [... rendering ...] @@ -127,7 +127,7 @@ needed in this case). #### Interactive mode: -```sh +``` $ ./prog > hello world!!! [... rendering ...] @@ -206,7 +206,7 @@ simple text documents. Thus, if you try for example: -```sh +``` $ ./prog < prog.c ``` @@ -219,7 +219,7 @@ you are curious. :) Defining an environment variable called `DRAFT` will enable the 'draft-mode'. Try for example: -```sh +``` $ echo 'testing the draft mode' | DRAFT=1 ./prog ``` diff --git a/2015/duble/index.html b/2015/duble/index.html index d0819b66a..13373cfae 100644 --- a/2015/duble/index.html +++ b/2015/duble/index.html @@ -141,13 +141,13 @@ Location: FR - French Republic (

      To build:

      -
          make
      +
          make

      There is an alternate version of this entry, discussed in the author’s remarks. See Alternate code below.

      To use:

      -
          echo Some text | ./prog
      +
          echo Some text | ./prog

      Try:

      -
          ./try.sh
      +
          ./try.sh

      As the script says if you want to move to the next command at any point (lorem-ipsum.txt takes a while to print in particular) you may do so by hitting ctrl-c/sending intr.

      @@ -155,7 +155,7 @@ ctrl-c/sending intr.

      This alternate code, provided by the author, is discussed in more detail by the author in the ‘prog.c vs prog.alt.c’ section of their remarks.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      Use prog.alt as you would prog above.

      Judges’ remarks:

      @@ -181,9 +181,9 @@ with other compilers or optimization levels). These have been fixed in been shortened in this file.

      How to build

      If you have clang:

      -
          CC=clang make -e
      +
          CC=clang make -e

      Otherwise (gcc):

      -
          make
      +
          make

      (You will get a few warnings in this case.)

      How to use it

      You need a terminal configured to handle a UTF-8 encoding and a font including @@ -196,16 +196,16 @@ configuration was needed.

      I also tested it on FreeBSD 9.3 32bits (font and encoding configuration was needed in this case).

      Basic mode:

      -
          $ echo 'I am testing this thing.' | ./prog
      -    [... rendering ...]
      -
      -    $ ./prog < lorem-ipsum.txt
      -    [... rendering ...]
      +
          $ echo 'I am testing this thing.' | ./prog
      +    [... rendering ...]
      +
      +    $ ./prog < lorem-ipsum.txt
      +    [... rendering ...]

      Interactive mode:

      -
          $ ./prog
      -    > hello world!!!
      -    [... rendering ...]
      -    >
      +
          $ ./prog
      +    > hello world!!!
      +    [... rendering ...]
      +    >

      Obfuscation:

      This entry is obfuscated in various ways:

        @@ -255,13 +255,13 @@ could still happen in case of long words.

        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
        +
            $ ./prog < prog.c

        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
        +
            $ 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” diff --git a/2015/endoh1/README.md b/2015/endoh1/README.md index 2ad45556a..1d3fe2ed1 100644 --- a/2015/endoh1/README.md +++ b/2015/endoh1/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -11,7 +11,7 @@ require it](../../faq.html#tcpserver). ## To use: -```sh +``` tcpserver -v 127.0.0.1 10333 ./prog ioccc.txt ``` @@ -44,7 +44,7 @@ his work. Compile the program as follows: -```sh +``` cc -O3 -std=c99 \ -Wall -Wextra -pedantic -o prog prog.c \ -Delta_u="Du*laplacian(u)-u*v*v+F*(1-u)" \ @@ -59,7 +59,7 @@ Then, run it with the `tcpserver` command in the [Daniel J. Bernstein](../../authors.html#Daniel_J_Bernstein)'s [1991/brndstd](../../1991/brnstnd/index.html) "Best of Show". -```sh +``` tcpserver -v 127.0.0.1 10333 ./prog ioccc.txt ``` diff --git a/2015/endoh1/index.html b/2015/endoh1/index.html index 5c1933b0c..baef32d36 100644 --- a/2015/endoh1/index.html +++ b/2015/endoh1/index.html @@ -144,12 +144,12 @@ Location: JP - Japan

        To build:

        -
            make
        +
            make

        NOTE: this program requires the tool tcpserver to use. If you do not have this program see FAQ 3.14 - How do I compile and install tcpserver for entries that require it.

        To use:

        -
            tcpserver -v 127.0.0.1 10333 ./prog ioccc.txt
        +
            tcpserver -v 127.0.0.1 10333 ./prog ioccc.txt

        Then connect to http://localhost:10333 with your browser.

        Judges’ remarks:

        How did the leopard get its @@ -168,18 +168,18 @@ test? This program is also based on his work.

        Whirlwind tour

        Compile the program as follows:

        -
            cc -O3 -std=c99 \
        -           -Wall -Wextra -pedantic -o prog prog.c \
        -           -Delta_u="Du*laplacian(u)-u*v*v+F*(1-u)" \
        -           -Delta_v="Dv*laplacian(v)+u*v*v-v*(F+K)" \
        -           -DF=0.040 -DK=0.060 -DDu=0.200 -DDv=0.100 \
        -           -DUV_BACKGROUND=1,0 -DUV_DROP=-0.5,0.5 \
        -           -DTIMESTEP=1.0 -DSPEED=2 -DRGB=255:128:192
        +
            cc -O3 -std=c99 \
        +           -Wall -Wextra -pedantic -o prog prog.c \
        +           -Delta_u="Du*laplacian(u)-u*v*v+F*(1-u)" \
        +           -Delta_v="Dv*laplacian(v)+u*v*v-v*(F+K)" \
        +           -DF=0.040 -DK=0.060 -DDu=0.200 -DDv=0.100 \
        +           -DUV_BACKGROUND=1,0 -DUV_DROP=-0.5,0.5 \
        +           -DTIMESTEP=1.0 -DSPEED=2 -DRGB=255:128:192

        Then, run it with the tcpserver command in the ucspi-tcp package, which was created by Daniel J. Bernstein’s 1991/brndstd “Best of Show”.

        -
            tcpserver -v 127.0.0.1 10333 ./prog ioccc.txt
        +
            tcpserver -v 127.0.0.1 10333 ./prog ioccc.txt

        Finally, open http://127.0.0.1:10333/ in a modern browser supporting HTML5. You can use the mouse cursor to place drops into the Petri dish interactively.

        diff --git a/2015/endoh2/README.md b/2015/endoh2/README.md index 7193fc798..4c03bea91 100644 --- a/2015/endoh2/README.md +++ b/2015/endoh2/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./try.sh ``` @@ -31,7 +31,7 @@ At this point you might be wondering, [WTF](http://acronyms.thefreedictionary.co How is this code obfuscated? Well look again: -```sh +``` less prog.c more prog.c @@ -49,7 +49,7 @@ If you are still puzzled, look at [prog.c](prog.c) with your favorite text edito **Follow these instructions literally!** -```sh +``` cat prog.c gcc -w -o prog prog.c ./prog diff --git a/2015/endoh2/index.html b/2015/endoh2/index.html index fac413246..950828a5c 100644 --- a/2015/endoh2/index.html +++ b/2015/endoh2/index.html @@ -141,11 +141,11 @@ Location: JP - Japan

        To build:

        -
            make
        +
            make

        To use:

        -
            ./prog
        +
            ./prog

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        At this point you might be wondering, WTF?*

          @@ -154,18 +154,18 @@ Location: JP - Japan
        • What the Fish (python form)

        How is this code obfuscated? Well look again:

        -
            less prog.c
        -
        -    more prog.c
        +
            less prog.c
        +
        +    more prog.c

        Where did those underscores come from? Well RTFS!**

        ** Read the Freaking Source (polite form) ** Read The Freaking Screen (polite form)

        If you are still puzzled, look at prog.c with your favorite text editor.

        Author’s remarks:

        Follow these instructions literally!

        -
            cat prog.c
        -    gcc -w -o prog prog.c
        -    ./prog
        +
            cat prog.c
        +    gcc -w -o prog prog.c
        +    ./prog

        You will do a double take.

        Hint 1: Do less prog.c. You will see an emphasized string if your terminal supports bold.

        diff --git a/2015/endoh3/README.md b/2015/endoh3/README.md index 70ad55fa8..6fe56a12b 100644 --- a/2015/endoh3/README.md +++ b/2015/endoh3/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog ``` @@ -16,7 +16,7 @@ To see the original [mullender](mullender.c) in action: -```sh +``` ./try.sh ``` @@ -26,7 +26,7 @@ like at the end. Send INTR to end the program. More generally use: -```sh +``` cc -o prog prog.c foo.c ./prog ^C # if necessary, where ^C is ctrl-C, interrrupt @@ -71,7 +71,7 @@ Read it upside down.) You got it? This program is supposed to be used in this way: -```sh +``` wget https://www.ioccc.org/1984/mullender.c clang -o prog prog.c mullender.c ./prog diff --git a/2015/endoh3/index.html b/2015/endoh3/index.html index 6740a5d56..8458cbe2a 100644 --- a/2015/endoh3/index.html +++ b/2015/endoh3/index.html @@ -141,19 +141,19 @@ Location: JP - Japan

        To build:

        -
            make
        +
            make

        To use:

        -
            ./prog
        +
            ./prog

        Try:

        To see the original mullender in action:

        -
            ./try.sh
        +
            ./try.sh

        Observe what happens when you hit enter or another character! You might even try typing out, one character at a time, 1984/mullender, and then see what it looks like at the end. Send INTR to end the program.

        More generally use:

        -
            cc -o prog prog.c foo.c
        -    ./prog
        -    ^C  # if necessary, where ^C is ctrl-C, interrrupt
        +
            cc -o prog prog.c foo.c
        +    ./prog
        +    ^C  # if necessary, where ^C is ctrl-C, interrrupt

        to compile and run prog as whatever foo.c is in the joke PDP-11 emulator.

        Judges’ remarks:

        Like Marty and @@ -181,9 +181,9 @@ the source code from all angles..

        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:

        -
            wget https://www.ioccc.org/1984/mullender.c
        -    clang -o prog prog.c mullender.c
        -    ./prog
        +
            wget https://www.ioccc.org/1984/mullender.c
        +    clang -o prog prog.c mullender.c
        +    ./prog

        You can enjoy the legendary winning entry of the first IOCCC, again.

        Internal

        This program uses __attribute__((constructor)), which is a GCC extension, to diff --git a/2015/endoh4/README.md b/2015/endoh4/README.md index 3e3f971fe..f5fedc363 100644 --- a/2015/endoh4/README.md +++ b/2015/endoh4/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -11,14 +11,14 @@ code](#alternate-code) below for details. ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./try.sh ``` @@ -32,7 +32,7 @@ Dogon](../../authors.html#Gil_Dogon); it is the author's original entry. ### Alternate build: -```sh +``` make alt ``` @@ -54,7 +54,7 @@ experiment with numbers that have more or larger factors? Visual factorization 1-liner. Try: -```sh +``` gcc -o prog prog.c ./prog @ ./prog @ @ diff --git a/2015/endoh4/index.html b/2015/endoh4/index.html index f7329c2af..6891974b7 100644 --- a/2015/endoh4/index.html +++ b/2015/endoh4/index.html @@ -141,19 +141,19 @@ Location: JP - Japan

        To build:

        -
            make
        +
            make

        There is an alt version which is the originally submitted entry. See Alternate code below for details.

        To use:

        -
            ./prog <a number of arguments>
        +
            ./prog <a number of arguments>

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Alternate code:

        An alternate version of this entry, prog.alt.c, is provided. This alternate code does not contain improvements suggested by Gil Dogon; it is the author’s original entry.

        Alternate build:

        -
            make alt
        +
            make alt

        Alternate use:

        Use prog.alt as you would prog above.

        Judges’ remarks:

        @@ -163,14 +163,14 @@ run out of command line argument space? How could you modify the program to experiment with numbers that have more or larger factors?

        Author’s remarks:

        Visual factorization 1-liner. Try:

        -
            gcc -o prog prog.c
        -    ./prog @
        -    ./prog @ @
        -    ./prog @ @ @
        -    ./prog @ @ @ @
        -    ./prog @ @ @ @ @ @
        -    ./prog @ @ @ @ @ @ @ @
        -    ./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
        +
            gcc -o prog prog.c
        +    ./prog @
        +    ./prog @ @
        +    ./prog @ @ @
        +    ./prog @ @ @ @
        +    ./prog @ @ @ @ @ @
        +    ./prog @ @ @ @ @ @ @ @
        +    ./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @

        Inspired by Animated Factorization Diagrams.

        prog.alt.c is the original version that I submitted. Gil diff --git a/2015/hou/README.md b/2015/hou/README.md index e4cb3d5c0..6690ff7d4 100644 --- a/2015/hou/README.md +++ b/2015/hou/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2015 hou bugs](../../bugs.html#2015_hou). ## To use: -```sh +``` echo something | ./prog ./prog < file ``` @@ -26,7 +26,7 @@ For more detailed information see [2015 hou bugs](../../bugs.html#2015_hou). ## Try: -```sh +``` ./try.sh ``` @@ -42,7 +42,7 @@ the reference code! Some things that make you go, "huh?" -```sh +``` ./prog < prog.c | cut -c-5 ./prog < Makefile | cut -c-4 ``` @@ -51,7 +51,7 @@ How are those values magically returned? What happens with a large file? Something over 256K. -```sh +``` ./prog < large_file ``` diff --git a/2015/hou/index.html b/2015/hou/index.html index 53d58857b..cdb42f167 100644 --- a/2015/hou/index.html +++ b/2015/hou/index.html @@ -141,16 +141,16 @@ Location: CN - People’s Republic of C

        To build:

        -
            make
        +
            make

        Bugs and (Mis)features:

        The current status of this entry is:

            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2015 hou bugs.

        To use:

        -
            echo something | ./prog
        -    ./prog < file
        +
            echo something | ./prog
        +    ./prog < file

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        A good start for understanding this entry might be rfc1321.txt. How does it compute this using only a @@ -159,11 +159,11 @@ algorithm is about 355 lines of code, yet this entry is only 199 lines with one statement per line and it isn’t using lots of macro expansion tricks like the reference code!

        Some things that make you go, “huh?”

        -
            ./prog < prog.c | cut -c-5
        -    ./prog < Makefile | cut -c-4
        +
            ./prog < prog.c | cut -c-5
        +    ./prog < Makefile | cut -c-4

        How are those values magically returned?

        What happens with a large file? Something over 256K.

        -
            ./prog < large_file
        +
            ./prog < large_file

        Where does that message come from?

        Author’s remarks:

        This looks like a normal C program.

        diff --git a/2015/howe/README.md b/2015/howe/README.md index 5e49afbd7..4d741f51b 100644 --- a/2015/howe/README.md +++ b/2015/howe/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,7 +10,7 @@ below. ## To use: -```sh +``` ./prog file1 file2 ./prog -d file1 file2 @@ -19,7 +19,7 @@ below. ## Try: -```sh +``` ./try.sh ``` @@ -32,7 +32,7 @@ entry but was changed to be the alt version. ### Alternate build: -```sh +``` make alt ``` diff --git a/2015/howe/index.html b/2015/howe/index.html index 162456e7a..b01943aeb 100644 --- a/2015/howe/index.html +++ b/2015/howe/index.html @@ -141,20 +141,20 @@ Location: CA - Canada

        To build:

        -
            make
        +
            make

        There is an alternate version provided. See Alternate code below.

        To use:

        -
            ./prog file1 file2
        -
        -    ./prog -d file1 file2
        +
            ./prog file1 file2
        +
        +    ./prog -d file1 file2

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Alternate code:

        This alternate version does not use a 64-bit FNV hash. This was the original entry but was changed to be the alt version.

        Alternate build:

        -
            make alt
        +
            make alt

        Alternate use:

        Use prog.alt as you would prog above.

        Judges’ remarks:

        diff --git a/2015/mills1/README.md b/2015/mills1/README.md index c9bec2e96..bdfd62035 100644 --- a/2015/mills1/README.md +++ b/2015/mills1/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./prog ``` @@ -27,13 +27,13 @@ Did you find that mobile application game a bit frustrating? Well you can adjust the Makefile parameters to make life a bit easier for you: -```sh +``` ./try.sh ``` which runs: -```sh +``` make clobber all DW=199999 DW=22 DH=16 DA=50 DI=-150 ./prog ``` @@ -147,13 +147,13 @@ to make some changes to the `Makefile` to get emojis to work on your system. To help you get started, I've included some example substitutions for emojis sprites and instruction text; for example, type -```sh +``` make EMOJI=beer LANGUAGE=spanish ``` or -```sh +``` make EMOJI=globe ``` diff --git a/2015/mills1/index.html b/2015/mills1/index.html index a3f046538..06efc3166 100644 --- a/2015/mills1/index.html +++ b/2015/mills1/index.html @@ -141,20 +141,20 @@ Location: US - United States of America

        To build:

        -
            make
        +
            make

        To use:

        -
            ./prog
        +
            ./prog

        Try:

        -
            ./prog
        +
            ./prog

        Press the up arrow and the down arrow at the right time.

        Judges’ remarks:

        Did you find that mobile application game a bit frustrating? Well you can adjust the Makefile parameters to make life a bit easier for you:

        -
            ./try.sh
        +
            ./try.sh

        which runs:

        -
            make clobber all DW=199999 DW=22 DH=16 DA=50 DI=-150
        -    ./prog
        +
            make clobber all DW=199999 DW=22 DH=16 DA=50 DI=-150
        +    ./prog

        From the Makefile:

            # Game parameters
             #
        @@ -240,9 +240,9 @@ characters (needed for UTF-8 support, which is needed for emojis), you may need
         to make some changes to the Makefile to get emojis to work on your system.
         To help you get started, I’ve included some example substitutions for emojis
         sprites and instruction text; for example, type

        -
            make EMOJI=beer LANGUAGE=spanish
        +
            make EMOJI=beer LANGUAGE=spanish

        or

        -
            make EMOJI=globe
        +
            make EMOJI=globe

        for some examples (the full list of options is in the Makefile). Don’t forget to make clobber first (or use make -B). If the output doesn’t look right, you may need to link with the “wide” version of ncurses. On MacOSX 10.11, it diff --git a/2015/mills2/README.md b/2015/mills2/README.md index eda7f95de..0151a9a8c 100644 --- a/2015/mills2/README.md +++ b/2015/mills2/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2015 mills2 bugs](../../bugs.html#2015_mills2 ## To use: -```sh +``` ./prog compressed_file.Z ``` ## Try: -```sh +``` ./try.sh ``` @@ -39,7 +39,7 @@ for a `compress(1)`-like compressor using a similar idea. Why is the sad smiley on line 12 in that particular place? -```c +``` c=0) :( O ``` @@ -66,7 +66,7 @@ on the command line. On the odd chance you don't have `compress(1)` hanging abo on your system, I've provided compressed copies of this year's IOCCC rules and guidelines files. To print them, just do -```sh +``` ./prog ioccc_guidelines.txt.Z ./prog ioccc_rules.txt.Z ``` diff --git a/2015/mills2/index.html b/2015/mills2/index.html index f9f814716..19f86d034 100644 --- a/2015/mills2/index.html +++ b/2015/mills2/index.html @@ -141,22 +141,22 @@ Location: US - United States of America

        To build:

        -
            make
        +
            make

        Bugs and (Mis)features:

        The current status of this entry is:

            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2015 mills2 bugs.

        To use:

        -
            ./prog compressed_file.Z
        +
            ./prog compressed_file.Z

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        Without ASCII art, the source code of this entry would have been exactly 256 bytes. Compared to 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?

        -
            c=0)                            :( O
        +
            c=0)                            :( O

        Author’s remarks:

        The Program

        This program is an implementation of the unix zcat(1) command for printing @@ -174,8 +174,8 @@ single function and a few ints.

        on the command line. On the odd chance you don’t have compress(1) hanging about on your system, I’ve provided compressed copies of this year’s IOCCC rules and guidelines files. To print them, just do

        -
            ./prog ioccc_guidelines.txt.Z
        -    ./prog ioccc_rules.txt.Z
        +
            ./prog ioccc_guidelines.txt.Z
        +    ./prog ioccc_rules.txt.Z

        The Details

        The basic cleverness here comes from realizing that the compressed data is itself an encoded version of the code dictionary. When the encoder sees diff --git a/2015/muth/README.md b/2015/muth/README.md index 2a3a97bf0..2f325f02b 100644 --- a/2015/muth/README.md +++ b/2015/muth/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` make -B [MACHINE=your_machine.h] [TAPE=your_tape.h] [X=[0|1|2|3|4|5|6|7|8|9]] [V=[0|1|2]] run ``` ## Try: -```sh +``` ./try.sh ``` @@ -68,13 +68,13 @@ files for examples. Every symbol used (except `_`) must be explicitly declared using -```c +``` #define sym_SYMBOL(sym, _SYMBOL) sym ``` Example: -```c +``` #define sym_1(sym, _1) sym ``` @@ -84,7 +84,7 @@ Example: The initial content of the tape must be defined in the tape header using a triple like: -```c +``` #define tape ((((,),...l2), l1), c, (r1, (r2..., (,)))) ``` @@ -119,7 +119,7 @@ machine. To halt the machine, use the keyword `break` as in -```c +``` #define A_1 (2, break) ``` diff --git a/2015/muth/index.html b/2015/muth/index.html index b9d3699b7..d957f0c57 100644 --- a/2015/muth/index.html +++ b/2015/muth/index.html @@ -141,11 +141,11 @@ Location: DE - Federal Republic of Germ

        To build:

        -
            make
        +
            make

        To use:

        -
            make -B [MACHINE=your_machine.h] [TAPE=your_tape.h] [X=[0|1|2|3|4|5|6|7|8|9]] [V=[0|1|2]] run
        +
            make -B [MACHINE=your_machine.h] [TAPE=your_tape.h] [X=[0|1|2|3|4|5|6|7|8|9]] [V=[0|1|2]] run

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        This is something we were fearing all along: that the C preprocessor is Turing-complete even without conditionals and recursive file inclusion as some kind of a @@ -179,13 +179,13 @@ macros in the output.

        files for examples.

        Tape Symbols

        Every symbol used (except _) must be explicitly declared using

        -
            #define sym_SYMBOL(sym, _SYMBOL) sym
        +
            #define sym_SYMBOL(sym, _SYMBOL) sym

        Example:

        -
            #define sym_1(sym, _1) sym
        +
            #define sym_1(sym, _1) sym

        Tape

        The initial content of the tape must be defined in the tape header using a triple like:

        -
            #define tape ((((,),...l2), l1), c, (r1, (r2..., (,))))
        +
            #define tape ((((,),...l2), l1), c, (r1, (r2..., (,))))
        • l1, l2, … are the symbols to the left
        • c is the symbol at the current position
        • @@ -209,7 +209,7 @@ want no movement.

          There must be a state A defined, which becomes the initial state of the machine.

          To halt the machine, use the keyword break as in

          -
              #define A_1 (2, break)
          +
              #define A_1 (2, break)
          make ``` @@ -18,7 +18,7 @@ For more detailed information see [2015 schweikhardt bugs](../../bugs.html#2015_ ## To use: -```sh +``` ./prog n ``` @@ -30,7 +30,7 @@ doing something else. The author explains this in more details. ## Try: -```sh +``` ./try.sh ``` @@ -44,7 +44,7 @@ where zeroes move to the right. This code is clean. When you compile with all warnings enabled, such as with clang: -```sh +``` cc -Weverything -pedantic -std=c11 -Dtyp=uint64\_t -O3 prog.c -o prog ``` @@ -73,7 +73,7 @@ the [Collatz conjecture](https://en.wikipedia.org/wiki/Collatz_conjecture). You may explore this famous conjecture using this entry: -```sh +``` ./prog 2410 ./prog abfff ./prog 27f8cebf @@ -158,7 +158,7 @@ prefix) as the first argument. The program prints the given number in zero-padded hex and each iteration along with a line count in decimal. The example above looks like this (compiled with 64 bit word size): -```sh +``` $ ./prog 6 0000000000000006 0000000000000003 1 @@ -175,7 +175,7 @@ The size of `n` is only limited by the argument size limit of your shell/OS (the program implements arbitrary size `bignum`s). To query this on your POSIX system, run -```sh +``` $ getconf ARG_MAX 262144 ``` @@ -187,7 +187,7 @@ Fear not, [bc(1)](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) to the rescue: -```sh +``` $ printf 'obase=16;10^100\n' | bc 1249AD2594C37CEB0B2784C4CE0BF38ACE408E211A7CAAB24308A82E8F1000000000\ 0000000000000000 @@ -333,7 +333,7 @@ hard, I could use `__LINE__` and `stdio.h` macros `EOF`, `L_tmpnam`, Another identity operation. I've done it for you already. Use this `.indent.pro` with FreeBSD indent: -```sh +``` $ cat .indent.pro -bad /* blank line after decls */ -bap /* blank line after functions */ @@ -383,7 +383,7 @@ Spoilers ahead. Duh! Pseudocode, with comments matching those in the C source: -```c +``` /* run */ if (non-NULL and nonempty argv[1]) { n = convert(argv[1]) @@ -404,7 +404,7 @@ Pseudocode, with comments matching those in the C source: `Bignum`s are represented as the two member `struct`s: -```c +``` typedef struct { size_t places; /* number of places in base 2 to the power of (8*sizeof(type)) */ type *number; /* dynamically allocated memory for number */ @@ -438,7 +438,7 @@ into a starting number (which is output as the first line), and starts crunching. Nothing stops you from executing -```sh +``` ./prog "$(cat prog.c)" # Kind of quine? ./prog "$(cat rules guidelines)" # A jackpot? Maybe next year... ./prog "$(cat /bin/ls)" # Number cut short at first NUL byte. @@ -473,7 +473,7 @@ The open source static checker [cppcheck](http://cppcheck.sourceforge.net/) checks various problems with respect to style, performance, portability and general fishiness. To enable all checks, run -```sh +``` cppcheck --enable=all --force -I/usr/include -Dtyp=uint32_t prog.c ``` @@ -486,7 +486,7 @@ checks various problems with respect to security like buffer overflows, function arguments to known troublemaker functions and more. It doesn't need to pre-process code, so can be run without the `typ` macro being defined: -```sh +``` $ flawfinder prog.c Flawfinder version 1.31, (C) 2001-2014 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 169 @@ -592,7 +592,7 @@ use for checking your C programs and I highly recommend trying it. For a start, paste the well know first program in the form and press "Analyze Code". Note the FlexeLint configuration options in comments (no space between `/*` and `lint`). -```c +``` /*lint -w4 turn on everything */ /*lint +esym(534,*) no demonstrator defaults */ /*lint -e966 indirectly included header file not used */ @@ -705,7 +705,7 @@ expressions other than assignments to `char` objects. A consequence is that printing digits with `'0' + digit` is not allowed (even though `'0'` is technically an `int`!) so I am forced to output hex digits with -```c +``` printf("%c", (met)tyr + 32 + 16 + ((8 + EOF) * ((met)tyr / (8 + 2)))); ``` @@ -730,7 +730,7 @@ precedence rules in expressions." This requires parentheses for almost all expressions involving more than one operator, especially those for which a cast is required, leading to hard to understand expressions such as -```c +``` const ser glx = (ser)((asx > (ser)64u) ? (ser)((ser)asx + (ser)8u + (ser)1u) : (ser)asx); not.not[leu] = (and)((and)not.not[leu] | (and)(((and)glx % (and)16u) << (and)lys)); ``` @@ -747,7 +747,7 @@ MISRA 16.10: "If a function returns error information, then that error information shall be tested." A cast to `void` would draw a lint warning, so I use the `printf(3)` result in expressions, -```c +``` lys -= 4 * printf("%c", (met)tyr + 32 + 16 + ((8 + EOF) * ((met)tyr / (8 + 2)))); val += printf("\n") / ((__LINE__ * L_tmpnam) + TMP_MAX); val -= (printf(" %d\n", val) > BUFSIZ) ? FILENAME_MAX : EOF; @@ -755,7 +755,7 @@ I use the `printf(3)` result in expressions, which are, in the absence of errors, equivalent to -```c +``` lys -= 4; /*nop*/ ++val; @@ -772,7 +772,7 @@ declared as pointer to `const` if the pointer is not used to modify the addressed object." in conjunction with lint's "Note 952: Parameter could be declared `const`" causes `const`-poisoning for all functions, -```c +``` static void phe(const ala not); static void gly(ala *const not, const and his); met main(met val, const pro *const his[]); @@ -792,13 +792,13 @@ up :-) (humor really helps!)" If your compiler supports a 128 bit wide type (e.g. clang, gcc) then you can use it via the `typ` macro: -```sh +``` clang -Dtyp=__uint128_t -o prog prog.c ``` Indeed, the program can use (and lints clean for) all of -```sh +``` clang -Dtyp=uint8_t -o prog8 prog.c clang -Dtyp=uint16_t -o prog16 prog.c clang -Dtyp=uint32_t -o prog32 prog.c diff --git a/2015/schweikhardt/index.html b/2015/schweikhardt/index.html index 27cd588ef..be701333a 100644 --- a/2015/schweikhardt/index.html +++ b/2015/schweikhardt/index.html @@ -141,25 +141,25 @@ Location: DE - Federal Republic of Germ

          To build:

          -
              make
          +
              make

          Bugs and (Mis)features:

          The current status of this entry is:

              STATUS: INABIAF - please **DO NOT** fix

          For more detailed information see 2015 schweikhardt bugs.

          To use:

          -
              ./prog n
          +
              ./prog n

          where n is a base 16 number of any size.

          NOTE: although it’s supposed to be a base 16 number nothing will stop you from doing something else. The author explains this in more details.

          Try:

          -
              ./try.sh
          +
              ./try.sh

          After running it once to see what commands are run, you might wish to run it a second time and just hold down space to see a fun scroll of numbers especially where zeroes move to the right.

          Judges’ remarks:

          This code is clean. When you compile with all warnings enabled, such as with clang:

          -
              cc -Weverything -pedantic -std=c11 -Dtyp=uint64\_t -O3 prog.c -o prog
          +
              cc -Weverything -pedantic -std=c11 -Dtyp=uint64\_t -O3 prog.c -o prog

          The code compiles without warnings on the systems that we tested!

          Even more, the code was 100% clean when we ran it against various static source checkers.

          @@ -177,15 +177,15 @@ would be a good warm-up exercise for someone to get ready to begin to work on the Collatz conjecture.

          You may explore this famous conjecture using this entry:

          -
              ./prog 2410
          -    ./prog abfff
          -    ./prog 27f8cebf
          -    ./prog 246f8fddf
          -    ./prog 2e95ab51ffea9de
          -    ./prog e6a5c22fd7bde9f
          -    ./prog 1b7dd73a937485bf
          -    ./prog 7d3237680d190a77e53751b
          -    ./prog 302ab3d052fb87c06228d249581be0e4
          +
              ./prog 2410
          +    ./prog abfff
          +    ./prog 27f8cebf
          +    ./prog 246f8fddf
          +    ./prog 2e95ab51ffea9de
          +    ./prog e6a5c22fd7bde9f
          +    ./prog 1b7dd73a937485bf
          +    ./prog 7d3237680d190a77e53751b
          +    ./prog 302ab3d052fb87c06228d249581be0e4

          NOTE: try.sh runs these for you, filtered through less(1).

          When you first look at the source, the code looks fairly straightforward. But look again. Like the Collatz conjecture, simplicity is deceptive! @@ -238,33 +238,33 @@ and stops at 1. The number n is specified in hexadecim prefix) as the first argument. The program prints the given number in zero-padded hex and each iteration along with a line count in decimal. The example above looks like this (compiled with 64 bit word size):

          -
              $ ./prog 6
          -    0000000000000006
          -    0000000000000003 1
          -    000000000000000A 2
          -    0000000000000005 3
          -    0000000000000010 4
          -    0000000000000008 5
          -    0000000000000004 6
          -    0000000000000002 7
          -    0000000000000001 8
          +
              $ ./prog 6
          +    0000000000000006
          +    0000000000000003 1
          +    000000000000000A 2
          +    0000000000000005 3
          +    0000000000000010 4
          +    0000000000000008 5
          +    0000000000000004 6
          +    0000000000000002 7
          +    0000000000000001 8

          The size of n is only limited by the argument size limit of your shell/OS (the program implements arbitrary size bignums). To query this on your POSIX system, run

          -
              $ getconf ARG_MAX
          -    262144
          +
              $ getconf ARG_MAX
          +    262144

          which reports the limit in bytes, here 256KB. This allows to test whether a Googol, which is 10100, satisfies the conjecture. But what is a googol in hex? Fear not, bc(1) to the rescue:

          -
              $ printf 'obase=16;10^100\n' | bc
          -    1249AD2594C37CEB0B2784C4CE0BF38ACE408E211A7CAAB24308A82E8F1000000000\
          -    0000000000000000
          -    $ ./prog 1249AD2594C37CEB0B2784C4CE0BF38ACE408E211A7CAAB24308A82E8F10000000000000000000000000 \
          -    | less
          -    [...]
          +
              $ printf 'obase=16;10^100\n' | bc
          +    1249AD2594C37CEB0B2784C4CE0BF38ACE408E211A7CAAB24308A82E8F1000000000\
          +    0000000000000000
          +    $ ./prog 1249AD2594C37CEB0B2784C4CE0BF38ACE408E211A7CAAB24308A82E8F10000000000000000000000000 \
          +    | less
          +    [...]

          Observe how the first 100 iterations melt the zeros to the right. Can you explain why?

          For a given n the program behavior is one of the following 3:

          @@ -373,24 +373,24 @@ hard, I could use __LINE__ and stdio.h macros EO

          Run it through a C beautifier

          Another identity operation. I’ve done it for you already. Use this .indent.pro with FreeBSD indent:

          -
              $ cat .indent.pro
          -        -bad   /* blank line after decls */
          -        -bap   /* blank line after functions */
          -        -br    /* braces on if line */
          -        -i8    /* indent */
          -        -l999  /* line length */
          -        -npcs  /* no space after function call names */
          -        -npsl  /* don't break procedure type */
          -        -ut    /* use tabs */
          -        -ce    /* cuddle else */
          -        -nip   /* no parameter indentation */
          -        -di1   /* declaration indent */
          -        -Tand
          -        -Tmet
          -        -Tthr
          -        -Tpro
          -        -Tser
          -        -Tala
          +
              $ cat .indent.pro
          +        -bad   /* blank line after decls */
          +        -bap   /* blank line after functions */
          +        -br    /* braces on if line */
          +        -i8    /* indent */
          +        -l999  /* line length */
          +        -npcs  /* no space after function call names */
          +        -npsl  /* don't break procedure type */
          +        -ut    /* use tabs */
          +        -ce    /* cuddle else */
          +        -nip   /* no parameter indentation */
          +        -di1   /* declaration indent */
          +        -Tand
          +        -Tmet
          +        -Tthr
          +        -Tpro
          +        -Tser
          +        -Tala

          It looks like a perfect program should have:

          • two and a half #includes of non-suspicious standard headers
          • @@ -415,27 +415,27 @@ to be.

            Examine the algorithm

            Spoilers ahead. Duh!

            Pseudocode, with comments matching those in the C source:

            -
                /* run */
            -    if (non-NULL and nonempty argv[1]) {
            -       n = convert(argv[1])
            -       print n                       /* 2hx */
            -       while (n != 1) {              /* one */
            -          if (n is odd) {            /* odd */
            -             m = deep copy of n      /* cpy */
            -             n <<= 1                 /* shl */
            -             n += m                  /* add */
            -             increment n             /* inc */
            -          } else {                   /* eve */
            -             n >>= 1                 /* shr */
            -          }
            -          print n                    /* 2hx */
            -      }
            -    }
            +
                /* run */
            +    if (non-NULL and nonempty argv[1]) {
            +       n = convert(argv[1])
            +       print n                       /* 2hx */
            +       while (n != 1) {              /* one */
            +          if (n is odd) {            /* odd */
            +             m = deep copy of n      /* cpy */
            +             n <<= 1                 /* shl */
            +             n += m                  /* add */
            +             increment n             /* inc */
            +          } else {                   /* eve */
            +             n >>= 1                 /* shr */
            +          }
            +          print n                    /* 2hx */
            +      }
            +    }

            Bignums are represented as the two member structs:

            -
                typedef struct {
            -         size_t places;   /* number of places in base 2 to the power of (8*sizeof(type)) */
            -         type  *number;   /* dynamically allocated memory for number */
            -    } bignum
            +
                typedef struct {
            +         size_t places;   /* number of places in base 2 to the power of (8*sizeof(type)) */
            +         type  *number;   /* dynamically allocated memory for number */
            +    } bignum

            Compile it (with flags to enable all warnings)

            Here’s where the program shines brighter than a gamma-ray burst!

            @@ -452,9 +452,9 @@ expected.

            This means however, that the program accepts any string, turns it into a starting number (which is output as the first line), and starts crunching. Nothing stops you from executing

            -
                ./prog "$(cat prog.c)"            # Kind of quine?
            -    ./prog "$(cat rules guidelines)"  # A jackpot? Maybe next year...
            -    ./prog "$(cat /bin/ls)"           # Number cut short at first NUL byte.
            +
                ./prog "$(cat prog.c)"            # Kind of quine?
            +    ./prog "$(cat rules guidelines)"  # A jackpot? Maybe next year...
            +    ./prog "$(cat /bin/ls)"           # Number cut short at first NUL byte.

            In a certain way, the program is character set and encoding agnostic.

            Assumptions made

              @@ -475,20 +475,20 @@ use 8 * sizeof(typ) bits per place. It does not work when CHA

              The open source static checker cppcheck checks various problems with respect to style, performance, portability and general fishiness. To enable all checks, run

              -
                  cppcheck --enable=all --force -I/usr/include -Dtyp=uint32_t prog.c
              +
                  cppcheck --enable=all --force -I/usr/include -Dtyp=uint32_t prog.c

              No issues found.

              flawfinder

              The open source static checker flawfinder checks various problems with respect to security like buffer overflows, function arguments to known troublemaker functions and more. It doesn’t need to pre-process code, so can be run without the typ macro being defined:

              -
                  $ flawfinder prog.c
              -    Flawfinder version 1.31, (C) 2001-2014 David A. Wheeler.
              -    Number of rules (primarily dangerous function names) in C/C++ ruleset: 169
              -    Examining prog.c
              -    FINAL RESULTS:
              -    ANALYSIS SUMMARY:
              -    No hits found.
              +
                  $ flawfinder prog.c
              +    Flawfinder version 1.31, (C) 2001-2014 David A. Wheeler.
              +    Number of rules (primarily dangerous function names) in C/C++ ruleset: 169
              +    Examining prog.c
              +    FINAL RESULTS:
              +    ANALYSIS SUMMARY:
              +    No hits found.

              valgrind

              The open source dynamic checker valgrind runs an executable and verifies all memory accesses and (de)allocations for proper @@ -572,18 +572,18 @@ demonstrator you can use for checking your C programs and I highly recommend trying it. For a start, paste the well know first program in the form and press “Analyze Code”. Note the FlexeLint configuration options in comments (no space between /* and lint).

              -
                  /*lint -w4            turn on everything */
              -    /*lint +esym(534,*)   no demonstrator defaults */
              -    /*lint -e966          indirectly included header file not used */
              -    /*lint -esym(9058,_*) tag not used outside typedef */
              -    /*lint -misra(2)      */
              -
              -    #include <stdio.h>
              -    int main(void)
              -    {
              -        printf("hello, world\n");
              -        return 0;
              -    }
              +
                  /*lint -w4            turn on everything */
              +    /*lint +esym(534,*)   no demonstrator defaults */
              +    /*lint -e966          indirectly included header file not used */
              +    /*lint -esym(9058,_*) tag not used outside typedef */
              +    /*lint -misra(2)      */
              +
              +    #include <stdio.h>
              +    int main(void)
              +    {
              +        printf("hello, world\n");
              +        return 0;
              +    }

              Possible checks include those for MISRA 2004 compliance verification. The Motor Industry Software Reliability Association @@ -675,7 +675,7 @@ use of character values.” This forbids using character constants in expressions other than assignments to char objects. A consequence is that printing digits with '0' + digit is not allowed (even though '0' is technically an int!) so I am forced to output hex digits with

              -
                  printf("%c", (met)tyr + 32 + 16 + ((8 + EOF) * ((met)tyr / (8 + 2))));
              +
                  printf("%c", (met)tyr + 32 + 16 + ((8 + EOF) * ((met)tyr / (8 + 2))));

              because of the “no magic numbers other than powers of two” rule. How is this an improvement over printf("%c", '0' + tyr + 7 * (tyr / 10), MISRA?

              MISRA 6.3: “typedefs that indicate size and signedness should be used in @@ -691,8 +691,8 @@ redundant casting ensues. It gets worse with the next rule…

              precedence rules in expressions.” This requires parentheses for almost all expressions involving more than one operator, especially those for which a cast is required, leading to hard to understand expressions such as

              -
                  const ser glx = (ser)((asx > (ser)64u) ? (ser)((ser)asx + (ser)8u + (ser)1u) : (ser)asx);
              -    not.not[leu] = (and)((and)not.not[leu] | (and)(((and)glx % (and)16u) << (and)lys));
              +
                  const ser glx = (ser)((asx > (ser)64u) ? (ser)((ser)asx + (ser)8u + (ser)1u) : (ser)asx);
              +    not.not[leu] = (and)((and)not.not[leu] | (and)(((and)glx % (and)16u) << (and)lys));

              MISRA 14.7: “A function shall have a single point of exit at the end of the function.” Sigh. Since I must use eloquent prototypes (8.1, 16.3, 16.4) and static functions (8.10, 8.11), I can only use a few functions. @@ -703,22 +703,22 @@ too high for a sane function.

              MISRA 16.10: “If a function returns error information, then that error information shall be tested.” A cast to void would draw a lint warning, so I use the printf(3) result in expressions,

              -
                  lys -= 4 * printf("%c", (met)tyr + 32 + 16 + ((8 + EOF) * ((met)tyr / (8 + 2))));
              -    val += printf("\n") / ((__LINE__ * L_tmpnam) + TMP_MAX);
              -    val -= (printf(" %d\n", val) > BUFSIZ) ? FILENAME_MAX : EOF;
              +
                  lys -= 4 * printf("%c", (met)tyr + 32 + 16 + ((8 + EOF) * ((met)tyr / (8 + 2))));
              +    val += printf("\n") / ((__LINE__ * L_tmpnam) + TMP_MAX);
              +    val -= (printf(" %d\n", val) > BUFSIZ) ? FILENAME_MAX : EOF;

              which are, in the absence of errors, equivalent to

              -
                  lys -= 4;
              -    /*nop*/
              -    ++val;
              +
                  lys -= 4;
              +    /*nop*/
              +    ++val;

              MISRA 13.1: “Assignment operators shall not be used in expressions that yield a Boolean value.” Forbids the idiomatic if ((p = malloc(n)) == NULL) and requires separate statements, in other words, bloat.

              MISRA 16.7: “A pointer parameter in a function prototype should be declared as pointer to const if the pointer is not used to modify the addressed object.” in conjunction with lint’s “Note 952: Parameter could be declared const” causes const-poisoning for all functions,

              -
                  static void phe(const ala not);
              -    static void gly(ala *const not, const and his);
              -    met main(met val, const pro *const his[]);
              +
                  static void phe(const ala not);
              +    static void gly(ala *const not, const and his);
              +    met main(met val, const pro *const his[]);

              and quite a number of automatic variables.

              Why the “laugh” and “throw up” messages?

              The guidelines state “We like programs that: make us laugh and/or throw @@ -726,13 +726,13 @@ up :-) (humor really helps!)”

              If you have a 128 bit type

              If your compiler supports a 128 bit wide type (e.g. clang, gcc) then you can use it via the typ macro:

              -
                  clang -Dtyp=__uint128_t -o prog prog.c
              +
                  clang -Dtyp=__uint128_t -o prog prog.c

              Indeed, the program can use (and lints clean for) all of

              -
                  clang -Dtyp=uint8_t  -o prog8  prog.c
              -    clang -Dtyp=uint16_t -o prog16 prog.c
              -    clang -Dtyp=uint32_t -o prog32 prog.c
              -    clang -Dtyp=uint64_t -o prog64 prog.c
              -    clang -std=c89 -Dtyp="unsigned long" -o prog89 prog.c
              +
                  clang -Dtyp=uint8_t  -o prog8  prog.c
              +    clang -Dtyp=uint16_t -o prog16 prog.c
              +    clang -Dtyp=uint32_t -o prog32 prog.c
              +    clang -Dtyp=uint64_t -o prog64 prog.c
              +    clang -std=c89 -Dtyp="unsigned long" -o prog89 prog.c

              This works because the program has no need for corresponding SCN or PRI macros to do the scanning and printing of variables of these types. With a 128 bit type the program can represent numbers up to diff --git a/2015/yang/README.md b/2015/yang/README.md index 9116877a7..304af9a2c 100644 --- a/2015/yang/README.md +++ b/2015/yang/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` echo Some text | ./prog ``` ## Try: -```sh +``` ./try.sh ``` @@ -37,7 +37,7 @@ so you need not worry about this. `Fuuko` is a [sea star](https://en.wikipedia.org/wiki/Starfish) generator. Feed her some input through `stdin` to get lots of sea star patterns on `stdout`. -```sh +``` cc -O3 -std=c90 fuuko.c -lm -o fuuko_c90 echo IOCCC | ./fuuko_c90 > output_c90.c ``` @@ -45,7 +45,7 @@ her some input through `stdin` to get lots of sea star patterns on `stdout`. If you compile with a C99 compiler instead of C90, the sea stars will have eyes. -```sh +``` cc -O3 -std=c99 fuuko.c -lm -o fuuko_c99 echo IOCCC | ./fuuko_c99 > output_c99.c ``` @@ -53,7 +53,7 @@ have eyes. Don't like [sea stars](https://en.wikipedia.org/wiki/Starfish)? Use a C++98 compiler to get a [dango](https://en.wikipedia.org/wiki/Dango) instead. -```sh +``` g++ -O3 -std=c++98 fuuko.c -lm -o fuuko_cpp98 echo IOCCC | ./fuuko_cpp98 > output_cpp98.c ``` @@ -63,7 +63,7 @@ compiler to get just [circles](https://en.wikipedia.org/wiki/Circle) (or [Swiss cheese](https://en.wikipedia.org/wiki/Swiss_cheeses_and_dairy_products), if you prefer that). -```sh +``` g++ -O3 -std=c++11 fuuko.c -lm -o fuuko_cpp11 echo IOCCC | ./fuuko_cpp11 > output_cpp11.c ``` @@ -71,7 +71,7 @@ prefer that). Don't like any of these patterns? Use a C11 compiler and there will be no extra pattern. -```sh +``` cc -O3 -std=c11 fuuko.c -lm -o fuuko_c11 echo IOCCC | ./fuuko_c11 > output_c11.c ``` diff --git a/2015/yang/index.html b/2015/yang/index.html index 567b9d1b1..3d9e4b2f0 100644 --- a/2015/yang/index.html +++ b/2015/yang/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

              To build:

              -
                  make
              +
                  make

              To use:

              -
                  echo Some text | ./prog
              +
                  echo Some text | ./prog

              Try:

              -
                  ./try.sh
              +
                  ./try.sh

              Judges’ remarks:

              Before analysing the code in detail we were able to guess two out of four tests this entry uses to tell the 5 languages/flavors apart. Can you find all four?

              @@ -157,26 +157,26 @@ so you need not worry about this.

              Author’s remarks:

              Fuuko is a sea star generator. Feed her some input through stdin to get lots of sea star patterns on stdout.

              -
                  cc -O3 -std=c90 fuuko.c -lm -o fuuko_c90
              -    echo IOCCC | ./fuuko_c90 > output_c90.c
              +
                  cc -O3 -std=c90 fuuko.c -lm -o fuuko_c90
              +    echo IOCCC | ./fuuko_c90 > output_c90.c

              If you compile with a C99 compiler instead of C90, the sea stars will have eyes.

              -
                  cc -O3 -std=c99 fuuko.c -lm -o fuuko_c99
              -    echo IOCCC | ./fuuko_c99 > output_c99.c
              +
                  cc -O3 -std=c99 fuuko.c -lm -o fuuko_c99
              +    echo IOCCC | ./fuuko_c99 > output_c99.c

              Don’t like sea stars? Use a C++98 compiler to get a dango instead.

              -
                  g++ -O3 -std=c++98 fuuko.c -lm -o fuuko_cpp98
              -    echo IOCCC | ./fuuko_cpp98 > output_cpp98.c
              +
                  g++ -O3 -std=c++98 fuuko.c -lm -o fuuko_cpp98
              +    echo IOCCC | ./fuuko_cpp98 > output_cpp98.c

              Don’t like dango either? Use a C++11 compiler to get just circles (or Swiss cheese, if you prefer that).

              -
                  g++ -O3 -std=c++11 fuuko.c -lm -o fuuko_cpp11
              -    echo IOCCC | ./fuuko_cpp11 > output_cpp11.c
              +
                  g++ -O3 -std=c++11 fuuko.c -lm -o fuuko_cpp11
              +    echo IOCCC | ./fuuko_cpp11 > output_cpp11.c

              Don’t like any of these patterns? Use a C11 compiler and there will be no extra pattern.

              -
                  cc -O3 -std=c11 fuuko.c -lm -o fuuko_c11
              -    echo IOCCC | ./fuuko_c11 > output_c11.c
              +
                  cc -O3 -std=c11 fuuko.c -lm -o fuuko_c11
              +    echo IOCCC | ./fuuko_c11 > output_c11.c

              Regardless of which of these C/C++ dialects you choose, the output will all be valid C90 code that reproduces original input on stdout, filled with pointer dereferences (C stars).

              diff --git a/2018/algmyr/README.md b/2018/algmyr/README.md index f97116b54..290432773 100644 --- a/2018/algmyr/README.md +++ b/2018/algmyr/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -22,7 +22,7 @@ For more detailed information see [2018 algmyr bugs](../../bugs.html#2018_algmyr ## To use: -```sh +``` ./prog < prog.c # Print garbage: might mess up your terminal ./prog > out.raw ./prog -d 2 0 out.raw # Decode the first (0th) channel out of two @@ -31,7 +31,7 @@ For more detailed information see [2018 algmyr bugs](../../bugs.html#2018_algmyr ## Try: -```sh +``` ./try.sh ``` @@ -164,13 +164,13 @@ standards compliant). This is used to print the usage instructions. Compiling using -```sh +``` gcc -Wall -Wextra -pedantic ``` gives only `-Wmisleading-indentation` which is sensible considering the source code. While -```sh +``` clang -Wall -Wextra -pedantic ``` @@ -179,7 +179,7 @@ bodies), `-Wstring-plus-int` (since apparently some people think string+`int` is concatenation) and one of the weirder warnings I have seen from me splitting a negative constant with whitespace. Compiling using -```sh +``` clang -Wall -Wextra -pedantic -Weverything ``` diff --git a/2018/algmyr/index.html b/2018/algmyr/index.html index d9736f462..c8b0196e5 100644 --- a/2018/algmyr/index.html +++ b/2018/algmyr/index.html @@ -141,7 +141,7 @@ Location: SE - Kingdom of Sweden (

              To build:

              -
                  make
              +
                  make

              To use this entry requires, in some invocations, a sound processing program. This can be ALSA or SoX but we recommend the latter. See FAQ 3.10 - How do I compile and use an IOCCC entry that requires sound?.

              @@ -150,11 +150,11 @@ compile and use an IOCCC entry that requires sound?.

                  STATUS: INABIAF - please **DO NOT** fix

              For more detailed information see 2018 algmyr bugs.

              To use:

              -
                  ./prog < prog.c                     # Print garbage: might mess up your terminal
              -    ./prog <file1> <file2> > out.raw
              -    ./prog -d 2 0 out.raw               # Decode the first (0th) channel out of two
              +
                  ./prog < prog.c                     # Print garbage: might mess up your terminal
              +    ./prog <file1> <file2> > out.raw
              +    ./prog -d 2 0 out.raw               # Decode the first (0th) channel out of two

              Try:

              -
                  ./try.sh
              +
                  ./try.sh

              Judges’ remarks:

              Be warned, this is not your garden variety text-to-speech program! Earplugs are advised, or at least a handy and well-tested volume knob.

              @@ -242,14 +242,14 @@ additional logic? Answer: ungetc(3) into stdin, one

              Compilation warnings

              Compiling using

              -
                  gcc -Wall -Wextra -pedantic
              +
                  gcc -Wall -Wextra -pedantic

              gives only -Wmisleading-indentation which is sensible considering the source code. While

              -
                  clang -Wall -Wextra -pedantic
              +
                  clang -Wall -Wextra -pedantic

              is a bit more pessimistic and gives -Wempty-body (I like loops without bodies), -Wstring-plus-int (since apparently some people think string+int is a concatenation) and one of the weirder warnings I have seen from me splitting a negative constant with whitespace. Compiling using

              -
                  clang -Wall -Wextra -pedantic -Weverything
              +
                  clang -Wall -Wextra -pedantic -Weverything

              produces a few page faults of warnings and makes me feel generally bad about myself. :(

              Misc

              diff --git a/2018/anderson/README.md b/2018/anderson/README.md index e95cef1d8..313369022 100644 --- a/2018/anderson/README.md +++ b/2018/anderson/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,14 +10,14 @@ code](#alternate-code) below for more details. ## To use: -```sh +``` ./prog < textfile ``` ## Try: -```sh +``` ./try.sh ``` @@ -31,7 +31,7 @@ it was not the shape of the Roman V that we, or the compiler, didn't like. ### Alternate build: -```sh +``` make alt ``` @@ -43,7 +43,7 @@ Use `prog.alt` as you would `prog` above. ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -58,7 +58,7 @@ down](http://en.wikipedia.org/wiki/River_%28typography%29)! ### Compiling the program: -```sh +``` cc -Wall -Wextra -Wpedantic -O3 -std=c11 prog.c -o prog ``` diff --git a/2018/anderson/index.html b/2018/anderson/index.html index e26fc1522..d6c52c91d 100644 --- a/2018/anderson/index.html +++ b/2018/anderson/index.html @@ -141,29 +141,29 @@ Location: US - United States of America

              To build:

              -
                  make
              +
                  make

              There is an alternate version of this entry. See Alternate code below for more details.

              To use:

              -
                  ./prog < textfile
              +
                  ./prog < textfile

              Try:

              -
                  ./try.sh
              +
                  ./try.sh

              Alternate code:

              Compare prog.c and prog.alt.c and find out why we had to modify the entry, and what confused the author (see the author’s remarks). No, it was not the shape of the Roman V that we, or the compiler, didn’t like.

              Alternate build:

              -
                  make alt
              +
                  make alt

              Alternate use:

              Use prog.alt as you would prog above.

              Alternate try:

              -
                  ./try.alt.sh
              +
                  ./try.alt.sh

              Judges’ remarks:

              With this entry, you won’t need to turn your monitor upside down!

              Author’s remarks:

              Compiling the program:

              -
                  cc -Wall -Wextra -Wpedantic -O3 -std=c11 prog.c -o prog
              +
                  cc -Wall -Wextra -Wpedantic -O3 -std=c11 prog.c -o prog

              Also works with a standard of C99, but C90/C89 will not compile due to for loop initial declarations, along with additional warnings about variable length arrays and lack of a return statement.

              diff --git a/2018/bellard/README.md b/2018/bellard/README.md index 429e5f379..f2edcdcfd 100644 --- a/2018/bellard/README.md +++ b/2018/bellard/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,7 +10,7 @@ code](#alternate-code) below. ## To use: -```sh +``` ./prog > lena.ppm ``` @@ -21,7 +21,7 @@ First open [Lenna.png](Lenna.png) in your graphics viewer of choice. Next, after running the above command (`./prog > lena.ppm`), open `lena.ppm` in your graphics viewer of choice. After that try: -```sh +``` ./try.sh ``` @@ -44,7 +44,7 @@ for Windows. ### Alternate build: -```sh +``` make alt ``` @@ -99,7 +99,7 @@ Although the program was optimized to decompress its built-in image, it accepts to decompress image files from its standard input. Examples: -```sh +``` ./prog d < lena512.bin > lena512.ppm ./prog d < fruits.bin > fruits.ppm ./prog d < vintage_cars.bin > vintage_cars.ppm diff --git a/2018/bellard/index.html b/2018/bellard/index.html index 4faf34ef3..1b4788a14 100644 --- a/2018/bellard/index.html +++ b/2018/bellard/index.html @@ -141,16 +141,16 @@ Location: FR - French Republic (

              To build:

              -
                  make
              +
                  make

              There is an alternate version that should work with Windows. See Alternate code below.

              To use:

              -
                  ./prog > lena.ppm
              +
                  ./prog > lena.ppm

              Try:

              First open Lenna.png in your graphics viewer of choice. Next, after running the above command (./prog > lena.ppm), open lena.ppm in your graphics viewer of choice. After that try:

              -
                  ./try.sh
              +
                  ./try.sh

              NOTE: the script uses the tools pngtopam(1) (or pngtopnm(1) for older versions) and pnmscale come from the netpbm project and cjpeg(1) comes from libjpeg-turbo. If you don’t have these tools already see FAQ 3.15 - How do I @@ -163,7 +163,7 @@ it?.

              The prog.alt.c is based on the author’s remarks and it should work for Windows.

              Alternate build:

              -
                  make alt
              +
                  make alt

              Alternate use:

              Use prog.alt as you would prog.

              Judges’ remarks:

              @@ -200,9 +200,9 @@ as the algorithms already have a significant complexity.

              Although the program was optimized to decompress its built-in image, it accepts to decompress image files from its standard input. Examples:

              -
                  ./prog d < lena512.bin > lena512.ppm
              -    ./prog d < fruits.bin > fruits.ppm
              -    ./prog d < vintage_cars.bin > vintage_cars.ppm
              +
                  ./prog d < lena512.bin > lena512.ppm
              +    ./prog d < fruits.bin > fruits.ppm
              +    ./prog d < vintage_cars.bin > vintage_cars.ppm

              The original images for fruits and vintage cars come from Wikipedia and were resized to a width of 1024 pixels.

              The program should be portable on any Unix system. On Windows the line diff --git a/2018/burton1/README.md b/2018/burton1/README.md index c98896bb8..e947c8bb6 100644 --- a/2018/burton1/README.md +++ b/2018/burton1/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,14 +10,14 @@ code](#alternate-code) below. ## To use: -```sh +``` ./prog < any-file ``` ## Try: -```sh +``` ./try.sh ``` @@ -32,7 +32,7 @@ with `-Wno-` options. ### Alternate build: -```sh +``` make alt ``` @@ -82,7 +82,7 @@ and without bypassing the solution using `execve(2)`, or functions built upon it E.g: -```c +``` main(){system("hd");} // it's turtles all the way down! ``` @@ -96,7 +96,7 @@ This solution is pleasing, but a true one-liner was the hoped-for goal. Here is the 157 character version in it's entirety: -```c +``` char O,o[ 20];L(O){ putchar ( O+ 48+39 *(9< O));} I(O) {L(~ 15); @@ -115,7 +115,7 @@ The progression to the present size is interesting, and it is interesting that the same algorithm can be expressed so differently by slight rearrangement of its parts. -```c +``` // 119 char O,o[20];main(l){for(;~(l=getchar());O||puts(o))o[O++]=isprint(l)?l:46,O&=15,printf("%02x ",l);O[o]=0;O&&puts(o);} // 116 @@ -139,7 +139,7 @@ These do not compete in the same category, since their output is materially diff They are derived from the solutions above, but are still fascinating as concise utilities, so here is their progression, for the curious: -```c +``` // 102 I;O(O){putchar(O+48+39*(9>4),O(l&15);O(-38);} // 80 @@ -156,7 +156,7 @@ It is possible to reduce the size of each of these by one by eliding the trailin This was not reported above since the newline kept getting appended by processing software, and it is more interesting to remove characters by changing code than by filtering: -```sh +``` $ tr -d '\012' < 109.c | wc -c 108 $ tr -d '\012' < 76.c | wc -c @@ -257,13 +257,13 @@ the expression within the ternary remains too complex. Try: -```sh +``` cat prog.c prog.alt.c ``` or -```sh +``` cmp -b prog.c prog.alt.c ``` diff --git a/2018/burton1/index.html b/2018/burton1/index.html index f977f41c1..9f52063a8 100644 --- a/2018/burton1/index.html +++ b/2018/burton1/index.html @@ -141,20 +141,20 @@ Location: US - United States of America

              To build:

              -
                  make
              +
                  make

              There is an alternate version of this entry. See Alternate code below.

              To use:

              -
                  ./prog < any-file
              +
                  ./prog < any-file

              Try:

              -
                  ./try.sh
              +
                  ./try.sh

              Alternate code:

              An alternate version of this entry, prog.alt.c, is provided This alternate code was supposed to compile without warnings, however with modern compilers this is no longer the case so it will only cleanly compile with -Wno- options.

              Alternate build:

              -
                  make alt
              +
                  make alt

              Alternate use:

              Use prog.alt as you would prog.

              Judges’ remarks:

              @@ -187,68 +187,68 @@ and without bypassing the solution using execve(2), or functions bu (system(3), popen(3), etc).

            E.g:

            -
                main(){system("hd");}       // it's turtles all the way down!
            +
                main(){system("hd");}       // it's turtles all the way down!

            is not acceptable.

            And, “output correctly” is the output format of this entry. QED.

            Early attempts ended up at a reasonably short 157 characters. This was too long for a one-liner, so it had to be formatted as something more interesting. This solution is pleasing, but a true one-liner was the hoped-for goal. Here is the 157 character version in it’s entirety:

            -
                char     O,o[  20];L(O){
            -    putchar  ( O+  48+39  *(9<
            -    O));}    I(O)  {L(~     15);
            -    O|| puts(o);}  main     (l){
            -    for(;~(l=getchar())     ;I(O
            -    &=15     ))o[  O++      ]=4<
            -    (4^l     >>5)  ?l:     46,L
            -    (l>>     4),L  (l&15);O&&
            -    I(o[     O]=0  );}//157c
            +
                char     O,o[  20];L(O){
            +    putchar  ( O+  48+39  *(9<
            +    O));}    I(O)  {L(~     15);
            +    O|| puts(o);}  main     (l){
            +    for(;~(l=getchar())     ;I(O
            +    &=15     ))o[  O++      ]=4<
            +    (4^l     >>5)  ?l:     46,L
            +    (l>>     4),L  (l&15);O&&
            +    I(o[     O]=0  );}//157c

            While thinking about this in the shower (you are not the only one that does this!) came the idea which reduced the code to just 119 chars. This dramatic reduction started to feel close to minimal, and the hunt resumed. The progression to the present size is interesting, and it is interesting that the same algorithm can be expressed so differently by slight rearrangement of its parts.

            -
                // 119
            -    char O,o[20];main(l){for(;~(l=getchar());O||puts(o))o[O++]=isprint(l)?l:46,O&=15,printf("%02x ",l);O[o]=0;O&&puts(o);}
            -    // 116
            -    char O,o[20];main(l){for(;O++[o]=~(l=getchar())?4<(4^l>>5)?l:46:0;(O&=15)||puts(o))printf("%02x ",l);O>1&&puts(o);}
            -    // 115
            -    char O,o[20];main(l){for(;O[o]=~(l=getchar())?4<(4^l>>5)?l:46:0;(O=-~O&15)||puts(o))printf("%02x ",l);O&&puts(o);}
            -    // 113
            -    char O,o[20];main(l){for(;~l;(O=~l?printf("%02x ",l),-~O&15:!O)||puts(o))O[o]=~(l=getchar())?4<(4^l>>5)?l:46:0;}
            -    // 112
            -    char O,o[20];main(l){for(;~l;(O=~l?-~O&printf("%02x ",l)*5:!O)||puts(o))O[o]=~(l=getchar())?4<(4^l>>5)?l:46:0;}
            -    // 111
            -    char O,o[20];main(l){for(;~l;O||puts(o))O=(O[o]=~(l=getchar())?4<(4^l>>5)?l:46:0)?-~O&printf("%02x ",l)*5:!O;}
            -    // 110
            -    char O,o[0];main(l){for(;~l;O||puts(o))O=(O[o]=~(l=getchar())?4<(4^l>>5)?l:46:0)?-~O&printf("%02x ",l)*5:!O;}
            -    // 109
            -    char O,o[];main(l){for(;~l;O||puts(o))O=(O[o]=~(l=getchar())?4<(4^l>>5)?l:46:0)?-~O&printf("%02x ",l)*5:!O;}
            +
                // 119
            +    char O,o[20];main(l){for(;~(l=getchar());O||puts(o))o[O++]=isprint(l)?l:46,O&=15,printf("%02x ",l);O[o]=0;O&&puts(o);}
            +    // 116
            +    char O,o[20];main(l){for(;O++[o]=~(l=getchar())?4<(4^l>>5)?l:46:0;(O&=15)||puts(o))printf("%02x ",l);O>1&&puts(o);}
            +    // 115
            +    char O,o[20];main(l){for(;O[o]=~(l=getchar())?4<(4^l>>5)?l:46:0;(O=-~O&15)||puts(o))printf("%02x ",l);O&&puts(o);}
            +    // 113
            +    char O,o[20];main(l){for(;~l;(O=~l?printf("%02x ",l),-~O&15:!O)||puts(o))O[o]=~(l=getchar())?4<(4^l>>5)?l:46:0;}
            +    // 112
            +    char O,o[20];main(l){for(;~l;(O=~l?-~O&printf("%02x ",l)*5:!O)||puts(o))O[o]=~(l=getchar())?4<(4^l>>5)?l:46:0;}
            +    // 111
            +    char O,o[20];main(l){for(;~l;O||puts(o))O=(O[o]=~(l=getchar())?4<(4^l>>5)?l:46:0)?-~O&printf("%02x ",l)*5:!O;}
            +    // 110
            +    char O,o[0];main(l){for(;~l;O||puts(o))O=(O[o]=~(l=getchar())?4<(4^l>>5)?l:46:0)?-~O&printf("%02x ",l)*5:!O;}
            +    // 109
            +    char O,o[];main(l){for(;~l;O||puts(o))O=(O[o]=~(l=getchar())?4<(4^l>>5)?l:46:0)?-~O&printf("%02x ",l)*5:!O;}

            There are solutions without the ASCII sidebar that are significantly shorter. These do not compete in the same category, since their output is materially different. They are derived from the solutions above, but are still fascinating as concise utilities, so here is their progression, for the curious:

            -
                // 102
            -    I;O(O){putchar(O+48+39*(9<O));}main(l){for(;~(l=getchar());O(++I&15?~15:~37))O(l>>4),O(l&15);O(-38);}
            -    // 80
            -    O;main(l){while(~(l=getchar()))printf("%02x%c",l,++O&15?32:10);O&15&&puts("");}
            -    // 78
            -    O;main(l){for(;~l;(O=~(l=getchar())?printf("%02x ",l),-~O&15:!O)||puts(""));}
            -    // 77
            -    O;main(l){for(;~l;(O=~(l=getchar())?-~O&printf("%02x ",l)*5:!O)||puts(""));}
            -    // 76
            -    O;main(l){for(;~l;O||puts(&O))O=~(l=getchar())?-~O&printf("%02x ",l)*5:!O;}
            +
                // 102
            +    I;O(O){putchar(O+48+39*(9<O));}main(l){for(;~(l=getchar());O(++I&15?~15:~37))O(l>>4),O(l&15);O(-38);}
            +    // 80
            +    O;main(l){while(~(l=getchar()))printf("%02x%c",l,++O&15?32:10);O&15&&puts("");}
            +    // 78
            +    O;main(l){for(;~l;(O=~(l=getchar())?printf("%02x ",l),-~O&15:!O)||puts(""));}
            +    // 77
            +    O;main(l){for(;~l;(O=~(l=getchar())?-~O&printf("%02x ",l)*5:!O)||puts(""));}
            +    // 76
            +    O;main(l){for(;~l;O||puts(&O))O=~(l=getchar())?-~O&printf("%02x ",l)*5:!O;}

            It is possible to reduce the size of each of these by one by eliding the trailing newline. This was not reported above since the newline kept getting appended by processing software, and it is more interesting to remove characters by changing code than by filtering:

            -
                $ tr -d '\012' < 109.c | wc -c
            -    108
            -    $ tr -d '\012' < 76.c | wc -c
            -    75
            -    $ tr -d '\012' < 109.c | cc -o 108 -xc -
            -    $ verify 108
            -    $
            +
                $ tr -d '\012' < 109.c | wc -c
            +    108
            +    $ tr -d '\012' < 76.c | wc -c
            +    75
            +    $ tr -d '\012' < 109.c | cc -o 108 -xc -
            +    $ verify 108
            +    $

            An obfuscated hex dump has been done before: 1986/bright is similar in function, but it uses more characters in just setting up its obfuscation than this entire @@ -321,9 +321,9 @@ perhaps – the smallest, clean-compiling version using clang or not work with the original Ritchie PDP-11 C compiler, since the expression within the ternary remains too complex.

            Try:

            -
                cat prog.c prog.alt.c
            +
                cat prog.c prog.alt.c

            or

            -
                cmp -b prog.c prog.alt.c
            +
                cmp -b prog.c prog.alt.c

            to compare the differences (diff is not helpful on a one-liner).

            make ``` ## To use: -```sh +``` ./prog [-tcksri] < file.c ``` ## Try: -```sh +``` ./try.sh ``` If you get really stuck, try: -```sh +``` man ./tac.1 ``` @@ -113,7 +113,7 @@ There is one (known) remaining problem with detection: * Comments between preprocessor hash and keyword are not replaced with whitespace; the following counts #include as two tokens, `#` and `include` (not as a reserved word): -```c +``` #/*this will not be counted*/include/*correctly*/ ``` @@ -128,14 +128,14 @@ counting words correctly absent `-k`. `tac` was run over all 366 previous IOCCC winning entries: -```sh +``` find ~/src/obc -type f -name \*.c | wc ``` The discrepancies found are documented and explained in the file [discrepancies.html](discrepancies.html). -```sh +``` find ~/src/obc -type f -a -name "*.c" | xargs ./spotcheck.sh ./prog | ./spotdiff.sh | grep -v keep | diff -bw - discrep* | grep "[<>] cl " ``` @@ -181,14 +181,14 @@ For instance, here is a simple token counter, useful in finding repeated long to frequency, or counting the references to identifiers, constants, or breadth of use of the language: -```sh +``` #!/usr/bin/env bash cat $* | ./prog -t | sort | uniq -c | sort -k1nr ``` And here is a C keyword frequency counter: -```sh +``` #!/usr/bin/env bash function iskeyword { awk 'BEGIN{f="c11";while(getline #!/usr/bin/env bash script=' BEGIN { @@ -342,7 +342,7 @@ which is neither complete (`#define`, `#ifndef`, `#undef` are missing -- yes, Virginia knows about `#define` omitted on purpose), nor correct (many more are added: `I`, `true`, `bool`, `compl`, ...): -```sh +``` (sed -n '1p' c11; sed -n '2,$p' ioccc.kw.freq | sort) | comm -3 - c11 ``` @@ -383,7 +383,7 @@ NB: This is *not* a portability concern, the one string holds only printable ASC Thus: -```sh +``` cc -ansi -Wall -trigraphs -Wno-trigraphs -Wno-parentheses -Wno-empty-body -Wno-char-subscripts -Wno-pointer-sign -DU=O -DW=\"keywords\" -o prog prog.c ``` @@ -403,7 +403,7 @@ are not recognised when written as `-rs` in prose). Try: -```sh +``` ./manpage.sh tac ./manpage.sh -h diff --git a/2018/burton2/index.html b/2018/burton2/index.html index 4fd39c4c5..4a387a984 100644 --- a/2018/burton2/index.html +++ b/2018/burton2/index.html @@ -141,13 +141,13 @@ Location: US - United States of America

            To build:

            -
                make
            +
                make

            To use:

            -
                ./prog [-tcksri] < file.c
            +
                ./prog [-tcksri] < file.c

            Try:

            -
                ./try.sh
            +
                ./try.sh

            If you get really stuck, try:

            -
                man ./tac.1
            +
                man ./tac.1

            Judges’ remarks:

            They say size isn’t everything, and in the case of IOCCC iocccsize.c that is saying something! @@ -228,17 +228,17 @@ quote consumes everything until the next quote

          • Comments between preprocessor hash and keyword are not replaced with whitespace; the following counts #include as two tokens, # and include (not as a reserved word):
          -
              #/*this will not be counted*/include/*correctly*/<stdio.h>
          +
              #/*this will not be counted*/include/*correctly*/<stdio.h>

          Fixing this properly hampers backwards compatibility in counting. This requires eliding comments during the translation phases (ISO 5.1.1.2, phase 3), and yet still counting words correctly absent -k.

          Backwards Compatibility:

          tac was run over all 366 previous IOCCC winning entries:

          -
              find ~/src/obc -type f -name \*.c | wc
          +
              find ~/src/obc -type f -name \*.c | wc

          The discrepancies found are documented and explained in the file discrepancies.html.

          -
              find ~/src/obc -type f -a -name "*.c" | xargs ./spotcheck.sh ./prog | ./spotdiff.sh |
          -            grep -v keep | diff -bw - discrep* | grep "[<>] cl "
          +
              find ~/src/obc -type f -a -name "*.c" | xargs ./spotcheck.sh ./prog | ./spotdiff.sh |
          +            grep -v keep | diff -bw - discrep* | grep "[<>] cl "

          In summary, there are only 6 unique entries out of 366 that have any variation in Rule 2 counts; in all cases, the differences are due to bugs within iocccsize, described in detail in the file @@ -273,14 +273,14 @@ This feature enables interesting analyses of C (and C++) code that’s hard to g

          For instance, here is a simple token counter, useful in finding repeated long tokens, or operator frequency, or counting the references to identifiers, constants, or breadth of use of the language:

          -
              #!/usr/bin/env bash
          -    cat $* | ./prog -t | sort | uniq -c | sort -k1nr
          +
              #!/usr/bin/env bash
          +    cat $* | ./prog -t | sort | uniq -c | sort -k1nr

          And here is a C keyword frequency counter:

          -
              #!/usr/bin/env bash
          -    function iskeyword {
          -       awk 'BEGIN{f="c11";while(getline<f)k[$1]=0} {if($1 in k)k[$1]++}END{for(i in k)print k[i],i}'
          -    }
          -    cat $* | ./prog -t | iskeyword | sort -k1nr
          +
              #!/usr/bin/env bash
          +    function iskeyword {
          +       awk 'BEGIN{f="c11";while(getline<f)k[$1]=0} {if($1 in k)k[$1]++}END{for(i in k)print k[i],i}'
          +    }
          +    cat $* | ./prog -t | iskeyword | sort -k1nr

          This script was used to “optimize” the reserved word order so the most frequent IOCCC winning entry keywords are checked first.

          An interesting aside: as might be expected, obfuscation has changed the frequency of @@ -299,47 +299,47 @@ handful of simple rules (and another use of the external keyword file). A more refined version of this is included in the file unob.sh, but the simple code below is a serviceable obfuscated C de-obfuscator in a scripting language. It really is this easy with tac:

          -
              #!/usr/bin/env bash
          -    script='
          -    BEGIN {
          -            last=nl="\n";
          -            f="c11"; while(getline <f > 0) kw[$0]++; close(f);
          -    }
          -
          -    function iskw(a)   { return a in kw }
          -    function indent(a) { return sprintf("%*s", n*3, " ") }
          -    function newline() { if (!infor && last != nl) printf last=nl; }
          -    function show(a) {
          -            if (last==nl) printf "%s", indent()
          -            printf "%s%s", space(), a
          -            last=a
          -    }
          -    function space() {
          -            return iskw(last) ||
          -              (last ~ /[A-Za-z0-9_+-\/%^[&\]\)=:<>;]$/ && $0 !~ /[:;()\[\],]/) ? " " : ""
          -    }
          -
          -    /^\(/       { ++paren }
          -    /^\)/       { --paren }
          -
          -    /^for/                  { newline(); infor=1 }
          -    infor && /^;/           { ++infor; show($0 " "); next }
          -    infor==1 && /^:/    { ++infor }
          -    infor>1 && paren==0 { infor=0 }
          -
          -    /^\?/               { tern++; n++; newline(); show($0 " "); next }
          -    tern && /^:/        { newline(); show($0); --tern; --n; next }
          -
          -    /^#/        { newline(); show($0); newline(); next }
          -    /^;/        { show($0); newline(); next }
          -    /^{/        { show($0); ++n; newline(); next }
          -    /^}/        { n--; newline(); show($0); newline(); next }
          -
          -    { show($0) }
          -    '
          -    cat $* | sed 's/#include/##include/' | cpp -E -trigraphs |
          -    sed 's/^# .*$//' | sed 's/^#//' |
          -    ./prog -t | awk "$script"
          +
              #!/usr/bin/env bash
          +    script='
          +    BEGIN {
          +            last=nl="\n";
          +            f="c11"; while(getline <f > 0) kw[$0]++; close(f);
          +    }
          +
          +    function iskw(a)   { return a in kw }
          +    function indent(a) { return sprintf("%*s", n*3, " ") }
          +    function newline() { if (!infor && last != nl) printf last=nl; }
          +    function show(a) {
          +            if (last==nl) printf "%s", indent()
          +            printf "%s%s", space(), a
          +            last=a
          +    }
          +    function space() {
          +            return iskw(last) ||
          +              (last ~ /[A-Za-z0-9_+-\/%^[&\]\)=:<>;]$/ && $0 !~ /[:;()\[\],]/) ? " " : ""
          +    }
          +
          +    /^\(/       { ++paren }
          +    /^\)/       { --paren }
          +
          +    /^for/                  { newline(); infor=1 }
          +    infor && /^;/           { ++infor; show($0 " "); next }
          +    infor==1 && /^:/    { ++infor }
          +    infor>1 && paren==0 { infor=0 }
          +
          +    /^\?/               { tern++; n++; newline(); show($0 " "); next }
          +    tern && /^:/        { newline(); show($0); --tern; --n; next }
          +
          +    /^#/        { newline(); show($0); newline(); next }
          +    /^;/        { show($0); newline(); next }
          +    /^{/        { show($0); ++n; newline(); next }
          +    /^}/        { n--; newline(); show($0); newline(); next }
          +
          +    { show($0) }
          +    '
          +    cat $* | sed 's/#include/##include/' | cpp -E -trigraphs |
          +    sed 's/^# .*$//' | sed 's/^#//' |
          +    ./prog -t | awk "$script"

          On the question of obfuscation:

          • I assume you noticed the braces?

            @@ -401,7 +401,7 @@ the IOJCC trash can.

            which is neither complete (#define, #ifndef, #undef are missing – yes, Virginia knows about #define omitted on purpose), nor correct (many more are added: I, true, bool, compl, …):

            -
                (sed -n '1p' c11; sed -n '2,$p' ioccc.kw.freq | sort) | comm -3 - c11
            +
                (sed -n '1p' c11; sed -n '2,$p' ioccc.kw.freq | sort) | comm -3 - c11

            That is an obfuscated way to say “diff”. But it also more clearly shows the, um, diffs.

            The usage string is similarly externalized, providing a better usability string than the limits would otherwise allow. If this is considered bending the rules too far, @@ -429,7 +429,7 @@ for obfuscation. Thus -trigraphs -Wno-trigraphs (which is also humo

            The code uses unsigned chars, but C strings are signed. Thus -Wno-pointer-sign. NB: This is not a portability concern, the one string holds only printable ASCII characters.

            Thus:

            -
                cc -ansi -Wall -trigraphs -Wno-trigraphs -Wno-parentheses -Wno-empty-body -Wno-char-subscripts -Wno-pointer-sign -DU=O -DW=\"keywords\" -o prog prog.c
            +
                cc -ansi -Wall -trigraphs -Wno-trigraphs -Wno-parentheses -Wno-empty-body -Wno-char-subscripts -Wno-pointer-sign -DU=O -DW=\"keywords\" -o prog prog.c

            Coda:

            Cody Boone Ferguson was relentless in his pursuit of bugs. Thanks to his reports, the version of unob.sh is stronger, @@ -442,12 +442,12 @@ works well on most inputs, but tends to need some raw nroff for more fancy constructions, such as combined arguments (e.g. the -r and -s arguments to tac are not recognised when written as -rs in prose).

            Try:

            -
                ./manpage.sh tac
            -
            -    ./manpage.sh -h
            -    ./manpage.sh -h | ./manpage.sh
            -    ./manpage.sh -h | ./manpage.sh -R | less
            -    ./manpage.sh -h | ./manpage.sh -P | lpr
            +
                ./manpage.sh tac
            +
            +    ./manpage.sh -h
            +    ./manpage.sh -h | ./manpage.sh
            +    ./manpage.sh -h | ./manpage.sh -R | less
            +    ./manpage.sh -h | ./manpage.sh -P | lpr

            NOTE: in 2023 the tac.man was updated to proper man format and renamed tac.1.

            make ``` @@ -11,14 +11,14 @@ below for more details. ## To use: -```sh +``` ./prog < text ``` ## Try: -```sh +``` ./try.sh ``` @@ -32,7 +32,7 @@ useful bug fix. ### Alternate build: -```sh +``` make alt ``` @@ -44,7 +44,7 @@ Use `prog.alt` as you would `prog` above. ### Alternate try: -```sh +``` ./try.alt.sh ``` diff --git a/2018/ciura/index.html b/2018/ciura/index.html index 7e8234641..a06438197 100644 --- a/2018/ciura/index.html +++ b/2018/ciura/index.html @@ -141,24 +141,24 @@ Location: PL - Republic of Poland

            To build:

            -
                make
            +
                make

            There is an alternate version that lacks a useful bug fix. See Alternate code and the author’s remarks (remarks section) below for more details.

            To use:

            -
                ./prog < text
            +
                ./prog < text

            Try:

            -
                ./try.sh
            +
                ./try.sh

            Alternate code:

            An alternate version of this entry, prog.alt.c, is provided. As mentioned in the author’s remarks, the alternate version lacks a useful bug fix.

            Alternate build:

            -
                make alt
            +
                make alt

            Alternate use:

            Use prog.alt as you would prog above.

            Alternate try:

            -
                ./try.alt.sh
            +
                ./try.alt.sh

            Do you spot the fix by running both try.sh and try.alt.sh?

            Judges’ remarks:

            diff --git a/2018/endoh1/README.md b/2018/endoh1/README.md index e3d54e5fd..35ac6dd74 100644 --- a/2018/endoh1/README.md +++ b/2018/endoh1/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog < textfile > output.gif ``` @@ -16,7 +16,7 @@ To see the input files and feed them to the program, redirecting to GIF files: -```sh +``` ./try.sh ``` @@ -40,7 +40,7 @@ least 2MiB of memory to run in. This program generates an animated GIF from a plain text. Run: -```sh +``` cc -o prog prog.c ./prog < invisible.txt > invisible.gif ``` @@ -51,14 +51,14 @@ letters that leave the mark and ones that do not? Other examples: -```sh +``` ./prog < golem.txt > golem.gif ./prog < smily.txt > smily.gif ``` The program itself has a hidden message. -```sh +``` ./prog < prog.c > prog.gif ``` diff --git a/2018/endoh1/index.html b/2018/endoh1/index.html index f429b12f4..58c6b42b2 100644 --- a/2018/endoh1/index.html +++ b/2018/endoh1/index.html @@ -141,12 +141,12 @@ Location: JP - Japan
          • To build:

            -
                make
            +
                make

            To use:

            -
                ./prog < textfile > output.gif
            +
                ./prog < textfile > output.gif

            Try:

            To see the input files and feed them to the program, redirecting to GIF files:

            -
                ./try.sh
            +
                ./try.sh

            Judges’ remarks:

            To get the best experience, use a GIF viewer that can handle animated GIFs. With macOS you can use Safari using open -a Safari smily.gif.

            @@ -158,16 +158,16 @@ how does it know which characters are closed?

            least 2MiB of memory to run in.

            Author’s remarks:

            This program generates an animated GIF from a plain text. Run:

            -
                cc -o prog prog.c
            -    ./prog < invisible.txt > invisible.gif
            +
                cc -o prog prog.c
            +    ./prog < invisible.txt > invisible.gif

            Open invisible.gif with a GIF viewer that can show animated GIFs and then wait a minute. You will see a hidden message. Can you tell the difference between letters that leave the mark and ones that do not?

            Other examples:

            -
                ./prog < golem.txt > golem.gif
            -    ./prog < smily.txt > smily.gif
            +
                ./prog < golem.txt > golem.gif
            +    ./prog < smily.txt > smily.gif

            The program itself has a hidden message.

            -
                ./prog < prog.c > prog.gif
            +
                ./prog < prog.c > prog.gif
            make ``` ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2018/endoh2/index.html b/2018/endoh2/index.html index 0c2a959dc..7ecb6a962 100644 --- a/2018/endoh2/index.html +++ b/2018/endoh2/index.html @@ -141,11 +141,11 @@ Location: JP - Japan

            To build:

            -
                make
            +
                make

            To use:

            -
                ./prog
            +
                ./prog

            Try:

            -
                ./try.sh
            +
                ./try.sh

            NOTE: to interrupt the loops send intr (typically ctrl-C).

            Judges’ remarks:

            And now for something completely different: A program whose metabolic diff --git a/2018/ferguson/README.md b/2018/ferguson/README.md index 7c924755f..b2ff88d50 100644 --- a/2018/ferguson/README.md +++ b/2018/ferguson/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,14 +10,14 @@ monkey Eric. See [Alternate code](#alternate-code) below. ## To use: -```sh +``` ./weasel ``` ## Try: -```sh +``` ./try.sh # For those who believe in '"intelligent" design' or want to see how easy it is @@ -47,7 +47,7 @@ about this under the [keyboards](#keyboards) section, briefly referred to in the ### Alternate build: -```sh +``` make alt ``` @@ -59,7 +59,7 @@ Use `weasel.alt` as you would `weasel` above. ### Alternate try: -```sh +``` ./try.alt.sh # For those who believe in '"intelligent" design' or want to see how easy it is @@ -80,7 +80,7 @@ detail in the [S, M and N Constants](#constants) section. The script above will make use of some of these. -```sh +``` ./try.alt.sh ``` @@ -107,7 +107,7 @@ while using more Cenozoic minded code migration, read [rpm.html](rpm.html). If you find yourself in an evolutionary dead end, try: -```sh +``` man ./weasel.1 ``` @@ -139,7 +139,7 @@ texts. To resolve this I think the best way is referencing the judges' remarks: if you want a quick rundown of the entry try what they suggest and view the man page (it explains all the options and describes the program briefly): -```sh +``` man ./weasel.man ``` @@ -444,7 +444,7 @@ has more than one word (that is it contains spaces) or anything else interpreted specially by your shell e.g. parentheses. For instance if you just want to find `METHINKS` you could do one of: -```sh +``` ./weasel METHINKS ./weasel "METHINKS" ./weasel 'METHINKS' @@ -452,14 +452,14 @@ specially by your shell e.g. parentheses. For instance if you just want to find If you wanted `YOU ARE A MONKEY`: -```sh +``` ./weasel "YOU ARE A MONKEY" ./weasel 'YOU ARE A MONKEY' ``` If you do one of: -```sh +``` ./weasel "METHINKS IT IS A" "MONKEY" ./weasel METHINKS IT IS A MONKEY ``` @@ -472,7 +472,7 @@ If you actually do want to search for a string starting with a `-` you must disable further parsing of options by using the `-` option itself; for example if you were to do any of: -```sh +``` ./weasel -q- -- -test ./weasel -q- -test ./weasel -q -- -test @@ -480,7 +480,7 @@ example if you were to do any of: The target string will be: `-TEST`. This means though that here: -```sh +``` ./weasel -q -- -test -r5 ``` @@ -498,7 +498,7 @@ are equivalent: As for the caveat I referenced what does the following do? -```sh +``` ./weasel -qr 5 ``` @@ -510,7 +510,7 @@ note on the parsing of the `-` option; if the program is currently parsing the other options are in the command line it might still parse the options. Thus you have: -```sh +``` $ ./weasel -qr-r5 quiet output mutation rate out of range @@ -522,14 +522,14 @@ you have: Similarly this would set quiet output, then an invalid mutation rate and then a mutation rate of 5: -```sh +``` ./weasel --qrr5 ``` If you were instead to do one of (for example): -```sh +``` ./weasel -q -- -r ./weasel -q -q- -r ``` @@ -568,7 +568,7 @@ requested? There are at least two ways to go about it: I took the monkey safe ('fool safe') method; *if you explicitly request monkey mode you cannot disable it in the same invocation of `weasel`! -```sh +``` $ ./weasel -qr101r5r101r1r test quiet output mutation rate out of range @@ -633,7 +633,7 @@ in monkey mode. Another example: -```sh +``` $ ./weasel -q -r101 test -r5 quiet output mutation rate out of range @@ -649,7 +649,7 @@ which means that it'll use the genetic algorithm. One more example of monkey mode: -```sh +``` $ ./weasel -q -mr101 test -r5 quiet output mutation rate out of range @@ -771,13 +771,13 @@ with. Try: -```sh +``` make test ``` This will essentially make sure the program is compiled and then do: -```sh +``` chmod +x test.sh ./test.sh ``` @@ -793,7 +793,7 @@ processed). You can pass additional options directly to the script but remember that it stops when there are no more strings in the file - so if you try: -```sh +``` ./test.sh -q test ``` @@ -825,7 +825,7 @@ program prints an error message and then exits (returning 1). But since the keyboard doesn't have `'\n'` if you were to type a `'` and send a `'\n'` before the closing `'` you might see something like: -```sh +``` $ ./weasel '!! > ' @@ -858,7 +858,7 @@ as well as some C keywords. 2. The way `main()` is declared is: -```c +``` /* Special C main() handler (encapsulation): */ #define r(main) main r(k main(k a, E **V)) { @@ -952,7 +952,7 @@ somewhere!). The Makefile simplifies how to reconfigure this value with the variable `MAX_SIZE`: -```sh +``` make clobber MAX_SIZE=55 all ``` @@ -965,7 +965,7 @@ number attempts without waiting for a very long time. The Makefile simplifies how to reconfigure this value with the variable `MAX_ATTEMPTS`: -```sh +``` make clobber MAX_ATTEMPTS=100 all ``` @@ -982,7 +982,7 @@ and the larger the values the more memory it'll require. The Makefile simplifies how to reconfigure this value with the variable `OFFSPRING`: -```sh +``` make clobber OFFSPRING=55 all ``` @@ -993,7 +993,7 @@ Skip to [Portability](#portability). The following options **must always be passed to the compiler:** -```sh +``` -DQ='typedef' -D'g(o)'='goto o;' -D'w(x)'="x:" -D'H(main)'='r(main)' ``` @@ -1003,13 +1003,13 @@ which running `make` will always do. If you want to increase the number of offspring to `50` (`N`) and the size of the chromosome to `75` (`S`) you would do: -```sh +``` make clobber OFFSPRING=50 MAX_SIZE=75 everything ``` If you wanted to change `N` to `3`: -```sh +``` make clobber OFFSPRING=3 everything ``` @@ -1020,7 +1020,7 @@ result. Remember too that `S` (`MAX_SIZE`) cannot be less than `38`. Both `S` an If you wanted to change the maximum number attempts to 100 you could do: -```sh +``` make clobber MAX_ATTEMPTS=100 everything ``` @@ -1038,7 +1038,7 @@ Originally I tested it on the below systems. #### Fedora 26: -```sh +``` $ clang --version|head -n1 clang version 4.0.1 (tags/RELEASE_401/final) $ gcc --version|head -n1 @@ -1051,7 +1051,7 @@ Originally I tested it on the below systems. #### CentOS Linux release 7.4.1708 (Core) -```sh +``` $ clang --version|head -n1 clang version 3.4.2 (tags/RELEASE_34/dot2-final) $ gcc --version|head -n1 @@ -1064,7 +1064,7 @@ Originally I tested it on the below systems. #### Fedora 27: -```sh +``` $ clang --version|head -n1 clang version 5.0.1 (tags/RELEASE_501/final) $ gcc --version|head -n1 @@ -1080,7 +1080,7 @@ Originally I tested it on the below systems. System Version: macOS 10.13.4 (17E199) Kernel Version: Darwin 17.5.0 -```sh +``` $ gcc -v Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 9.1.0 (clang-902.0.39.1) @@ -1209,7 +1209,7 @@ When we found others were actually trying to programs with A, we quickly added additional cryptic features and evolved into B, BCPL, and finally C. We stopped when we got a clean compile on the following syntax: -```c +``` for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/ 8)%2))P("|"+(*u/4)%2); ``` @@ -1252,7 +1252,7 @@ is a lack of common sense but since he was part of its creation I don't think it's a bad thing; **on the contrary it makes all of us C programmers even more talented! :)** I do wonder if he tested that bit of C code though: -```c +``` for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/ 8)%2))P("|"+(*u/4)%2); ``` diff --git a/2018/ferguson/index.html b/2018/ferguson/index.html index bf86d8f44..bf4d3416f 100644 --- a/2018/ferguson/index.html +++ b/2018/ferguson/index.html @@ -141,21 +141,21 @@ Location: US - United States of America

            To build:

            -
                make
            +
                make

            The author provided an alternate version which has a simpler keyboard for the monkey Eric. See Alternate code below.

            To use:

            -
                ./weasel
            +
                ./weasel

            Try:

            -
                ./try.sh
            -
            -    # For those who believe in '"intelligent" design' or want to see how easy it is
            -    # to prove evolution is a proven fact:
            -    ./id.sh
            -
            -    # For those who want to see if Eric the monkey can type the word 'words' before
            -    # falling asleep or giving up:
            -    ./monkey-words.sh
            +
                ./try.sh
            +
            +    # For those who believe in '"intelligent" design' or want to see how easy it is
            +    # to prove evolution is a proven fact:
            +    ./id.sh
            +
            +    # For those who want to see if Eric the monkey can type the word 'words' before
            +    # falling asleep or giving up:
            +    ./monkey-words.sh

            NOTE: the try.sh script will run the other two scripts but if the first one, id.sh is terminated early in the try script, the second one, monkey-words.sh will not be run.

            @@ -167,26 +167,26 @@ make use of some of these.

            about this under the keyboards section, briefly referred to in the what it is section.

            Alternate build:

            -
                make alt
            +
                make alt

            Alternate use:

            Use weasel.alt as you would weasel above.

            Alternate try:

            -
                ./try.alt.sh
            -
            -    # For those who believe in '"intelligent" design' or want to see how easy it is
            -    # to prove evolution is a proven fact:
            -    ./id.alt.sh
            -
            -    # For those who want to see if Eric the monkey can type the word 'words' before
            -    # falling asleep or giving up:
            -    ./monkey-words.alt.sh
            +
                ./try.alt.sh
            +
            +    # For those who believe in '"intelligent" design' or want to see how easy it is
            +    # to prove evolution is a proven fact:
            +    ./id.alt.sh
            +
            +    # For those who want to see if Eric the monkey can type the word 'words' before
            +    # falling asleep or giving up:
            +    ./monkey-words.alt.sh

            NOTE: the try.alt.sh script will run the other two scripts but if the first one, id.alt.sh is terminated early in the try script, the second one, monkey-words.alt.sh will not be run.

            You can reconfigure certain values. These are described by the author in more detail in the S, M and N Constants section. The script above will make use of some of these.

            -
                ./try.alt.sh
            +
                ./try.alt.sh

            You can reconfigure certain values. These are described by the author in more detail in the S, M and N Constants section. The script above will make use of some of these.

            @@ -203,7 +203,7 @@ from the phylogenetic tree of life.

            If you wish your computer to maintain one branch in the Cretaceous C code era, while using more Cenozoic minded code migration, read rpm.html.

            If you find yourself in an evolutionary dead end, try:

            -
                man ./weasel.1
            +
                man ./weasel.1

            Author’s remarks:

            1. Preface
            2. @@ -228,7 +228,7 @@ didn’t want to reveal as much publicly and many people don’t like to read lo texts. To resolve this I think the best way is referencing the judges’ remarks: if you want a quick rundown of the entry try what they suggest and view the man page (it explains all the options and describes the program briefly):

              -
                  man ./weasel.man
              +
                  man ./weasel.man

              If that isn’t sufficient I would recommend reading this section (and possibly the next) where I attempt to give a brief explanation of the sections to make reading it easier and faster. In addition I want to point out a few @@ -461,26 +461,26 @@ it must be a single parameter which means you’ll need to quote the string if i has more than one word (that is it contains spaces) or anything else interpreted specially by your shell e.g. parentheses. For instance if you just want to find METHINKS you could do one of:

              -
                  ./weasel METHINKS
              -    ./weasel "METHINKS"
              -    ./weasel 'METHINKS'
              +
                  ./weasel METHINKS
              +    ./weasel "METHINKS"
              +    ./weasel 'METHINKS'

              If you wanted YOU ARE A MONKEY:

              -
                  ./weasel "YOU ARE A MONKEY"
              -    ./weasel 'YOU ARE A MONKEY'
              +
                  ./weasel "YOU ARE A MONKEY"
              +    ./weasel 'YOU ARE A MONKEY'

              If you do one of:

              -
                  ./weasel "METHINKS IT IS A" "MONKEY"
              -    ./weasel METHINKS IT IS A MONKEY
              +
                  ./weasel "METHINKS IT IS A" "MONKEY"
              +    ./weasel METHINKS IT IS A MONKEY

              It will search for MONKEY in both cases; in other words it’s the last one. If the string is too long given the value of S (see
              How to build) it will be truncated.

              If you actually do want to search for a string starting with a - you must disable further parsing of options by using the - option itself; for example if you were to do any of:

              -
                  ./weasel -q- -- -test
              -    ./weasel -q- -test
              -    ./weasel -q -- -test
              +
                  ./weasel -q- -- -test
              +    ./weasel -q- -test
              +    ./weasel -q -- -test

              The target string will be: -TEST. This means though that here:

              -
                  ./weasel -q -- -test -r5
              +
                  ./weasel -q -- -test -r5

              The string to be searched would actually be -r5 and the mutation rate will remain the default because after the - option is seen it will no longer parse additional options: only target strings if anything left on the @@ -490,7 +490,7 @@ are equivalent:

                  -q-\
                   -q --

              As for the caveat I referenced what does the following do?

              -
                  ./weasel -qr 5
              +
                  ./weasel -qr 5

              In fact it will set quiet output and set the target string to be ‘5’. So the mutation rate will be out of range, thus enabling that Easter egg, but it will likely come to an answer fairly quickly because it’s just a single character. A @@ -498,18 +498,18 @@ note on the parsing of the - option; if the program is currently pa argv[N], for example, and it encounters a -- then depending on where the other options are in the command line it might still parse the options. Thus you have:

              -
                  $ ./weasel -qr-r5
              -    quiet output
              -    mutation rate out of range
              -    target 'METHINKS IT IS LIKE A WEASEL'
              -    mutation rate 5
              -    Generation  440 Offspring 20: METHINKS IT IS LIKE A WEASEL
              +
                  $ ./weasel -qr-r5
              +    quiet output
              +    mutation rate out of range
              +    target 'METHINKS IT IS LIKE A WEASEL'
              +    mutation rate 5
              +    Generation  440 Offspring 20: METHINKS IT IS LIKE A WEASEL

              Similarly this would set quiet output, then an invalid mutation rate and then a mutation rate of 5:

              -
                  ./weasel --qrr5
              +
                  ./weasel --qrr5

              If you were instead to do one of (for example):

              -
                  ./weasel -q -- -r
              -    ./weasel -q -q- -r
              +
                  ./weasel -q -- -r
              +    ./weasel -q -q- -r

              Then it would set quiet output then see the -- (the - option itself) and then the target string would literally be set to -r because it no longer cares about the - for option parsing. In other words options @@ -536,15 +536,15 @@ monkey mode be disabled? If yes how do we know if monkey mode was specially requested? There are at least two ways to go about it: I took the monkey safe (‘fool safe’) method; *if you explicitly request monkey mode you cannot disable it in the same invocation of weasel!

              -
                  $ ./weasel -qr101r5r101r1r test
              -    quiet output
              -    mutation rate out of range
              -    mutation rate out of range
              -    mutation rate out of range
              -    target 'test'
              -    mutation rate 0
              -    monkey at typewriter
              -    Generation 16844        Offspring 22: TEST
              +
                  $ ./weasel -qr101r5r101r1r test
              +    quiet output
              +    mutation rate out of range
              +    mutation rate out of range
              +    mutation rate out of range
              +    target 'test'
              +    mutation rate 0
              +    monkey at typewriter
              +    Generation 16844        Offspring 22: TEST

              So in this case I joined the options in the following order:

              1. -q

                @@ -575,24 +575,24 @@ matter
                because of truncation but I do in any case specifically check for Given that it was a short string it did find the answer relatively quickly, even in monkey mode.

                Another example:

                -
                    $ ./weasel -q -r101 test -r5
                -    quiet output
                -    mutation rate out of range
                -    target 'test'
                -    mutation rate 5
                -    Generation  109 Offspring 13: TEST
                +
                    $ ./weasel -q -r101 test -r5
                +    quiet output
                +    mutation rate out of range
                +    target 'test'
                +    mutation rate 5
                +    Generation  109 Offspring 13: TEST

                In this case I also enabled quiet mode but I didn’t join the options; the -r101 reports that it’s out of range and sets monkey mode. I then specify the target string and then set a valid mutation rate. This disabled monkey mode which means that it’ll use the genetic algorithm.

                One more example of monkey mode:

                -
                    $ ./weasel -q -mr101 test -r5
                -    quiet output
                -    mutation rate out of range
                -    target 'test'
                -    mutation rate 5
                -    monkey at typewriter
                -    Generation 465298       Offspring 10: TEST
                +
                    $ ./weasel -q -mr101 test -r5
                +    quiet output
                +    mutation rate out of range
                +    target 'test'
                +    mutation rate 5
                +    monkey at typewriter
                +    Generation 465298       Offspring 10: TEST

                Here I also requested quiet output and then explicitly requested that Eric the monkey types. After this I set the mutation rate to be 101 which would have set monkey mode (in this case only temporarily as I later set it to a valid @@ -676,10 +676,10 @@ file and pass each string to the program itself. I’ve included a script test.sh and a file of sample input test-strings.txt that you can play with.

                Try:

                -
                    make test
                +
                    make test

                This will essentially make sure the program is compiled and then do:

                -
                    chmod +x test.sh
                -    ./test.sh
                +
                    chmod +x test.sh
                +    ./test.sh

                The script will first try compiling the program (if necessary) and if it fails for any reason it will exit; else it will read each line in the file test-strings.txt (if the file doesn’t exist or can’t be read the script will @@ -689,7 +689,7 @@ string it’ll sleep approximately 2 seconds and then read the next string processed).

                You can pass additional options directly to the script but remember that it stops when there are no more strings in the file - so if you try:

                -
                    ./test.sh -q test
                +
                    ./test.sh -q test

                The final string test won’t be searched for; it will however run the program in all invocations with quiet output enabled. The following are some notes about how the shell and the program interact with each other:

                @@ -713,11 +713,11 @@ and the fact the program does not accept spaces other than a literal space
                program prints an error message and then exits (returning 1). But since the keyboard doesn’t have '\n' if you were to type a ' and send a '\n' before the closing ' you might see something like:

                -
                    $ ./weasel '!!
                -    > '
                -
                -    '
                -    ' not in keyboard " !"#$<%:>&'()*+,-./0123456789;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~"
                +
                    $ ./weasel '!!
                +    > '
                +
                +    '
                +    ' not in keyboard " !"#$<%:>&'()*+,-./0123456789;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~"

                I showed that ' is in the keyboard already; however the user sent a \n (hence the secondary prompt > on line two) before literally typing the closing ' (also line two). But in order to make it clear what character is invalid I @@ -737,9 +737,9 @@ rather confusing and hard to read.

                as well as some C keywords.

              2. The way main() is declared is:

              -
                  /* Special C main() handler (encapsulation): */
              -    #define r(main) main
              -    r(k main(k a, E **V)) {
              +
                  /* Special C main() handler (encapsulation): */
              +    #define r(main) main
              +    r(k main(k a, E **V)) {

              It appears to be recursively defined but is it? And is it truly encapsulation? And is it executing code of any kind? It mightn’t seem like it isn’t encapsulation and also isn’t executing code but assuming it’s @@ -813,7 +813,7 @@ won’t spoil; yes this ironically and amusingly means I’ve left a rotten egg somewhere!).

              The Makefile simplifies how to reconfigure this value with the variable MAX_SIZE:

              -
                  make clobber MAX_SIZE=55 all
              +
                  make clobber MAX_SIZE=55 all

              The next macro that can be reconfigured, M (or MAX_ATTEMPTS in the Makefile), is the maximum attempts before giving up. This was added as another feature in 2024 but it was not made an alt version because there already is an @@ -821,7 +821,7 @@ alt version. This macro allows for seeing what happens when reaching the maximum number attempts without waiting for a very long time.

              The Makefile simplifies how to reconfigure this value with the variable MAX_ATTEMPTS:

              -
                  make clobber MAX_ATTEMPTS=100 all
              +
                  make clobber MAX_ATTEMPTS=100 all

              The final macro, N (or OFFSPRING in the Makefile), is the number of offspring per generation.

              Anything less than 4 will be set to 3 (that’s not a typo!) and this is part of @@ -831,23 +831,23 @@ both individually and together the program will use varying amounts of memory and the larger the values the more memory it’ll require.

              The Makefile simplifies how to reconfigure this value with the variable OFFSPRING:

              -
                  make clobber OFFSPRING=55 all
              +
                  make clobber OFFSPRING=55 all

              Compilation

              Skip to Portability.

              The following options must always be passed to the compiler:

              -
                  -DQ='typedef' -D'g(o)'='goto o;' -D'w(x)'="x:" -D'H(main)'='r(main)'
              +
                  -DQ='typedef' -D'g(o)'='goto o;' -D'w(x)'="x:" -D'H(main)'='r(main)'

              which running make will always do.

              If you want to increase the number of offspring to 50 (N) and the size of the chromosome to 75 (S) you would do:

              -
                  make clobber OFFSPRING=50 MAX_SIZE=75 everything
              +
                  make clobber OFFSPRING=50 MAX_SIZE=75 everything

              If you wanted to change N to 3:

              -
                  make clobber OFFSPRING=3 everything
              +
                  make clobber OFFSPRING=3 everything

              Remember that it cannot be less than 3; more correctly if it’s less than 4 it’s redefined to 3 so you could have passed in -DN=2 (or MAX_SIZE=2) and have the same result. Remember too that S (MAX_SIZE) cannot be less than 38. Both S and N are capped at SIZE_MAX - 1 or whatever M (MAX_ATTEMPTS) is set to.

              If you wanted to change the maximum number attempts to 100 you could do:

              -
                  make clobber MAX_ATTEMPTS=100 everything
              +
                  make clobber MAX_ATTEMPTS=100 everything

              Portability

              Skip to An aside on bugs.

              This entry requires at least C99 even if you translate digraphs. The program @@ -857,43 +857,43 @@ smaller and this I believe includes SIZE_MAX). I don’t think Wind ports would have many issues (if any) either but I have no way to test this. Originally I tested it on the below systems.

              Fedora 26:

              -
                  $ clang --version|head -n1
              -    clang version 4.0.1 (tags/RELEASE_401/final)
              -    $ gcc --version|head -n1
              -    gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2)
              -    $ /lib64/libc-2.25.so |head -n1|cut -d',' -f1-1
              -    GNU C Library (GNU libc) stable release version 2.25
              -    $ lscpu |grep Endian
              -    Byte Order:          Little Endian
              +
                  $ clang --version|head -n1
              +    clang version 4.0.1 (tags/RELEASE_401/final)
              +    $ gcc --version|head -n1
              +    gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2)
              +    $ /lib64/libc-2.25.so |head -n1|cut -d',' -f1-1
              +    GNU C Library (GNU libc) stable release version 2.25
              +    $ lscpu |grep Endian
              +    Byte Order:          Little Endian

              CentOS Linux release 7.4.1708 (Core)

              -
                  $ clang --version|head -n1
              -    clang version 3.4.2 (tags/RELEASE_34/dot2-final)
              -    $ gcc --version|head -n1
              -    gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
              -    $ /lib64/libc-2.17.so |head -n1 |cut -d, -f1-1
              -    GNU C Library (GNU libc) stable release version 2.17
              -    $ lscpu |grep Endian
              -    Byte Order:            Little Endian
              +
                  $ clang --version|head -n1
              +    clang version 3.4.2 (tags/RELEASE_34/dot2-final)
              +    $ gcc --version|head -n1
              +    gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
              +    $ /lib64/libc-2.17.so |head -n1 |cut -d, -f1-1
              +    GNU C Library (GNU libc) stable release version 2.17
              +    $ lscpu |grep Endian
              +    Byte Order:            Little Endian

              Fedora 27:

              -
                  $ clang --version|head -n1
              -    clang version 5.0.1 (tags/RELEASE_501/final)
              -    $ gcc --version|head -n1
              -    gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
              -    $ /lib64/libc-2.26.so |head -n1|cut -d, -f1-1
              -    GNU C Library (GNU libc) stable release version 2.26
              -    $ lscpu |grep Endian
              -    Byte Order:          Little Endian
              +
                  $ clang --version|head -n1
              +    clang version 5.0.1 (tags/RELEASE_501/final)
              +    $ gcc --version|head -n1
              +    gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
              +    $ /lib64/libc-2.26.so |head -n1|cut -d, -f1-1
              +    GNU C Library (GNU libc) stable release version 2.26
              +    $ lscpu |grep Endian
              +    Byte Order:          Little Endian

              macOS:

              System Version: macOS 10.13.4 (17E199) Kernel Version: Darwin 17.5.0

              -
                  $ gcc -v
              -    Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
              -    Apple LLVM version 9.1.0 (clang-902.0.39.1)
              -    Target: x86_64-apple-darwin17.5.0
              -    Thread model: posix
              -    InstalledDir: /Library/Developer/CommandLineTools/usr/bin
              -    $ uname -srmv
              -    Darwin 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar  5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64
              +
                  $ gcc -v
              +    Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
              +    Apple LLVM version 9.1.0 (clang-902.0.39.1)
              +    Target: x86_64-apple-darwin17.5.0
              +    Thread model: posix
              +    InstalledDir: /Library/Developer/CommandLineTools/usr/bin
              +    $ uname -srmv
              +    Darwin 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar  5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64

              An aside

              Skip to Installing.

              Any undocumented bugs are the result of insolent monkeys tampering with any @@ -1012,8 +1012,8 @@ When we found others were actually trying to programs with A, we quickly added additional cryptic features and evolved into B, BCPL, and finally C. We stopped when we got a clean compile on the following syntax:

              -
                  for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/
              -    8)%2))P("|"+(*u/4)%2);
              +
                  for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/
              +    8)%2))P("|"+(*u/4)%2);

              “To think that modern programmers would try to use a language that allowed such a statement was beyond our comprehension! We actually thought of selling @@ -1054,8 +1054,8 @@ person to talk about it with is more than welcome!). Ken suggested that the is a lack of common sense but since he was part of its creation I don’t think it’s a bad thing; on the contrary it makes all of us C programmers even more talented! :) I do wonder if he tested that bit of C code though:

              -
                  for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/
              -    8)%2))P("|"+(*u/4)%2);
              +
                  for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/
              +    8)%2))P("|"+(*u/4)%2);

              How is R=; valid? Since I don’t have the context maybe there is something I’m missing but either way it’s a funny piece. It could also be for irony itself (actually I had previously thought of somehow implementing something like that diff --git a/2018/giles/README.md b/2018/giles/README.md index 4d6887630..7c76d3247 100644 --- a/2018/giles/README.md +++ b/2018/giles/README.md @@ -4,21 +4,21 @@ This entry requires SDL2 to be installed. See [FAQ 3.8: How do I compile an IOCCC entry that requires SDL1 or SDL2?](../../faq.html#SDL) if you don't have it installed and don't know how to do so. -```sh +``` make ``` ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./prog ioccc.txt ./prog prog.c diff --git a/2018/giles/index.html b/2018/giles/index.html index cf82e435c..430def535 100644 --- a/2018/giles/index.html +++ b/2018/giles/index.html @@ -144,17 +144,17 @@ Location: AU - Commonwealth of Australi

              This entry requires SDL2 to be installed. See FAQ 3.8: How do I compile an IOCCC entry that requires SDL1 or SDL2? if you don’t have it installed and don’t know how to do so.

              -
                  make
              +
                  make

              To use:

              -
                  ./prog
              +
                  ./prog

              Try:

              -
                  ./prog ioccc.txt
              -
              -    ./prog prog.c
              -
              -    ./prog sand.txt
              -
              -    ./prog sand.alt.txt
              +
                  ./prog ioccc.txt
              +
              +    ./prog prog.c
              +
              +    ./prog sand.txt
              +
              +    ./prog sand.alt.txt

              NOTE: these invocations will take quite some time to finish.

              Judges’ remarks:

              Can you explain the behavior of the program when ioccc.txt is given diff --git a/2018/hou/README.md b/2018/hou/README.md index 08004924f..b72aae28a 100644 --- a/2018/hou/README.md +++ b/2018/hou/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2018 hou bugs](../../bugs.html#2018_hou). ## To use: -```sh +``` ./prog < input.json > output.html ``` @@ -27,7 +27,7 @@ View `output.html` in a browser. ## Try: -```sh +``` ./try.sh ``` diff --git a/2018/hou/index.html b/2018/hou/index.html index fe7d571de..9ce8ef778 100644 --- a/2018/hou/index.html +++ b/2018/hou/index.html @@ -141,16 +141,16 @@ Location: CN - People’s Republic of C

              To build:

              -
                  make
              +
                  make

              Bugs and (Mis)features:

              The current status of this entry is:

                  STATUS: INABIAF - please **DO NOT** fix

              For more detailed information see 2018 hou bugs.

              To use:

              -
                  ./prog < input.json > output.html
              +
                  ./prog < input.json > output.html

              View output.html in a browser.

              Try:

              -
                  ./try.sh
              +
                  ./try.sh

              The script will generate a JSON file called ioccc.json, showing it via tee(1) and then run the program on that. Can you find any problem with the JSON file? What happens if you try and fix it?

              diff --git a/2018/mills/README.md b/2018/mills/README.md index 5d630e036..4719ee36b 100644 --- a/2018/mills/README.md +++ b/2018/mills/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -8,7 +8,7 @@ If you wish to save state so that you can run the program and keep files changed (for instance you don't want to compile `mullender.c` again) you can compile it like: -```sh +``` make clobber SAVE=1 all ``` @@ -31,14 +31,14 @@ For more detailed information see [2018 mills bugs](../../bugs.html#2018_mills). ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./prog ``` @@ -47,7 +47,7 @@ At the `>boot` prompt, type return. At the `:` prompt, type `rk(0,0)rkunix` and wait for it to initialise itself. Now try typing: -```sh +``` cat > prog.c main(){ printf("Hello, world!\n"); } ^D @@ -59,7 +59,7 @@ where `^D` is EOF. Next try: -```sh +``` cc mullender.c a.out ``` @@ -81,7 +81,7 @@ Do small machines only need small programs? This program weighs in at just This program can take you back to the start of everything, it is possible to run v0. Just type: -```sh +``` ./v0 ``` @@ -91,7 +91,7 @@ You will be greeted with a familiar prompt of "login". The username and password are "dmr" and "dmr". To make things more familiar you'll need to create '.' as it hasn't been invented yet on this image! -```sh +``` @ ln dd dmr . ``` @@ -102,7 +102,7 @@ together like `ops.s bl.s hello.s bi.s` (in that order) to produce a.out! But wait, we said this was the start of it all! This program can also run a program that replaces an even larger machine that can run BSD 2.9. To start this, -```sh +``` ./prog ``` @@ -118,7 +118,7 @@ shown earlier. But wait, there is even more! Try: -```sh +``` ./v6 ``` @@ -220,7 +220,7 @@ only a quarter of a century ago -- how much could things have changed?). Let's try some: -```sh +``` # ls .cshrc .profile boot hkunix mnt tmp .login 2.9stamp dev lib mullender.c unix diff --git a/2018/mills/index.html b/2018/mills/index.html index bed5d3d5a..90ad0e441 100644 --- a/2018/mills/index.html +++ b/2018/mills/index.html @@ -141,11 +141,11 @@ Location: US - United States of America

              To build:

              -
                  make
              +
                  make

              If you wish to save state so that you can run the program and keep files changed (for instance you don’t want to compile mullender.c again) you can compile it like:

              -
                  make clobber SAVE=1 all
              +
                  make clobber SAVE=1 all

              Make sure that if you do add a file (including by compiling code) that before you exit (ctrl-e) you type in sync! Otherwise the file might not exist or it will be corrupt if it does.

              @@ -155,21 +155,21 @@ will be corrupt if it does.

              STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2018 mills bugs.

        To use:

        -
            ./prog
        +
            ./prog

        Try:

        -
            ./prog
        +
            ./prog

        At the >boot prompt, type return.

        At the : prompt, type rk(0,0)rkunix and wait for it to initialise itself. Now try typing:

        -
            cat > prog.c
        -    main(){ printf("Hello, world!\n"); }
        -    ^D
        -    cc prog.c
        -    a.out
        +
            cat > prog.c
        +    main(){ printf("Hello, world!\n"); }
        +    ^D
        +    cc prog.c
        +    a.out

        where ^D is EOF.

        Next try:

        -
            cc mullender.c
        -    a.out
        +
            cc mullender.c
        +    a.out

        … and enjoy the classic 1984/mullender entry as it would have been in 1984 with a VAX-11/PDP-11! Once it reaches the end of the line, hit enter and see what happens again. When you’re tired of it hit ctrl-c.

        @@ -180,18 +180,18 @@ line, hit enter and see what happens again. When you’re tired of it hit ctrl-c 3636 bytes, which is considerably lighter than the original machine it can replace.

        This program can take you back to the start of everything, it is possible to run v0. Just type:

        -
            ./v0
        +
            ./v0

        NOTE: To quit v0, press Control-E.

        You will be greeted with a familiar prompt of “login”. The username and password are “dmr” and “dmr”. To make things more familiar you’ll need to create ‘.’ as it hasn’t been invented yet on this image!

        -
            @ ln dd dmr .
        +
            @ ln dd dmr .

        An ls will reveal that C hasn’t been invented yet! IOBCC anyone? The compiler is bc. It produces assembly, which will then need to be assembled together like ops.s bl.s hello.s bi.s (in that order) to produce a.out!

        But wait, we said this was the start of it all! This program can also run a program that replaces an even larger machine that can run BSD 2.9. To start this,

        -
            ./prog
        +
            ./prog

        At the >boot prompt, type return.

        At the “:” prompt, type rk(0,0)rkunix.

        NOTE: To quit prog, press Control-E.

        @@ -199,7 +199,7 @@ program that replaces an even larger machine that can run BSD 2.9. To start this the very first IOCCC entries 1984/mullender, as shown earlier.

        But wait, there is even more! Try:

        -
            ./v6
        +
            ./v6

        At the @ prompt, type rkunix. You might want to type stty -lcase as otherwise the output will be in all caps.

        NOTE: To quit v6, press Control-E.

        @@ -269,15 +269,15 @@ If so, consider a make clean to start from scratch.

        root prompt. Most of the commands you are familiar with work here (this was only a quarter of a century ago – how much could things have changed?). Let’s try some:

        -
            # ls
        -    .cshrc       .profile     boot         hkunix       mnt          tmp
        -    .login       2.9stamp     dev          lib          mullender.c  unix
        -    .msgsrc      bin          etc          lost+found   rkunix       usr
        -    # df
        -    Filesystem  Mounted on  kbytes    used    free  % used
        -    /dev/rk0    /             1958    1688     270     86%
        -    # bin/cc mullender.c
        -    # ./a.out
        +
            # ls
        +    .cshrc       .profile     boot         hkunix       mnt          tmp
        +    .login       2.9stamp     dev          lib          mullender.c  unix
        +    .msgsrc      bin          etc          lost+found   rkunix       usr
        +    # df
        +    Filesystem  Mounted on  kbytes    used    free  % used
        +    /dev/rk0    /             1958    1688     270     86%
        +    # bin/cc mullender.c
        +    # ./a.out

        The program you’ve just run was the [winning entry of the first IOCCC contest from 1984] 1 (or was it 1894?), a personal favorite of mine. It is rather tightly bound to running on either a PDP-11 or a VAX-11. Now you have one.

        diff --git a/2018/poikola/README.md b/2018/poikola/README.md index 7c19d2635..4f52e100b 100644 --- a/2018/poikola/README.md +++ b/2018/poikola/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog ``` @@ -17,7 +17,7 @@ On a terminal that supports 24 bit color, has black background, and size at least 125x38, try: -```sh +``` ./try.sh ``` @@ -40,13 +40,13 @@ And those in the deep south might wish to go north for a better view. ### How to build: -```sh +``` cc -o prog -std=gnu11 -O3 prog.c ``` or -```sh +``` make ``` diff --git a/2018/poikola/index.html b/2018/poikola/index.html index c2b1d57fc..80a7204e3 100644 --- a/2018/poikola/index.html +++ b/2018/poikola/index.html @@ -141,13 +141,13 @@ Location: FI - Republic of Finland

        To build:

        -
            make
        +
            make

        To use:

        -
            ./prog
        +
            ./prog

        Try:

        On a terminal that supports 24 bit color, has black background, and size at least 125x38, try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        It is said by some students of Astronomy:

            Oh, Be A Fine Gal, Kiss Me!
        @@ -157,9 +157,9 @@ You might wish, on a star, to better understand the colors being displayed.
         And those in the deep south might wish to go north for a better view.

        Author’s remarks:

        How to build:

        -
            cc -o prog -std=gnu11 -O3 prog.c
        +
            cc -o prog -std=gnu11 -O3 prog.c

        or

        -
            make
        +
            make

        Poster:

        You can generate an A3 sized poster by make docs. This command creates a pdf file poikola.pdf.

        diff --git a/2018/vokes/README.md b/2018/vokes/README.md index f2748e654..2495403af 100644 --- a/2018/vokes/README.md +++ b/2018/vokes/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2018 vokes bugs](../../bugs.html#2018_vokes). ## To use: -```sh +``` ./prog < file.txt ``` ## Try: -```sh +``` ./try.sh ``` diff --git a/2018/vokes/index.html b/2018/vokes/index.html index cf587d738..92af852e9 100644 --- a/2018/vokes/index.html +++ b/2018/vokes/index.html @@ -141,15 +141,15 @@ Location: US - United States of America

        To build:

        -
            make
        +
            make

        Bugs and (Mis)features:

        The current status of this entry is:

            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2018 vokes bugs.

        To use:

        -
            ./prog < file.txt
        +
            ./prog < file.txt

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        What this program does is not witchcraft and there are no spectres, but you might have a meltdown trying to work it all out (look at the source code to diff --git a/2018/yang/README.md b/2018/yang/README.md index bfbd9bf7a..cbba77996 100644 --- a/2018/yang/README.md +++ b/2018/yang/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,7 +10,7 @@ The author suggested that after compilation one should look at the generated files. For instance: -```sh +``` less generated1.c less generated2.c less generated3.c @@ -19,7 +19,7 @@ files. For instance: ## Try: -```sh +``` ./try.sh ``` @@ -44,7 +44,7 @@ of `./left`, `./right` and `./shift` and the additionally generated programs. The final message can be revealed using -```sh +``` ./msg9 < prog.c ``` @@ -59,7 +59,7 @@ But what combinations will generate `./msg3`, `./msg4`, `./msg5`, `./msg6`, `Nuko` is a text rotator: given some text in `stdin`, `Nuko` will write the same text to `stdout`, but rotated 90 degrees counterclockwise. -```sh +``` cc prog.c -o left ./left < input.txt > rotated_counterclockwise.txt ``` @@ -68,7 +68,7 @@ Due to static memory allocation, only the first 1K columns by 1K rows are rotated, the rest are silently ignored. But fear not, a separate tool with dynamic memory allocation is included: -```sh +``` ./left < prog.c > r1.c cc r1.c -o right ./right < input.txt > rotated_clockwise.txt @@ -83,7 +83,7 @@ rotate counterclockwise once more, we get another program. This program outputs a single message to `stdout`, which is the name of the series that `Nuko` came from. -```sh +``` ./left < prog.c | ./left > r2.c cc r2.c -o msg0 ./msg0 @@ -92,7 +92,7 @@ series that `Nuko` came from. There is one final rotation, which produces a tool that removes leading whitespaces: -```sh +``` ./left < prog.c | ./left | ./left > r3.c cc r3.c -o shift ./shift < input.txt > no_leading_space.txt @@ -112,7 +112,7 @@ side). This shifted code behaves slightly different from the original program. For example, here are two more messages that can be produced: -```sh +``` ./shift < prog.c | ./right > msg1.c && gcc msg1.c -o msg1 && ./msg1 ./shift < prog.c | ./left > msg2.c && gcc msg2.c -o msg2 && ./msg2 ``` diff --git a/2018/yang/index.html b/2018/yang/index.html index 1b46cb805..4a1add36e 100644 --- a/2018/yang/index.html +++ b/2018/yang/index.html @@ -141,15 +141,15 @@ Location: US - United States of America

        To build:

        -
            make
        +
            make

        To use:

        The author suggested that after compilation one should look at the generated files. For instance:

        -
            less generated1.c
        -    less generated2.c
        -    less generated3.c
        +
            less generated1.c
        +    less generated2.c
        +    less generated3.c

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        Code should be readable in any direction! This tool will help you rotate your code so you don’t have to stare at it sideways or even upside down. Rotating @@ -164,21 +164,21 @@ reveal messages and one more tool that can be used to reveal the final message hidden in the original source. All of these can be created using combinations of ./left, ./right and ./shift and the additionally generated programs.

        The final message can be revealed using

        -
            ./msg9 < prog.c
        +
            ./msg9 < prog.c

        But what combinations will generate ./msg3, ./msg4, ./msg5, ./msg6, ./msg7, ./msg8 and finally ./msg9?

        Author’s remarks:

        Tools’ usage:

        Nuko is a text rotator: given some text in stdin, Nuko will write the same text to stdout, but rotated 90 degrees counterclockwise.

        -
            cc prog.c -o left
        -    ./left < input.txt > rotated_counterclockwise.txt
        +
            cc prog.c -o left
        +    ./left < input.txt > rotated_counterclockwise.txt

        Due to static memory allocation, only the first 1K columns by 1K rows are rotated, the rest are silently ignored. But fear not, a separate tool with dynamic memory allocation is included:

        -
            ./left < prog.c > r1.c
        -    cc r1.c -o right
        -    ./right < input.txt > rotated_clockwise.txt
        +
            ./left < prog.c > r1.c
        +    cc r1.c -o right
        +    ./right < input.txt > rotated_clockwise.txt

        For variety, this second tool rotates clockwise instead of counterclockwise. Also, it can handle files larger than 1024x1024, depending on how much memory you have.

        @@ -186,14 +186,14 @@ depending on how much memory you have.

        rotate counterclockwise once more, we get another program. This program outputs a single message to stdout, which is the name of the series that Nuko came from.

        -
            ./left < prog.c | ./left > r2.c
        -    cc r2.c -o msg0
        -    ./msg0
        +
            ./left < prog.c | ./left > r2.c
        +    cc r2.c -o msg0
        +    ./msg0

        There is one final rotation, which produces a tool that removes leading whitespaces:

        -
            ./left < prog.c | ./left | ./left > r3.c
        -    cc r3.c -o shift
        -    ./shift < input.txt > no_leading_space.txt
        +
            ./left < prog.c | ./left | ./left > r3.c
        +    cc r3.c -o shift
        +    ./shift < input.txt > no_leading_space.txt

        Where this might be useful, besides ruining the formatting of certain files, is that it completes the set of tools needed to solve the puzzle that is embedded in prog.c.

        @@ -204,8 +204,8 @@ toward one of those notches (and create a new notch on the other side). This shifted code behaves slightly different from the original program. For example, here are two more messages that can be produced:

        -
            ./shift < prog.c | ./right > msg1.c && gcc msg1.c -o msg1 && ./msg1
        -    ./shift < prog.c | ./left > msg2.c && gcc msg2.c -o msg2 && ./msg2
        +
            ./shift < prog.c | ./right > msg1.c && gcc msg1.c -o msg1 && ./msg1
        +    ./shift < prog.c | ./left > msg2.c && gcc msg2.c -o msg2 && ./msg2

        In total, there are 9 embedded strings that can be produced via a sequence of rotates and shifts, one of which can be used to extract the 10th final string from prog.c. The intent is to simulate those diff --git a/2019/adamovsky/README.md b/2019/adamovsky/README.md index 212eabbfe..106110192 100644 --- a/2019/adamovsky/README.md +++ b/2019/adamovsky/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2019 adamovsky bugs](../../bugs.html#2019_ada ## To use: -```sh +``` ./prog file.unl ``` ## Try: -```sh +``` ./try.sh ``` @@ -47,7 +47,7 @@ Functional programming is not a panacea against core dumps, after all. This can be demonstrated by: -```sh +``` ./prog crash.unl ``` @@ -84,7 +84,7 @@ by the sheer length of the dividing line and totally overlooks the rest of the p When built directly using -```sh +``` make ``` @@ -92,7 +92,7 @@ the program (`prog`) accepts a single parameter with the name of an Unlambda pro download the [Colossal Cave Adventure][1] (the [advent.unl](advent.unl) file) and run it like this: -```sh +``` ./prog advent.unl ``` @@ -105,7 +105,7 @@ entries from [quine contest][4]. There is an alternative build path that requires the 2018 IOCCC size tool to complete. Put the tool source [iocccsize_2018.c](iocccsize_2018.c) in the project directory and call -```sh +``` make identify ``` diff --git a/2019/adamovsky/index.html b/2019/adamovsky/index.html index ecc6846dd..8a1efb36b 100644 --- a/2019/adamovsky/index.html +++ b/2019/adamovsky/index.html @@ -141,15 +141,15 @@ Location: CZ - Czech Republic (

        To build:

        -
            make
        +
            make

        Bugs and (Mis)features:

        The current status of this entry is:

            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2019 adamovsky bugs.

        To use:

        -
            ./prog file.unl
        +
            ./prog file.unl

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        Even after pre-processing and indenting, the C code of this entry it is about as understandable as the Unlambda code.

        @@ -159,7 +159,7 @@ bytes which crashed it:

            ````.0`.0`.0`c.0``sssss

        Functional programming is not a panacea against core dumps, after all.

        This can be demonstrated by:

        -
            ./prog crash.unl
        +
            ./prog crash.unl

        Author’s remarks:

        A highly structured state state machine

        Purpose:

        @@ -181,11 +181,11 @@ actually a one-liner. It certainly was for me. I like to think the by the sheer length of the dividing line and totally overlooks the rest of the program.

        Usage:

        When built directly using

        -
            make
        +
            make

        the program (prog) accepts a single parameter with the name of an Unlambda program. You can download the Colossal Cave Adventure (the advent.unl file) and run it like this:

        -
            ./prog advent.unl
        +
            ./prog advent.unl

        NOTE: the file was added to the entry so there is no need to download it.

        @@ -194,7 +194,7 @@ and run it like this:

        entries from quine contest.

        There is an alternative build path that requires the 2018 IOCCC size tool to complete. Put the tool source iocccsize_2018.c in the project directory and call

        -
            make identify
        +
            make identify

        It will build the tool and use it to build an alternative program prog2, which in turn will produce an Unlambda program identify.unl. make identify runs this program to identify itself.

        diff --git a/2019/burton/README.md b/2019/burton/README.md index b02f13418..33e509a4e 100644 --- a/2019/burton/README.md +++ b/2019/burton/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2019 burton bugs](../../bugs.html#2019_burton ## To use: -```sh +``` ./prog < file ./cow file @@ -27,7 +27,7 @@ For more detailed information see [2019 burton bugs](../../bugs.html#2019_burton ## Try: -```sh +``` ./try.sh ``` @@ -51,7 +51,7 @@ The output should look familiar. Compiles cleanly with: -```sh +``` WARN="-Wno-implicit-int -Wno-missing-variable-declarations -Wno-parentheses" cc -Wall -Wextra -Weverything -pedantic $WARN -include stdio.h -o prog prog.c ``` @@ -63,7 +63,7 @@ programs, it is silent upon success; any output demonstrates an error. Instead of checking correctness, the [check.sh](check.sh) script can simply output the results: (The Makefile contains the spoiler): -```sh +``` out=cat ./check.sh ./prog ``` @@ -97,7 +97,7 @@ interface. Included is a version without compilation warnings: -```sh +``` cc -Wall -Wextra -Weverything -pedantic -include stdio.h -o prog.clean prog.clean.c ``` diff --git a/2019/burton/index.html b/2019/burton/index.html index 8fc78da6b..d35a8f4ae 100644 --- a/2019/burton/index.html +++ b/2019/burton/index.html @@ -141,17 +141,17 @@ Location: US - United States of America

        To build:

        -
            make
        +
            make

        Bugs and (Mis)features:

        The current status of this entry is:

            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2019 burton bugs.

        To use:

        -
            ./prog < file
        -
        -    ./cow file
        +
            ./prog < file
        +
        +    ./cow file

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        A tiny, but punctually correct way of POSIX counting for text files. This one line, one word, 127 character beauty continues to expand the number of classic @@ -163,14 +163,14 @@ interesting.

        Feed it anything on stdin. The output should look familiar.

        Compiles cleanly with:

        -
            WARN="-Wno-implicit-int -Wno-missing-variable-declarations -Wno-parentheses"
        -    cc -Wall -Wextra -Weverything -pedantic $WARN -include stdio.h -o prog prog.c
        +
            WARN="-Wno-implicit-int -Wno-missing-variable-declarations -Wno-parentheses"
        +    cc -Wall -Wextra -Weverything -pedantic $WARN -include stdio.h -o prog prog.c

        Description:

        Included is a test script, useful for the corner cases. As in all good Unix programs, it is silent upon success; any output demonstrates an error. Instead of checking correctness, the check.sh script can simply output the results: (The Makefile contains the spoiler):

        -
            out=cat ./check.sh ./prog
        +
            out=cat ./check.sh ./prog

        Interestingly, and a spoiler here: macOS and FreeBSD implement the common utility “correctly”. CentOS and Ubuntu both share a “flawed” utility that changes output format based upon input redirection or pipeline(!). As well, the @@ -189,7 +189,7 @@ All your base belong to us, but the constants seem a bit … off?

        The script cow.sh provides a closer analog, and perhaps a more useful interface.

        Included is a version without compilation warnings:

        -
            cc -Wall -Wextra -Weverything -pedantic -include stdio.h -o prog.clean prog.clean.c
        +
            cc -Wall -Wextra -Weverything -pedantic -include stdio.h -o prog.clean prog.clean.c

        Bugs

        The flags are not supported. Although they could easily be added into cow.sh. This exercise left to the reader.

        diff --git a/2019/ciura/README.md b/2019/ciura/README.md index 8864cd95e..5edf5d0cc 100644 --- a/2019/ciura/README.md +++ b/2019/ciura/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -22,14 +22,14 @@ For more detailed information see [2019 ciura bugs](../../bugs.html#2019_ciura). ## To use: -```sh +``` ./getwords.sh en | grep .. | ./prog string ``` ## Try: -```sh +``` ./try.sh ``` @@ -42,7 +42,7 @@ newline. See the Author's remarks for more information. ### Alternate build: -```sh +``` make alt ``` @@ -54,7 +54,7 @@ Use `prog.alt` as you would `prog` above. ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -83,7 +83,7 @@ of the alphabet exactly once. #### Example execution: -```sh +``` $ grep .. /usr/share/dict/words | ./prog abcdefghijklmnopqrstuvwxyz qualm fjord wiz pyx vs beg kc nth quartz jinx vs fed kc womb glyph diff --git a/2019/ciura/index.html b/2019/ciura/index.html index 6a37b351b..4da4d26d3 100644 --- a/2019/ciura/index.html +++ b/2019/ciura/index.html @@ -141,7 +141,7 @@ Location: PL - Republic of Poland

        To build:

        -
            make
        +
            make

        There is an alternate version available. See Alternate code below.

        Bugs and (Mis)features:

        @@ -149,18 +149,18 @@ below.

            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2019 ciura bugs.

        To use:

        -
            ./getwords.sh en | grep .. | ./prog string
        +
            ./getwords.sh en | grep .. | ./prog string

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Alternate code:

        There is an alternate version of this code that flushes stdout after writing a newline. See the Author’s remarks for more information.

        Alternate build:

        -
            make alt
        +
            make alt

        Alternate use:

        Use prog.alt as you would prog above.

        Alternate try:

        -
            ./try.alt.sh
        +
            ./try.alt.sh

        Judges’ remarks:

        A few letters, one at a time, with no repeats. How many different ways can this be done?

        @@ -176,23 +176,23 @@ written with an alphabet and outputs perfect pangrams composed of these words. A perfect pangram is a series of words that contains every letter of the alphabet exactly once.

        Example execution:

        -
            $ grep .. /usr/share/dict/words | ./prog abcdefghijklmnopqrstuvwxyz
        -    qualm fjord wiz pyx vs beg kc nth
        -    quartz jinx vs fed kc womb glyph
        -    quid jamb fez vs pyx kc growl nth
        -    quiz fjord pyx vs bag kc mewl nth
        -    quiz fjord pyx vs gab kc mewl nth
        -    quiz fjord pyx vs gem bawl kc nth
        -    quiz fjord pyx vs meg bawl kc nth
        -    quiz fjord vex bawl kc gyp ms nth
        -    quiz jamb flex vs kc gyp word nth
        -    quiz jamb pyx vs kc flog drew nth
        -    quiz jamb pyx vs kc frog lewd nth
        -    quiz jamb pyx vs kc frog weld nth
        -    quiz jamb pyx vs kc golf drew nth
        -    quiz jamb pyx vs kc grew fold nth
        -    quiz jamb pyx vs kc grow nth fled
        -    quiz jamb pyx vs kc growl fed nth
        +
            $ grep .. /usr/share/dict/words | ./prog abcdefghijklmnopqrstuvwxyz
        +    qualm fjord wiz pyx vs beg kc nth
        +    quartz jinx vs fed kc womb glyph
        +    quid jamb fez vs pyx kc growl nth
        +    quiz fjord pyx vs bag kc mewl nth
        +    quiz fjord pyx vs gab kc mewl nth
        +    quiz fjord pyx vs gem bawl kc nth
        +    quiz fjord pyx vs meg bawl kc nth
        +    quiz fjord vex bawl kc gyp ms nth
        +    quiz jamb flex vs kc gyp word nth
        +    quiz jamb pyx vs kc flog drew nth
        +    quiz jamb pyx vs kc frog lewd nth
        +    quiz jamb pyx vs kc frog weld nth
        +    quiz jamb pyx vs kc golf drew nth
        +    quiz jamb pyx vs kc grew fold nth
        +    quiz jamb pyx vs kc grow nth fled
        +    quiz jamb pyx vs kc growl fed nth

        Rearranging the words into more or less meaningful expressions is the user’s duty.

        This entry implements Algorithm X (Exact cover via dancing links) diff --git a/2019/diels-grabsch1/README.md b/2019/diels-grabsch1/README.md index 4210d5af6..e9a5d01eb 100644 --- a/2019/diels-grabsch1/README.md +++ b/2019/diels-grabsch1/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog < file > file.Z ``` ## Try: -```sh +``` ./try.sh ``` @@ -37,19 +37,19 @@ compresses differently? The judges know. :) #### Usage: -```sh +``` ./prog < input.txt > input.txt.Z ``` #### Example: -```sh +``` ./prog < guidelines.txt > guidelines.txt.Z ``` #### Check for correctness: -```sh +``` zcat guidelines.txt.Z > guidelines2.txt diff -s guidelines.txt guidelines2.txt ``` diff --git a/2019/diels-grabsch1/index.html b/2019/diels-grabsch1/index.html index 76e2f87b0..1a3d47d30 100644 --- a/2019/diels-grabsch1/index.html +++ b/2019/diels-grabsch1/index.html @@ -141,11 +141,11 @@ Location: DE - Federal Republic of Germ

        To build:

        -
            make
        +
            make

        To use:

        -
            ./prog < file > file.Z
        +
            ./prog < file > file.Z

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        Finally, IOCCC now has its own text compression program, and it is short enough to qualify for the Best Short Program award! That said, can you compress it down @@ -157,12 +157,12 @@ compresses differently? The judges know. :)

        Author’s remarks:

        A tiny “compress” tool:

        Usage:

        -
            ./prog < input.txt > input.txt.Z
        +
            ./prog < input.txt > input.txt.Z

        Example:

        -
            ./prog < guidelines.txt > guidelines.txt.Z
        +
            ./prog < guidelines.txt > guidelines.txt.Z

        Check for correctness:

        -
            zcat guidelines.txt.Z > guidelines2.txt
        -    diff -s guidelines.txt guidelines2.txt
        +
            zcat guidelines.txt.Z > guidelines2.txt
        +    diff -s guidelines.txt guidelines2.txt

        Of course you can also use 2015/mills2 instead of zcat to verify the output file. The achieved compression ratio roughly matches that of the classic Unix compress(1) tool. And the source code is very diff --git a/2019/diels-grabsch2/README.md b/2019/diels-grabsch2/README.md index fb3f3c5d7..22a25e0ae 100644 --- a/2019/diels-grabsch2/README.md +++ b/2019/diels-grabsch2/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./try.sh ``` @@ -33,7 +33,7 @@ that you are dreaming? Or is it, wake up from the simulation? This program prints its own SHA-512 hash. To verify, run: -```sh +``` $ sha512sum prog.c; ./prog 43bd0c4381a5078d2850fca9ae5e0647596bcc03cd67d8d973ad02ff35c316c728e7b347ca70abe6c74e745e63646cc7643cb0cffcd3d9a969cbf31a7ce5bf68 prog.c 43bd0c4381a5078d2850fca9ae5e0647596bcc03cd67d8d973ad02ff35c316c728e7b347ca70abe6c74e745e63646cc7643cb0cffcd3d9a969cbf31a7ce5bf68 diff --git a/2019/diels-grabsch2/index.html b/2019/diels-grabsch2/index.html index eb3535cc3..3748f10c1 100644 --- a/2019/diels-grabsch2/index.html +++ b/2019/diels-grabsch2/index.html @@ -141,11 +141,11 @@ Location: DE - Federal Republic of Germ

        To build:

        -
            make
        +
            make

        To use:

        -
            ./prog
        +
            ./prog

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Judges’ remarks:

        Before running this one, stay calm. Chill out, have a cup of tea. Is this bad?

        To understand what is going on here, please check if you are dreaming, or are you dreaming @@ -153,9 +153,9 @@ that you are dreaming? Or is it, wake up from the simulation?

        Author’s remarks:

        Almost a hash collision:

        This program prints its own SHA-512 hash. To verify, run:

        -
            $ sha512sum prog.c; ./prog
        -    43bd0c4381a5078d2850fca9ae5e0647596bcc03cd67d8d973ad02ff35c316c728e7b347ca70abe6c74e745e63646cc7643cb0cffcd3d9a969cbf31a7ce5bf68  prog.c
        -    43bd0c4381a5078d2850fca9ae5e0647596bcc03cd67d8d973ad02ff35c316c728e7b347ca70abe6c74e745e63646cc7643cb0cffcd3d9a969cbf31a7ce5bf68
        +
            $ sha512sum prog.c; ./prog
        +    43bd0c4381a5078d2850fca9ae5e0647596bcc03cd67d8d973ad02ff35c316c728e7b347ca70abe6c74e745e63646cc7643cb0cffcd3d9a969cbf31a7ce5bf68  prog.c
        +    43bd0c4381a5078d2850fca9ae5e0647596bcc03cd67d8d973ad02ff35c316c728e7b347ca70abe6c74e745e63646cc7643cb0cffcd3d9a969cbf31a7ce5bf68

        It started as a complicated “hello world” program that prints some random hex digits instead of “hello world”. Then, the digits were adjusted until the resulting program matched its own SHA-512 hash, via brute force through all diff --git a/2019/dogon/README.md b/2019/dogon/README.md index 8d76d1ee9..f6aa9accf 100644 --- a/2019/dogon/README.md +++ b/2019/dogon/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2019 dogon bugs](../../bugs.html#2019_dogon). ## To use: -```sh +``` ./prog < pattern.mc ``` ## Try: -```sh +``` ./try.sh ``` @@ -247,13 +247,13 @@ of his vast knowledge regarding GOL programming and hashlife. As a free bonus, Tom has allowed me to show his code which is probably the most efficient yet most obfuscated way of calculating the GOL function on a 64 bits `8*8` leaf: -````c +``` unsigned long life8x8(long a) { unsigned long aw = a << 1, ae = a >> 1, s0 = aw ^ ae, s1 = aw & ae, hs0 = s0 ^ a, hs1 = (s0 & a) | s1, hs0w8 = hs0 >> 8, hs0e8 = hs0 << 8, hs1w8 = hs1 >> 8, hs1e8 = hs1 << 8, ts0 = hs0w8 ^ hs0e8, ts1 = (hs0w8 & hs0e8) | (ts0 & s0); return (hs1w8 ^ hs1e8 ^ ts1 ^ s1) & ((hs1w8 | hs1e8) ^ (ts1 | s1)) & ((ts0 ^ s0) | a); } -```` +``` This uses only 19 bitwise operations and six shifts to calculate the inner 6x6 next generation bits of the input 8x8 ! diff --git a/2019/dogon/index.html b/2019/dogon/index.html index 954f3e8c8..8264e0e61 100644 --- a/2019/dogon/index.html +++ b/2019/dogon/index.html @@ -141,15 +141,15 @@ Location: IL - State of Israel (

        To build:

        -
            make
        +
            make

        Bugs and (Mis)features:

        The current status of this entry is:

            STATUS: uses gets() - change to fgets() if possible

        For more detailed information see 2019 dogon bugs.

        To use:

        -
            ./prog < pattern.mc
        +
            ./prog < pattern.mc

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Make sure that you keep focus of windows in mind when going back and forth to the program and the script.

        Judges’ remarks:

        @@ -321,11 +321,7 @@ master, who reviewed some earlier versions of the entry and freely shared some of his vast knowledge regarding GOL programming and hashlife. As a free bonus, Tom has allowed me to show his code which is probably the most efficient yet most obfuscated way of calculating the GOL function on a 64 bits 8*8 leaf:

        -
            unsigned long life8x8(long a) { unsigned long aw = a << 1, ae = a >> 1, s0 = aw
        -    ^ ae, s1 = aw & ae, hs0 = s0 ^ a, hs1 = (s0 & a) | s1, hs0w8 = hs0 >> 8, hs0e8 =
        -    hs0 << 8, hs1w8 = hs1 >> 8, hs1e8 = hs1 << 8, ts0 = hs0w8 ^ hs0e8, ts1 = (hs0w8
        -    & hs0e8) | (ts0 & s0); return (hs1w8 ^ hs1e8 ^ ts1 ^ s1) & ((hs1w8 | hs1e8) ^
        -    (ts1 | s1)) & ((ts0 ^ s0) | a); }
        +

        <!---`c--> unsigned long life8x8(long a) { unsigned long aw = a << 1, ae = a >> 1, s0 = aw ^ ae, s1 = aw & ae, hs0 = s0 ^ a, hs1 = (s0 & a) | s1, hs0w8 = hs0 >> 8, hs0e8 = hs0 << 8, hs1w8 = hs1 >> 8, hs1e8 = hs1 << 8, ts0 = hs0w8 ^ hs0e8, ts1 = (hs0w8 & hs0e8) | (ts0 & s0); return (hs1w8 ^ hs1e8 ^ ts1 ^ s1) & ((hs1w8 | hs1e8) ^ (ts1 | s1)) & ((ts0 ^ s0) | a); }

        This uses only 19 bitwise operations and six shifts to calculate the inner 6x6 next generation bits of the input 8x8 !

        make ``` @@ -21,20 +21,20 @@ For more detailed information see [2019 duble bugs](../../bugs.html#2019_duble). ## To use: -```sh +``` ./prog file ``` ## Try: -```sh +``` ./prog /tmp/drawing ``` Open another window / terminal. -```sh +``` ./prog /tmp/drawing ``` @@ -42,13 +42,13 @@ Open more terminals and repeat... You might also wish to try a full screen size. For this try: -```sh +``` make clobber fullscreen ``` Alternatively, if you want to change the size, do something like: -```sh +``` make clobber LINES=20 COLUMNS=20 all ``` @@ -69,7 +69,7 @@ the editor. After editing the file and quitting, try: -```sh +``` /tmp/drawing ``` @@ -97,7 +97,7 @@ alternate code might not work as well in macOS. ### Alternate build: -```sh +``` make alt ``` @@ -132,7 +132,7 @@ To build, type `make` (assuming gcc) or `make CC=clang`. Then you can start the program. It expects a file path as its first argument: -```sh +``` ./prog /tmp/drawing ``` @@ -216,7 +216,7 @@ Note: the drawing files `prog` generates are probably even more portable than The default size is the one of my xterm (see top of Makefile). You may set it to the full size of your terminal window by typing: -```sh +``` make clobber fullscreen ``` diff --git a/2019/duble/index.html b/2019/duble/index.html index afd9bb62d..f08f5199e 100644 --- a/2019/duble/index.html +++ b/2019/duble/index.html @@ -141,7 +141,7 @@ Location: FR - French Republic (

        To build:

        -
            make
        +
            make

        There is an alternate version, the original, which does not work well in macOS. See Alternate code below if you are curious.

        Bugs and (Mis)features:

        @@ -149,16 +149,16 @@ See Alternate code below if you are curious.

            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2019 duble bugs.

        To use:

        -
            ./prog file
        +
            ./prog file

        Try:

        -
            ./prog /tmp/drawing
        +
            ./prog /tmp/drawing

        Open another window / terminal.

        -
            ./prog /tmp/drawing
        +
            ./prog /tmp/drawing

        Open more terminals and repeat…

        You might also wish to try a full screen size. For this try:

        -
            make clobber fullscreen
        +
            make clobber fullscreen

        Alternatively, if you want to change the size, do something like:

        -
            make clobber LINES=20 COLUMNS=20 all
        +
            make clobber LINES=20 COLUMNS=20 all

        The author provided us with the following table for use:


          @@ -173,7 +173,7 @@ to the move mode).

          The mode and current color is indicated at the bottom left corner of the editor.

          After editing the file and quitting, try:

          -
              /tmp/drawing
          +
              /tmp/drawing

          i.e. execute the file.


          WARNING: if the file is deleted it might lock any session still in use. These @@ -188,7 +188,7 @@ directory which you’ll have to delete manually. This is also discussed in

          An alternate version of this entry, prog.alt.c, is provided. This alternate code might not work as well in macOS.

          Alternate build:

          -
              make alt
          +
              make alt

          Alternate use:

          Use prog.alt as you would prog above.

          Judges’ remarks:

          @@ -204,7 +204,7 @@ of someone else by just opening the same file!

          See section Limits, Portability for more info.

          To build, type make (assuming gcc) or make CC=clang.

          Then you can start the program. It expects a file path as its first argument:

          -
              ./prog /tmp/drawing
          +
              ./prog /tmp/drawing

          (If not started this way, with a file, prog will refuse to start.)

          If the file does not exist, you will start with a blank drawing.

          If someone else (or another instance of yourself, maybe?) is already @@ -264,7 +264,7 @@ inverse video mode, and movement escape codes, e.g. xterm, g

          The drawing area size is set at compilation time:

          The default size is the one of my xterm (see top of Makefile). You may set it to the full size of your terminal window by typing:

          -
              make clobber fullscreen
          +
              make clobber fullscreen

          IMPORTANT NOTES:

          • The program compiled with a given size will fail to reload a drawing file diff --git a/2019/endoh/README.md b/2019/endoh/README.md index 4429c7dfd..ba192b442 100644 --- a/2019/endoh/README.md +++ b/2019/endoh/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -21,7 +21,7 @@ For more detailed information see [2019 endoh bugs](../../bugs.html#2019_endoh). ## To use: -```sh +``` ./prog ``` @@ -30,7 +30,7 @@ For more detailed information see [2019 endoh bugs](../../bugs.html#2019_endoh). If you have `gdb(1)` installed: -```sh +``` ./try.sh ``` @@ -40,7 +40,7 @@ only been tested with linux. You might also wish to try: -```sh +``` gdb ./prog || lldb ./prog ``` @@ -59,20 +59,20 @@ ascii` when debugging it to reveal its purpose. Compile prog.c with no optimization. -```sh +``` cc -g -O0 -o prog prog.c ``` Then, run it. You will see a segmentation fault. -```sh +``` $ ./prog Segmentation fault (core dumped) ``` Let's debug. As usual, run it under gdb. -```sh +``` $ gdb ./prog (gdb) run Starting program: /home/.../prog @@ -132,7 +132,7 @@ The original program can be used as a GDB command file. By using this, you can confirm that it is actually a quine. -```sh +``` gdb -q -x prog.c ./prog | sed -n -r 's/#.*:([0-9]+)/\1/p' | awk '{printf "%c",$1}' > prog2.c diff prog.c prog2.c ``` diff --git a/2019/endoh/index.html b/2019/endoh/index.html index 77c4c65a3..1f5537cdf 100644 --- a/2019/endoh/index.html +++ b/2019/endoh/index.html @@ -141,7 +141,7 @@ Location: JP - Japan
          • To build:

            -
                make
            +
                make

            NOTE: the use of the C compiler optimiser was disabled and -g was enabled for this entry because it is SUPPOSED to crash and it needs debugging symbols.

            Bugs and (Mis)features:

            @@ -149,32 +149,32 @@ this entry because it is SUPPOSED to crash and it needs debugging symbols.

                STATUS: INABIAF - please **DO NOT** fix

            For more detailed information see 2019 endoh bugs.

            To use:

            -
                ./prog
            +
                ./prog

            Try:

            If you have gdb(1) installed:

            -
                ./try.sh
            +
                ./try.sh

            Note that in macOS installing gdb(1) takes multiple steps - it’s not just a matter of installing gdb(1) and that’s that. The try.sh script has only been tested with linux.

            You might also wish to try:

            -
                gdb ./prog || lldb ./prog
            +
                gdb ./prog || lldb ./prog

            and then type in r (to run program) and then bt (for backtrace).

            Judges’ remarks:

            The purpose of this program is to crash. You’ll want to have memorized man 7 ascii when debugging it to reveal its purpose.

            Author’s remarks:

            backtrace quine:

            Compile prog.c with no optimization.

            -
                cc -g -O0 -o prog prog.c
            +
                cc -g -O0 -o prog prog.c

            Then, run it. You will see a segmentation fault.

            -
                $ ./prog
            -    Segmentation fault (core dumped)
            +
                $ ./prog
            +    Segmentation fault (core dumped)

            Let’s debug. As usual, run it under gdb.

            -
                $ gdb ./prog
            -    (gdb) run
            -    Starting program: /home/.../prog
            -
            -    Program received signal SIGSEGV, Segmentation fault.
            -    0x0000000000000000 in ?? ()
            +
                $ gdb ./prog
            +    (gdb) run
            +    Starting program: /home/.../prog
            +
            +    Program received signal SIGSEGV, Segmentation fault.
            +    0x0000000000000000 in ?? ()

            Okay, check the backtrace.

                (gdb) backtrace
                 #0  0x0000000000000000 in ?? ()
            @@ -212,8 +212,8 @@ only been tested with linux.

            #7 0x0000555555555747 in x65 () at prog.c:101 ...

            By using this, you can confirm that it is actually a quine.

            -
                gdb -q -x prog.c ./prog | sed -n -r 's/#.*:([0-9]+)/\1/p' | awk '{printf "%c",$1}' > prog2.c
            -    diff prog.c prog2.c
            +
                gdb -q -x prog.c ./prog | sed -n -r 's/#.*:([0-9]+)/\1/p' | awk '{printf "%c",$1}' > prog2.c
            +    diff prog.c prog2.c
            make ``` ## To use: -```sh +``` ./prog infile.wav outfile.wav ``` ## Try: -```sh +``` ./try.sh ``` @@ -62,7 +62,7 @@ Interesting fact: The size of the program from `./iocccsize -i` is 2019. #### How to use: -```sh +``` ./prog input [output [size [dry [wet [damping]]]]] prog.exe input [output [size [dry [wet [damping]]]]] ``` @@ -87,7 +87,7 @@ The default settings are designed to make the effect obvious rather than subtle, so it may be a good idea to adjust the ratio of "dry" to "wet", to give a more pleasant result: -```sh +``` ./prog in.wav out.wav 1.8 80% 15% ``` diff --git a/2019/giles/index.html b/2019/giles/index.html index 5c4c0355b..df1b1207a 100644 --- a/2019/giles/index.html +++ b/2019/giles/index.html @@ -141,11 +141,11 @@ Location: AU - Commonwealth of Australi

            To build:

            -
                make
            +
                make

            To use:

            -
                ./prog infile.wav outfile.wav
            +
                ./prog infile.wav outfile.wav

            Try:

            -
                ./try.sh
            +
                ./try.sh

            NOTE: play, which try.sh uses, comes from SoX, the Swiss Army Knife of sound processing programs. If you don’t have this installed, see FAQ 3.10: How do I compile and use an IOCCC entry that requires sound.

            @@ -175,8 +175,8 @@ the latter reports warnings about loss of information when converting floa and that void (*)() and void (*)(void) are not the same thing.

            Interesting fact: The size of the program from ./iocccsize -i is 2019.

            How to use:

            -
                ./prog input [output [size [dry [wet [damping]]]]]
            -    prog.exe input [output [size [dry [wet [damping]]]]]
            +
                ./prog input [output [size [dry [wet [damping]]]]]
            +    prog.exe input [output [size [dry [wet [damping]]]]]
            • input: The path to the input file. Required.
            • output: The path to the output file. Optional, defaults to out.wav.
            • @@ -196,7 +196,7 @@ decimal numbers (e.g. 0.35) or as percentages (e.g. 35%).

              The default settings are designed to make the effect obvious rather than subtle, so it may be a good idea to adjust the ratio of “dry” to “wet”, to give a more pleasant result:

              -
                  ./prog in.wav out.wav 1.8 80% 15%
              +
                  ./prog in.wav out.wav 1.8 80% 15%

              The program only supports WAV files, and only mostly. Other audio formats, such as MP3, are not supported because they are difficult to decode, but there are free programs such as ffmpeg that can perform the conversion. Some of the diff --git a/2019/karns/README.md b/2019/karns/README.md index a01b9c128..ecffd2819 100644 --- a/2019/karns/README.md +++ b/2019/karns/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -21,13 +21,13 @@ For more detailed information see [2019 karns bugs](../../bugs.html#2019_karns). ## To use: -```sh +``` ./prog < textfile_that_fits_on_the_screen ``` You might want to type: -```sh +``` reset ``` @@ -36,13 +36,13 @@ after running the program to restore the terminal to its previous state. ## Try: -```sh +``` ./try.sh ``` If you have more time you might want to try: -```sh +``` ./prog < README.md ``` @@ -82,7 +82,7 @@ connected with anything. This program usually compiles under both GCC and clang. Build with: -```sh +``` $(CC) -std=c99 -o tbfs prog.c ``` @@ -90,13 +90,13 @@ where `$(CC)` is cc, gcc, clang, or some other C compiler. You can then run it with: -```sh +``` cat | ./tbfs ``` Examples: -```sh +``` ./tbfs < maze ./tbfs < prog.c ``` diff --git a/2019/karns/index.html b/2019/karns/index.html index dbe986a6c..496be455a 100644 --- a/2019/karns/index.html +++ b/2019/karns/index.html @@ -141,7 +141,7 @@ Location: US - United States of America

              To build:

              -
                  make
              +
                  make

              NOTE: we disable the optimiser because this program has problems with it enabled.

              Bugs and (Mis)features:

              @@ -149,14 +149,14 @@ enabled.

                  STATUS: INABIAF - please **DO NOT** fix

              For more detailed information see 2019 karns bugs.

              To use:

              -
                  ./prog < textfile_that_fits_on_the_screen
              +
                  ./prog < textfile_that_fits_on_the_screen

              You might want to type:

              -
                  reset
              +
                  reset

              after running the program to restore the terminal to its previous state.

              Try:

              -
                  ./try.sh
              +
                  ./try.sh

              If you have more time you might want to try:

              -
                  ./prog < README.md
              +
                  ./prog < README.md

              Judges’ remarks:

              If you typically get lost in mazes, watching this program run might – or might not, YMMV – teach you how to find your way in a maze. The algorithm is @@ -179,13 +179,13 @@ adjacent nodes that are also spaces. Nodes that aren’t spaces are not connected with anything.

              Compiling and Running:

              This program usually compiles under both GCC and clang. Build with:

              -
                  $(CC) -std=c99 -o tbfs prog.c
              +
                  $(CC) -std=c99 -o tbfs prog.c

              where $(CC) is cc, gcc, clang, or some other C compiler.

              You can then run it with:

              -
                  cat <input file> | ./tbfs
              +
                  cat <input file> | ./tbfs

              Examples:

              -
                  ./tbfs < maze
              -    ./tbfs < prog.c
              +
                  ./tbfs < maze
              +    ./tbfs < prog.c

              Issues

              • The program must be ran in a terminal that supports ANSI escape codes for diff --git a/2019/lynn/README.md b/2019/lynn/README.md index 6d4c43522..dea764f68 100644 --- a/2019/lynn/README.md +++ b/2019/lynn/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2019 lynn bugs](../../bugs.html#2019_lynn). ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./try.sh ``` @@ -62,7 +62,7 @@ typeclasses. Just pass dictionaries explicitly. Build the compiler: -```sh +``` cc -o prog prog.c ``` @@ -72,7 +72,7 @@ Build the compiler: Test the compiler on [fib.hs](fib.hs): -```sh +``` (./prog < fib.hs ; cat prog.c) > fib.c ``` @@ -81,7 +81,7 @@ Compiling the output produces a binary that prints the 30th Fibonacci number. The file [ghcfib.hs](ghcfib.hs) includes [fib.hs](fib.hs) with some glue code, and shows GHC also accepts our subset of Haskell: -```sh +``` ghc ghcfib.hs ``` @@ -93,7 +93,7 @@ instead provide [hint.hs](hint.hs), the output of a certain stage of the compiler when run on itself. This intermediate output is hopefully difficult to understand, yet is accepted by our compiler: -```sh +``` (./prog < hint.hs ; cat prog.c) > hint.c make hint ./hint @@ -116,7 +116,7 @@ languages"](https://www.cs.dartmouth.edu/~doug/nfa.pdf). We exercise it by showing the first entries of the length-ordered list of all strings consisting of the characters `a` and `b` that contain an even number of `a`s. -```sh +``` (./prog < lol.hs ; cat prog.c) > lol.c make lol ./lol @@ -124,7 +124,7 @@ of the characters `a` and `b` that contain an even number of `a`s. A GHC wrapper is provided: -```sh +``` ghc ghclol.hs ``` @@ -135,14 +135,14 @@ See [scc.hs](scc.hs) (and its GHC wrapper [ghcscc.hs](ghcscc.hs)) for an elegant way to print the strongly-connected components of a graph in reverse topological order. -```sh +``` (./prog < scc.hs ; cat prog.c) > scc.c ``` It expects the input to be in a similar format as a previous entry (2018 vokes). For example: -```sh +``` make scc ./scc < example-1.txt ./scc < example-2.txt diff --git a/2019/lynn/index.html b/2019/lynn/index.html index a44868304..f0fb76129 100644 --- a/2019/lynn/index.html +++ b/2019/lynn/index.html @@ -141,15 +141,15 @@ Location: US - United States of America

                To build:

                -
                    make
                +
                    make

                Bugs and (Mis)features:

                The current status of this entry is:

                    STATUS: INABIAF - please **DO NOT** fix

                For more detailed information see 2019 lynn bugs.

                To use:

                -
                    ./prog
                +
                    ./prog

                Try:

                -
                    ./try.sh
                +
                    ./try.sh

                Judges’ remarks:

                A fully functional compiler. The example prints out the 30th Fibonacci number.

                @@ -171,23 +171,23 @@ trace of those scary unsafeThisAndThat functions. All functions mus

              Building:

              Build the compiler:

              -
                  cc -o prog prog.c
              +
                  cc -o prog prog.c

              Demos:

              Fibonacci numbers:

              Test the compiler on fib.hs:

              -
                  (./prog < fib.hs ; cat prog.c) > fib.c
              +
                  (./prog < fib.hs ; cat prog.c) > fib.c

              Compiling the output produces a binary that prints the 30th Fibonacci number.

              The file ghcfib.hs includes fib.hs with some glue code, and shows GHC also accepts our subset of Haskell:

              -
                  ghc ghcfib.hs
              +
                  ghc ghcfib.hs

              Self-hosting compiler:

              To avoid spoiling this entry by revealing the original Haskell source, we instead provide hint.hs, the output of a certain stage of the compiler when run on itself. This intermediate output is hopefully difficult to understand, yet is accepted by our compiler:

              -
                  (./prog < hint.hs ; cat prog.c) > hint.c
              -    make hint
              -    ./hint
              +
                  (./prog < hint.hs ; cat prog.c) > hint.c
              +    make hint
              +    ./hint

              The output program behaves like the compiler itself.

              Unlike the original source from which it is derived, GHC fails to compile hint.hs. This is because values have been replaced with their Scott @@ -200,21 +200,21 @@ it to work.

              languages”. We exercise it by showing the first entries of the length-ordered list of all strings consisting of the characters a and b that contain an even number of as.

              -
                  (./prog < lol.hs ; cat prog.c) > lol.c
              -    make lol
              -    ./lol
              +
                  (./prog < lol.hs ; cat prog.c) > lol.c
              +    make lol
              +    ./lol

              A GHC wrapper is provided:

              -
                  ghc ghclol.hs
              +
                  ghc ghclol.hs

              Strongly-connected components:

              See scc.hs (and its GHC wrapper ghcscc.hs) for an elegant way to print the strongly-connected components of a graph in reverse topological order.

              -
                  (./prog < scc.hs ; cat prog.c) > scc.c
              +
                  (./prog < scc.hs ; cat prog.c) > scc.c

              It expects the input to be in a similar format as a previous entry (2018 vokes). For example:

              -
                  make scc
              -    ./scc < example-1.txt
              -    ./scc < example-2.txt
              +
                  make scc
              +    ./scc < example-1.txt
              +    ./scc < example-2.txt

              The output should agree, though our program omits line numbers and does not sort entries within a line. (Also, our program only treats spaces as whitespace, and supports any non-space character in a vertex name.)

              diff --git a/2019/mills/README.md b/2019/mills/README.md index 7e0cb0686..8444eb3c0 100644 --- a/2019/mills/README.md +++ b/2019/mills/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2019 mills bugs](../../bugs.html#2019_mills). ## To use: -```sh +``` make cpclean # Let this run for about about an hour and then kill it: ./prog Shakespeare.txt @@ -27,7 +27,7 @@ For more detailed information see [2019 mills bugs](../../bugs.html#2019_mills). ## Try: -```sh +``` ./try.sh ``` @@ -92,19 +92,19 @@ OMLET has three operating modes: For your first OMLET experiment, we will try training a simple single-level RNN to write some [Shakespeare][5] plays. Start by typing -```sh +``` make ``` After it builds, train it using -```sh +``` ./prog Shakespere.txt ``` This will immediately start outputting gibberish to the output, e.g. -```sh +``` ./prog Shakespere.txt ``` @@ -259,7 +259,7 @@ doing `Control-C`. You can continue training from a previous checkpoint by providing the checkpoint file name as the second parameter, for example: -```sh +``` ./prog Shakespeare.txt cp01_1.970 ``` @@ -275,7 +275,7 @@ parameters to generate data. Inference mode takes the checkpoint file as *standard input* (not on the command line) and hence must be run with a command like -```sh +``` ./prog < cp55_1.807 ``` @@ -294,7 +294,7 @@ The default network for OMLET (the one you get if you type `make` with the executable name `prog`) is the simplest recurrent neural network. It looks like -```c +``` h = tanh(Wxh * x + Whh * h' + Bh) y = Why * h + By ``` @@ -317,26 +317,26 @@ It is the presence of the hidden state vector that allows the RNN to "remember" the past. We can see what would happen if we removed this hidden state. If you type -```sh +``` make lin1 ``` OMLET will create an [ADALINE][10] network that does -```c +``` y = Wxy * x + By ``` This is a simple [linear][11] [feed-forward network][12]. You can run it with -```sh +``` ./lin1 Shakespeare.txt ``` The linear network won't be able to get past the gibberish stage, because it lacks history: -```sh +``` ./lin1 Shakespeare.txt ``` @@ -388,7 +388,7 @@ the language but `per` with the digit 1). We can try to improve the RNN's performance by stacking RNN modules atop each other: -```c +``` h1 = RNN(h1', x) h2 = RNN(h2', h1) y = Why * h2 + By @@ -414,13 +414,13 @@ the hard limit with `limit -h stacksize` and set it with You can try the deeper network by doing -```sh +``` make rnn2 ``` (or even `make rnn3` if you want a three-layer RNN) and train it with -```sh +``` ./rnn2 Shakespeare.txt ``` @@ -444,13 +444,13 @@ gradient, worsening the exploding and vanishing gradient problem. solve this problem. Christopher Olah gives a good description of them at his [blog posting][20]. You can build a two-level LSTM by doing -```sh +``` make lstm2 ``` and train with it with -```sh +``` ./lstm2 Shakespeare.txt ``` @@ -464,7 +464,7 @@ its hidden state via "gates". These gates are called The basic LSTM equations are -```c +``` f = sigmoid(Wxf * x + Whf * h' + Bf) i = sigmoid(Wxi * x + Whi * h' + Bi) o = sigmoid(Wxo * x + Who * h' + Bo) @@ -496,7 +496,7 @@ simplified versions of an LSTM which combine the gates together, meaning they require fewer learned parameters. This allows them to train faster than a generic LSTM. You can build a two-layer GRU with -```sh +``` make gru2 ``` @@ -510,7 +510,7 @@ compiler's command-line by using `-D` directives. The network is defined by a `-DNW='...'` command which consists of a series of comma-separated assignments. For example, the simple one-layer RNN could be defined like -```make +``` -DNW=' x = I(n), hp = I(128), \ h = C(hp, T(A(L(128, x), L(128, hp)))), \ y = L(n, h)' @@ -555,7 +555,7 @@ training mode, this is used to generate the loss which is backpropagated. As an example of a more complicated network, we can look at a two-layer GRU network: -```make +``` -DHS=128, \ -DNW=' x = I(n), \ y = L(n, MD(MD(x)))' \ diff --git a/2019/mills/index.html b/2019/mills/index.html index 70635adb6..c0d38519d 100644 --- a/2019/mills/index.html +++ b/2019/mills/index.html @@ -141,17 +141,17 @@ Location: US - United States of America

              To build:

              -
                  make
              +
                  make

              Bugs and (Mis)features:

              The current status of this entry is:

                  STATUS: INABIAF - please **DO NOT** fix

              For more detailed information see 2019 mills bugs.

              To use:

              -
                  make cpclean
              -    # Let this run for about about an hour and then kill it:
              -    ./prog Shakespeare.txt
              +
                  make cpclean
              +    # Let this run for about about an hour and then kill it:
              +    ./prog Shakespeare.txt

              Try:

              -
                  ./try.sh
              +
                  ./try.sh

              However, as the binary model files used to produce the output are in an implementation-specific format, your mileage may vary.

              Judges’ remarks:

              @@ -200,11 +200,11 @@ training, but you can have even more fun by downloading some larger datasets:

              For your first OMLET experiment, we will try training a simple single-level RNN to write some Shakespeare plays. Start by typing

              -
                  make
              +
                  make

              After it builds, train it using

              -
                  ./prog Shakespere.txt
              +
                  ./prog Shakespere.txt

              This will immediately start outputting gibberish to the output, e.g.

              -
                  ./prog Shakespere.txt
              +
                  ./prog Shakespere.txt

              produces:

                  sins ohennAu
                   T-teooclelp tiThoWy
              @@ -331,7 +331,7 @@ helpful if you need to stop and restart training. You can stop training by
               doing Control-C.

              You can continue training from a previous checkpoint by providing the checkpoint file name as the second parameter, for example:

              -
                  ./prog Shakespeare.txt cp01_1.970
              +
                  ./prog Shakespeare.txt cp01_1.970

              After the validation cycle finishes, OMLET begins the next epoch by restarting training at the beginning of the training set. Training continues forever, until you quit it with Control-C. You should monitor the checkpoints to @@ -342,7 +342,7 @@ OMLET to run the network in inference mode which uses the frozen checkpoint parameters to generate data. Inference mode takes the checkpoint file as standard input (not on the command line) and hence must be run with a command like

              -
                  ./prog < cp55_1.807
              +
                  ./prog < cp55_1.807

              Running it produces an infinite amount of generated output, until you hit Control-C to stop it.

              Note that if you decide to change networks or use a different input file, you @@ -353,8 +353,8 @@ cause a crash.

              The default network for OMLET (the one you get if you type make with the executable name prog) is the simplest recurrent neural network. It looks like

              -
                  h = tanh(Wxh * x + Whh * h' + Bh)
              -    y = Why * h + By
              +
                  h = tanh(Wxh * x + Whh * h' + Bh)
              +    y = Why * h + By

              where

              • x is the input vector
              • @@ -371,14 +371,14 @@ the loss of the network across the training set.

                It is the presence of the hidden state vector that allows the RNN to “remember” the past. We can see what would happen if we removed this hidden state. If you type

                -
                    make lin1
                +
                    make lin1

                OMLET will create an ADALINE network that does

                -
                    y = Wxy * x + By
                +
                    y = Wxy * x + By

                This is a simple linear feed-forward network. You can run it with

                -
                    ./lin1 Shakespeare.txt
                +
                    ./lin1 Shakespeare.txt

                The linear network won’t be able to get past the gibberish stage, because it lacks history:

                -
                    ./lin1 Shakespeare.txt
                +
                    ./lin1 Shakespeare.txt

                produces:

                    UERond w,
                 
                @@ -418,9 +418,9 @@ the language but per with the digit 1).

                Going deeper:

                We can try to improve the RNN’s performance by stacking RNN modules atop each other:

                -
                    h1 = RNN(h1', x)
                -    h2 = RNN(h2', h1)
                -    y = Why * h2 + By
                +
                    h1 = RNN(h1', x)
                +    h2 = RNN(h2', h1)
                +    y = Why * h2 + By

                with RNN(h, x) defined as above. Each RNN module has its own set of parameters and its own hidden state vector. This will improve the network’s performance, at the cost of a much larger parameter space.

                @@ -436,9 +436,9 @@ the hard limit with limit -h stacksize and set it with limit stacksize 65532 (replacing 65532 with the actual hard limit).


                You can try the deeper network by doing

                -
                    make rnn2
                +
                    make rnn2

                (or even make rnn3 if you want a three-layer RNN) and train it with

                -
                    ./rnn2 Shakespeare.txt
                +
                    ./rnn2 Shakespeare.txt

                The additional depth should allow the network to make better predictions (it can represent more complicated history), but it may take a long time to train -- both because the network (being larger) now requires more time to train and @@ -454,9 +454,9 @@ gradient, worsening the exploding and vanishing gradient problem.

                Long Short Term Memory networks (also called LSTMs) were developed to solve this problem. Christopher Olah gives a good description of them at his blog posting. You can build a two-level LSTM by doing

                -
                    make lstm2
                +
                    make lstm2

                and train with it with

                -
                    ./lstm2 Shakespeare.txt
                +
                    ./lstm2 Shakespeare.txt

                The LSTM is much easier to train because it explicitly decides how to update its hidden state via “gates”. These gates are called

                  @@ -466,11 +466,11 @@ its hidden state via “gates”. These gates are called

                  produce the output

                The basic LSTM equations are

                -
                    f = sigmoid(Wxf * x + Whf * h' + Bf)
                -    i = sigmoid(Wxi * x + Whi * h' + Bi)
                -    o = sigmoid(Wxo * x + Who * h' + Bo)
                -    c = f * c' + i * tanh(Wxc * x + Whc * h' + Bc)
                -    h = o * tanh(c)
                +
                    f = sigmoid(Wxf * x + Whf * h' + Bf)
                +    i = sigmoid(Wxi * x + Whi * h' + Bi)
                +    o = sigmoid(Wxo * x + Who * h' + Bo)
                +    c = f * c' + i * tanh(Wxc * x + Whc * h' + Bc)
                +    h = o * tanh(c)

                Where

                • x is the input vector
                • @@ -494,7 +494,7 @@ examples). One important one is the
                      make gru2
                  +
                      make gru2

                  Building your own networks

                  The OMLET Makefile comes with one-, two- and three-layer RNNs, LSTMs and GRUs, along with simpler feed-forward networks like multi-layer perceptrons and @@ -503,7 +503,7 @@ own networks by modifying the Makefile. Networks are passed in on t compiler’s command-line by using -D directives. The network is defined by a -DNW='...' command which consists of a series of comma-separated assignments. For example, the simple one-layer RNN could be defined like

                  -
                      -DNW=' x  = I(n), hp = I(128),                  \
                  +
                      -DNW=' x  = I(n), hp = I(128),                  \
                              h  = C(hp, T(A(L(128, x), L(128, hp)))), \
                              y  = L(n, h)'

                  The network declares x as an input vector (there must be a declaration for @@ -538,7 +538,7 @@ inference mode, this is used to select the next character to emit. In training mode, this is used to generate the loss which is backpropagated.

                  As an example of a more complicated network, we can look at a two-layer GRU network:

                  -
                      -DHS=128,                                 \
                  +
                      -DHS=128,                                 \
                       -DNW=' x  = I(n),                         \
                              y  = L(n, MD(MD(x)))'              \
                       -DBK=' hp = I(HS),                        \
                  diff --git a/2019/poikola/README.md b/2019/poikola/README.md
                  index 4d45815df..f4acd2fc1 100644
                  --- a/2019/poikola/README.md
                  +++ b/2019/poikola/README.md
                  @@ -1,6 +1,6 @@
                   ## To build:
                   
                  -```sh
                  +```
                       make
                   ```
                   
                  @@ -26,7 +26,7 @@ For more detailed information see [2019 poikola bugs](../../bugs.html#2019_poiko
                   
                   ## To use:
                   
                  -```sh
                  +```
                       ./prog 512 ./prog
                   
                       sleep 86400; make clobber prog
                  @@ -38,7 +38,7 @@ For more detailed information see [2019 poikola bugs](../../bugs.html#2019_poiko
                   
                   If you wish for some documentation:
                   
                  -```sh
                  +```
                       make docs
                   ```
                   
                  @@ -49,7 +49,7 @@ This will create the file `poikola.pdf` for your enjoyment.
                   
                   If you don't have a few days, try:
                   
                  -```sh
                  +```
                       ./try.sh
                   ```
                   
                  @@ -65,7 +65,7 @@ what can be done with the original entry.
                   
                   ### Alternate build:
                   
                  -```sh
                  +```
                       make alt
                   ```
                   
                  @@ -77,7 +77,7 @@ Use `prog.alt` as you would `prog` above.
                   
                   ### Alternate try:
                   
                  -```sh
                  +```
                       ./try.alt.sh
                   ```
                   
                  @@ -103,19 +103,19 @@ Nykänen](https://en.wikipedia.org/wiki/Matti_Nyk%C3%A4nen).
                   
                   ### How to build:
                   
                  -```sh
                  +```
                       gcc -O0 -o prog prog.c
                   ```
                   
                   or
                   
                  -```sh
                  +```
                       clang -O[0123s] -o prog prog.c
                   ```
                   
                   e.g.:
                   
                  -```sh
                  +```
                       clang -O1 -o prog prog.c
                   ```
                   
                  @@ -166,7 +166,7 @@ unnecessary checks, but either fails or gets stuck if invoked erroneously. The
                   program is invoked in this way:
                   
                   
                  -```sh
                  +```
                       ./prog  
                   ```
                   
                  diff --git a/2019/poikola/index.html b/2019/poikola/index.html
                  index cb5ca4dde..5899e90ad 100644
                  --- a/2019/poikola/index.html
                  +++ b/2019/poikola/index.html
                  @@ -141,7 +141,7 @@ Location: FI - Republic of Finland 
                   
                   

                  To build:

                  -
                      make
                  +
                      make

                  There is an alternate version of this program which changes the way the output is displayed. See Alternate code below.

                  NOTE: we disable the optimiser because the author stated that for GCC optimiser @@ -153,30 +153,30 @@ forcing -std=gnu11.

                      STATUS: INABIAF - please **DO NOT** fix

                  For more detailed information see 2019 poikola bugs.

                  To use:

                  -
                      ./prog 512 ./prog
                  -
                  -    sleep 86400; make clobber prog
                  -    ./prog 512 ./prog
                  -
                  -    sleep 86400; make clobber prog
                  -    ./prog 512 ./prog
                  +
                      ./prog 512 ./prog
                  +
                  +    sleep 86400; make clobber prog
                  +    ./prog 512 ./prog
                  +
                  +    sleep 86400; make clobber prog
                  +    ./prog 512 ./prog

                  If you wish for some documentation:

                  -
                      make docs
                  +
                      make docs

                  This will create the file poikola.pdf for your enjoyment.

                  Try:

                  If you don’t have a few days, try:

                  -
                      ./try.sh
                  +
                      ./try.sh

                  As the 2019 poikola bugs says, this program will not validate input so it might get stuck or fail if invoked erroneously.

                  Alternate code:

                  This version prints a newline after each number for parsing in other ways than what can be done with the original entry.

                  Alternate build:

                  -
                      make alt
                  +
                      make alt

                  Alternate use:

                  Use prog.alt as you would prog above.

                  Alternate try:

                  -
                      ./try.alt.sh
                  +
                      ./try.alt.sh

                  Judges’ remarks:

                  Do you have the time to see what this program does? Think again, come back and try again.

                  @@ -191,11 +191,11 @@ accomplishments of Ma Nykänen.

                  Author’s remarks:

                  How to build:

                  -
                      gcc -O0 -o prog prog.c
                  +
                      gcc -O0 -o prog prog.c

                  or

                  -
                      clang -O[0123s] -o prog prog.c
                  +
                      clang -O[0123s] -o prog prog.c

                  e.g.:

                  -
                      clang -O1 -o prog prog.c
                  +
                      clang -O1 -o prog prog.c

                  Poster:

                  You can generate an A3 sized poster by make docs. This command creates a pdf file poikola.pdf. This requires the @@ -231,7 +231,7 @@ three consecutive days.

                  As this is a contest for obfuscated code, the program does not perform unnecessary checks, but either fails or gets stuck if invoked erroneously. The program is invoked in this way:

                  -
                      ./prog <integer> <file>
                  +
                      ./prog <integer> <file>

                  where <integer> is 224, 256, 384, 512 or even 1024. Yes, I know 1024 is not a supported length of output, but as I said, the program does not validate its input in any way. These same parameters should be given in calculating a diff --git a/2019/yang/README.md b/2019/yang/README.md index c15c7d2f0..1176f11d6 100644 --- a/2019/yang/README.md +++ b/2019/yang/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2019 yang bugs](../../bugs.html#2019_yang). ## To use: -```sh +``` ./prog sample_input.txt a b c d cat a @@ -35,7 +35,7 @@ For more detailed information see [2019 yang bugs](../../bugs.html#2019_yang). ## Try: -```sh +``` ./try.sh ``` @@ -52,7 +52,7 @@ output again. Scramble/unscramble to single file: -```sh +``` ./prog original.txt > scrambled.txt ./prog < scrambled.txt > unscrambled.txt @@ -60,7 +60,7 @@ Scramble/unscramble to single file: Scramble/unscramble to multiple files: -```sh +``` ./prog input.txt output1.txt output2.txt ... cat output1.txt output2.txt ... | ./prog > unscrambled.txt @@ -68,7 +68,7 @@ Scramble/unscramble to multiple files: Re-scramble: -```sh +``` ./prog original.txt | ./prog - > scrambled1.txt ./prog original.txt | ./prog - | ./prog - > scrambled2.txt ./prog original.txt | ./prog - | ./prog - | ... > scrambled3.txt @@ -76,7 +76,7 @@ Re-scramble: Scramble slowly: -```sh +``` ./prog input.txt | ruby prog.c ``` @@ -87,14 +87,14 @@ Input must be in UTF-8 encoding. This is a text scrambling utility. To scramble text, specify input file name as the first argument: -```sh +``` ./prog input.txt > output.txt ``` If original input file was small enough to fit in your terminal, you can simply use `cat` to unscramble the output text. -```sh +``` cat output.txt ``` @@ -106,7 +106,7 @@ order. This effect is more visible if there is a delay after each character is printed. For convenience, a utility is included in the source to output characters slowly: -```sh +``` ./prog input.txt | ruby prog.c ``` @@ -114,14 +114,14 @@ Scrambling order is deterministic, but you can reshuffle the output by piping it through the same utility again, by specifying `-` as the first argument: -```sh +``` ./prog input.txt | ./prog - | ./prog - | ... ``` You can also split the input to multiple files, each getting a subset of the original input characters: -```sh +``` ./prog input.txt output1.txt output2.txt ... cat output1.txt output2.txt ... > unscrambled.txt ``` @@ -138,7 +138,7 @@ positions to be misaligned. But fear not, this utility also includes unscrambling functionality. If no argument is specified, input will be read through `stdin` and unscrambled to `stdout`: -```sh +``` ./prog < scrambled.txt > unscrambled.txt ``` @@ -146,7 +146,7 @@ Where this is useful is that if you scramble the input to multiple files and unscramble each output file individually, those output files can be printed on transparencies and distributed separately. -```sh +``` ./prog input.txt output1.txt output2.txt output3.txt ./prog < output1.txt > layer1.txt ./prog < output2.txt > layer2.txt @@ -159,7 +159,7 @@ In other words, this is a utility for facilitating This utility can also be used just for removing trailing whitespaces and expanding tabs to 8 spaces. -```sh +``` ./prog input.txt | ./prog ``` diff --git a/2019/yang/index.html b/2019/yang/index.html index 850161a0e..4fe17d475 100644 --- a/2019/yang/index.html +++ b/2019/yang/index.html @@ -141,52 +141,52 @@ Location: US - United States of America

                  To build:

                  -
                      make
                  +
                      make

                  Bugs and (Mis)features:

                  The current status of this entry is:

                      STATUS: INABIAF - please **DO NOT** fix

                  For more detailed information see 2019 yang bugs.

                  To use:

                  -
                      ./prog sample_input.txt a b c d
                  -
                  -    cat a
                  -
                  -    cat b
                  -
                  -    cat c
                  -
                  -    cat d
                  -
                  -    cat a b c d | ./prog
                  +
                      ./prog sample_input.txt a b c d
                  +
                  +    cat a
                  +
                  +    cat b
                  +
                  +    cat c
                  +
                  +    cat d
                  +
                  +    cat a b c d | ./prog

                  Try:

                  -
                      ./try.sh
                  +
                      ./try.sh

                  Judges’ remarks:

                  Do you understand how this program works? You may have to go over and over the output again.

                  Author’s remarks:

                  Summary:

                  Scramble/unscramble to single file:

                  -
                      ./prog original.txt > scrambled.txt
                  -
                  -    ./prog < scrambled.txt > unscrambled.txt
                  +
                      ./prog original.txt > scrambled.txt
                  +
                  +    ./prog < scrambled.txt > unscrambled.txt

                  Scramble/unscramble to multiple files:

                  -
                      ./prog input.txt output1.txt output2.txt ...
                  -
                  -    cat output1.txt output2.txt ... | ./prog > unscrambled.txt
                  +
                      ./prog input.txt output1.txt output2.txt ...
                  +
                  +    cat output1.txt output2.txt ... | ./prog > unscrambled.txt

                  Re-scramble:

                  -
                      ./prog original.txt | ./prog - > scrambled1.txt
                  -    ./prog original.txt | ./prog - | ./prog - > scrambled2.txt
                  -    ./prog original.txt | ./prog - | ./prog - | ... > scrambled3.txt
                  +
                      ./prog original.txt | ./prog - > scrambled1.txt
                  +    ./prog original.txt | ./prog - | ./prog - > scrambled2.txt
                  +    ./prog original.txt | ./prog - | ./prog - | ... > scrambled3.txt

                  Scramble slowly:

                  -
                      ./prog input.txt | ruby prog.c
                  +
                      ./prog input.txt | ruby prog.c

                  Input must be in UTF-8 encoding.

                  Details:

                  This is a text scrambling utility. To scramble text, specify input file name as the first argument:

                  -
                      ./prog input.txt > output.txt
                  +
                      ./prog input.txt > output.txt

                  If original input file was small enough to fit in your terminal, you can simply use cat to unscramble the output text.

                  -
                      cat output.txt
                  +
                      cat output.txt

                  It might seem like nothing was scrambled, but you can try passing the output through strings(1) and see that most of the original strings are gone. What happened is that the original text has been shuffled with ANSI cursor @@ -194,15 +194,15 @@ positioning codes inserted in such a way that characters are printed in random order. This effect is more visible if there is a delay after each character is printed. For convenience, a utility is included in the source to output characters slowly:

                  -
                      ./prog input.txt | ruby prog.c
                  +
                      ./prog input.txt | ruby prog.c

                  Scrambling order is deterministic, but you can reshuffle the output by piping it through the same utility again, by specifying - as the first argument:

                  -
                      ./prog input.txt | ./prog - | ./prog - | ...
                  +
                      ./prog input.txt | ./prog - | ./prog - | ...

                  You can also split the input to multiple files, each getting a subset of the original input characters:

                  -
                      ./prog input.txt output1.txt output2.txt ...
                  -    cat output1.txt output2.txt ... > unscrambled.txt
                  +
                      ./prog input.txt output1.txt output2.txt ...
                  +    cat output1.txt output2.txt ... > unscrambled.txt

                  You can only unscramble files with cat if the input fits in a single terminal screen. If you don’t know what will be the terminal size of the recipient, note that prog.c will fit in a 80x25 terminal, so a @@ -213,19 +213,19 @@ sufficient for unscrambling because any scrolling causes the character positions to be misaligned. But fear not, this utility also includes unscrambling functionality. If no argument is specified, input will be read through stdin and unscrambled to stdout:

                  -
                      ./prog < scrambled.txt > unscrambled.txt
                  +
                      ./prog < scrambled.txt > unscrambled.txt

                  Where this is useful is that if you scramble the input to multiple files and unscramble each output file individually, those output files can be printed on transparencies and distributed separately.

                  -
                      ./prog input.txt output1.txt output2.txt output3.txt
                  -    ./prog < output1.txt > layer1.txt
                  -    ./prog < output2.txt > layer2.txt
                  -    ./prog < output3.txt > layer3.txt
                  +
                      ./prog input.txt output1.txt output2.txt output3.txt
                  +    ./prog < output1.txt > layer1.txt
                  +    ./prog < output2.txt > layer2.txt
                  +    ./prog < output3.txt > layer3.txt

                  In other words, this is a utility for facilitating visual cryptography.

                  This utility can also be used just for removing trailing whitespaces and expanding tabs to 8 spaces.

                  -
                      ./prog input.txt | ./prog
                  +
                      ./prog input.txt | ./prog

                  Features:

                  UTF-8 support:

                  A simple text scrambling utility might not have required a screenful diff --git a/2020/burton/README.md b/2020/burton/README.md index 94506a2eb..40f183ca0 100644 --- a/2020/burton/README.md +++ b/2020/burton/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,14 +18,14 @@ For more detailed information see [2020 burton bugs](../../bugs.html#2020_burton ## To use: -```sh +``` ./prog arg ... ``` ## Try: -```sh +``` ./try.sh ``` @@ -67,7 +67,7 @@ result? This code may be tested by: -```sh +``` make test ``` @@ -107,19 +107,19 @@ Compiles cleanly under `clang -Wall -Weverything -pedantic`, but you need to add On a little-endian machine: -```sh +``` clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=6945503773712347754LL -DI=5859838231191962459LL -DT=0 -DS=7 -o prog prog.c ``` On a big-endian machine: -```sh +``` clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=7091606191627001958LL -DI=6006468689561538903LL -DT=1 -DS=0 -o prog_be prog.c ``` You might be interested to compile it both ways on the same host, and try: -```sh +``` ./prog 1; ./prog_be 1 ``` diff --git a/2020/burton/index.html b/2020/burton/index.html index 51aab99c4..d2ebbc568 100644 --- a/2020/burton/index.html +++ b/2020/burton/index.html @@ -141,15 +141,15 @@ Location: US - United States of America

                  To build:

                  -
                      make
                  +
                      make

                  Bugs and (Mis)features:

                  The current status of this entry is:

                      STATUS: INABIAF - please **DO NOT** fix

                  For more detailed information see 2020 burton bugs.

                  To use:

                  -
                      ./prog arg ...
                  +
                      ./prog arg ...

                  Try:

                  -
                      ./try.sh
                  +
                      ./try.sh

                  Alternate code:

                  By default, the program works for Little Endian machines. This alternate build is for Big Endian machines (that works whether you have LE or BE).

                  @@ -170,7 +170,7 @@ value that results when the two magic constants are XORed.

                  choosing new constants, but using the same computation generate a reversed result?

                  This code may be tested by:

                  -
                      make test
                  +
                      make test

                  Author’s remarks:

                  Invoke this with a single non-negative integer less than 256, and a useful transformation occurs.

                  @@ -189,11 +189,11 @@ display strange results with more than one argument.

                  Compiles cleanly under clang -Wall -Weverything -pedantic, but you need to add --include stdio.h --include stdlib.h for the printf(3) and atoi(3).

                  On a little-endian machine:

                  -
                      clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=6945503773712347754LL -DI=5859838231191962459LL -DT=0 -DS=7 -o prog prog.c
                  +
                      clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=6945503773712347754LL -DI=5859838231191962459LL -DT=0 -DS=7 -o prog prog.c

                  On a big-endian machine:

                  -
                      clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=7091606191627001958LL -DI=6006468689561538903LL -DT=1 -DS=0 -o prog_be prog.c
                  +
                      clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=7091606191627001958LL -DI=6006468689561538903LL -DT=1 -DS=0 -o prog_be prog.c

                  You might be interested to compile it both ways on the same host, and try:

                  -
                      ./prog 1; ./prog_be 1
                  +
                      ./prog 1; ./prog_be 1
                  make ``` @@ -18,20 +18,20 @@ For more detailed information see [2020 carlini bugs](../../bugs.html#2020_carli ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./try.sh ``` Or if you actually want to play: -```sh +``` # Play with a friend, real or imagined, P1 and P2, squares are numbered 1..9 ./prog ``` @@ -51,7 +51,7 @@ HOW ABOUT A NICE GAME OF CHESSTIC-TAC-TOE? ### USAGE -```sh +``` cc -o prog prog.c ./prog ``` @@ -92,7 +92,7 @@ compilers unhappy, and others slow. (For example, passing GCC the flags `-Wall Under some terminals the program may exit early. The following should always work: -```sh +``` echo "1 2 3 4 5 6 7" | ./prog ``` @@ -100,7 +100,7 @@ Under some terminals the program may exit early. The following should always wor The entirety of the program consists of a single iterated call to `printf(3)`. -```c +``` int main() { while(*d) printf(fmt, arg); } @@ -144,13 +144,13 @@ Format specifiers can take extra "arguments". For example, the following expression -```c +``` printf("%1$.*2$d%3$hhn", 5, 10, &x) ``` will have the same effect as if we had written -```c +``` x = 10; ``` @@ -174,37 +174,37 @@ We can use format strings to compute the OR/NOT of arbitrary "bits". We'll start with the simplest, OR: -```c +``` printf("%1$s%2$s%3$hhn", a, b, c) ``` will compute -```c +``` *c = strlen(a) + strlen(b) ``` but given that `strlen(x)` is `1` for a 1-bit and `0` for a 0-bit, we have -```c +``` *c = a | b ``` Computing the NOT of a single value is also easy: -```c +``` printf("%1$255d%1$s%hhn", a, b) ``` will compute -```c +``` *b = (strlen(a)+255)%256 = strlen(a)-1 ``` and again, because `strlen(x)` is either `1` or `0` we have -```c +``` *c = !b ``` @@ -221,7 +221,7 @@ To detect who has won, we implement the following logic. Let `A`, `B`, and `C` b pointers to three squares in a row to test, and `D` be where to save if there is a win or not. -```c +``` "%A$s%B$s%C$s%1$253d%11$hhn" // r11 = !(*A & *B & *C) ZERO "%11$s%1$255d%11hhn" // r11 = !r11 @@ -235,7 +235,7 @@ possible three-in-a-row configurations, for both players. The ZERO macro ensures that the number of bytes written out is 0 mod 256 with the following expression -```c +``` "%1$hhn%1$s" (repeated 256 times) ``` @@ -254,13 +254,13 @@ bits to Xs and Os to print out. This is actually rather straightforward. Given in `1$` the pointer to player 1's square, and `2$` the pointer to player 2's, and in `3$` the pointer to the board string, we can compute -```c +``` "%1$s" (repeated 47 times) "%2$s" (repeated 56 times) %1$32d%3$hhn" ``` which will, in effect, compute -```c +``` *r3 = (*r1) * 47 + (*r2) * 56 + 32 ``` @@ -273,7 +273,7 @@ which will output `' '` if neither are true, `'X'` if `r1` is true, or `'O'` if In order to be able to finally display the board, while still only using one `printf(3)` statement, we finish the statement with -```c +``` "\n\033[2J\n%26$s" ``` @@ -299,7 +299,7 @@ won, or the game is over and it is a draw. This turns out not to be as hard as it might look. Using the same trick as before, we set byte four to be -```c +``` *byte4 = is_win * 'W' + is_tie * 'T' ``` @@ -313,7 +313,7 @@ ends. It should just exit. One option would be to implement the logic as -```c +``` printf() while (*ok) { scanf(); @@ -324,7 +324,7 @@ One option would be to implement the logic as but this would DOUBLE the number of calls to `printf(3)` we require. So instead we implement it like this -```c +``` while (*ok) { scanf(); printf(); diff --git a/2020/carlini/index.html b/2020/carlini/index.html index 295bddb6a..5141805a0 100644 --- a/2020/carlini/index.html +++ b/2020/carlini/index.html @@ -141,18 +141,18 @@ Location: US - United States of America

                  To build:

                  -
                      make
                  +
                      make

                  Bugs and (Mis)features:

                  The current status of this entry is:

                      STATUS: INABIAF - please **DO NOT** fix

                  For more detailed information see 2020 carlini bugs.

                  To use:

                  -
                      ./prog
                  +
                      ./prog

                  Try:

                  -
                      ./try.sh
                  +
                      ./try.sh

                  Or if you actually want to play:

                  -
                      # Play with a friend, real or imagined, P1 and P2, squares are numbered 1..9
                  -    ./prog
                  +
                      # Play with a friend, real or imagined, P1 and P2, squares are numbered 1..9
                  +    ./prog

                  Judges’ remarks:

                  This program consists of a single printf(3) statement wrapped in a while loop. You would not think that this would amount to much, but you would be very, @@ -161,8 +161,8 @@ ASCII art of the program source.

                  Author’s remarks:

                  HOW ABOUT A NICE GAME OF CHESSTIC-TAC-TOE?

                  USAGE

                  -
                      cc -o prog prog.c
                  -    ./prog
                  +
                      cc -o prog prog.c
                  +    ./prog

                  Alternates between P1 and P2. Enter a digit [1-9] to move:

                      1 | 2 | 3
                       ---------
                  @@ -187,12 +187,12 @@ patient.

                  After macro expansion the format string is roughly 100K. This makes some compilers unhappy, and others slow. (For example, passing GCC the flags -Wall -Wextra -pedantic will result in a warning about oversized strings.)

                  Under some terminals the program may exit early. The following should always work:

                  -
                      echo "1 2 3 4 5 6 7" | ./prog
                  +
                      echo "1 2 3 4 5 6 7" | ./prog

                  OBFUSCATION

                  The entirety of the program consists of a single iterated call to printf(3).

                  -
                      int main() {
                  -        while(*d) printf(fmt, arg);
                  -    }
                  +
                      int main() {
                  +        while(*d) printf(fmt, arg);
                  +    }

                  Here, fmt is a single string, and arg is a series of arguments to printf(3).

                  While its primary purpose is to serve as The One True Debugger, printf(3) also happens @@ -218,9 +218,9 @@ this one printf(3) call (and a call to scanf(3) to rea

                • "%3$.*4$d": print argument 3 to printf(3) with as many zeros as in argument 4.

                For example, the following expression

                -
                    printf("%1$.*2$d%3$hhn", 5, 10, &x)
                +
                    printf("%1$.*2$d%3$hhn", 5, 10, &x)

                will have the same effect as if we had written

                -
                    x = 10;
                +
                    x = 10;

                because it will print out 0000000005 (5 padded to size 10) and then write the number of bytes written to x.

                printf(3) Oriented Programming

                @@ -233,17 +233,17 @@ array–one bit per pair of bytes:

              We can use format strings to compute the OR/NOT of arbitrary “bits”.

              We’ll start with the simplest, OR:

              -
                  printf("%1$s%2$s%3$hhn", a, b, c)
              +
                  printf("%1$s%2$s%3$hhn", a, b, c)

              will compute

              -
                  *c = strlen(a) + strlen(b)
              +
                  *c = strlen(a) + strlen(b)

              but given that strlen(x) is 1 for a 1-bit and 0 for a 0-bit, we have

              -
                  *c = a | b
              +
                  *c = a | b

              Computing the NOT of a single value is also easy:

              -
                  printf("%1$255d%1$s%hhn", a, b)
              +
                  printf("%1$255d%1$s%hhn", a, b)

              will compute

              -
                  *b = (strlen(a)+255)%256 = strlen(a)-1
              +
                  *b = (strlen(a)+255)%256 = strlen(a)-1

              and again, because strlen(x) is either 1 or 0 we have

              -
                  *c = !b
              +
                  *c = !b

              From here we can compute any binary circuit. Doing something efficient, though, still takes work.

              Tic-Tac-Toe

              @@ -252,16 +252,16 @@ with a turn counter that alternates between player 1 and player 2.

              To detect who has won, we implement the following logic. Let A, B, and C be pointers to three squares in a row to test, and D be where to save if there is a win or not.

              -
                  "%A$s%B$s%C$s%1$253d%11$hhn" // r11 = !(*A & *B & *C)
              -    ZERO
              -    "%11$s%1$255d%11hhn" // r11 = !r11
              -    ZERO
              -    "%11$s%D$s%D$hhn" // *D = *D | r11
              +
                  "%A$s%B$s%C$s%1$253d%11$hhn" // r11 = !(*A & *B & *C)
              +    ZERO
              +    "%11$s%1$255d%11hhn" // r11 = !r11
              +    ZERO
              +    "%11$s%D$s%D$hhn" // *D = *D | r11

              That is, we set *D to 1 if there is a three-in-a-row. We repeat this for all possible three-in-a-row configurations, for both players.

              The ZERO macro ensures that the number of bytes written out is 0 mod 256 with the following expression

              -
                  "%1$hhn%1$s" (repeated 256 times)
              +
                  "%1$hhn%1$s" (repeated 256 times)

              where argument 1 is a pointer to a temporary variable followed by a NUL byte.

              This works because if the current count is 0 mod 256, then "%1$hhn" will write zero to argument 1 and then "%1$s" will never emit any text. If, on the other @@ -273,15 +273,15 @@ times we’re eventually going to reach 0 mod 256.

              bits to Xs and Os to print out. This is actually rather straightforward. Given in 1$ the pointer to player 1’s square, and 2$ the pointer to player 2’s, and in 3$ the pointer to the board string, we can compute

              -
                  "%1$s" (repeated 47 times) "%2$s" (repeated 56 times) %1$32d%3$hhn"
              +
                  "%1$s" (repeated 47 times) "%2$s" (repeated 56 times) %1$32d%3$hhn"

              which will, in effect, compute

              -
                  *r3 = (*r1) * 47 + (*r2) * 56 + 32
              +
                  *r3 = (*r1) * 47 + (*r2) * 56 + 32

              which will output ' ' if neither are true, 'X' if r1 is true, or 'O' if r2 is true.

              Further Obfuscations

              In order to be able to finally display the board, while still only using one printf(3) statement, we finish the statement with

              -
                  "\n\033[2J\n%26$s"
              +
                  "\n\033[2J\n%26$s"

              which is the escape sequence to clear the screen, and then prints argument 26. Argument 26 is a pointer to a char* in memory, that initially is undefined, but within the printf(3) statement we will construct this string to look like a @@ -297,7 +297,7 @@ tic-tac-toe board.

              won, or the game is over and it is a draw.

              This turns out not to be as hard as it might look. Using the same trick as before, we set byte four to be

              -
                  *byte4 = is_win * 'W' + is_tie * 'T'
              +
                  *byte4 = is_win * 'W' + is_tie * 'T'

              The byte 'I' and 'S' can always be the same, and we do the same for 'E'/'N'.

              We do this same on-the-fly creation of the scanf(3) format string, but for a different reason. We first want to run printf(3) to show the first board, and @@ -305,17 +305,17 @@ then alternate between runs to scanf(3) and printf(3) displaying moves. Importantly, we do not want a final scanf(3) when the game ends. It should just exit.

              One option would be to implement the logic as

              -
                  printf()
              -    while (*ok) {
              -        scanf();
              -        printf();
              -}
              +
                  printf()
              +    while (*ok) {
              +        scanf();
              +        printf();
              +}

              but this would DOUBLE the number of calls to printf(3) we require. So instead we implement it like this

              -
                  while (*ok) {
              -        scanf();
              -        printf();
              -    }
              +
                  while (*ok) {
              +        scanf();
              +        printf();
              +    }

              (In reality we actually pass scanf(3) as an argument to avoid the extra statement, but it has the same effect.)

              Notice there is now no initial printf(3). In order make sure the program doesn’t diff --git a/2020/endoh1/README.md b/2020/endoh1/README.md index 135b8ca01..bebe74089 100644 --- a/2020/endoh1/README.md +++ b/2020/endoh1/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,7 +10,7 @@ code](#alternate-code) below. ## To use: -```sh +``` # IMPORTANT for macOS: run under Terminal.app ./prog @@ -19,7 +19,7 @@ code](#alternate-code) below. ## Try: -```sh +``` # IMPORTANT for macOS: run under Terminal.app # Try resizing the terminal window before the first click. @@ -41,7 +41,7 @@ Author's remarks for more details. ### Alternate build: -```sh +``` make alt ``` @@ -94,7 +94,7 @@ All you have to do is (0). You can test if you are lucky or not. It uses ncurses: -```sh +``` gcc -o prog prog.c -lncurses ./prog ``` @@ -200,7 +200,7 @@ Analyze the code. You can also play with a prepared map. -```sh +``` ./prog ioccc.txt ``` diff --git a/2020/endoh1/index.html b/2020/endoh1/index.html index 02fd1a903..bf1b2a7fc 100644 --- a/2020/endoh1/index.html +++ b/2020/endoh1/index.html @@ -141,29 +141,29 @@ Location: JP - Japan

              To build:

              -
                  make
              +
                  make

              There is an alternate version provided by the author. See Alternate code below.

              To use:

              -
                  # IMPORTANT for macOS: run under Terminal.app
              -
              -    ./prog
              +
                  # IMPORTANT for macOS: run under Terminal.app
              +
              +    ./prog

              Try:

              -
                  # IMPORTANT for macOS: run under Terminal.app
              -
              -    # Try resizing the terminal window before the first click.
              -
              -    # Try resizing the terminal window after the first click.
              -
              -    ./prog ioccc.txt
              -
              -    ./prog unwinnable.txt
              +
                  # IMPORTANT for macOS: run under Terminal.app
              +
              +    # Try resizing the terminal window before the first click.
              +
              +    # Try resizing the terminal window after the first click.
              +
              +    ./prog ioccc.txt
              +
              +    ./prog unwinnable.txt

              Alternate code:

              An alternate version of this entry, prog.alt.c, is provided. This alternate code lacks the additional rule to flag all unprobed cells. See the Author’s remarks for more details.

              Alternate build:

              -
                  make alt
              +
                  make alt

              Alternate use:

              Use prog.alt as you would prog above.

              Judges’ remarks:

              @@ -194,8 +194,8 @@ such a boring task!

              All you have to do is (0). You can test if you are lucky or not.

              How to use:

              It uses ncurses:

              -
                  gcc -o prog prog.c -lncurses
              -    ./prog
              +
                  gcc -o prog prog.c -lncurses
              +    ./prog

              You will see a terminal-wide field of a minesweeper. Probe a cell by mouse click.

              If a cell turns out to have a mine (or not), the program determines whether its @@ -255,7 +255,7 @@ are flagged.

              Analyze the code.

              One more thing

              You can also play with a prepared map.

              -
                  ./prog ioccc.txt
              +
                  ./prog ioccc.txt

              The format of the text is:

                  width height number-of-mines priorities-of-each-cell...

              There are mines in a cell whose “priorities-of-each-cell” is less than diff --git a/2020/endoh2/README.md b/2020/endoh2/README.md index b0bfbb89a..c8beae056 100644 --- a/2020/endoh2/README.md +++ b/2020/endoh2/README.md @@ -1,26 +1,26 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./try.sh ``` What happens if you do -```sh +``` ./prog prog.c ``` @@ -41,7 +41,7 @@ render for a larger terminal window? How about adding more glyphs? No! Try not. Do, or do not. There is no try. -```sh +``` cc -std=c99 prog.c ./a.out ./a.out hello.txt diff --git a/2020/endoh2/index.html b/2020/endoh2/index.html index 3aadb66d5..684440dd6 100644 --- a/2020/endoh2/index.html +++ b/2020/endoh2/index.html @@ -141,13 +141,13 @@ Location: JP - Japan

              To build:

              -
                  make
              +
                  make

              To use:

              -
                  ./prog
              +
                  ./prog

              Try:

              -
                  ./try.sh
              +
                  ./try.sh

              What happens if you do

              -
                  ./prog prog.c
              +
                  ./prog prog.c

              ?

              Judges’ remarks:

              Clever use of the C99 complex data type. The spoiler directory @@ -157,11 +157,11 @@ shapes.

              render for a larger terminal window? How about adding more glyphs?

              Author’s remarks:

              No! Try not. Do, or do not. There is no try.

              -
                  cc -std=c99 prog.c
              -    ./a.out
              -    ./a.out hello.txt
              -    ./a.out yoda.txt
              -    ./a.out bear.txt
              +
                  cc -std=c99 prog.c
              +    ./a.out
              +    ./a.out hello.txt
              +    ./a.out yoda.txt
              +    ./a.out bear.txt

              See spoiler.zip for the source code. The 16th most common password on the Internet in 2017 (according to Splash Data) the password is.

              make ``` @@ -10,14 +10,14 @@ code](#alternate-code) below. ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./run_clock # And watch closely for 15-20 seconds ``` @@ -31,7 +31,7 @@ alternate code uses Unicode letters. ### Alternate build: -```sh +``` make alt ``` @@ -43,7 +43,7 @@ Use `prog.alt` as you would `prog` above. ### Alternate try: -```sh +``` ./run_clock.alt # And watch closely for 15-20 seconds ``` @@ -63,7 +63,7 @@ time might depend on what time it is. Prepare a mirror! -```sh +``` make clock ``` diff --git a/2020/endoh3/index.html b/2020/endoh3/index.html index 17fd15fc0..da75a8fe7 100644 --- a/2020/endoh3/index.html +++ b/2020/endoh3/index.html @@ -141,24 +141,24 @@ Location: JP - Japan

              To build:

              -
                  make
              +
                  make

              An alternate version of this program exists. See Alternate code below.

              To use:

              -
                  ./prog
              +
                  ./prog

              Try:

              -
                  ./run_clock
              -    # And watch closely for 15-20 seconds
              +
                  ./run_clock
              +    # And watch closely for 15-20 seconds

              Alternate code:

              An alternate version of this entry, prog.alt.c, is provided. This alternate code uses Unicode letters.

              Alternate build:

              -
                  make alt
              +
                  make alt

              Alternate use:

              Use prog.alt as you would prog above.

              Alternate try:

              -
                  ./run_clock.alt
              -    # And watch closely for 15-20 seconds
              +
                  ./run_clock.alt
              +    # And watch closely for 15-20 seconds

              Judges’ remarks:

              You may be tempted to use a mirror. Resist the temptation! Try figuring out how the clock hands are drawn. Can you change the program to make it draw a @@ -167,7 +167,7 @@ familiar (non-mirrored) clock face? Can you add the second hand?

              time might depend on what time it is.

              Author’s remarks:

              Prepare a mirror!

              -
                  make clock
              +
                  make clock

              Note: You need to recompile it each run.

              sudo xcode-select --install ``` @@ -53,13 +53,13 @@ you want to use the Makefile) to compile and link this entry. With Fedora more recent versions there's the `dnf` package manager but I cannot help with any of the GUI installers since I don't use them. Something like: -```sh +``` sudo dnf install ncurses-devel ncurses make gcc ``` or -```sh +``` # dnf install ncurses-devel ncurses make gcc ``` @@ -69,25 +69,25 @@ Just like Fedora you will need `gcc`, `ncurses`, `ncurses-devel` (and if you want to use the Makefile `make`). CentOS uses `yum` and CentOS 8 uses `dnf`. So: -```sh +``` sudo yum install ncurses-devel ncurses make gcc ``` or -```sh +``` # yum install ncurses-devel ncurses make gcc ``` or -```sh +``` sudo dnf install ncurses-devel ncurses make gcc ``` or -```sh +``` # dnf install ncurses-devel ncurses make gcc ``` diff --git a/2020/ferguson1/HACKING.html b/2020/ferguson1/HACKING.html index 6e996a51b..e1617d5b7 100644 --- a/2020/ferguson1/HACKING.html +++ b/2020/ferguson1/HACKING.html @@ -192,19 +192,19 @@ defaults if you don’t want to change the colour.

              initialise a pair (make it 5 so as to not interfere with the script customisability) and then you use the bkgd() function with the colour pair. Something like this:

              -
                  init_pair(5, COLOR_BLACK, COLOR_WHITE);
              -    bkgd(COLOR_PAIR(5));
              +
                  init_pair(5, COLOR_BLACK, COLOR_WHITE);
              +    bkgd(COLOR_PAIR(5));

              I played with this after winning and I came across some problems with colours but that changes the background of the program anyway.

              The standard colour identifiers are:

              -
                  COLOR_BLACK
              -    COLOR_RED
              -    COLOR_GREEN
              -    COLOR_YELLOW
              -    COLOR_BLUE
              -    COLOR_MAGENTA
              -    COLOR_CYAN
              -    COLOR_WHITE
              +
                  COLOR_BLACK
              +    COLOR_RED
              +    COLOR_GREEN
              +    COLOR_YELLOW
              +    COLOR_BLUE
              +    COLOR_MAGENTA
              +    COLOR_CYAN
              +    COLOR_WHITE

              See Linux Journal for more information article https://www.linuxjournal.com/content/programming-color-ncurses for more details.

              @@ -220,16 +220,16 @@ source code (include the single quotes!) respectively:

              Let’s say you don’t want to use arrow keys or you don’t have arrow keys. Instead you might want the keys l, r, u and d for the directions. Find the case statements:

              -
                  case KEY_LEFT:
              -    case KEY_RIGHT:
              -    case KEY_UP:
              -    case KEY_DOWN:
              +
                  case KEY_LEFT:
              +    case KEY_RIGHT:
              +    case KEY_UP:
              +    case KEY_DOWN:

              Replace KEY_LEFT with:

              -
                  'l'
              +
                  'l'

              and do the same thing for the other directions too. If you want more than one key e.g. the arrow keys and the letters just add another case statement e.g. for left it might be:

              -
                  case KEY_LEFT: case 'l':
              +
                  case KEY_LEFT: case 'l':

              Yes the single quotes matter. You can do similar for the other input keys. Please note that modifier keys like ctrl aren’t detectable or at least I’m unaware of how to do so.

              @@ -245,9 +245,9 @@ end of the game; I leave that as an exercise to the reader to implement two different sets. Please also be aware that if you don’t want any information you must set it to the below at the very least; defining it without a value is not enough (it amounts to the parameters to a printf call):

              -
                  #define J " " );
              +
                  #define J " " );

              If you don’t care about brief displays of ‘o’ at 0,0 you can just have:

              -
                  #define J "");
              +
                  #define J "");

              That’s the bare minimum. Notice also that it’s been a long while since I’ve tested this part but I think this is right.

              Anyway as I said the score line has basic statistics that’s relatively easy to @@ -262,7 +262,7 @@ bug. This however was something I didn’t quite like: I like having the coordinates of where the snake is plus the other things that are there (a number of which were added over time). Obviously this would take many bug sized bytes (bites) even once let alone twice! Thus I made it into a define:

              -
                  #define J Z(X:%d/%d Y:%d/%d S:%zu/%zu B:%zu\n), Y, y[-2], X,*y,A,g, c);
              +
                  #define J Z(X:%d/%d Y:%d/%d S:%zu/%zu B:%zu\n), Y, y[-2], X,*y,A,g, c);

              With the table below you can show a variety of other variables/statistics.

              There’s another reason for changing this line though: depending on the terminal width the line could cover the top wall; this can even happen only part of the @@ -280,7 +280,7 @@ so if this line wasn’t there it would require changes to make it work right.For an example this would only include the size of the snake and the number of bugs eaten (I think I have this correct; I’ve made many changes to the point of not wanting to mess with anything that’s unnecessary):

              -
                  #define J Z(SIZE: %zu BUGS: %zu\n), A, c);
              +
                  #define J Z(SIZE: %zu BUGS: %zu\n), A, c);

              More generally the following expressions and data types (with format specifiers) come to mind as information that might be of interest.

                  DESCRIPTION             EXPRESSION          TYPE    FORMAT SPECIFIER
              @@ -307,10 +307,10 @@ come to mind as information that might be of interest.

              bug)

              Make it so the snake starts at a random location

              Quite simply change:

              -
                  X = H / 2; Y = *x / 2;
              +
                  X = H / 2; Y = *x / 2;

              To be something like:

              -
                  X = R(1,H-1);
              -    Y = R(2,*x-1);
              +
                  X = R(1,H-1);
              +    Y = R(2,*x-1);

              Or whatever you might want it to be… (question to answer: will this work at all? You decide!)

              Additions (+)

              @@ -407,22 +407,22 @@ their ruddy phone instead of where they’re walking (even when crossing a busy street!).

              If you look at the walls code you will see a ternary operator for both X and Y coordinates. This of course is very different now but the idea remains the same:

              -
                  if (p && !(*O>=O[1]||H>=M(1)))
              -    {
              -        if (X<1||X>=H)
              -            X = X<1?H-1:1;
              -        if (Y<2||Y>=*O)
              -            Y = Y<2?*O-1:2;
              -    }
              +
                  if (p && !(*O>=O[1]||H>=M(1)))
              +    {
              +        if (X<1||X>=H)
              +            X = X<1?H-1:1;
              +        if (Y<2||Y>=*O)
              +            Y = Y<2?*O-1:2;
              +    }

              You can ignore the first if if you like; I’m not going to explain that part. The inner if statements however are testing if the new snake coordinates are beyond the walls (off screen). Depending on where the snake is it will set the coordinates to the correct new location.

              If however you wanted the walls to act as a barrier you could do something like this instead (omitting the inner if statements here):

              -
                  X=X<1?1:*H-1;
              -
              -    Y=Y<2?2:*O-1;
              +
                  X=X<1?1:*H-1;
              +
              +    Y=Y<2?2:*O-1;

              Again though that’s just the idea; the code is dramatically different. The above incidentally is not even complete.

              You could also have it so depending on the WALLS value have it go through diff --git a/2020/ferguson1/HACKING.md b/2020/ferguson1/HACKING.md index 5c8bce9e7..f679f646b 100644 --- a/2020/ferguson1/HACKING.md +++ b/2020/ferguson1/HACKING.md @@ -78,7 +78,7 @@ initialise a pair (make it 5 so as to not interfere with the script customisability) and then you use the bkgd() function with the colour pair. Something like this: -```c +``` init_pair(5, COLOR_BLACK, COLOR_WHITE); bkgd(COLOR_PAIR(5)); ``` @@ -88,7 +88,7 @@ but that changes the background of the program anyway. The standard colour identifiers are: -```c +``` COLOR_BLACK COLOR_RED COLOR_GREEN @@ -124,7 +124,7 @@ Let's say you don't want to use arrow keys or you don't have arrow keys. Instead you might want the keys `l`, `r`, `u` and `d` for the directions. Find the case statements: -```c +``` case KEY_LEFT: case KEY_RIGHT: case KEY_UP: @@ -133,7 +133,7 @@ statements: Replace `KEY_LEFT` with: -```c +``` 'l' ``` @@ -141,7 +141,7 @@ and do the same thing for the other directions too. If you want more than one key e.g. the arrow keys and the letters just add another case statement e.g. for left it might be: -```c +``` case KEY_LEFT: case 'l': ``` @@ -166,13 +166,13 @@ different sets. Please also be aware that if you don't want any information you must set it to the below at the very least; defining it without a value is not enough (it amounts to the parameters to a printf call): -```c +``` #define J " " ); ``` If you don't care about brief displays of 'o' at 0,0 you can just have: -```c +``` #define J ""); ``` @@ -194,7 +194,7 @@ coordinates of where the snake is plus the other things that are there (a number of which were added over time). Obviously this would take many bug sized bytes (bites) even once let alone twice! Thus I made it into a define: -```c +``` #define J Z(X:%d/%d Y:%d/%d S:%zu/%zu B:%zu\n), Y, y[-2], X,*y,A,g, c); ``` @@ -220,7 +220,7 @@ For an example this would only include the size of the snake and the number of bugs eaten (I think I have this correct; I've made many changes to the point of not wanting to mess with anything that's unnecessary): -```c +``` #define J Z(SIZE: %zu BUGS: %zu\n), A, c); ``` @@ -257,13 +257,13 @@ come to mind as information that might be of interest. Quite simply change: -```c +``` X = H / 2; Y = *x / 2; ``` To be something like: -```c +``` X = R(1,H-1); Y = R(2,*x-1); ``` @@ -395,7 +395,7 @@ street!). If you look at the walls code you will see a ternary operator for both `X` and `Y` coordinates. This of course is very different now but the idea remains the same: -```c +``` if (p && !(*O>=O[1]||H>=M(1))) { if (X<1||X>=H) @@ -414,7 +414,7 @@ coordinates to the correct new location. If however you wanted the walls to act as a barrier you could do something like this instead (omitting the inner if statements here): -```c +``` X=X<1?1:*H-1; Y=Y<2?2:*O-1; diff --git a/2020/ferguson1/README.md b/2020/ferguson1/README.md index 40e97670a..aaa7d1f22 100644 --- a/2020/ferguson1/README.md +++ b/2020/ferguson1/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2020 ferguson1 bugs](../../bugs.html#2020_fer ## To use: -```sh +``` WAIT=N WALLS=[01] EVADE=N SIZE=N MAXSIZE=N GROW=N SHEDS=N SHED=N CANNIBAL=[01] ./prog # start pressing some arrow keys ``` @@ -87,7 +87,7 @@ and non-zero). ## Try: -```sh +``` make test WAIT=75 WALLS=1 CANNIBAL=1 ./prog @@ -211,7 +211,7 @@ features. Because all IOCCC entries should have a man page I have included one (even though much of it is what's also above). To render try: -```sh +``` man ./snake.1 ``` diff --git a/2020/ferguson1/bugs.html b/2020/ferguson1/bugs.html index 808ec0547..0ff4ed91e 100644 --- a/2020/ferguson1/bugs.html +++ b/2020/ferguson1/bugs.html @@ -141,7 +141,7 @@ like some of the other features this was not intentionally designed but is simply a fun consequence of the features I did implement.

              Let’s say you want to verify that the evade mode is at the right count. How can you verify it without modifying the code? Try:

              -
                  SIZE=0 SHED=1 SHEDS=1 EVADE=10 ./prog
              +
                  SIZE=0 SHED=1 SHEDS=1 EVADE=10 ./prog

              Since you start out at size 0 and you shed every movement then when you’re size 10 (as long as you don’t eat a bug of course!) the bug should evade.

              If you set it to SIZE=10 there would be a difference of 10. Now every @@ -154,7 +154,7 @@ don’t at this time remember any I might have done.

              The snake doesn’t seem to be moving

              One way to show this is in full is to set the initial size and growth size to a high value; then try each one individually. For example:

              -
                  SIZE=100 ./prog
              +
                  SIZE=100 ./prog

              In this case after you make the first move the snake will keep growing and so the snake tail stays in the same spot until after it’s the ‘full size’. When it has reached the full size then the entire body of the snake will @@ -201,24 +201,24 @@ way negative size will force a win.

              Here’s a fun output:

                  < <<<+

              That’s from:

              -
                  SHED=1 SHEDS=-1 ./prog
              +
                  SHED=1 SHEDS=-1 ./prog

              And right after that you would see:

                  YOU WIN!
                   X:72/156 Y:20/41 S:997/997 B:0

              Try this though:

              -
                  SHEDS=-1 SHED=25 ./prog
              +
                  SHEDS=-1 SHED=25 ./prog

              And you’ll see that you start to be the normal size but then you leave your head several places until you end up getting to the max size (by way of it being unsigned). This isn’t a bug even if it might seem like one. In fact this is the basis of the grow/shrink mode of play that I talk about in the gameplay.html (gameplay.md on GitHub) file.

              Here’s another thing to be aware of. Let’s say you do:

              -
                  SIZE=1 GROW=-1 ./prog
              +
                  SIZE=1 GROW=-1 ./prog

              How many bugs will it take before you win? In fact it’s two: you would see the head twice: the second time once you ‘shrink’ down to size 0; it would then be that if you get another bug you will be at the ‘max size’:

              -
                  YOU WIN!
              -    X:81/156 Y:35/41 S:997/997 B:2
              +
                  YOU WIN!
              +    X:81/156 Y:35/41 S:997/997 B:2

              ‘I was a few places behind my tail and I ran into it!’

              I.e. what happens if you’re growing - for example after just eating a bug - and you’re racing towards your tail? If you’re behind it should be fine since you’re @@ -271,23 +271,23 @@ how it’s done in Snake and works well). The minimum terminal size I require in the game is 10 x 10. This includes the walls and score line.

              Now the default max snake size is 997 but when the terminal is too small it adjusts the max snake size. For 10 lines and 10 columns you would see:

              -
                  $ make test
              -    terminal supports cursor movement
              -    terminal supports making cursor invisible
              -    terminal supports bold
              -    terminal supports colours
              -
              -    terminal rows  10 (7   playable)
              -    terminal cols  10 (8   playable)
              -
              -    snake size:    49 (max size: 49)
              -          bugs:     9 (max size: 9)
              -
              -    at least 28 columns recommended for snake size 49    (is 10)
              -    at least 28 columns recommended for snake size 49    (is 10)
              -
              -    1 problem detected (0 fatal).
              -    make: *** [test] Error 1
              +
                  $ make test
              +    terminal supports cursor movement
              +    terminal supports making cursor invisible
              +    terminal supports bold
              +    terminal supports colours
              +
              +    terminal rows  10 (7   playable)
              +    terminal cols  10 (8   playable)
              +
              +    snake size:    49 (max size: 49)
              +          bugs:     9 (max size: 9)
              +
              +    at least 28 columns recommended for snake size 49    (is 10)
              +    at least 28 columns recommended for snake size 49    (is 10)
              +
              +    1 problem detected (0 fatal).
              +    make: *** [test] Error 1

              First: what’s the problem? It’s just a warning that for the snake size of 49 the recommended size of columns is 28. However this is just for the score text; with only 10 columns it will overflow and wrap to the next line(s). But if you observe diff --git a/2020/ferguson1/bugs.md b/2020/ferguson1/bugs.md index 80adc6ed9..b5596128a 100644 --- a/2020/ferguson1/bugs.md +++ b/2020/ferguson1/bugs.md @@ -22,7 +22,7 @@ simply a fun consequence of the features I did implement. Let's say you want to verify that the evade mode is at the right count. How can you verify it without modifying the code? Try: -```sh +``` SIZE=0 SHED=1 SHEDS=1 EVADE=10 ./prog ``` @@ -44,7 +44,7 @@ don't at this time remember any I might have done. One way to show this is in full is to set the initial size and growth size to a high value; then try each one individually. For example: -```sh +``` SIZE=100 ./prog ``` @@ -113,7 +113,7 @@ Here's a fun output: That's from: -```sh +``` SHED=1 SHEDS=-1 ./prog ``` @@ -126,7 +126,7 @@ And right after that you would see: Try this though: -```sh +``` SHEDS=-1 SHED=25 ./prog ``` @@ -138,7 +138,7 @@ this is the basis of the grow/shrink mode of play that I talk about in the Here's another thing to be aware of. Let's say you do: -```sh +``` SIZE=1 GROW=-1 ./prog ``` @@ -146,7 +146,7 @@ How many bugs will it take before you win? In fact it's two: you would see the head twice: the second time once you 'shrink' down to size 0; it would then be that if you get another bug you will be at the 'max size': -```sh +``` YOU WIN! X:81/156 Y:35/41 S:997/997 B:2 ``` @@ -228,7 +228,7 @@ the game is 10 x 10. This includes the walls and score line. Now the default max snake size is 997 but when the terminal is too small it adjusts the max snake size. For 10 lines and 10 columns you would see: -```sh +``` $ make test terminal supports cursor movement terminal supports making cursor invisible diff --git a/2020/ferguson1/cannibalism.log.html b/2020/ferguson1/cannibalism.log.html index efccfdc64..23c823e46 100644 --- a/2020/ferguson1/cannibalism.log.html +++ b/2020/ferguson1/cannibalism.log.html @@ -274,7 +274,7 @@ most of them.

              Example 5: snake moving left with snake inside itsself

              Another example invocation where the snake head is in the snake and where the snake hadn’t yet moved (that is it was still growing):

              -
                  CANNIBAL=1 SIZE=1500 GROW=2 MAXSIZE=1600 ./prog
              +
                  CANNIBAL=1 SIZE=1500 GROW=2 MAXSIZE=1600 ./prog

              It looked like:

                  X:55/89 Y:11/25 S:1564/1600 B:32
                   ##########################################################################################
              diff --git a/2020/ferguson1/cannibalism.log.md b/2020/ferguson1/cannibalism.log.md
              index 172ec0b13..0e4f84aa2 100644
              --- a/2020/ferguson1/cannibalism.log.md
              +++ b/2020/ferguson1/cannibalism.log.md
              @@ -184,7 +184,7 @@ most of them.
               Another example invocation where the snake head is in the snake and where the snake
               hadn't yet moved (that is it was still growing):
               
              -```sh
              +```
                   CANNIBAL=1 SIZE=1500 GROW=2 MAXSIZE=1600 ./prog
               ```
               
              diff --git a/2020/ferguson1/crazy.log.html b/2020/ferguson1/crazy.log.html
              index ba8f351b4..ed1b5da5a 100644
              --- a/2020/ferguson1/crazy.log.html
              +++ b/2020/ferguson1/crazy.log.html
              @@ -123,7 +123,7 @@
               
               
               

              The following are a few screen dumps of:

              -
                  SIZE=100 SHEDS=5 GROW=-10 SHED=50 MAXSIZE=250 ./prog
              +
                  SIZE=100 SHEDS=5 GROW=-10 SHED=50 MAXSIZE=250 ./prog

              As you will see it took 17 bugs to get down to below 0. Notice how I had to get down to 0 more than once: because I moved enough times before I got the last bug that I grew by 5 in size. I then however moved a bit more and ate a bug diff --git a/2020/ferguson1/crazy.log.md b/2020/ferguson1/crazy.log.md index b509c4968..46a6c83e7 100644 --- a/2020/ferguson1/crazy.log.md +++ b/2020/ferguson1/crazy.log.md @@ -1,6 +1,6 @@ The following are a few screen dumps of: -```sh +``` SIZE=100 SHEDS=5 GROW=-10 SHED=50 MAXSIZE=250 ./prog ``` diff --git a/2020/ferguson1/gameplay.html b/2020/ferguson1/gameplay.html index af294eae6..02c46906c 100644 --- a/2020/ferguson1/gameplay.html +++ b/2020/ferguson1/gameplay.html @@ -451,9 +451,9 @@ setting the max size to a smaller value than the size you specify (or the default) or setting the size to higher than the default (or < 0 which will end up being > the max size though I suppose there might be some value that makes it less than again - I’m not going to try and figure that out however). Anyway:

              -
                  SIZE=-1 ./prog
              -    YOU WIN!
              -    X:24/49 Y:8/16 S:658/658 B:0
              +
                  SIZE=-1 ./prog
              +    YOU WIN!
              +    X:24/49 Y:8/16 S:658/658 B:0

              Observe that the size isn’t the default 997: because the screen size is too small for that value (see terminals.md).

              The reason I chose 997 is that it leaves a bit of a challenge for some (maybe @@ -499,22 +499,22 @@ you have any form of epilepsy. Thank you.

              If you want to draw the snake wherever you like on the screen you can do this by modifying the wait time (for input) to -1 (or any value < 0): then the snake does not move until you press a movement key. For example:

              -
                  WAIT=-1 ./prog
              +
                  WAIT=-1 ./prog

              When you eat a bug the snake will grow and you can draw more. If you want to make it so you can go through yourself:

              -
                  WAIT=-1 CANNIBAL=1 ./prog
              +
                  WAIT=-1 CANNIBAL=1 ./prog

              If you don’t want to start out so small (i.e. you want to be able to draw more quickly) you can just set the size to a bigger number (and you could do the same with growth and moult/shed):

              -
                  SIZE=50 CANNIBAL=1 WAIT=-1 ./prog
              +
                  SIZE=50 CANNIBAL=1 WAIT=-1 ./prog

              Do note that although you’re a bigger size you still grow one movement at a time.

              Okay but then if you get too many bugs the drawing will be over. If this proves to be a problem simply do:

              -
                  SIZE=100 CANNIBAL=1 WAIT=-1 GROW=0 ./prog
              +
                  SIZE=100 CANNIBAL=1 WAIT=-1 GROW=0 ./prog

              Or something like that (maybe make the size bigger but that’s up to you). You could also set the max size to be the highest possible by saying

              -
                  MAXSIZE=-1
              +
                  MAXSIZE=-1

              Which I’ve done in the play.sh script.

              I discuss how this mode works in [spoilers.markdown][].

              Here’s an example run where I spelt ‘SNAKE’. As you can see it’s far from @@ -536,7 +536,7 @@ different colours and depending on the exact parameters you specify it could easily be in the trigger range for epilepsy but potentially stimulation overload too.

              If you’re still here you can create this effect like:

              -
                  WAIT=0 WALLS=1 CANNIBAL=1 ./prog
              +
                  WAIT=0 WALLS=1 CANNIBAL=1 ./prog

              As long as the bug evades you’ll find that the snake is growing because it’s actually eating bugs; the computer is actually playing the game by itself! You can still move the snake though it won’t seem like you have much control over @@ -553,14 +553,14 @@ happen because the bug has to find a X and Y coordinate that’s not occupied an so with fewer available it has a harder time finding a place in that one line.

              Computer player variations

              Here’s how to make the bug move every time the snake moves:

              -
                  CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 ./prog
              +
                  CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 ./prog

              Help the computer win fairly quickly

              If you want to see the game ‘win’ try something like:

              -
                  CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 MAXSIZE=10 ./prog
              +
                  CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 MAXSIZE=10 ./prog

              Negative growth (Shrink) Automatic mode

              Here’s a fun one I just thought of (a long time after these other modes were thought of):

              -
                  WAIT=0 EVADE=1 GROW=-1 SIZE=9 MAXSIZE=10 CANNIBAL=1 ./prog
              +
                  WAIT=0 EVADE=1 GROW=-1 SIZE=9 MAXSIZE=10 CANNIBAL=1 ./prog

              What you’ll see is that first the snake will get to the size of 9 - whether it shows to be 10 characters depends on whether or not it gets a bug before it can get to that length - and then it’ll start shrinking until it’s just the head @@ -568,7 +568,7 @@ then the head again (i.e. 1 then 0 in size) and then win! This is also in the play.sh script.

              Adjusting the time/speed

              Of course you can also do something like:

              -
                  WAIT=5 WALLS=1 CANNIBAL=1 ./prog
              +
                  WAIT=5 WALLS=1 CANNIBAL=1 ./prog

              Which although might not seem like it is significantly slower.

              Moving the snake about to create patterns

              If you press different direction keys in some pattern you will see a pattern @@ -578,7 +578,7 @@ suppose also how much the bug moves and the chance of being eaten also).

              Here’s an idea: how many moves is needed to make it possible to have some sort of success in catching bugs? Obviously the dimensions will affect this value.

              How long will it take for the snake to run into itself? For instance by doing:

              -
                  WAIT=0 ./prog
              +
                  WAIT=0 ./prog

              On my 13” MacBook Pro (replaced later by a 16”) at the default settings going horizontally the snake ran into itself at:

                  OW!
              @@ -592,7 +592,7 @@ or growing to the full size directly. This is how it works:

              You have a negative shedding growth and a positive growth size: negative and positive winning. Depending on the parameters specified it might go one way over the other. Try:

              -
                  SIZE=150 SHEDS=-5 GROW=10 SHED=50 MAXSIZE=250 ./prog
              +
                  SIZE=150 SHEDS=-5 GROW=10 SHED=50 MAXSIZE=250 ./prog

              What this does is set the size to 150 (to make it not go down so quickly) and then for each bug you eat it adds 5 to the size; for every 50 moves (that you don’t get the bug) you shrink by 5. You will find that at times you might only @@ -608,7 +608,7 @@ dumps with this idea.

              You could also have it so that eating a bug makes you shrink and moving so many moves you grow. I tried this and for me it was far more fun. The play.sh also has this mode:

              -
                  SIZE=100 SHEDS=5 GROW=-10 SHED=50 MAXSIZE=250 ./prog
              +
                  SIZE=100 SHEDS=5 GROW=-10 SHED=50 MAXSIZE=250 ./prog

              Obviously there are many other variations. The play.sh script has some of them (the above is option 5; others are 4, 15 and 16 but only options 4 and 5 are called Grow / Shrink).

              @@ -622,7 +622,7 @@ typical range of seizures is 3 to 30 flashes per seconds (but can be higher) and that means that at EVADE=1 every 231ms there will be a flash in addition to the snake moving too.

              Anyway this might sound absurd but it can be somewhat hypnotic by doing:

              -
                  EVADE=1 CANNIBAL=1 ./prog
              +
                  EVADE=1 CANNIBAL=1 ./prog

              And just moving the snake about not trying to catch any bugs - just let whatever happens happen.

              Gameplay mode: Stimulation / Calming mode

              @@ -631,7 +631,7 @@ want to play a game without having to worry about winning or losing you can set the growth size to 0 and then just move the snake round and round eating bugs until you want to quit. You can enable cannibalism so that you don’t have to worry about even running into yourself and losing:

              -
                  GROW=0 CANNIBAL=1 ./prog
              +
                  GROW=0 CANNIBAL=1 ./prog

              Gameplay mode: Expansibility

              As I was writing this document and the game modes I have thought of other game modes (they were added) and I have come back to this document to add more modes. @@ -650,9 +650,9 @@ reason as well as I simply enjoy it and thinking up new modes.

              this file discusses as well as allowing to easily change the colours.

              Colours selection: snake-colours

              To do this use the snake-colours script like so:

              -
                  ./snake-colours
              +
                  ./snake-colours

              If you want to pass in specific variables you can do that too e.g.:

              -
                  CANNIBAL=1 ./snake-colours
              +
                  CANNIBAL=1 ./snake-colours

              The script will prompt you for the colour of the walls, snake head, body and the bug.

              Automate the above gameplay modes

              @@ -664,9 +664,9 @@ snake-colours above) and then gives you a list of game modes to play. You can pass in the game variables but note that if you pass in a variable that the mode you choose uses then the script will override what you pass in.

              To use you can do something like:

              -
                  ./play.sh
              +
                  ./play.sh

              Or to make it so walls are an obstacle:

              -
                  WALLS=0 ./play.sh
              +
                  WALLS=0 ./play.sh

              6. Notes about some of the game variables

              The game variables can be used for a variety of things including different gameplay modes (as shown above) but here are some general notes about a few of them.

              diff --git a/2020/ferguson1/gameplay.md b/2020/ferguson1/gameplay.md index 65311b794..df76efb96 100644 --- a/2020/ferguson1/gameplay.md +++ b/2020/ferguson1/gameplay.md @@ -415,7 +415,7 @@ default) or setting the size to higher than the default (or < 0 which will end up being > the max size though I suppose there might be some value that makes it less than again - I'm not going to try and figure that out however). Anyway: -```sh +``` SIZE=-1 ./prog YOU WIN! X:24/49 Y:8/16 S:658/658 B:0 @@ -487,7 +487,7 @@ If you want to draw the snake wherever you like on the screen you can do this by modifying the wait time (for input) to -1 (or any value < 0): then the snake does not move until you press a movement key. For example: -```sh +``` WAIT=-1 ./prog ``` @@ -495,7 +495,7 @@ does not move until you press a movement key. For example: When you eat a bug the snake will grow and you can draw more. If you want to make it so you can go through yourself: -```sh +``` WAIT=-1 CANNIBAL=1 ./prog ``` @@ -503,7 +503,7 @@ If you don't want to start out so small (i.e. you want to be able to draw more quickly) you can just set the size to a bigger number (and you could do the same with growth and moult/shed): -```sh +``` SIZE=50 CANNIBAL=1 WAIT=-1 ./prog ``` @@ -513,14 +513,14 @@ time. Okay but then if you get too many bugs the drawing will be over. If this proves to be a problem simply do: -```sh +``` SIZE=100 CANNIBAL=1 WAIT=-1 GROW=0 ./prog ``` Or something like that (maybe make the size bigger but that's up to you). You could also set the max size to be the highest possible by saying -```sh +``` MAXSIZE=-1 ``` @@ -556,7 +556,7 @@ too. If you're still here you can create this effect like: -```sh +``` WAIT=0 WALLS=1 CANNIBAL=1 ./prog ``` @@ -582,7 +582,7 @@ so with fewer available it has a harder time finding a place in that one line. Here's how to make the bug move every time the snake moves: -```sh +``` CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 ./prog ``` @@ -591,7 +591,7 @@ Here's how to make the bug move every time the snake moves: If you want to see the game 'win' try something like: -```sh +``` CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 MAXSIZE=10 ./prog ``` @@ -601,7 +601,7 @@ If you want to see the game 'win' try something like: Here's a fun one I just thought of (a long time after these other modes were thought of): -```sh +``` WAIT=0 EVADE=1 GROW=-1 SIZE=9 MAXSIZE=10 CANNIBAL=1 ./prog ``` @@ -616,7 +616,7 @@ then the head again (i.e. 1 then 0 in size) and then win! This is also in the Of course you can also do something like: -```sh +``` WAIT=5 WALLS=1 CANNIBAL=1 ./prog ``` @@ -635,7 +635,7 @@ of success in catching bugs? Obviously the dimensions will affect this value. How long will it take for the snake to run into itself? For instance by doing: -```sh +``` WAIT=0 ./prog ``` @@ -660,7 +660,7 @@ You have a negative shedding growth and a positive growth size: negative and positive winning. Depending on the parameters specified it might go one way over the other. Try: -```sh +``` SIZE=150 SHEDS=-5 GROW=10 SHED=50 MAXSIZE=250 ./prog ``` @@ -683,7 +683,7 @@ You could also have it so that eating a bug makes you shrink and moving so many moves you grow. I tried this and for me it was far more fun. The [play.sh][] also has this mode: -```sh +``` SIZE=100 SHEDS=5 GROW=-10 SHED=50 MAXSIZE=250 ./prog ``` @@ -705,7 +705,7 @@ snake moving too. Anyway this might sound absurd but it can be somewhat hypnotic by doing: -```sh +``` EVADE=1 CANNIBAL=1 ./prog ``` @@ -721,7 +721,7 @@ the growth size to 0 and then just move the snake round and round eating bugs until you want to quit. You can enable cannibalism so that you don't have to worry about even running into yourself and losing: -```sh +``` GROW=0 CANNIBAL=1 ./prog ``` @@ -752,13 +752,13 @@ this file discusses as well as allowing to easily change the colours. To do this use the [snake-colours][] script like so: -```sh +``` ./snake-colours ``` If you want to pass in specific variables you can do that too e.g.: -```sh +``` CANNIBAL=1 ./snake-colours ``` @@ -777,13 +777,13 @@ you choose uses then the script will override what you pass in. To use you can do something like: -```sh +``` ./play.sh ``` Or to make it so walls are an obstacle: -```sh +``` WALLS=0 ./play.sh ``` diff --git a/2020/ferguson1/index.html b/2020/ferguson1/index.html index f35ffa2ea..5e0c99042 100644 --- a/2020/ferguson1/index.html +++ b/2020/ferguson1/index.html @@ -141,14 +141,14 @@ Location: US - United States of America

              To build:

              -
                  make
              +
                  make

              Bugs and (Mis)features:

              The current status of this entry is:

                  STATUS: INABIAF - please **DO NOT** fix

              For more detailed information see 2020 ferguson1 bugs.

              To use:

              -
                  WAIT=N WALLS=[01] EVADE=N SIZE=N MAXSIZE=N GROW=N SHEDS=N SHED=N CANNIBAL=[01] ./prog
              -    # start pressing some arrow keys
              +
                  WAIT=N WALLS=[01] EVADE=N SIZE=N MAXSIZE=N GROW=N SHEDS=N SHED=N CANNIBAL=[01] ./prog
              +    # start pressing some arrow keys

              where N is a number and [01] is either 1 or 0 (or more correctly zero and non-zero).

              Variables:

              @@ -202,25 +202,25 @@ whether you can go through the Snake or not. Default is 0 (cannot - die if you try).

            Try:

            -
                make test
            -
            -    WAIT=75 WALLS=1 CANNIBAL=1 ./prog
            -
            -    ./prog
            -
            -    SIZE=-1 ./prog
            -
            -    CANNIBAL=1 WALLS=1 WAIT=50 EVADE=200 ./prog
            -
            -    WAIT=75 GROW=-1 SIZE=5 CANNIBAL=1 ./prog
            -
            -    CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 MAXSIZE=10 ./prog
            -
            -    ./play
            -    # allows you to configure colours and has various pre-configured gameplay modes
            -
            -    ./snake-colours
            -    # allows for configuring colours
            +
                make test
            +
            +    WAIT=75 WALLS=1 CANNIBAL=1 ./prog
            +
            +    ./prog
            +
            +    SIZE=-1 ./prog
            +
            +    CANNIBAL=1 WALLS=1 WAIT=50 EVADE=200 ./prog
            +
            +    WAIT=75 GROW=-1 SIZE=5 CANNIBAL=1 ./prog
            +
            +    CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 MAXSIZE=10 ./prog
            +
            +    ./play
            +    # allows you to configure colours and has various pre-configured gameplay modes
            +
            +    ./snake-colours
            +    # allows for configuring colours

            Judges’ remarks:

            As the Gadsden flag warns, beware of the snake! This game has a number of configurable pitfalls including walls and snakes.

            @@ -306,7 +306,7 @@ look like bugs but aren’t as well as documenting a built-in test unit for some features.

            Because all IOCCC entries should have a man page I have included one (even though much of it is what’s also above). To render try:

            -
                man ./snake.1
            +
                man ./snake.1

            The COMPILING.html file has a few portability notes and the HACKING.html file has some information on how one might modify things, things that could be implemented diff --git a/2020/ferguson1/spoilers.html b/2020/ferguson1/spoilers.html index 4fdec4773..276176c87 100644 --- a/2020/ferguson1/spoilers.html +++ b/2020/ferguson1/spoilers.html @@ -762,9 +762,9 @@ returning E() I am returning 1 but if the end of main() is reached returned. In either case curses is ended.

            One of these optimisations saved four bytes simply by taking advantage of the value of a loop iterator after the loop. The loop is:

            -
                for (I = 0; A && I < A - 1; ++I)
            +
                for (I = 0; A && I < A - 1; ++I)

            However after the loop I had this:

            -
                A > 1 && q(n[A - 1],e[A - 1], 'o');
            +
                A > 1 && q(n[A - 1],e[A - 1], 'o');

            When I was considering moving that line to before the loop it occurred to me that as long as A > 0 then A - 1 == I after the loop. I still had to check for A > 1 but I could refer to just I instead of A - 1!

            @@ -779,31 +779,31 @@ place at this point) I was looking at the code to see if I could figure out how to save even more bytes. Here are some that I found interesting ways to go about the problem.

            First, the function that turns on colours looked like:

            -
                if (h) attron(m(PAIR(L)));
            -    else attroff(m(PAIR(L)));
            +
                if (h) attron(m(PAIR(L)));
            +    else attroff(m(PAIR(L)));

            But I thought is that else actually needed? If I were to switch the order so that the attroff() is called first then I could just do an if (h) - therefore getting rid of the else! But then I thought why not do what I’ve done elsewhere? I had:

            -
                attroff(m(PAIR(L)));
            -    if (h) attron(m(PAIR(L)));
            +
                attroff(m(PAIR(L)));
            +    if (h) attron(m(PAIR(L)));

            But I then saved an extra byte by making it:

            -
                attroff(m(PAIR(L)));
            -    h && attron(m(PAIR(L)));
            +
                attroff(m(PAIR(L)));
            +    h && attron(m(PAIR(L)));

            That saved two bytes.

            Second let’s look at the B() function: there were two things I thought of that would save some bytes (I no longer know how many but a few at least possibly six or even more). I had the following code:

            -
                if (V && U && o) { S(N); b(1); }
            +
                if (V && U && o) { S(N); b(1); }

            This made sure that only if the snake has caught a bug should it grow by the growth size and increase the bug count. But was checking for the V or U necessary? I gave it a look over and it occurred to me: the only time B() is called with 1 (thus o is 1 so the if is true) was if the bug actually is caught. That means I could remove the V && U && part of the if! Thus it became instead:

            -
                if (o) { S(N); b(1); }
            +
                if (o) { S(N); b(1); }

            Then this

            -
                !o && V && U && q U,V,' ');
            +
                !o && V && U && q U,V,' ');

            …is to make sure to only clear the spot the bug is (or was) at if the bug was NOT eaten. Why not eaten? Because if it was eaten it means the snake’s head will be there!

            @@ -818,7 +818,7 @@ unfortunately the snake has to be placed first since the bug cannot be placed where the snake already is. So if I had to make sure the game had started (the snake has moved at least once) what could I check? In fact that means the direction is not 0! So I could just replace it with:

            -
                !o && D && q *U,*V,' ');
            +
                !o && D && q *U,*V,' ');

            That reduced the count further. But then I wondered if even that much is needed. The condition is that the bug has evaded which means the snake has moved already (so game started). What calls to this function happen before the game starts @@ -831,7 +831,7 @@ to check for is that !o: because after this call before the game ev the score line is updated: so the empty space will be overwritten anyway. And if the score line is made an empty string it doesn’t matter because it’ll appear as all spaces anyway. Thus I could save another three bytes by changing it to:

            -
                !o  && q *U,*V,' ');
            +
                !o  && q *U,*V,' ');

            Technically it would be a " " (see HACKING.html or on GitHub HACKING.md) else for N (not referring to the variable though it might very well matter here too) movements (i.e. due to sizes) you will at times (e.g. diff --git a/2020/ferguson1/spoilers.md b/2020/ferguson1/spoilers.md index 051ce9f88..5c4dab325 100644 --- a/2020/ferguson1/spoilers.md +++ b/2020/ferguson1/spoilers.md @@ -818,13 +818,13 @@ returned. In either case curses is ended. One of these optimisations saved four bytes simply by taking advantage of the value of a loop iterator after the loop. The loop is: -```c +``` for (I = 0; A && I < A - 1; ++I) ``` However after the loop I had this: -```c +``` A > 1 && q(n[A - 1],e[A - 1], 'o'); ``` @@ -847,7 +847,7 @@ the problem. First, the function that turns on colours looked like: -```c +``` if (h) attron(m(PAIR(L))); else attroff(m(PAIR(L))); ``` @@ -857,14 +857,14 @@ that the `attroff()` is called first then I could just do an `if (h)` - therefore getting rid of the `else`! But then I thought why not do what I've done elsewhere? I had: -```c +``` attroff(m(PAIR(L))); if (h) attron(m(PAIR(L))); ``` But I then saved an extra byte by making it: -```c +``` attroff(m(PAIR(L))); h && attron(m(PAIR(L))); ``` @@ -875,7 +875,7 @@ Second let's look at the `B()` function: there were two things I thought of that would save some bytes (I no longer know how many but a few at least possibly six or even more). I had the following code: -```c +``` if (V && U && o) { S(N); b(1); } ``` @@ -886,13 +886,13 @@ called with `1` (thus `o` is 1 so the if is true) was if the bug actually is caught. That means I could remove the `V && U &&` part of the if! Thus it became instead: -```c +``` if (o) { S(N); b(1); } ``` Then this -```c +``` !o && V && U && q U,V,' '); ``` @@ -913,7 +913,7 @@ where the snake already is. So if I had to make sure the game had started (the snake has moved at least once) what could I check? In fact that means the direction is not 0! So I could just replace it with: -```c +``` !o && D && q *U,*V,' '); ``` @@ -930,7 +930,7 @@ the score line is updated: so the empty space will be overwritten anyway. And if the score line is made an empty string it doesn't matter because it'll appear as all spaces anyway. Thus I could save another three bytes by changing it to: -```c +``` !o && q *U,*V,' '); ``` diff --git a/2020/ferguson1/terminals.html b/2020/ferguson1/terminals.html index 30281c68c..377d52ba1 100644 --- a/2020/ferguson1/terminals.html +++ b/2020/ferguson1/terminals.html @@ -151,7 +151,7 @@ movement is required) I have provided a source file that can test your terminal for the capabilities I use in the entry.

            It also tries to determine the minimum number of columns to play without the status line overflowing - even with the dynamic length. Try:

            -
                $ make test
            +
                $ make test

            This compiles the program termcaps.c and runs it; you should see something like:

                terminal supports cursor movement
                 terminal supports making cursor invisible
            @@ -178,21 +178,21 @@ maximum (capped) snake size.

            If I pass in any of the variables GROW, MAXSIZE, SIZE and/or LINES or COLUMNS it bases its calculations on those variables. For example:

            -
                terminal supports cursor movement
            -    terminal supports making cursor invisible
            -    terminal supports bold
            -    terminal supports colours
            -
            -    terminal rows  41 (38  playable)
            -    terminal cols 155 (153 playable)
            -
            -    snake size:  5776 (max size: 5776)
            -          bugs:  5771 (max size: 5771)
            -
            -    at least 37 columns (currently 155) recommended for snake size 5776
            -    at least 37 columns (currently 155) recommended for capped snake size 5776
            -
            -    No problems detected.
            +
                terminal supports cursor movement
            +    terminal supports making cursor invisible
            +    terminal supports bold
            +    terminal supports colours
            +
            +    terminal rows  41 (38  playable)
            +    terminal cols 155 (153 playable)
            +
            +    snake size:  5776 (max size: 5776)
            +          bugs:  5771 (max size: 5771)
            +
            +    at least 37 columns (currently 155) recommended for snake size 5776
            +    at least 37 columns (currently 155) recommended for capped snake size 5776
            +
            +    No problems detected.

            As you can see it tells you the max size (the ‘capsized’ snake) as well as the requested max size (if the requested size is bigger than the capped size then it will be set to that value instead) of the snake. The capped size is like in the @@ -224,12 +224,12 @@ resize the window with first. But what if you want exacts?

            To specify the lines/columns of curses program per instance use the LINES and COLUMNS environmental variables.

            For demonstration consider the following:

            -
                $ echo $LINES $COLUMNS
            -    42 157
            +
                $ echo $LINES $COLUMNS
            +    42 157

            Note: I subtract 1 from the max y/x and the max coords in the game output include the walls and score line but these values are for the terminal itself.

            Say you want 55 columns:

            -
                $ COLUMNS=55 ./prog
            +
                $ COLUMNS=55 ./prog

            This will force curses to detect the max columns (X) of your terminal (for the game dimensions) - to be 55; it might look like this instead:

                X:27/54 Y:20/41 S:5/997 B:0
            @@ -245,8 +245,8 @@ etc. For the game you might not see the final score.

            In my tests there is one thing that at least allows you to see the final score and that is by running clear before running the program. That’s what the prog.alt version does. You might run it as one of:

            -
                LINES=20 ./prog.alt
            -    LINES=20 ./snake.alt
            +
                LINES=20 ./prog.alt
            +    LINES=20 ./snake.alt

            Even if the final score is visible though the terminal may very well still be messed up. There are numerous things you might try but probably the easiest is to run the game again without modifying the dimensions (and then just quit) or @@ -259,7 +259,7 @@ even just the reset command.

            (the line-feed character is normally control-J) to get the terminal to work, as carriage-return may no longer work in the abnormal state.

            If you don’t have the reset utility you can try:

            -
                echo -e \\033c
            +
                echo -e \\033c

            Otherwise try clear; stty sane (that will turn on echo also) or if all else fails log out and back in.

            For more information on this subject generally see the Linux keyboard and @@ -271,10 +271,10 @@ outside what’s actually possible with their screen. But then player 4 comes along and thinks he/she will be clever and mess with the dimensions a bit. Let’s say they have a 13” monitor and they think it’d be funny to see how 997 lines would work; they might try something like:

            -
                LINES=997 ./prog
            +
                LINES=997 ./prog

            What then? Well expect trouble; curses will not know any better and the max number of lines will be 997. If they were to do:

            -
                COLUMNS=997 ./prog
            +
                COLUMNS=997 ./prog

            Then they will see a different effect. Again the same reason: the player trying to be funny.

            The game will try and be funny in return and you can expect it to not function @@ -306,7 +306,7 @@ GitHub) file).

            According to my tests for monochrome terminals the screen has the white and black background; if terminal is configured to be black background white foreground that is the order it is too. You can try that like:

            -
                TERM=linux-m ./prog
            +
                TERM=linux-m ./prog

            But I do not specifically check if the terminal has colours. Is there a curses implementation that has a problem here? Below I explain what to comment out should you need colours to be disabled but I personally have not run into any @@ -328,19 +328,19 @@ support in the source code itself.

            Based on the two as well as the fact that monochrome terminals (I’ve tried under both Linux and macOS) seem to work fine I believe I am fine here too. And to confirm this I wrote the following code with the output below:

            -
                #include <curses.h>
            -
            -    int main()
            -    {
            -        initscr();
            -        start_color();
            -        printw("COLORS: %d\nCOLOR_PAIRS: %d\n", COLORS, COLOR_PAIRS);
            -        getch();
            -        endwin();
            -    }
            -
                TERM=linux-m ./colour_pairs
            -    COLORS: 0
            -    COLOR_PAIRS: 0
            +
                #include <curses.h>
            +
            +    int main()
            +    {
            +        initscr();
            +        start_color();
            +        printw("COLORS: %d\nCOLOR_PAIRS: %d\n", COLORS, COLOR_PAIRS);
            +        getch();
            +        endwin();
            +    }
            +
                TERM=linux-m ./colour_pairs
            +    COLORS: 0
            +    COLOR_PAIRS: 0

            Without specifying the TERM I get:

                COLORS: 256
                 COLOR_PAIRS: 32767
            @@ -348,22 +348,22 @@ confirm this I wrote the following code with the output below:

            possible colour pairs than I have used so that’s not a problem either. Perhaps even it would only be a runtime error if the colours are supported and the number is out of the range? To try and figure this out I did another test:

            -
                int main()
            -    {
            -        initscr();
            -        start_color();
            -
            -        init_pair(COLOR_PAIRS+1, COLOR_WHITE, COLOR_GREEN);
            -        bkgd(COLOR_PAIR(COLOR_PAIRS+1));
            -        init_pair(1, COLOR_WHITE, COLOR_BLACK);
            -        attron(COLOR_PAIR(1));
            -        printw("COLORS: %d\nCOLOR_PAIRS: %d\n", COLORS, COLOR_PAIRS);
            -
            -        getch();
            -        endwin();
            -    }
            +
                int main()
            +    {
            +        initscr();
            +        start_color();
            +
            +        init_pair(COLOR_PAIRS+1, COLOR_WHITE, COLOR_GREEN);
            +        bkgd(COLOR_PAIR(COLOR_PAIRS+1));
            +        init_pair(1, COLOR_WHITE, COLOR_BLACK);
            +        attron(COLOR_PAIR(1));
            +        printw("COLORS: %d\nCOLOR_PAIRS: %d\n", COLORS, COLOR_PAIRS);
            +
            +        getch();
            +        endwin();
            +    }

            Running it like

            -
                TERM=linux-m ./colour_pairs
            +
                TERM=linux-m ./colour_pairs

            I got the output as if colours weren’t used: 0 and 0. With coloured terminals however it was not visible. If I however comment out the call to bkgd() I get instead:

            diff --git a/2020/ferguson1/terminals.md b/2020/ferguson1/terminals.md index 0bb19941e..efe19fde6 100644 --- a/2020/ferguson1/terminals.md +++ b/2020/ferguson1/terminals.md @@ -30,7 +30,7 @@ for the capabilities I use in the entry. It also tries to determine the minimum number of columns to play without the status line overflowing - even with the dynamic length. Try: -```sh +``` $ make test ``` @@ -67,7 +67,7 @@ If I pass in any of the variables **GROW**, **MAXSIZE**, **SIZE** and/or **LINES** or **COLUMNS** it bases its calculations on those variables. For example: -```sh +``` terminal supports cursor movement terminal supports making cursor invisible terminal supports bold @@ -129,7 +129,7 @@ To specify the lines/columns of curses program per instance use the `LINES` and For demonstration consider the following: -```sh +``` $ echo $LINES $COLUMNS 42 157 ``` @@ -139,7 +139,7 @@ include the walls and score line but these values are for the terminal itself. Say you want 55 columns: -```sh +``` $ COLUMNS=55 ./prog ``` @@ -166,7 +166,7 @@ In my tests there is one thing that at least allows you to see the final score and that is by running `clear` before running the program. That's what the prog.alt version does. You might run it as one of: -```sh +``` LINES=20 ./prog.alt LINES=20 ./snake.alt ``` @@ -190,7 +190,7 @@ The Linux man page says: If you don't have the reset utility you can try: -```sh +``` echo -e \\033c ``` @@ -209,14 +209,14 @@ along and thinks he/she will be clever and mess with the dimensions a bit. Let's say they have a 13" monitor and they think it'd be funny to see how 997 lines would work; they might try something like: -```sh +``` LINES=997 ./prog ``` What then? Well expect trouble; curses will not know any better and the max number of lines will be 997. If they were to do: -```sh +``` COLUMNS=997 ./prog ``` @@ -265,7 +265,7 @@ According to my tests for monochrome terminals the screen has the white and black background; if terminal is configured to be black background white foreground that is the order it is too. You can try that like: -```sh +``` TERM=linux-m ./prog ``` @@ -301,7 +301,7 @@ Based on the two as well as the fact that monochrome terminals (I've tried under both Linux and macOS) seem to work fine I believe I am fine here too. And to confirm this I wrote the following code with the output below: -```c +``` #include int main() @@ -314,7 +314,7 @@ confirm this I wrote the following code with the output below: } ``` -```sh +``` TERM=linux-m ./colour_pairs COLORS: 0 COLOR_PAIRS: 0 @@ -332,7 +332,7 @@ possible colour pairs than I have used so that's not a problem either. Perhaps even it would only be a runtime error if the colours are supported and the number is out of the range? To try and figure this out I did another test: -```c +``` int main() { initscr(); @@ -351,7 +351,7 @@ number is out of the range? To try and figure this out I did another test: Running it like -```sh +``` TERM=linux-m ./colour_pairs ``` diff --git a/2020/ferguson1/troubleshooting.html b/2020/ferguson1/troubleshooting.html index 4e4c4c49a..789a4be37 100644 --- a/2020/ferguson1/troubleshooting.html +++ b/2020/ferguson1/troubleshooting.html @@ -372,7 +372,7 @@ hit a key every time to move because it is blocking.

          On environmental variables more generally and string to int conversions

          What happens if you do:

          -
              WALLS= ./prog
          +
              WALLS= ./prog

          Can you run into the wall since you didn’t specify a value and the default is 1? No. That’s not the way it works. By saying WALLS= you have told the system that there is that environmental variable. However the way the strtoul() functions @@ -381,12 +381,12 @@ it’s wasteful (iocccsize wise) and I have never felt that having invalid input for a number could have a better value than 0.

          If however you were to give valid input followed by invalid input the valid input would be parsed. For example:

          -
              WALLS=1test ./prog
          +
              WALLS=1test ./prog

          would let you go through the walls. On the other hand

          -
              WALLS=test1 ./prog
          +
              WALLS=test1 ./prog

          would not. Furthermore if you specify the same variable more than once it’s the last one that counts. For example:

          -
              WALLS=0 WALLS=1 CANNIBAL=1 CANNIBAL=0 ./prog
          +
              WALLS=0 WALLS=1 CANNIBAL=1 CANNIBAL=0 ./prog

          would allow you to go through walls but you could not cannibalise.

          Also note that I specify base 0 which means that you can also have it in hex and octal. These are all the same:

          @@ -421,17 +421,17 @@ will end (yes things that haven’t begun can be ended).

          If calloc() fails to obtain the needed memory you’ll see something like (here it was before I added proper - to make the perfect and obvious pun - capsizing so that by setting the size to -1 it went to the max unsigned value):

          -
              $ MAXSIZE=-1 ./prog
          -    memory error
          -    X:0/157 Y:0/42 S:3/18446744073709551614 B:0
          +
              $ MAXSIZE=-1 ./prog
          +    memory error
          +    X:0/157 Y:0/42 S:3/18446744073709551614 B:0

          BTW: There are two arrays that have to be MAXSIZE (technically + 1).

          Is it possible that some value specified by the user could mess this up? I do not know but what I do know is that because it’s unsigned it can’t be negative; if the max size is 0 then the array size will be 1 but it won’t matter because the snake size will be >= that max anyway. But here’s a curious output:

          -
              SIZE=1 MAXSIZE=0 ./prog
          -    YOU WIN!
          -    X:78/156 Y:20/41 S:0/0 B:0
          +
              SIZE=1 MAXSIZE=0 ./prog
          +    YOU WIN!
          +    X:78/156 Y:20/41 S:0/0 B:0

          Why does it show snake size as 0 when I specified 1? It’s because the max size is 0 and I limit the size to be no bigger than the max size.

          WALLS= ./prog ``` @@ -342,20 +342,20 @@ for a number could have a better value than 0. If however you were to give valid input followed by invalid input the valid input would be parsed. For example: -```sh +``` WALLS=1test ./prog ``` would let you go through the walls. On the other hand -```sh +``` WALLS=test1 ./prog ``` would not. Furthermore if you specify the same variable more than once it's the last one that counts. For example: -```sh +``` WALLS=0 WALLS=1 CANNIBAL=1 CANNIBAL=0 ./prog ``` @@ -414,7 +414,7 @@ If `calloc()` fails to obtain the needed memory you'll see something like (here was before I added proper - to make the perfect and obvious pun - capsizing so that by setting the size to -1 it went to the max unsigned value): -```sh +``` $ MAXSIZE=-1 ./prog memory error X:0/157 Y:0/42 S:3/18446744073709551614 B:0 @@ -428,7 +428,7 @@ not know but what I do know is that because it's unsigned it can't be negative; if the max size is 0 then the array size will be 1 but it won't matter because the snake size will be >= that max anyway. But here's a curious output: -```sh +``` SIZE=1 MAXSIZE=0 ./prog YOU WIN! X:78/156 Y:20/41 S:0/0 B:0 diff --git a/2020/ferguson2/README.md b/2020/ferguson2/README.md index 1747ae26b..b21ef2414 100644 --- a/2020/ferguson2/README.md +++ b/2020/ferguson2/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -11,7 +11,7 @@ at once. See [Alternate code](#alternate-code) below. ## To use: -```sh +``` ./prog # get recode help: @@ -49,13 +49,13 @@ are allowed. ## Try: -```sh +``` ./try.sh ``` What does: -```sh +``` echo | ./recode echo | ./recode -v ``` @@ -72,14 +72,14 @@ and to make it a bit more like the real thing. ### Alternate build: -```sh +``` make alt ``` The default time to sleep is 400000 microseconds but you can change this by doing: -```sh +``` make clobber SLEEP=600000 alt ``` @@ -93,7 +93,7 @@ Use `prog.alt` as you would `prog` above. ### Alternate try: -```sh +``` ./try.alt.sh ``` @@ -110,7 +110,7 @@ There is a good deal of useful documentation that is provided with this entry: * [enigma.1](enigma.1) - A useful man page for this entry. To render, try: -```sh +``` man ./enigma.1 ``` @@ -251,7 +251,7 @@ the result (after finishing the enciphering). If you run it like: -```sh +``` ./prog - ``` @@ -283,7 +283,7 @@ program as well as how to use the two winning entries of the [Morse code](https://en.wikipedia.org/wiki/Morse_code) that I referred to earlier: -```sh +``` $ ./prog - Ring 1: 3 Setting 1: I @@ -317,7 +317,7 @@ default settings; as the judges suggest this invocation I will not show it here. But you can also type it out like this: -```sh +``` $ ./prog IOCCC UUMMX @@ -328,7 +328,7 @@ The IOCCC comes from stdin; the `UUMMX` is written to stdout. If I compile the 2014 entry and copy it to my local directory as `vik` I might do: -```sh +``` $ echo TEST|./prog |./vik | mplayer -demuxer rawaudio - ``` @@ -340,7 +340,7 @@ a bug in that entry (Fedora, CentOS and macOS all affected). For example I can use the syntax provided in the winning remarks along with my entry to write it to a file. Say: -```sh +``` $ echo TEST|./prog |./vik > test.raw $ ./vik e < test.raw | ./prog LEST @@ -348,21 +348,21 @@ entry to write it to a file. Say: Why did that happen? This shows more details: -```sh +``` $ ./vik e < test.raw SCWV ``` However as can be seen the first char is wrong: -```sh +``` $ echo TEST|./prog KCWV ``` And piping the original output to my entry itself you get the original input: -```sh +``` $ echo TEST | ./prog | ./prog TEST ``` @@ -372,7 +372,7 @@ idea anyway. Neither do I know if the original transcoding is correct. What if I use the input string `LEST` instead? In that case it worked fine: -```sh +``` $ echo LEST | ./prog | ./vik > lest.raw $ ./vik e < lest.raw | ./prog LEST @@ -380,7 +380,7 @@ What if I use the input string `LEST` instead? In that case it worked fine: But there's one obvious question, right? Let's try the most important one: -```sh +``` $ echo IOCCC | ./prog | ./vik > ioccc.raw $ ./vik e < ioccc.raw UUMMX @@ -396,7 +396,7 @@ too. Notice also how it showed the same output that my program gave it - `UUMMX` What about the other [Morse code entry](../../1998/dorssel/dorssel.c)? -```sh +``` $ echo IOCCC | ./prog | ./dorssel ..- ..- -- -- -..- ``` @@ -441,7 +441,7 @@ The parser is in a sense rather rudimentary but allows for both interactive and automatic (e.g. via the [recode](recode.c) program) input. This does mean that something like the following can happen: -```sh +``` $ ./prog - Ring 1: 1AB Setting 1: Position 1: Ring 2: 2CD @@ -504,7 +504,7 @@ should help you remember (though not at this time in our world it might help you later on?). This might become even more useful after the challenge is accepted, accomplished and made use of! :) -```sh +``` $ echo ABC | ./prog GYM $ echo ABC | ./prog | ./prog @@ -536,7 +536,7 @@ ended his life. (I later made a bug fix but I consider this inconsequential). As for [recode.c][] though I really love this: -```c +``` /\ / This is *not* what you think: ``` @@ -552,13 +552,13 @@ It's an [Enigma machine](https://en.wikipedia.org/wiki/Enigma_machine) simulator that proof that it's obfuscated itself?! :) Silliness aside [obfuscation.txt][] has some of the ways I think this entry is obfuscated. To decipher try: -```sh +``` ./recode -Robfuscation.key -fobfuscation.txt | ./prog - 2>/dev/null > obfuscation.md ``` To encipher: -```sh +``` ./recode -Robfuscation.key -fobfuscation.md | ./prog - 2>/dev/null > obfuscation.txt ``` diff --git a/2020/ferguson2/index.html b/2020/ferguson2/index.html index bcf65d597..3e3da234a 100644 --- a/2020/ferguson2/index.html +++ b/2020/ferguson2/index.html @@ -141,62 +141,62 @@ Location: US - United States of America

          To build:

          -
              make
          +
              make

          The author provided alternate code that prints the output one character at a time to make it a bit more like the real thing in that it isn’t dumped out all at once. See Alternate code below.

          To use:

          -
              ./prog
          -
          -    # get recode help:
          -    ./recode -h
          -
          -    # general syntax for recode passing to Enigma machine:
          -    ./recode [options] | ./prog - 2>/dev/null
          -    # general syntax for recode without passing to Enigma machine:
          -    ./recode [options]
          -
          -    # recode prompts for settings; pass to Enigma machine:
          -    ./recode | ./prog - 2>/dev/null
          -
          -    # recode reads from input file, prompts for settings; passed to Enigma machine:
          -    ./recode -finput | ./prog - 2>/dev/null
          -
          -    # recode reads config from string or file; passed to Enigma machine after
          -    # prompting for input:
          -    ./recode -R<string|file> | ./prog - 2>/dev/null
          -
          -    # write config to output file; passed to Enigma machine after prompting for
          -    # input:
          -    ./recode -o<config> | ./prog - 2>/dev/null
          -
          -    # pseudo-randomly select settings
          -    ./recode -r
          -
          -    # show Enigma machine settings after selection / generation:
          -    ./recode -v
          +
              ./prog
          +
          +    # get recode help:
          +    ./recode -h
          +
          +    # general syntax for recode passing to Enigma machine:
          +    ./recode [options] | ./prog - 2>/dev/null
          +    # general syntax for recode without passing to Enigma machine:
          +    ./recode [options]
          +
          +    # recode prompts for settings; pass to Enigma machine:
          +    ./recode | ./prog - 2>/dev/null
          +
          +    # recode reads from input file, prompts for settings; passed to Enigma machine:
          +    ./recode -finput | ./prog - 2>/dev/null
          +
          +    # recode reads config from string or file; passed to Enigma machine after
          +    # prompting for input:
          +    ./recode -R<string|file> | ./prog - 2>/dev/null
          +
          +    # write config to output file; passed to Enigma machine after prompting for
          +    # input:
          +    ./recode -o<config> | ./prog - 2>/dev/null
          +
          +    # pseudo-randomly select settings
          +    ./recode -r
          +
          +    # show Enigma machine settings after selection / generation:
          +    ./recode -v

          NOTE: in recode no spaces between options and option arguments are allowed.

          Try:

          -
              ./try.sh
          +
              ./try.sh

          What does:

          -
              echo | ./recode
          -    echo | ./recode -v
          +
              echo | ./recode
          +    echo | ./recode -v

          do?

          Alternate code:

          This version, prog.alt.c, writes a character at a time, sleeping after each character, so that one can read it more easily (for longer output) and to make it a bit more like the real thing.

          Alternate build:

          -
              make alt
          +
              make alt

          The default time to sleep is 400000 microseconds but you can change this by doing:

          -
              make clobber SLEEP=600000 alt
          +
              make clobber SLEEP=600000 alt

          to change it to 600000 microseconds. It guards against negative numbers.

          Alternate use:

          Use prog.alt as you would prog above.

          Alternate try:

          -
              ./try.alt.sh
          +
              ./try.alt.sh

          Notice how only the last part should use the prog.alt. Why? Try it and find out! Can you figure out why this works this way?

          Judges’ remarks:

          @@ -205,7 +205,7 @@ out! Can you figure out why this works this way?

          • enigma.1 - A useful man page for this entry. To render, try:
          -
              man ./enigma.1
          +
              man ./enigma.1
          • recode.html (or recode.html if reading on GitHub)
              @@ -317,7 +317,7 @@ leave this in for historical purposes.

              for input (end with EOF). At that point it’ll process the input string and print the result (after finishing the enciphering).

              If you run it like:

              -
                  ./prog -
              +
                  ./prog -

              It will prompt you for the settings of the machine (example below).

              The first group is in the order of rotor (number), @@ -338,78 +338,78 @@ on GitHub see here) though one might need a di of exercise after taking up the challenge! :-) These however show the general program as well as how to use the two winning entries of the Morse code that I referred to earlier:

              -
                  $ ./prog -
              -    Ring 1: 3
              -    Setting 1: I
              -    Position 1: O
              -    Ring 2: 1
              -    Setting 2: C
              -    Position 2: C
              -    Ring 3: 5
              -    Setting 3: C
              -    Position 3: Z
              -    Reflector: 2
              -    Plugboard pair 1: CO
              -    Plugboard pair 2: DE
              -    Plugboard pair 3: SN
              -    Plugboard pair 4: XY
              -    Plugboard pair 5: MS
              -    Plugboard pair 6: AT
              -    Plugboard pair 7: VF
              -    Plugboard pair 8: UR
              -    Plugboard pair 9: KL
              -    Plugboard pair 10: BJ
              -    IOCCC
              -    ^D
              -    CFDRG
              +
                  $ ./prog -
              +    Ring 1: 3
              +    Setting 1: I
              +    Position 1: O
              +    Ring 2: 1
              +    Setting 2: C
              +    Position 2: C
              +    Ring 3: 5
              +    Setting 3: C
              +    Position 3: Z
              +    Reflector: 2
              +    Plugboard pair 1: CO
              +    Plugboard pair 2: DE
              +    Plugboard pair 3: SN
              +    Plugboard pair 4: XY
              +    Plugboard pair 5: MS
              +    Plugboard pair 6: AT
              +    Plugboard pair 7: VF
              +    Plugboard pair 8: UR
              +    Plugboard pair 9: KL
              +    Plugboard pair 10: BJ
              +    IOCCC
              +    ^D
              +    CFDRG

              Notice that all output except the deciphered/enciphered text is sent to stdout.

              If I didn’t specify the - by e.g. echo IOCCC | ./prog then it will use the default settings; as the judges suggest this invocation I will not show it here.

              But you can also type it out like this:

              -
                  $ ./prog
              -    IOCCC
              -    UUMMX
              +
                  $ ./prog
              +    IOCCC
              +    UUMMX

              The IOCCC comes from stdin; the UUMMX is written to stdout.

              If I compile the 2014 entry and copy it to my local directory as vik I might do:

              -
                  $ echo TEST|./prog |./vik | mplayer -demuxer rawaudio -
              +
                  $ echo TEST|./prog |./vik | mplayer -demuxer rawaudio -

              And you would hear Morse code of the Enigma output of ‘TEST’ (i.e. KCWV)! Or perhaps not in this case. I’m not sure: I discovered a bug in that entry (Fedora, CentOS and macOS all affected).

              For example I can use the syntax provided in the winning remarks along with my entry to write it to a file. Say:

              -
                  $ echo TEST|./prog |./vik > test.raw
              -    $ ./vik e < test.raw | ./prog
              -    LEST
              +
                  $ echo TEST|./prog |./vik > test.raw
              +    $ ./vik e < test.raw | ./prog
              +    LEST

              Why did that happen? This shows more details:

              -
                  $ ./vik e < test.raw
              -    SCWV
              +
                  $ ./vik e < test.raw
              +    SCWV

              However as can be seen the first char is wrong:

              -
                  $ echo TEST|./prog
              -    KCWV
              +
                  $ echo TEST|./prog
              +    KCWV

              And piping the original output to my entry itself you get the original input:

              -
                  $ echo TEST | ./prog  | ./prog
              -    TEST
              +
                  $ echo TEST | ./prog  | ./prog
              +    TEST

              I’m not sure what causes that or if there’s a way to fix it but that’s the idea anyway. Neither do I know if the original transcoding is correct.

              What if I use the input string LEST instead? In that case it worked fine:

              -
                  $ echo LEST | ./prog | ./vik > lest.raw
              -    $ ./vik e < lest.raw | ./prog
              -    LEST
              +
                  $ echo LEST | ./prog | ./vik > lest.raw
              +    $ ./vik e < lest.raw | ./prog
              +    LEST

              But there’s one obvious question, right? Let’s try the most important one:

              -
                  $ echo IOCCC | ./prog | ./vik > ioccc.raw
              -    $ ./vik e < ioccc.raw
              -    UUMMX
              -    $ ./vik e < ioccc.raw | ./prog
              -    IOCCC
              +
                  $ echo IOCCC | ./prog | ./vik > ioccc.raw
              +    $ ./vik e < ioccc.raw
              +    UUMMX
              +    $ ./vik e < ioccc.raw | ./prog
              +    IOCCC

              Phew! The program redeemed itself after the test failure! :)

              (Technically above it didn’t print a newline after the output and this is how it is with some of the things I pasted in the other file and maybe others here too. Notice also how it showed the same output that my program gave it - UUMMX.)

              What about the other Morse code entry?

              -
                  $ echo IOCCC | ./prog | ./dorssel
              -    ..- ..- -- -- -..-
              +
                  $ echo IOCCC | ./prog | ./dorssel
              +    ..- ..- -- -- -..-

              The recode.c configurator

              I have included a supplementary program recode.c that can do a number of things which acts as a kind of wrapper and configurator to my entry. By default @@ -440,26 +440,26 @@ make it more flexible by a wrapper program.

              The parser is in a sense rather rudimentary but allows for both interactive and automatic (e.g. via the recode program) input. This does mean that something like the following can happen:

              -
                  $ ./prog -
              -    Ring 1: 1AB
              -    Setting 1: Position 1: Ring 2: 2CD
              -    Setting 2: Position 2: Ring 3: 3
              -    Setting 3: A
              -    Position 3: B
              -    Reflector: 1A
              -    Plugboard pair 1: BC
              -    Plugboard pair 2: ..
              -    Plugboard pair 3: ..
              -    Plugboard pair 4: DE
              -    Plugboard pair 5: FG
              -    Plugboard pair 6: HI
              -    Plugboard pair 7: JK
              -    Plugboard pair 8: LM
              -    Plugboard pair 9: NO
              -    Plugboard pair 10: PQ
              -    IOCCC
              -    WD
              -    SIRDK
              +
                  $ ./prog -
              +    Ring 1: 1AB
              +    Setting 1: Position 1: Ring 2: 2CD
              +    Setting 2: Position 2: Ring 3: 3
              +    Setting 3: A
              +    Position 3: B
              +    Reflector: 1A
              +    Plugboard pair 1: BC
              +    Plugboard pair 2: ..
              +    Plugboard pair 3: ..
              +    Plugboard pair 4: DE
              +    Plugboard pair 5: FG
              +    Plugboard pair 6: HI
              +    Plugboard pair 7: JK
              +    Plugboard pair 8: LM
              +    Plugboard pair 9: NO
              +    Plugboard pair 10: PQ
              +    IOCCC
              +    WD
              +    SIRDK

              First of all: what is that WD? I didn’t type that but it showed up hitting ctrl-d to end input.

              If everything is input correctly it would show nothing except the actual @@ -493,10 +493,10 @@ GitHub).

              should help you remember (though not at this time in our world it might help you later on?). This might become even more useful after the challenge is accepted, accomplished and made use of! :)

              -
                  $ echo ABC | ./prog
              -    GYM
              -    $ echo ABC | ./prog | ./prog
              -    ABC
              +
                  $ echo ABC | ./prog
              +    GYM
              +    $ echo ABC | ./prog | ./prog
              +    ABC

              On the source code layout

              The layout of recode.c isn’t too significant (but see below) but I want to mention prog.c especially:

              @@ -516,17 +516,17 @@ which was exactly 75 years from the day that the person responsible for the Second World War, Adolf Hitler, ended his life. (I later made a bug fix but I consider this inconsequential).

              As for recode.c though I really love this:

              -
                            /\
              -    /          This is *not* what you think:
              +
                            /\
              +    /          This is *not* what you think:

              …because it seems so wrong in C code at first glance. Also what does the ‘this’ refer to?

              Obfuscation

              It’s an Enigma machine simulator! Isn’t that proof that it’s obfuscated itself?! :) Silliness aside obfuscation.txt has some of the ways I think this entry is obfuscated. To decipher try:

              -
                  ./recode -Robfuscation.key -fobfuscation.txt | ./prog - 2>/dev/null > obfuscation.md
              +
                  ./recode -Robfuscation.key -fobfuscation.txt | ./prog - 2>/dev/null > obfuscation.md

              To encipher:

              -
                  ./recode -Robfuscation.key -fobfuscation.md | ./prog - 2>/dev/null > obfuscation.txt
              +
                  ./recode -Robfuscation.key -fobfuscation.md | ./prog - 2>/dev/null > obfuscation.txt

              The file obfuscation.key is the key to decipher/encipher obfuscation.txt.

              For the lazy obfuscation.html has the deciphered version. I am afraid I’m not diff --git a/2020/ferguson2/obfuscation.html b/2020/ferguson2/obfuscation.html index a4e7778fa..ed272871f 100644 --- a/2020/ferguson2/obfuscation.html +++ b/2020/ferguson2/obfuscation.html @@ -140,41 +140,41 @@ there is an aesthetic appeal to my eyes too).

              Y<:19:><:27:> but it’s not the only example. Here the compound literal of 13 ints:

            -
                        int *z=(int[13]) { 0 } , *e, *g;
            +
                        int *z=(int[13]) { 0 } , *e, *g;

            Then in main:

            -
                        e = z + 10;
            -            g = e + 1;
            -
            -            for (j=-3; j < 0; ++j)
            -                e<:j:> = j+3;
            +
                        e = z + 10;
            +            g = e + 1;
            +
            +            for (j=-3; j < 0; ++j)
            +                e<:j:> = j+3;

            Which I think is more confusing: when one is iterating an array you don’t expect to start out with index < 0 but to then compare that that index < 0 and increment until 0 along with setting the value of the array to j + 3 is more confusing still. There are at least two other ways that are much easier to read that could accomplish the same thing. It continues on:

            -
                        /* ... */
            -            e<:i-3:> = (j < 1 ? 1 : (j > 5 ? 5 : j))-1;
            +
                        /* ... */
            +            e<:i-3:> = (j < 1 ? 1 : (j > 5 ? 5 : j))-1;
            • Observe these two functions:
            -
                        void w(char *s, int k, int v)
            -            {
            -                    for(e<:2:> = 0; s<:*P:>; ++e<:2:>)
            -                    {
            -                            v = s<:e<:2:>:>;
            -                            if(v > 64 && v < 91)
            -                                s<:e<:2:>:> = (((v - 65 + k) % 26) + 65);
            -                    }
            -            }
            -            void Q(void)
            -            {
            -                    for(*g = 0; *g < 3; ++*g)
            -                    {
            -                            *Y<:16+e<:1:>:>=S<:e<:e<:1:>-3:>:>;
            -                            R<:e<:1:>:>=Y<:e<:-3+e<:1:>:>:>;
            -                            w(R[*g],*(e+e<:1:>-6)=q(Y<:8:>,*Y<:7:>),*g);
            -                    }
            -            }
            +
                        void w(char *s, int k, int v)
            +            {
            +                    for(e<:2:> = 0; s<:*P:>; ++e<:2:>)
            +                    {
            +                            v = s<:e<:2:>:>;
            +                            if(v > 64 && v < 91)
            +                                s<:e<:2:>:> = (((v - 65 + k) % 26) + 65);
            +                    }
            +            }
            +            void Q(void)
            +            {
            +                    for(*g = 0; *g < 3; ++*g)
            +                    {
            +                            *Y<:16+e<:1:>:>=S<:e<:e<:1:>-3:>:>;
            +                            R<:e<:1:>:>=Y<:e<:-3+e<:1:>:>:>;
            +                            w(R[*g],*(e+e<:1:>-6)=q(Y<:8:>,*Y<:7:>),*g);
            +                    }
            +            }

            First of all: why do I set e[2] to 0 and increment it for each pass in the loop, but then the condition for the loop is s[*P]?

            Second notice the many references to e[1] (as e[1] and g). This variable (pointing @@ -200,14 +200,14 @@ temporary variable instead of a regular int in the function (so make it global); and (2) I didn’t want to risk changing all the offsets: thus I just made that address e[1]. Thus I also have:

          -
                      for (*g = 0 ; *g < 10; ++*g)
          -            {
          -                r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>;
          -                if (r<:-3:> && r<:-2:> == r<:-1:>)
          -                    return r<:-3:>;
          -                if (r<:-2:> && r<:-3:> == r<:-1:>)
          -                    return r<:-2:>;
          -            }
          +
                      for (*g = 0 ; *g < 10; ++*g)
          +            {
          +                r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>;
          +                if (r<:-3:> && r<:-2:> == r<:-1:>)
          +                    return r<:-3:>;
          +                if (r<:-2:> && r<:-3:> == r<:-1:>)
          +                    return r<:-2:>;
          +            }

          This e[1] of course is the same as *g as above and as you can see has multiple dimensions (that is the reference to Y does) too (and this is also strewn about the code). In the above I’m referring to the variable in more @@ -218,7 +218,7 @@ which I use as the two chars to compare (this is the plugboard function).

        • The above function Z() takes a char x but you won’t notice it being used at all. Why? In fact I call it like so:
        -
                        k = Z(r<:-1:>=k);
        +
                        k = Z(r<:-1:>=k);

        The char is just used as a way to be able to call the function and assign to the proper variable at the same time: in the function Z I don’t care about x because it’s the same value as r[-1] (which I do care about). Why is it @@ -230,7 +230,7 @@ again negative offsets to cause more confusion.

        refer to the same variable in more than one way (or in some cases maybe more correct to say ‘same location’). In the Z() function for example:
      -
                      r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>;
      +
                      r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>;

      I refer to e[1] as both: *(e+1) and 1[e].

      • Replacing a number of if ..s with ... && (...)s (in one case at least @@ -245,7 +245,7 @@ index (sort of).

      • Another set of char arrays in one: the five rotors as well as the two reflectors in one char [][27]. This makes for some fun code like:

      -
                  (Y<:e<:-10:>+5:><:k-'A':>) && (k = Y<:e<:-10:>+5:><:k-'A':>);
      +
                  (Y<:e<:-10:>+5:><:k-'A':>) && (k = Y<:e<:-10:>+5:><:k-'A':>);

      (Of course this also removes an if statement by joining with a &&).

      • In fact I decided that the above two arrays in arrays needed to be merged @@ -275,18 +275,18 @@ enough because as they rightly point out they can just use the C preprocessor itself. But although I have quite a few cpp directives I am not using them for obfuscation but rather to save bytes. For examples:

      -
                  %:define J(x)                 do(*x)=getchar(); while((*x)=='\n')
      +
                  %:define J(x)                 do(*x)=getchar(); while((*x)=='\n')

      Is used quite a number of times and although it could be a function that takes a pointer to an int it was more convenient this way (I believe it used more bytes but I no longer know that). There are many others and they all save bytes (or at least most of them do if not all). There is one in particular I want to bring up though because I think it’s a curious one and it ties in to another point above:

      -
                  %:define A(y)                                 *(&Y<:7:><:1:>+(y))
      +
                  %:define A(y)                                 *(&Y<:7:><:1:>+(y))

      What is special about this one: Above I noted how I sort of refer directly to the notch settings (I think it was the notch settings anyway). Now I could have done say

      -
                  char a = Y[7][1], b = Y[7][3], c = Y[7][5];
      +
                  char a = Y[7][1], b = Y[7][3], c = Y[7][5];

      But I felt that doing instead the pointer arithmetic was worth doing. However it used significantly more bytes even as a macro: 17 if I recall right. That’s with the macro. If I were to include it three times by itself @@ -314,9 +314,9 @@ differently (and separated) so that one cannot easily replace the char

    • Also what is this about ?

    -
                                    /\
    -                    /           This is     *not* what you think:
    -                            void D(char*x){ /* ... */ }
    +
                                    /\
    +                    /           This is     *not* what you think:
    +                            void D(char*x){ /* ... */ }

    Is that valid and if so how does it function? Yes it’s valid but I’ll leave the other part of the question up to the reader to answer. Hint: you already know how it works (yes, really you do)! Another hint: This is and is not a diff --git a/2020/ferguson2/obfuscation.md b/2020/ferguson2/obfuscation.md index 16f331175..4d0ea37bc 100644 --- a/2020/ferguson2/obfuscation.md +++ b/2020/ferguson2/obfuscation.md @@ -19,13 +19,13 @@ there is an aesthetic appeal to my eyes too). Y<:19:><:27:> but it's not the only example. Here the compound literal of 13 ints: -```c +``` int *z=(int[13]) { 0 } , *e, *g; ``` Then in main: -```c +``` e = z + 10; g = e + 1; @@ -39,14 +39,14 @@ ints: more confusing still. There are at least two other ways that are much easier to read that could accomplish the same thing. It continues on: -```c +``` /* ... */ e<:i-3:> = (j < 1 ? 1 : (j > 5 ? 5 : j))-1; ``` * Observe these two functions: -```c +``` void w(char *s, int k, int v) { for(e<:2:> = 0; s<:*P:>; ++e<:2:>) @@ -96,7 +96,7 @@ temporary variable instead of a regular int in the function (so make it global); and (2) I didn't want to risk changing all the offsets: thus I just made that address `e[1]`. Thus I also have: -```c +``` for (*g = 0 ; *g < 10; ++*g) { r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>; @@ -117,7 +117,7 @@ address `e[1]`. Thus I also have: * The above function Z() takes a `char x` but you won't notice it being used at all. Why? In fact I call it like so: -```c +``` k = Z(r<:-1:>=k); ``` @@ -132,7 +132,7 @@ at all. Why? In fact I call it like so: refer to the same variable in more than one way (or in some cases maybe more correct to say 'same location'). In the Z() function for example: -```c +``` r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>; ``` @@ -153,7 +153,7 @@ index (sort of). * Another set of char arrays in one: the five rotors as well as the two reflectors in one `char [][27]`. This makes for some fun code like: -```c +``` (Y<:e<:-10:>+5:><:k-'A':>) && (k = Y<:e<:-10:>+5:><:k-'A':>); ``` @@ -194,7 +194,7 @@ enough because as they rightly point out they can just use the C preprocessor itself. But although I have quite a few cpp directives I am not using them for obfuscation but rather to save bytes. For examples: -```c +``` %:define J(x) do(*x)=getchar(); while((*x)=='\n') ``` @@ -205,7 +205,7 @@ obfuscation but rather to save bytes. For examples: particular I want to bring up though because I think it's a curious one and it ties in to another point above: -```c +``` %:define A(y) *(&Y<:7:><:1:>+(y)) ``` @@ -213,7 +213,7 @@ obfuscation but rather to save bytes. For examples: to the notch settings (I think it was the notch settings anyway). Now I could have done say -```c +``` char a = Y[7][1], b = Y[7][3], c = Y[7][5]; ``` @@ -248,7 +248,7 @@ variables in recode.c, move them to prog.c, compile and expect it to work right. * Also what is this about ? -```c +``` /\ / This is *not* what you think: void D(char*x){ /* ... */ } diff --git a/2020/ferguson2/recode.html b/2020/ferguson2/recode.html index f1da0cd75..6f6d4cea6 100644 --- a/2020/ferguson2/recode.html +++ b/2020/ferguson2/recode.html @@ -170,34 +170,34 @@ with the Roman numeral, showing their actual orders etc.), the reflectors

    In this file I will show an example of each feature and then get to the wonderful ‘challenge’ for everyone.

    Options

    -
        ./recode -h
    -    usage: ./recode [options]
    -    -v                  display selected settings
    -    -r                  pseudo-randomly select settings
    -    -f<input file>      read file for Enigma input
    -    -R<string|file>     init settings from settings string or file
    -    -o<output file>     write settings to file
    +
        ./recode -h
    +    usage: ./recode [options]
    +    -v                  display selected settings
    +    -r                  pseudo-randomly select settings
    +    -f<input file>      read file for Enigma input
    +    -R<string|file>     init settings from settings string or file
    +    -o<output file>     write settings to file

    -r randomises settings. It won’t prompt you for settings but it will for input if you don’t give the option to read in a file for input.

    -v shows selected settings. For example combining -r and -v:

    -
        $ echo IOCCC | ./recode -r -v
    -    Ring 1: (  I) EKMFLGDQVZNTOWYHXUSPAIBRCJ
    -    Ring 2: (  V) VZBRGITYUPSDNHLXAWMJQOFECK
    -    Ring 3: ( IV) ESOVPZJAYQUIRHXLNFTGKDCMWB
    -    Ring  settings: WAR
    -    Ring positions: XKE
    -    Reflector: (B) YRUHQSLDPXNGOKMIEBFZCWVJAT
    -    Plugboard pair #01: XE
    -    Plugboard pair #02: HJ
    -    Plugboard pair #03: SA
    -    Plugboard pair #04: PY
    -    Plugboard pair #05: CI
    -    Plugboard pair #06: ZB
    -    Plugboard pair #07: WD
    -    Plugboard pair #08: QN
    -    Plugboard pair #09: RU
    -    Plugboard pair #10: VG
    -    1WX5AK4RE1XEHJSAPYCIZBWDQNRUVGIOCCC
    +
        $ echo IOCCC | ./recode -r -v
    +    Ring 1: (  I) EKMFLGDQVZNTOWYHXUSPAIBRCJ
    +    Ring 2: (  V) VZBRGITYUPSDNHLXAWMJQOFECK
    +    Ring 3: ( IV) ESOVPZJAYQUIRHXLNFTGKDCMWB
    +    Ring  settings: WAR
    +    Ring positions: XKE
    +    Reflector: (B) YRUHQSLDPXNGOKMIEBFZCWVJAT
    +    Plugboard pair #01: XE
    +    Plugboard pair #02: HJ
    +    Plugboard pair #03: SA
    +    Plugboard pair #04: PY
    +    Plugboard pair #05: CI
    +    Plugboard pair #06: ZB
    +    Plugboard pair #07: WD
    +    Plugboard pair #08: QN
    +    Plugboard pair #09: RU
    +    Plugboard pair #10: VG
    +    1WX5AK4RE1XEHJSAPYCIZBWDQNRUVGIOCCC

    Though you won’t find some of those strings in recode.c or prog.c. Yes the WAR for the Ringstellung (Ring settings) is an amusing coincidence but it really did happen!

    @@ -207,11 +207,11 @@ encipherment/decipherment). If the file cannot be opened it sets back to stdin.<

    -o outputs the settings to the file. If the file cannot be opened for writing or is the same file name (see below) then only stdout will be used. Example of randomised output going to a file:

    -
        $ ./recode -r -oconfig
    -    IOCCC
    -    3PP4UB5GG1ELGTKFCOPVBNUYXJAWSDIOCCC
    -    $ cat config
    -    3PP4UB5GG1ELGTKFCOPVBNUYXJAWSD$
    +
        $ ./recode -r -oconfig
    +    IOCCC
    +    3PP4UB5GG1ELGTKFCOPVBNUYXJAWSDIOCCC
    +    $ cat config
    +    3PP4UB5GG1ELGTKFCOPVBNUYXJAWSD$

    Notice that a terminating newline isn’t added. Also note that it outputs to stdout so you can pipe it to the Enigma machine but at the same time have the settings saved for deciphering the text later (the configuration does not have @@ -236,7 +236,7 @@ what about if one exists but the other does not?

    File options parser limitation

    Due to the way the parsing of options is done (no spaces between option char and argument) shell expansion will not work right so for example doing:

    -
        $ ./recode -R~/config
    +
        $ ./recode -R~/config

    will not read the file ‘config’ in the home directory. I show another way to achieve this later.

    This limitation also applies to the -f and -o options!

    @@ -246,17 +246,17 @@ the program interactively.

    Piping commands to recode

    If stdin is not a tty (!isatty(0)) and neither randomised mode nor reading in from a file is specified then you might just see something like:

    -
        $ echo testing test tests | ./recode
    -    1AB2BB3CC1testing test tests
    -
    -    $ echo testing test tests | ./recode | ./prog - 2>/dev/null
    -    mfrwxan lzng ofnlu
    -
    -    $ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode
    -    1AB2BB3CC1mfrwxan lzng ofnlu
    -
    -    $ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode | ./prog - 2>/dev/null
    -    testing test tests
    +
        $ echo testing test tests | ./recode
    +    1AB2BB3CC1testing test tests
    +
    +    $ echo testing test tests | ./recode | ./prog - 2>/dev/null
    +    mfrwxan lzng ofnlu
    +
    +    $ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode
    +    1AB2BB3CC1mfrwxan lzng ofnlu
    +
    +    $ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode | ./prog - 2>/dev/null
    +    testing test tests

    In other words just the defaults. This was to simplify the problems with prompting again for input if it’s invalid (though as you’ll see it does a good job at this anyway).

    @@ -265,59 +265,59 @@ job at this anyway).

    input manually (if you randomise or read in from previously saved file no input need be done at all) then make sure to redirect stderr to /dev/null. If you don’t you might see something like:

    -
        $ ./recode -r | ./prog -
    -    Ring 1: IOCCC
    -    Setting 1: Position 1: Ring 2: Setting 2: Position 2: Ring 3: Setting 3: Position 3: Reflector: Plugboard pair 1: Plugboard pair 2: Plugboard pair 3: Plugboard pair 4: Plugboard pair 5: Plugboard pair 6: Plugboard pair 7: Plugboard pair 8: Plugboard pair 9: Plugboard pair 10: DEVIY
    +
        $ ./recode -r | ./prog -
    +    Ring 1: IOCCC
    +    Setting 1: Position 1: Ring 2: Setting 2: Position 2: Ring 3: Setting 3: Position 3: Reflector: Plugboard pair 1: Plugboard pair 2: Plugboard pair 3: Plugboard pair 4: Plugboard pair 5: Plugboard pair 6: Plugboard pair 7: Plugboard pair 8: Plugboard pair 9: Plugboard pair 10: DEVIY

    What happened is that Ring 1: is printed to stderr but since it’s not been redirected to /dev/null it prints this out; at this point however it prompts for input. Why or how it shows the first prompt instead of later on I do not know. Anyway at this point the simulator is already expecting input to en/decipher. That’s why after I sent EOF it printed out the remaining strings to stderr.

    Manually test the recode program with the Enigma program

    -
        $ cat input
    -    IOCCC
    -
    -    $ ./recode -finput
    -    Rotors:
    -    (1)   I: EKMFLGDQVZNTOWYHXUSPAIBRCJ
    -    (2)  II: AJDKSIRUXBLHWTMCQGZNPYFVOE
    -    (3) III: BDFHJLCPRTXVZNYEIWGAKMUSQO
    -    (4)  IV: ESOVPZJAYQUIRHXLNFTGKDCMWB
    -    (5)   V: VZBRGITYUPSDNHLXAWMJQOFECK
    -    Input rotor 1 (1 - 5): 1
    -    Input rotor 2 (1 - 5): 2
    -    Input rotor 3 (1 - 5): 3
    -    Input setting 1 (A - Z): A
    -    Input setting 2 (A - Z): A
    -    Input setting 3 (A - Z): A
    -    Input position 1 (A - Z): A
    -    Input position 2 (A - Z): A
    -    Input position 3 (A - Z): A
    -    Reflector:
    -    (1) (B) YRUHQSLDPXNGOKMIEBFZCWVJAT
    -    (2) (C) FVPJIAOYEDRZXWGCTKUQSBNMHL
    -    Input reflector (1 - 2): 2
    -    Input plugboard pair 1: AB
    -    Input plugboard pair 2: CD
    -    Input plugboard pair 3: ..
    -    Input plugboard pair 4: EF
    -    Input plugboard pair 5: GH
    -    Input plugboard pair 6: IJ
    -    Input plugboard pair 7: KL
    -    Input plugboard pair 8: MN
    -    Input plugboard pair 9: OP
    -    Input plugboard pair 10: QR
    -    1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC
    +
        $ cat input
    +    IOCCC
    +
    +    $ ./recode -finput
    +    Rotors:
    +    (1)   I: EKMFLGDQVZNTOWYHXUSPAIBRCJ
    +    (2)  II: AJDKSIRUXBLHWTMCQGZNPYFVOE
    +    (3) III: BDFHJLCPRTXVZNYEIWGAKMUSQO
    +    (4)  IV: ESOVPZJAYQUIRHXLNFTGKDCMWB
    +    (5)   V: VZBRGITYUPSDNHLXAWMJQOFECK
    +    Input rotor 1 (1 - 5): 1
    +    Input rotor 2 (1 - 5): 2
    +    Input rotor 3 (1 - 5): 3
    +    Input setting 1 (A - Z): A
    +    Input setting 2 (A - Z): A
    +    Input setting 3 (A - Z): A
    +    Input position 1 (A - Z): A
    +    Input position 2 (A - Z): A
    +    Input position 3 (A - Z): A
    +    Reflector:
    +    (1) (B) YRUHQSLDPXNGOKMIEBFZCWVJAT
    +    (2) (C) FVPJIAOYEDRZXWGCTKUQSBNMHL
    +    Input reflector (1 - 2): 2
    +    Input plugboard pair 1: AB
    +    Input plugboard pair 2: CD
    +    Input plugboard pair 3: ..
    +    Input plugboard pair 4: EF
    +    Input plugboard pair 5: GH
    +    Input plugboard pair 6: IJ
    +    Input plugboard pair 7: KL
    +    Input plugboard pair 8: MN
    +    Input plugboard pair 9: OP
    +    Input plugboard pair 10: QR
    +    1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC

    Notice that I skipped a plugboard pair; this can be done in a number of ways but two dots is one. Notice also that it’s in a different order than the simulator: because with the size restrictions on my entry I saved bytes by using the same loop where I could. It just felt more natural to have them grouped together in a configurator for the simulator.

    -
        $ echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC | ./prog - 2>/dev/null
    -    HQNVO
    -    $ echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC  | ./prog - 2>/dev/null | echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRHQNVO | ./prog  - 2>/dev/null
    -    IOCCC
    +
        $ echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC | ./prog - 2>/dev/null
    +    HQNVO
    +    $ echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC  | ./prog - 2>/dev/null | echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRHQNVO | ./prog  - 2>/dev/null
    +    IOCCC

    As you can see the recode program prompts for the settings and outputs the input for the Enigma program. I then copied/pasted that output to the program and got the result HQNVO.

    @@ -330,58 +330,58 @@ part again; I could have just done the latter part but I wanted to show the way the pipeline works with settings etc.

    What happens if the plugboard pairs are the same but in a different order? It’s the same output:

    -
        $ echo 1AA2AA3AA2AB..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null
    -    HQNVO
    +
        $ echo 1AA2AA3AA2AB..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null
    +    HQNVO

    Also if you flip the order of the letters in the pair e.g. the AB as BA instead:

    -
        $ echo 1AA2AA3AA2BA..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null
    -    HQNVO
    +
        $ echo 1AA2AA3AA2BA..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null
    +    HQNVO

    Only write config file

    -
        $ ./recode -v -oconfig -finput >/dev/null
    -    Rotors:
    -    (1)   I: EKMFLGDQVZNTOWYHXUSPAIBRCJ
    -    (2)  II: AJDKSIRUXBLHWTMCQGZNPYFVOE
    -    (3) III: BDFHJLCPRTXVZNYEIWGAKMUSQO
    -    (4)  IV: ESOVPZJAYQUIRHXLNFTGKDCMWB
    -    (5)   V: VZBRGITYUPSDNHLXAWMJQOFECK
    -    Input rotor 1 (1 - 5): 1
    -    Input rotor 2 (1 - 5): 2
    -    Input rotor 3 (1 - 5): 3
    -    Input setting 1 (A - Z): A
    -    Input setting 2 (A - Z): C
    -    Input setting 3 (A - Z): E
    -    Input position 1 (A - Z): B
    -    Input position 2 (A - Z): D
    -    Input position 3 (A - Z): F
    -    Reflector:
    -    (1) (B) YRUHQSLDPXNGOKMIEBFZCWVJAT
    -    (2) (C) FVPJIAOYEDRZXWGCTKUQSBNMHL
    -    Input reflector (1 - 2): 2
    -    Input plugboard pair 1: AB
    -    Input plugboard pair 2: CD
    -    Input plugboard pair 3: EF
    -    Input plugboard pair 4: GHIJ
    -    Input plugboard pair 5: IJ
    -    Input plugboard pair 6: KL
    -    Input plugboard pair 7: MN
    -    Input plugboard pair 8: OP
    -    Input plugboard pair 9: QR
    -    Input plugboard pair 10: ST
    -    Ring 1: (  I) EKMFLGDQVZNTOWYHXUSPAIBRCJ
    -    Ring 2: ( II) AJDKSIRUXBLHWTMCQGZNPYFVOE
    -    Ring 3: (III) BDFHJLCPRTXVZNYEIWGAKMUSQO
    -    Ring  settings: ACE
    -    Ring positions: BDF
    -    Reflector: (C) FVPJIAOYEDRZXWGCTKUQSBNMHL
    -    Plugboard pair #01: AB
    -    Plugboard pair #02: CD
    -    Plugboard pair #03: EF
    -    Plugboard pair #04: GH
    -    Plugboard pair #05: IJ
    -    Plugboard pair #06: KL
    -    Plugboard pair #07: MN
    -    Plugboard pair #08: OP
    -    Plugboard pair #09: QR
    -    Plugboard pair #10: ST
    +
        $ ./recode -v -oconfig -finput >/dev/null
    +    Rotors:
    +    (1)   I: EKMFLGDQVZNTOWYHXUSPAIBRCJ
    +    (2)  II: AJDKSIRUXBLHWTMCQGZNPYFVOE
    +    (3) III: BDFHJLCPRTXVZNYEIWGAKMUSQO
    +    (4)  IV: ESOVPZJAYQUIRHXLNFTGKDCMWB
    +    (5)   V: VZBRGITYUPSDNHLXAWMJQOFECK
    +    Input rotor 1 (1 - 5): 1
    +    Input rotor 2 (1 - 5): 2
    +    Input rotor 3 (1 - 5): 3
    +    Input setting 1 (A - Z): A
    +    Input setting 2 (A - Z): C
    +    Input setting 3 (A - Z): E
    +    Input position 1 (A - Z): B
    +    Input position 2 (A - Z): D
    +    Input position 3 (A - Z): F
    +    Reflector:
    +    (1) (B) YRUHQSLDPXNGOKMIEBFZCWVJAT
    +    (2) (C) FVPJIAOYEDRZXWGCTKUQSBNMHL
    +    Input reflector (1 - 2): 2
    +    Input plugboard pair 1: AB
    +    Input plugboard pair 2: CD
    +    Input plugboard pair 3: EF
    +    Input plugboard pair 4: GHIJ
    +    Input plugboard pair 5: IJ
    +    Input plugboard pair 6: KL
    +    Input plugboard pair 7: MN
    +    Input plugboard pair 8: OP
    +    Input plugboard pair 9: QR
    +    Input plugboard pair 10: ST
    +    Ring 1: (  I) EKMFLGDQVZNTOWYHXUSPAIBRCJ
    +    Ring 2: ( II) AJDKSIRUXBLHWTMCQGZNPYFVOE
    +    Ring 3: (III) BDFHJLCPRTXVZNYEIWGAKMUSQO
    +    Ring  settings: ACE
    +    Ring positions: BDF
    +    Reflector: (C) FVPJIAOYEDRZXWGCTKUQSBNMHL
    +    Plugboard pair #01: AB
    +    Plugboard pair #02: CD
    +    Plugboard pair #03: EF
    +    Plugboard pair #04: GH
    +    Plugboard pair #05: IJ
    +    Plugboard pair #06: KL
    +    Plugboard pair #07: MN
    +    Plugboard pair #08: OP
    +    Plugboard pair #09: QR
    +    Plugboard pair #10: ST

    Notice that I redirect stdout to /dev/null so that the config is only written to the file config. But also notice that for plugboard pair 4 I typed in GHIJ @@ -389,55 +389,55 @@ and it didn’t report an error. Neither did it complain about IJ i pair. This is because it consumes input overflow.

    It shouldn’t be this way for the simulator though because that could cause inconsistent number of characters expected before the text to encipher.

    -
        $ cat config
    -    1AB2CD3EF2ABCDEFGHIJKLMNOPQRST
    -
    -    $ ( cat config ; cat input ) | ./prog - 2>/dev/null
    -    LRAVE
    -
    -    $ ( cat config ; cat input ) | ./prog - 2>/dev/null | ( cat config ; echo LRAVE ) | ./prog  - 2>/dev/null
    -    IOCCC
    +
        $ cat config
    +    1AB2CD3EF2ABCDEFGHIJKLMNOPQRST
    +
    +    $ ( cat config ; cat input ) | ./prog - 2>/dev/null
    +    LRAVE
    +
    +    $ ( cat config ; cat input ) | ./prog - 2>/dev/null | ( cat config ; echo LRAVE ) | ./prog  - 2>/dev/null
    +    IOCCC

    What if you don’t want to worry about having to specify input but just have the settings written? You can do that too by either sending a newline or else directly type ctrl-d (or whatever you have EOF set to) or give it an empty file.

    The following are all equivalent in that they will write to a settings file (the first one will print a newline with the echo but that won’t matter):

    -
        $ echo | ./recode -r -osettings
    -    $ echo -n | ./recode -r -osettings
    -    $ > empty
    -    $ ./recode -r -osettings < empty
    -    $ cat empty | ./recode -r -osettings
    -    $ ./recode -r -osettings
    -    ^D
    +
        $ echo | ./recode -r -osettings
    +    $ echo -n | ./recode -r -osettings
    +    $ > empty
    +    $ ./recode -r -osettings < empty
    +    $ cat empty | ./recode -r -osettings
    +    $ ./recode -r -osettings
    +    ^D

    (Above ^D was not shown but I typed it.) The way it works: if nothing is read the buffer remains NULL and so I don’t print it but still do print the settings file. (Actually even if getdelim() fails you’re supposed to free the buffer so I set another variable to indicate if it should be printed.)

    Reusing a configuration

    -
        $ echo -n|./recode -r -oconfig
    -    4UH5II1RJ1SPIFEJLYGZWRTBHVCAMN$
    -
    -    $ cat input.txt
    -    IOCCC 2020 Enigma simulator example text file
    -
    -    This is a sentence.
    -
    -    This is another sentence.
    -
    -    $ ( cat config ; cat input.txt  ) | ./prog - 2>/dev/null > output
    -    $ cat output
    -    AAPRT 2020 Dkemny tpgnjsjai xpovrgl jvgs wxra
    -
    -    Fytt ly m xyiilaqh.
    -
    -    Ybbp ox dmuzerm oscwgytb.
    -    $ ( cat config ; cat output ) | ./prog  - 2>/dev/null > io
    -    $ diff io input.txt
    -    $
    +
        $ echo -n|./recode -r -oconfig
    +    4UH5II1RJ1SPIFEJLYGZWRTBHVCAMN$
    +
    +    $ cat input.txt
    +    IOCCC 2020 Enigma simulator example text file
    +
    +    This is a sentence.
    +
    +    This is another sentence.
    +
    +    $ ( cat config ; cat input.txt  ) | ./prog - 2>/dev/null > output
    +    $ cat output
    +    AAPRT 2020 Dkemny tpgnjsjai xpovrgl jvgs wxra
    +
    +    Fytt ly m xyiilaqh.
    +
    +    Ybbp ox dmuzerm oscwgytb.
    +    $ ( cat config ; cat output ) | ./prog  - 2>/dev/null > io
    +    $ diff io input.txt
    +    $

    Alternatively you can just use the -R and -f options:

    -
        $ ./recode -finput.txt -Rconfig | ./prog - 2>/dev/null > output2
    -    $ diff output output2
    -    $
    +
        $ ./recode -finput.txt -Rconfig | ./prog - 2>/dev/null > output2
    +    $ diff output output2
    +    $

    Write config file, read data file and pass to Enigma simulator

        $ ./recode -finput.txt -oconfig | ./prog - 2>/dev/null > output
         Rotors:
    @@ -476,37 +476,37 @@ set another variable to indicate if it should be printed.)

    Cody?) there’s also a reference to code which I also love (just as all participants of the IOCCC do). Other things there don’t mean anything but what does is the output:

    -
        $ cat output
    -    DBFAF 2020 Ittejg ltblwriac uqdfqvr dhqh ghhf
    -
    -    Jsjy ce v pxdmullo.
    -
    -    Sara tj rtaayak uxfhjcti.
    -
    -    $ ./recode -Rconfig -foutput | ./prog - 2>/dev/null
    -    IOCCC 2020 Enigma simulator example text file
    -
    -    This is a sentence.
    -
    -    This is another sentence.
    +
        $ cat output
    +    DBFAF 2020 Ittejg ltblwriac uqdfqvr dhqh ghhf
    +
    +    Jsjy ce v pxdmullo.
    +
    +    Sara tj rtaayak uxfhjcti.
    +
    +    $ ./recode -Rconfig -foutput | ./prog - 2>/dev/null
    +    IOCCC 2020 Enigma simulator example text file
    +
    +    This is a sentence.
    +
    +    This is another sentence.

    Piping directly to the Enigma code once (with randomised settings, saved)

    This is like the above only randomised:

    -
        $ ./recode -r -oconfig|./prog - 2>/dev/null
    -    IOCCC
    -    UGEVP
    +
        $ ./recode -r -oconfig|./prog - 2>/dev/null
    +    IOCCC
    +    UGEVP

    Note that I typed in IOCCC and sent EOF (ctrl-d); the settings were written to the config file (for deciphering later) and then all of it was piped to the Enigma entry resulting in the line below IOCCC. But let’s verify it worked out okay:

    -
        $ cat config
    -    2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ
    +
        $ cat config
    +    2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ

    Without having to copy/paste intermediate results:

    -
        $ echo IOCCC | ./recode -Rconfig | ./prog - 2>/dev/null | ./recode -Rconfig | ./prog - 2>/dev/null
    -    IOCCC
    +
        $ echo IOCCC | ./recode -Rconfig | ./prog - 2>/dev/null | ./recode -Rconfig | ./prog - 2>/dev/null
    +    IOCCC

    You can also use a string for the -R option. I’ll use command substitution and actual pasting to demonstrate:

    -
        $ echo IOCCC | ./recode -R$(cat config) | ./prog - 2>/dev/null | ./recode -R2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ | ./prog - 2>/dev/null
    -    IOCCC
    +
        $ echo IOCCC | ./recode -R$(cat config) | ./prog - 2>/dev/null | ./recode -R2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ | ./prog - 2>/dev/null
    +    IOCCC

    Usage conclusion

    That should give you an idea of how to use the recode program. I leave it as an exercise to the reader to implement additional features but here are some @@ -585,7 +585,7 @@ think that I would give too much away? :)

    the key you wish to select is

        0EZ4PC1CC0PGTAQSOXWNMDRYKFUZEI

    you can do:

    -
        ./recode -R0EZ4PC1CC0PGTAQSOXWNMDRYKFUZEI -fencrypted.html | ./prog - 2>/dev/null > decrypted.html
    +
        ./recode -R0EZ4PC1CC0PGTAQSOXWNMDRYKFUZEI -fencrypted.html | ./prog - 2>/dev/null > decrypted.html

    Then open decrypted.html in your browser.

    ./recode -h usage: ./recode [options] -v display selected settings @@ -71,7 +71,7 @@ if you don't give the option to read in a file for input. `-v` shows selected settings. For example combining `-r` and `-v`: -```sh +``` $ echo IOCCC | ./recode -r -v Ring 1: ( I) EKMFLGDQVZNTOWYHXUSPAIBRCJ Ring 2: ( V) VZBRGITYUPSDNHLXAWMJQOFECK @@ -104,7 +104,7 @@ encipherment/decipherment). If the file cannot be opened it sets back to stdin. or is the same file name (see below) then only stdout will be used. Example of randomised output going to a file: -```sh +``` $ ./recode -r -oconfig IOCCC 3PP4UB5GG1ELGTKFCOPVBNUYXJAWSDIOCCC @@ -143,7 +143,7 @@ what about if one exists but the other does not? Due to the way the parsing of options is done (no spaces between option char and argument) shell expansion will not work right so for example doing: -```sh +``` $ ./recode -R~/config ``` @@ -163,7 +163,7 @@ the program interactively. If stdin is not a tty (`!isatty(0)`) and neither randomised mode nor reading in from a file is specified then you might just see something like: -```sh +``` $ echo testing test tests | ./recode 1AB2BB3CC1testing test tests @@ -189,7 +189,7 @@ input manually (if you randomise or read in from previously saved file no input need be done at all) then make sure to redirect stderr to /dev/null. If you don't you might see something like: -```sh +``` $ ./recode -r | ./prog - Ring 1: IOCCC Setting 1: Position 1: Ring 2: Setting 2: Position 2: Ring 3: Setting 3: Position 3: Reflector: Plugboard pair 1: Plugboard pair 2: Plugboard pair 3: Plugboard pair 4: Plugboard pair 5: Plugboard pair 6: Plugboard pair 7: Plugboard pair 8: Plugboard pair 9: Plugboard pair 10: DEVIY @@ -205,7 +205,7 @@ That's why after I sent EOF it printed out the remaining strings to stderr. # Manually test the recode program with the Enigma program -```sh +``` $ cat input IOCCC @@ -249,7 +249,7 @@ than the simulator: because with the size restrictions on my entry I saved bytes by using the same loop where I could. It just felt more natural to have them grouped together in a configurator for the [simulator](prog.c). -```sh +``` $ echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC | ./prog - 2>/dev/null HQNVO $ echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC | ./prog - 2>/dev/null | echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRHQNVO | ./prog - 2>/dev/null @@ -273,21 +273,21 @@ What happens if the plugboard pairs are the same but in a different order? It's the same output: -```sh +``` $ echo 1AA2AA3AA2AB..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null HQNVO ``` Also if you flip the order of the letters in the pair e.g. the AB as BA instead: -```sh +``` $ echo 1AA2AA3AA2BA..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null HQNVO ``` # Only write config file -```sh +``` $ ./recode -v -oconfig -finput >/dev/null Rotors: (1) I: EKMFLGDQVZNTOWYHXUSPAIBRCJ @@ -345,7 +345,7 @@ pair. This is because it consumes input overflow. It shouldn't be this way for the simulator though because that could cause inconsistent number of characters expected before the text to encipher. -```sh +``` $ cat config 1AB2CD3EF2ABCDEFGHIJKLMNOPQRST @@ -363,7 +363,7 @@ directly type ctrl-d (or whatever you have EOF set to) or give it an empty file. The following are all equivalent in that they will write to a settings file (the first one will print a newline with the echo but that won't matter): -```sh +``` $ echo | ./recode -r -osettings $ echo -n | ./recode -r -osettings $ > empty @@ -380,7 +380,7 @@ set another variable to indicate if it should be printed.) # Reusing a configuration -```sh +``` $ echo -n|./recode -r -oconfig 4UH5II1RJ1SPIFEJLYGZWRTBHVCAMN$ @@ -405,7 +405,7 @@ set another variable to indicate if it should be printed.) Alternatively you can just use the `-R` and `-f` options: -```sh +``` $ ./recode -finput.txt -Rconfig | ./prog - 2>/dev/null > output2 $ diff output output2 $ @@ -456,7 +456,7 @@ participants of the IOCCC do). Other things there don't mean anything but what does is the output: -```sh +``` $ cat output DBFAF 2020 Ittejg ltblwriac uqdfqvr dhqh ghhf @@ -477,7 +477,7 @@ does is the output: This is like the above only randomised: -```sh +``` $ ./recode -r -oconfig|./prog - 2>/dev/null IOCCC UGEVP @@ -489,14 +489,14 @@ the config file (for deciphering later) and then all of it was piped to the Enigma entry resulting in the line below IOCCC. But let's verify it worked out okay: -```sh +``` $ cat config 2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ ``` Without having to copy/paste intermediate results: -```sh +``` $ echo IOCCC | ./recode -Rconfig | ./prog - 2>/dev/null | ./recode -Rconfig | ./prog - 2>/dev/null IOCCC ``` @@ -504,7 +504,7 @@ Without having to copy/paste intermediate results: You can also use a string for the `-R` option. I'll use command substitution and actual pasting to demonstrate: -```sh +``` $ echo IOCCC | ./recode -R$(cat config) | ./prog - 2>/dev/null | ./recode -R2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ | ./prog - 2>/dev/null IOCCC ``` @@ -612,7 +612,7 @@ the key you wish to select is you can do: -```sh +``` ./recode -R0EZ4PC1CC0PGTAQSOXWNMDRYKFUZEI -fencrypted.html | ./prog - 2>/dev/null > decrypted.html ``` diff --git a/2020/giles/README.md b/2020/giles/README.md index 97c8b1c15..8c3c444c9 100644 --- a/2020/giles/README.md +++ b/2020/giles/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -18,7 +18,7 @@ For more detailed information see [2020 giles bugs](../../bugs.html#2020_giles). ## To use: -```sh +``` ./prog < dtmf.wav ./prog [digits] > digits.wav @@ -33,7 +33,7 @@ will be converted to the DTMF sound! ## Try: -```sh +``` ./try.sh ./prog < pi.wav @@ -71,7 +71,7 @@ exactly 16 bits per sample, but it allows any sample rate and any number of audio channels. -```sh +``` $ ./prog < pi.wav 31415926 ``` @@ -80,7 +80,7 @@ If the program is executed with a command-line argument, it will generate the tones corresponding to the specified characters, writing them to standard output as a WAV file. -```sh +``` $ ./prog 867-5309 | aplay ``` diff --git a/2020/giles/index.html b/2020/giles/index.html index 0174c263f..8e2e9ff31 100644 --- a/2020/giles/index.html +++ b/2020/giles/index.html @@ -141,26 +141,26 @@ Location: AU - Commonwealth of Australi

    To build:

    -
        make
    +
        make

    Bugs and (Mis)features:

    The current status of this entry is:

        STATUS: INABIAF - please **DO NOT** fix

    For more detailed information see 2020 giles bugs.

    To use:

    -
        ./prog < dtmf.wav
    -
    -    ./prog [digits] > digits.wav
    +
        ./prog < dtmf.wav
    +
    +    ./prog [digits] > digits.wav

    where dtmf.wav is a WAV file of the dialling of a number being dialled with DTMF (Dual-tone multi frequency) (more commonly known as Touch-Tone) and [digits] is a sequence of digits that will be converted to the DTMF sound!

    Try:

    -
        ./try.sh
    -    ./prog < pi.wav
    -
    -    # See
    -    ./prog 867-5309 > jenny.wav
    +
        ./try.sh
    +    ./prog < pi.wav
    +
    +    # See
    +    ./prog 867-5309 > jenny.wav

    If the script try.sh did not play a WAV file, it means you do not have SoX installed; see FAQ 3.10: How do I compile and use an IOCCC entry that requires sound?). In this case install it and try it again or @@ -180,12 +180,12 @@ standard input, decode the touch-tones in the file, and output the corresponding digits to standard output. This program only supports WAV files that have exactly 16 bits per sample, but it allows any sample rate and any number of audio channels.

    -
        $ ./prog < pi.wav
    -    31415926
    +
        $ ./prog < pi.wav
    +    31415926

    If the program is executed with a command-line argument, it will generate the tones corresponding to the specified characters, writing them to standard output as a WAV file.

    -
        $ ./prog 867-5309 | aplay
    +
        $ ./prog 867-5309 | aplay

    Interesting Features

    • When compiled with gcc -pedantic -Wall -Wextra there are no compiler diff --git a/2020/kurdyukov1/README.md b/2020/kurdyukov1/README.md index 227c9411b..1102c11b6 100644 --- a/2020/kurdyukov1/README.md +++ b/2020/kurdyukov1/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -10,7 +10,7 @@ code](#alternate-code) below for more details. ## To use: -```sh +``` ./prog # input some text @@ -22,7 +22,7 @@ code](#alternate-code) below for more details. ## Try: -```sh +``` ./try.sh ``` @@ -46,7 +46,7 @@ are the program in assembly for x86_64 linux and x86 linux respectively. To build [prog.alt.c](prog.alt.c): -```sh +``` make alt ``` diff --git a/2020/kurdyukov1/index.html b/2020/kurdyukov1/index.html index a970ea07d..c7dcf8332 100644 --- a/2020/kurdyukov1/index.html +++ b/2020/kurdyukov1/index.html @@ -141,18 +141,18 @@ Location: RU - Russian Federation

      To build:

      -
          make
      +
          make

      There are alternate versions of this entry. See Alternate code below for more details.

      To use:

      -
          ./prog
      -    # input some text
      -
      -    echo text | ./prog
      -
      -    ./prog < file
      +
          ./prog
      +    # input some text
      +
      +    echo text | ./prog
      +
      +    ./prog < file

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Alternate code:

      There are a number of alternate versions for this program, some in C and some in assembly.

      @@ -164,7 +164,7 @@ different social media profile covers as well as different shapes.

      are the program in assembly for x86_64 linux and x86 linux respectively.

      Alternate build:

      To build prog.alt.c:

      -
          make alt
      +
          make alt

      Alternate use:

      Use prog.alt as you would prog above.

      Judges’ remarks:

      diff --git a/2020/kurdyukov2/README.md b/2020/kurdyukov2/README.md index 389aeb676..dfbaebff7 100644 --- a/2020/kurdyukov2/README.md +++ b/2020/kurdyukov2/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` # Take a selfie ./prog 1000 selfie.jpg output.jpg # Admire your portrait in cubist style @@ -41,7 +41,7 @@ This program divides the image into a specified number of rectangles. This process is content aware, so the algorithm tries to match most of the information. However, it doesn't find the best theoretically possible layout. -```sh +``` ./prog 1000 input.jpg output.jpg ``` @@ -56,13 +56,13 @@ If you want to use `libjpeg` compiled from sources, then use the `LIBJPEG` defin specify the path to includes and the library. For example using [libjpeg source](https://mac-dev-env.patrickbougie.com/libjpeg/) version 9c: -```sh +``` make prog LIBJPEG="-Ijpeg-9c jpeg-9c/libjpeg.a" ``` Use this command to build a PNG version (you need `libpng`): -```sh +``` make prog_png LIBPNG="-lpng" ``` @@ -80,13 +80,13 @@ information! First, make sure you have the compiler tools installed e.g. by: -```sh +``` sudo xcode-select --install ``` Make sure you install [MacPorts](https://www.macports.org/install.php). Then do: -```sh +``` sudo port install jpeg libpng ImageMagick ``` @@ -95,7 +95,7 @@ GIFs from the results using `makegif.sh`. After that’s installed you need to run make with these options: -```sh +``` make LDFLAGS="-I/opt/local/include -L/opt/local/lib" ``` @@ -103,7 +103,7 @@ After that’s installed you need to run make with these options: First, make sure you have the compiler tools installed e.g. by: -```sh +``` sudo xcode-select --install ``` @@ -111,14 +111,14 @@ Make sure you install [Homebrew](https://brew.sh). Then: -```sh +``` brew install libjpeg libpng eval "$(brew shellenv)" ``` You are now ready to compile this entry: -```sh +``` make clobber all ``` @@ -139,7 +139,7 @@ vertically to get the minimum difference. You can use this command to make a GIF from output images (uses ImageMagick). For instance after running the command suggested by the judges: -```sh +``` convert -delay 10 -dither none -loop 0 $(find . -maxdepth 1 -type f -name '*jpg' | sort -V) $(find . -maxdepth 1 -type f -name '*jpg' | sort -rV) +map out.gif ``` diff --git a/2020/kurdyukov2/index.html b/2020/kurdyukov2/index.html index c4da60725..60d46857f 100644 --- a/2020/kurdyukov2/index.html +++ b/2020/kurdyukov2/index.html @@ -141,16 +141,16 @@ Location: RU - Russian Federation

      To build:

      -
          make
      +
          make

      To use:

      -
          ./prog
      +
          ./prog

      Try:

      -
          # Take a selfie
      -    ./prog 1000 selfie.jpg output.jpg
      -    # Admire your portrait in cubist style
      -
      -    # Also try:
      -    ./try.sh
      +
          # Take a selfie
      +    ./prog 1000 selfie.jpg output.jpg
      +    # Admire your portrait in cubist style
      +
      +    # Also try:
      +    ./try.sh

      Judges’ remarks:

      This entry has reminded us of a winning entry back in the early 90s. Can you guess which one?

      @@ -161,7 +161,7 @@ rectangles. What is the complexity? Is it obvious from the source code?

      This program divides the image into a specified number of rectangles. This process is content aware, so the algorithm tries to match most of the information. However, it doesn’t find the best theoretically possible layout.

      -
          ./prog 1000 input.jpg output.jpg
      +
          ./prog 1000 input.jpg output.jpg

      Building

      You can build three versions, depending on the image format.

      Default is JPEG version; if you have the libjpeg development package installed @@ -169,9 +169,9 @@ in your system, then make without arguments should do the right thi

      If you want to use libjpeg compiled from sources, then use the LIBJPEG define to specify the path to includes and the library. For example using libjpeg source version 9c:

      -
          make prog LIBJPEG="-Ijpeg-9c jpeg-9c/libjpeg.a"
      +
          make prog LIBJPEG="-Ijpeg-9c jpeg-9c/libjpeg.a"

      Use this command to build a PNG version (you need libpng):

      -
          make prog_png LIBPNG="-lpng"
      +
          make prog_png LIBPNG="-lpng"

      And the PPM version (no additional dependencies, can read raw/ASCII PPM, writes raw PPM):

          make prog_ppm
      @@ -179,22 +179,22 @@ raw PPM):

      Thanks to Cody Boone Ferguson for this information!

      First, make sure you have the compiler tools installed e.g. by:

      -
          sudo xcode-select --install
      +
          sudo xcode-select --install

      Make sure you install MacPorts. Then do:

      -
          sudo port install jpeg libpng ImageMagick
      +
          sudo port install jpeg libpng ImageMagick

      The program itself doesn’t need ImageMagick, install it only if you plan to make GIFs from the results using makegif.sh.

      After that’s installed you need to run make with these options:

      -
          make LDFLAGS="-I/opt/local/include -L/opt/local/lib"
      +
          make LDFLAGS="-I/opt/local/include -L/opt/local/lib"

      Building on macOS with Homebrew

      First, make sure you have the compiler tools installed e.g. by:

      -
          sudo xcode-select --install
      +
          sudo xcode-select --install

      Make sure you install Homebrew.

      Then:

      -
          brew install libjpeg libpng
      -    eval "$(brew shellenv)"
      +
          brew install libjpeg libpng
      +    eval "$(brew shellenv)"

      You are now ready to compile this entry:

      -
          make clobber all
      +
          make clobber all

      Notes

      Made this thing while experimenting with the idea of representing an image with rectangles (lossy compression). It’s not very good in that sense, but the @@ -206,7 +206,7 @@ the picture data is split (halves may have different size) horizontally or vertically to get the minimum difference.

      You can use this command to make a GIF from output images (uses ImageMagick). For instance after running the command suggested by the judges:

      -
          convert -delay 10 -dither none -loop 0 $(find . -maxdepth 1 -type f -name '*jpg' | sort -V) $(find . -maxdepth 1 -type f -name '*jpg' | sort -rV) +map out.gif
      +
          convert -delay 10 -dither none -loop 0 $(find . -maxdepth 1 -type f -name '*jpg' | sort -V) $(find . -maxdepth 1 -type f -name '*jpg' | sort -rV) +map out.gif

      NOTE: the above is done in the try.sh script.

      Also provided makegif.sh to aid with GIF creation.

      make ``` @@ -10,14 +10,14 @@ code](#alternate-code) below. ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` ./try.sh ``` @@ -29,7 +29,7 @@ The alternate version, [prog.alt.c](prog.alt.c), has the main code as a macro. ### Alternate build: -```sh +``` make alt ``` @@ -61,7 +61,7 @@ exactly what it says nonetheless. Compile and try this: -```sh +``` cat input.txt | ./prog ``` diff --git a/2020/kurdyukov3/index.html b/2020/kurdyukov3/index.html index 80d1ed3ed..409255004 100644 --- a/2020/kurdyukov3/index.html +++ b/2020/kurdyukov3/index.html @@ -141,17 +141,17 @@ Location: RU - Russian Federation

      To build:

      -
          make
      +
          make

      There is an alternate version of this program. See Alternate code below.

      To use:

      -
          ./prog
      +
          ./prog

      Try:

      -
          ./try.sh
      +
          ./try.sh

      Alternate code:

      The alternate version, prog.alt.c, has the main code as a macro.

      Alternate build:

      -
          make alt
      +
          make alt

      Alternate use:

      Use prog.alt as you would prog above.

      Judges’ remarks:

      @@ -169,7 +169,7 @@ exactly what it says nonetheless.

      Author’s remarks:

      Letter Mixer

      Compile and try this:

      -
          cat input.txt | ./prog
      +
          cat input.txt | ./prog

      The program can work with letters that are not represented in English, as long as these letters are encoded in the higher part of the single-byte character set (use iconv to convert from UTF-8 and back).

      diff --git a/2020/kurdyukov4/README.md b/2020/kurdyukov4/README.md index e8f7234cd..56314f481 100644 --- a/2020/kurdyukov4/README.md +++ b/2020/kurdyukov4/README.md @@ -1,13 +1,13 @@ ## To build: -```sh +``` make ``` ## To use: -```sh +``` ./prog text_file output_length context_length random_seed ``` @@ -17,7 +17,7 @@ When running this, ask yourself why it gets progressively slower when the context length decreases: -```sh +``` ./try.sh ``` @@ -70,7 +70,7 @@ Now can you appreciate the award title a bit better? ### Building: -```sh +``` cc prog.c -o prog ``` @@ -79,7 +79,7 @@ Now can you appreciate the award title a bit better? This program generates random text from the provided dictionary using a Markov chain, outputting to `stdout`. -```sh +``` ./prog input.txt 2000 10 12345 ``` @@ -110,7 +110,7 @@ You can try this with the inputs provided with [2019/mills](../../2019/mills/index.html) from the IOCCC entries. -```sh +``` $ ./prog Shakespeare.txt 2001 10 12345 ``` diff --git a/2020/kurdyukov4/index.html b/2020/kurdyukov4/index.html index c68502143..2cd9f1eb1 100644 --- a/2020/kurdyukov4/index.html +++ b/2020/kurdyukov4/index.html @@ -141,13 +141,13 @@ Location: RU - Russian Federation

      To build:

      -
          make
      +
          make

      To use:

      -
          ./prog text_file output_length context_length random_seed
      +
          ./prog text_file output_length context_length random_seed

      Try:

      When running this, ask yourself why it gets progressively slower when the context length decreases:

      -
          ./try.sh
      +
          ./try.sh

      Performance depends on the number of same hashes found. Too many identical strings if the context length is small. @@ -183,11 +183,11 @@ Middle-earth (HoMe). Now can you appreciate the award title a bit better?

      Author’s remarks:

      Building:

      -
          cc prog.c -o prog
      +
          cc prog.c -o prog

      Usage:

      This program generates random text from the provided dictionary using a Markov chain, outputting to stdout.

      -
          ./prog input.txt 2000 10 12345
      +
          ./prog input.txt 2000 10 12345

      Parameters are:

      1. dictionary filename @@ -209,7 +209,7 @@ the output of this size in bytes exists somewhere in the dictionary.

      2. Example

        You can try this with the inputs provided with 2019/mills from the IOCCC entries.

        -
            $ ./prog Shakespeare.txt 2001 10 12345
        +
            $ ./prog Shakespeare.txt 2001 10 12345

        produces:

            r sons, wives for them, as the hope I had it. This is the way they be not too ra
             sh a trial of you only. Therefore will not out of door? Nurse: Marry, bachelor,
        diff --git a/2020/otterness/README.md b/2020/otterness/README.md
        index b7f3806ff..fce019a44 100644
        --- a/2020/otterness/README.md
        +++ b/2020/otterness/README.md
        @@ -1,6 +1,6 @@
         ## To build:
         
        -```sh
        +```
             make
         ```
         
        @@ -18,14 +18,14 @@ For more detailed information see [2020 otterness bugs](../../bugs.html#2020_ott
         
         ## To use:
         
        -```sh
        +```
             ./prog
         ```
         
         
         ## Try:
         
        -```sh
        +```
             ./try.sh
         ```
         
        @@ -74,7 +74,7 @@ for most of my testing (see [cvikl.mid](cvikl.mid)).
         Compile the program using the following command (I tested this using both
         `clang` and `gcc`):
         
        -```sh
        +```
             cc -pedantic -Wall -Werror -Wextra -O3 -o prog prog.c
         ```
         
        diff --git a/2020/otterness/index.html b/2020/otterness/index.html
        index 26882e265..a51e2a7c9 100644
        --- a/2020/otterness/index.html
        +++ b/2020/otterness/index.html
        @@ -141,15 +141,15 @@ Location: US - United States of America
         
         
         

        To build:

        -
            make
        +
            make

        Bugs and (Mis)features:

        The current status of this entry is:

            STATUS: INABIAF - please **DO NOT** fix

        For more detailed information see 2020 otterness bugs.

        To use:

        -
            ./prog
        +
            ./prog

        Try:

        -
            ./try.sh
        +
            ./try.sh

        Now play output.mid and output2.mid in an audio player that can play MIDI files.

        Judges’ remarks:

        @@ -179,7 +179,7 @@ for most of my testing (see cvikl.mid).

        Usage

        Compile the program using the following command (I tested this using both clang and gcc):

        -
            cc -pedantic -Wall -Werror -Wextra -O3 -o prog prog.c
        +
            cc -pedantic -Wall -Werror -Wextra -O3 -o prog prog.c

        The program expects a MIDI on stdin, and writes a modified MIDI to stdout:

            ./prog <input.mid >output.mid

        If the program encounters an error, no output will generally be produced, and diff --git a/2020/tsoj/README.md b/2020/tsoj/README.md index f0584ee54..f3300a74d 100644 --- a/2020/tsoj/README.md +++ b/2020/tsoj/README.md @@ -1,6 +1,6 @@ ## To build: -```sh +``` make ``` @@ -11,14 +11,14 @@ to those familiar with vi. See [Alternate code](#alternate-code) below. ## To use: -```sh +``` ./prog ``` ## Try: -```sh +``` # Make your terminal as large as possible, possibly reduce your font size # then... ./prog @@ -33,14 +33,14 @@ where instead of `w`, `a`, `s` and `d`, you can use `k`, `h`, `j` and `l`. ### Alternate build: -```sh +``` make alt ``` ### Alternate use: -```sh +``` # Make your terminal as large as possible, possibly reduce your font size # then... ./prog.alt diff --git a/2020/tsoj/index.html b/2020/tsoj/index.html index 299f12b18..ce72928a5 100644 --- a/2020/tsoj/index.html +++ b/2020/tsoj/index.html @@ -141,24 +141,24 @@ Location: DE - Federal Republic of Germ

        To build:

        -
            make
        +
            make

        There is an alternate version which has controls that will make much more sense to those familiar with vi. See Alternate code below.

        To use:

        -
            ./prog
        +
            ./prog

        Try:

        -
            # Make your terminal as large as possible, possibly reduce your font size
        -    # then...
        -    ./prog
        +
            # Make your terminal as large as possible, possibly reduce your font size
        +    # then...
        +    ./prog

        Alternate code:

        This version has the difference of moving forwards, left, backwards and right, where instead of w, a, s and d, you can use k, h, j and l.

        Alternate build:

        -
            make alt
        +
            make alt

        Alternate use:

        -
            # Make your terminal as large as possible, possibly reduce your font size
        -    # then...
        -    ./prog.alt
        +
            # Make your terminal as large as possible, possibly reduce your font size
        +    # then...
        +    ./prog.alt

        ..and maybe curse less than you might otherwise, but still probably curse (see below) :-)

        Judges’ remarks:

        diff --git a/2020/yang/README.md b/2020/yang/README.md index dac49559d..7e0bccf2a 100644 --- a/2020/yang/README.md +++ b/2020/yang/README.md @@ -1,20 +1,20 @@ ## To build: -```sh +```--> make ``` ## To use: -```sh +```--> ./prog [PIN] < input.txt > output.c ``` ## Try: -```sh +```--> ./try.sh ``` @@ -22,7 +22,7 @@ The author provided the file [cppp.cc](cppp.cc) which can preprocess the generated output to make them more acceptable to typical compilers. To build: -```sh +```--> make cppp ``` @@ -44,7 +44,7 @@ spoiler](spoiler.html) that shows how this entry was written. ### Synopsis -```sh +```--> echo "Hello world" | ./prog 12345 > encoded.c gcc -DPIN=12345 encoded.c -o ./decoded && ./decoded @@ -63,14 +63,14 @@ Mile is a C code generator. Run without arguments for the help message below: When run with an encoding PIN (first command line argument), Mile will read bytes from `stdin` and generate C code on `stdout`. Example: -```sh +```--> echo "Hello, world!" | ./prog 56789 > encoded.c ``` This generated code will reproduce the same input bytes on `stdout` when executed, if it was compiled with the same encoding PIN. -```sh +```--> gcc -DPIN=56789 encoded.c -o decoded ``` diff --git a/2020/yang/index.html b/2020/yang/index.html index 7ce97c488..234afc888 100644 --- a/2020/yang/index.html +++ b/2020/yang/index.html @@ -141,14 +141,14 @@ Location: US - United States of America

        To build:

        -
            make
        +
            make

        To use:

        -
            ./prog [PIN] < input.txt > output.c
        +
            ./prog [PIN] < input.txt > output.c

        Try:

        -
            ./try.sh
        +
            ./try.sh

        The author provided the file cppp.cc which can preprocess the generated output to make them more acceptable to typical compilers. To build:

        -
            make cppp
        +
            make cppp

        See the author’s remarks for more details.

        Judges’ remarks:

        You might think of this entry as code obfuscater with a code. @@ -159,9 +159,9 @@ What is compiling this entry about? spoiler that shows how this entry was written.

        Author’s remarks:

        Synopsis

        -
            echo "Hello world" | ./prog 12345 > encoded.c
        -
        -    gcc -DPIN=12345 encoded.c -o ./decoded && ./decoded
        +
            echo "Hello world" | ./prog 12345 > encoded.c
        +
        +    gcc -DPIN=12345 encoded.c -o ./decoded && ./decoded

        Details

        Mile is a C code generator. Run without arguments for the help message below:

            usage: [PIN] < input.txt > output.c
        @@ -169,10 +169,10 @@ spoiler that shows how this entry was written.

        where [PIN] is an integer in the range of 1..65535

        When run with an encoding PIN (first command line argument), Mile will read bytes from stdin and generate C code on stdout. Example:

        -
            echo "Hello, world!" | ./prog 56789 > encoded.c
        +
            echo "Hello, world!" | ./prog 56789 > encoded.c

        This generated code will reproduce the same input bytes on stdout when executed, if it was compiled with the same encoding PIN.

        -
            gcc -DPIN=56789 encoded.c -o decoded
        +
            gcc -DPIN=56789 encoded.c -o decoded

        The generated code reconstructs all data at compile time by seeding a random number generator with the given PIN to reproduce the input bytes, and simply does one fwrite(3) call at run time to print those bytes. Not diff --git a/README.html b/README.html index 02f009af9..d33ce58ec 100644 --- a/README.html +++ b/README.html @@ -194,7 +194,7 @@ you encounter should give you more appreciation for the entry.

        If you have the energy to type in the text, or if you have access to a machine readable version of these programs, you should next consider some preprocessing such as:

        -
        sed -e '/^#.*include/d' prog.c | cc -E
        +
        sed -e '/^#.*include/d' prog.c | cc -E

        This strips away comments and expands the program’s macros without having things such as includes and macros cluttering up the output. If the entry requires or suggests the use of compile line options (such as -Dindex=strchr) they should diff --git a/README.md b/README.md index d1ab4134c..bbf9e640b 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ If you have the energy to type in the text, or if you have access to a machine readable version of these programs, you should next consider some preprocessing such as: -```sh +``` sed -e '/^#.*include/d' prog.c | cc -E ``` diff --git a/archive/historic/README.md b/archive/historic/README.md index 78187b197..a9238d640 100644 --- a/archive/historic/README.md +++ b/archive/historic/README.md @@ -79,7 +79,7 @@ Machine](https://web.archive.org) as of [2022 Dec *HINT*: To uncompress a given bzip2 compressed tarball file, use: -```sh +``` tar -jxvf file.tar.bz2 ``` @@ -88,7 +88,7 @@ where "_file.tar.bz2_" is the name of a file found in this directory. To uncompress all of the 2022 Dec 28 archive using the year based bzip2 compressed tarball files: -```sh +``` for year in 198{4,5,6,7,8,9} 199{0,1,2,3,4,5,6,8} 200{0,1,4,5,6} 201{1,2,3,4,5,8,9} 2020; do rm -rf "$year" tar -jxvf "archive-$year.tar.bz2" diff --git a/archive/historic/index.html b/archive/historic/index.html index 9c98c19dc..14417ccba 100644 --- a/archive/historic/index.html +++ b/archive/historic/index.html @@ -191,14 +191,14 @@ Machine as of [2022 Dec 28)(https://web.archive.org/web/20201228005211/https://www.ioccc.org/).

        How to unpack

        HINT: To uncompress a given bzip2 compressed tarball file, use:

        -
        tar -jxvf file.tar.bz2
        +
        tar -jxvf file.tar.bz2

        where “file.tar.bz2” is the name of a file found in this directory.

        To uncompress all of the 2022 Dec 28 archive using the year based bzip2 compressed tarball files:

        -
        for year in 198{4,5,6,7,8,9} 199{0,1,2,3,4,5,6,8} 200{0,1,4,5,6} 201{1,2,3,4,5,8,9} 2020; do
        -    rm -rf "$year"
        -    tar -jxvf "archive-$year.tar.bz2"
        -done
        +
        for year in 198{4,5,6,7,8,9} 199{0,1,2,3,4,5,6,8} 200{0,1,4,5,6} 201{1,2,3,4,5,8,9} 2020; do
        +    rm -rf "$year"
        +    tar -jxvf "archive-$year.tar.bz2"
        +done
        ^[0-9a-z][0-9a-z_]*$ ``` @@ -48,7 +48,7 @@ anonymous author in a given year. Anonymous author_handle's match this regexp: -```re +``` Anonymous_[0-9][0-9][0-9][0-9][.0-9]*$ ``` @@ -56,14 +56,14 @@ Anonymous_[0-9][0-9][0-9][0-9][.0-9]*$ The `author_handle.json` must have the following JSON members: -```json +``` "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", "author_JSON_format_version" : "0.1 2023-05-22", ``` There must be the following JSON members: -```json +``` "full_name" : "Your Full Name", "sort_word" : "lowercaselast", "location_code" : "XX", @@ -80,13 +80,13 @@ an `author` and the entry they submitted are to be listed. A `sort_word` matches this regexp: -```re +``` ^[a-z][0-9a-z]* ``` And there must be the following JSON members: -```json +``` "email" : "user0@example.com", "url" : "https://a.host0.example.com/index.html", "alt_url" : "https://b.host0.example.com/index.html", @@ -109,7 +109,7 @@ And there must be the following JSON members: If an author does not have one of the previous set of values, or wishes to not disclose it / keep it anonymous, then the JSON value can be `null`. For example: -```json +``` "email" : null, "url" : null, "alt_url" : null, @@ -125,7 +125,7 @@ NOTE: The JSON value of `null` is NOT enclosed in double quotes. The `"winning_entry_set"` is an array of JSON members that indicate each of the IOCCC winning entries that the author is the author of. :-) -```json +``` { "entry_id" : "YYYY_dirname" } ``` @@ -136,7 +136,7 @@ of the winning entry under the given year directory. NOTE: Due to mis-features in the JSON spec, the final JSON member must NOT be followed by a comma. For example: -```json +``` "winning_entry_set" : [ { "entry_id" : "1987_somedir" }, { "entry_id" : "2020_entrydir" }, @@ -148,7 +148,7 @@ For example: Here is a fictitious author_handle.json example: -```json +``` { "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", "author_JSON_format_version" : "1.0 2023-06-10", @@ -176,7 +176,7 @@ Here is a fictitious author_handle.json example: Here is fictitious author_handle.json example where all entries that may be withheld are null: -```json +``` { "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", "author_JSON_format_version" : "1.0 2023-06-10", diff --git a/bin/README.md b/bin/README.md index 967feeaf7..1129af50d 100644 --- a/bin/README.md +++ b/bin/README.md @@ -18,13 +18,13 @@ Run a command on all winning entries. For example: -```sh +``` bin/all-run.sh -v 3 bin/quick-readme2index.sh -v 1 ``` Or for example: -```sh +``` bin/all-run.sh -v 3 bin/readme2index.sh -v 1 ``` @@ -35,19 +35,19 @@ Run a command on all IOCCC years. For example: -```sh +``` bin/all-years.sh -v 1 bin/gen-year-index.sh -v 1 ``` Or for example: -```sh +``` bin/all-years.sh -v 1 bin/chk-entry.sh ``` We recommend that this tool be invoked via the top level `Makefile`: -```sh +``` make verify_entry_files ``` @@ -59,7 +59,7 @@ Check that files required by an entry match the entry's manifest as found in For example: -```sh +``` bin/chk-entry.sh 2020/ferguson1 ``` @@ -70,7 +70,7 @@ Generate the list of files in the entry's manifest, `.entry.json`. For example: -```sh +``` awk -f bin/filelist.entry.json.awk 2020/ferguson1/.entry.json ``` @@ -81,7 +81,7 @@ Generate the top level `/authors.html` page. Usage: -```sh +``` bin/gen-authors.sh -v 1 ``` @@ -92,7 +92,7 @@ Generate the top level `/location.html` page. Usage: -```sh +``` bin/gen-location.sh -v 1 ``` @@ -104,7 +104,7 @@ files. Usage: -```sh +``` bin/gen-other-html.sh -v 1 ``` @@ -115,13 +115,13 @@ Generate an XML sitemap for the IOCCC web site. Usage: -```sh +``` bin/gen-sitemap.sh -v 1 ``` We recommend that this tool be invoked via the top level `Makefile`: -```sh +``` make gen_sitemap ``` @@ -135,31 +135,31 @@ Without argument, the `contest_status` is unchanged. Usage: -```sh +``` bin/gen-status.sh -v 1 ``` To force the `contest_status` to be closed: -```sh +``` bin/gen-status.sh -v 1 closed ``` To force the `contest_status` to be open: -```sh +``` bin/gen-status.sh -v 1 open ``` To see other valid statuses: -```sh +``` bin/gen-status -h ``` We recommend that this tool be invoked via the top level `Makefile`: -```sh +``` make gen_status ``` @@ -170,7 +170,7 @@ Generate a number of top level HTML pages for the IOCCC web sites. Usage: -```sh +``` bin/gen-top-html.sh -v 1 ``` @@ -191,7 +191,7 @@ Examples of top level HTML pages built by this tool include: We recommend that this tool be invoked via the top level `Makefile`: -```sh +``` make gen_top_html ``` @@ -202,13 +202,13 @@ Generate an `index.html` page for an given IOCCC year. Usage: -```sh +``` bin/gen-year-index.sh -v 1 2020 ``` We recommend that this tool be invoked via the top level `Makefile`: -```sh +``` make gen_year_index ``` @@ -219,13 +219,13 @@ Generate the top level `/years.html` page. Usage: -```sh +``` bin/gen-years.sh -v 1 ``` We recommend that this tool be invoked via the top level `Makefile`: -```sh +``` make gen_years ``` @@ -279,7 +279,7 @@ If only a few `index.hmtl` files need updating, then this command will only briefly pause while the slightly longer [readme2index.sh](readme2index.sh) is run: -```sh +``` bin/all-run.sh -v 3 bin/quick-readme2index.sh -v 1 ``` @@ -289,7 +289,7 @@ and `index.html` are correct. If in doubt, use: We recommend that this tool be invoked via the top level `Makefile`: -```sh +``` make quick_entry_index ``` @@ -298,19 +298,19 @@ make quick_entry_index Convert an entry README.md into entry directory index.html. -```sh +``` bin/all-run.sh -v 3 bin/readme2index.sh -v 1 ``` To build `index.html` files for all entries: -```sh +``` bin/all-run.sh -v 3 bin/readme2index.sh -v 1 ``` We recommend that this tool be invoked via the top level `Makefile`: -```sh +``` make entry_index ``` @@ -341,19 +341,19 @@ Sort a .gitignore in a entry directory. Usage: -```sh +``` bin/sort.gitignore.sh -v 1 YYYY/dir ``` Suggested usage: -```sh +``` bin/all-run.sh bin/sort.gitignore.sh -v 1 ``` We recommend that this tool be invoked via the top level `Makefile`: -```sh +``` make sort_gitignore ``` @@ -389,13 +389,13 @@ Form a compressed tarball for an entry. Usage: -```sh +``` bin/tar-entry.sh -v 1 YYYY/dir ``` Suggested usage: -```sh +``` bin/all-run.sh -v 3 bin/tar-entry.sh -v 1 -W ``` @@ -406,19 +406,19 @@ Form a compressed tarball for an IOCCC year. Usage: -```sh +``` bin/tar-year.sh -v 1 YYYY ``` Suggested usage: -```sh +``` bin/all-years.sh -v 3 bin/tar-year.sh -v 1 -W ``` We recommend that this tool be invoked via the top level `Makefile`: -```sh +``` make form_year_tarball ``` @@ -429,19 +429,19 @@ Untar an entry's a compressed tarball. Usage: -```sh +``` bin/untar-entry.sh -v 1 YYYY/dir ``` Suggested usage: -```sh +``` bin/all-run.sh -v 3 bin/untar-entry.sh -v 1 ``` We recommend that this tool be invoked via the top level `Makefile`: -```sh +``` make untar_entry_tarball ``` @@ -452,19 +452,19 @@ Untar an IOCCC year's compressed tarball. Usage: -```sh +``` bin/untar-year.sh -v 1 YYYY ``` Suggested usage: -```sh +``` bin/all-years.sh -v 3 bin/untar-year.sh -v 1 ``` We recommend that this tool be invoked via the top level `Makefile`: -```sh +``` make untar_year_tarball ``` @@ -494,14 +494,14 @@ the file name form: By using command line options of the form: -```sh +``` -H phase=name ``` where `phase` is the name of an HTML phase, a non-default file may be used. For example: -```sh +``` -H topnav=up2index ``` @@ -512,7 +512,7 @@ used during the _topnav_ HTML phase. If `name` is dot (i.e., `.`), then the given HTML phase is skipped. For example: -```sh +``` -H footer=. ``` @@ -861,7 +861,7 @@ a POSIX safe string with the addition of `+` (for technical reasons beyond this document). In particular, the `author_handle` must be an ASCII string that matches this regexp: -```re +``` ^[0-9A-Za-z][0-9A-Za-z._+-]*$" ``` @@ -900,7 +900,7 @@ in the case of [2005/anon](../2005/anon/anon.c). Anonymous `author_handle`'s match this regexp: -```re +``` Anonymous_[0-9][0-9][0-9][0-9][.0-9]*$ ``` @@ -932,7 +932,7 @@ Non-numeric `year` strings are lower case. A `year` string matches this regexp: -```re +``` [0-9a-z][0-9a-z][0-9a-z][0-9a-z] ``` @@ -957,7 +957,7 @@ A `dir` is a POSIX safe string that holds an entry. A `dir` is a string that matches this regexp: -```re +``` ^[a-z][0-9a-z.-]*$ ``` diff --git a/bin/index.html b/bin/index.html index a70ecc470..5d27fcbf2 100644 --- a/bin/index.html +++ b/bin/index.html @@ -133,63 +133,63 @@ repo.

        all-run.sh

        Run a command on all winning entries.

        For example:

        -
        bin/all-run.sh -v 3 bin/quick-readme2index.sh -v 1
        +
        bin/all-run.sh -v 3 bin/quick-readme2index.sh -v 1

        Or for example:

        -
        bin/all-run.sh -v 3 bin/readme2index.sh -v 1
        +
        bin/all-run.sh -v 3 bin/readme2index.sh -v 1

        all-years.sh

        Run a command on all IOCCC years.

        For example:

        -
        bin/all-years.sh -v 1 bin/gen-year-index.sh -v 1
        +
        bin/all-years.sh -v 1 bin/gen-year-index.sh -v 1

        Or for example:

        -
        bin/all-years.sh -v 1 bin/chk-entry.sh
        +
        bin/all-years.sh -v 1 bin/chk-entry.sh

        We recommend that this tool be invoked via the top level Makefile:

        -
        make verify_entry_files
        +
        make verify_entry_files

        chk-entry.sh

        Check that files required by an entry match the entry’s manifest as found in .entry.json.

        For example:

        -
        bin/chk-entry.sh 2020/ferguson1
        +
        bin/chk-entry.sh 2020/ferguson1

        filelist.entry.json.awk

        Generate the list of files in the entry’s manifest, .entry.json.

        For example:

        -
        awk -f bin/filelist.entry.json.awk 2020/ferguson1/.entry.json
        +
        awk -f bin/filelist.entry.json.awk 2020/ferguson1/.entry.json

        gen-authors.sh

        Generate the top level /authors.html page.

        Usage:

        -
        bin/gen-authors.sh -v 1
        +
        bin/gen-authors.sh -v 1

        gen-location.sh

        Generate the top level /location.html page.

        Usage:

        -
        bin/gen-location.sh -v 1
        +
        bin/gen-location.sh -v 1

        gen-other-html.sh

        Generate entry HTML files (other than README.md to index.html) from markdown files.

        Usage:

        -
        bin/gen-other-html.sh -v 1
        +
        bin/gen-other-html.sh -v 1

        gen-sitemap.sh

        Generate an XML sitemap for the IOCCC web site.

        Usage:

        -
        bin/gen-sitemap.sh -v 1
        +
        bin/gen-sitemap.sh -v 1

        We recommend that this tool be invoked via the top level Makefile:

        -
        make gen_sitemap
        +
        make gen_sitemap

        gen-status.sh

        Generate status.json according to the modification dates of status.json and news.html.

        Without argument, the contest_status is unchanged.

        Usage:

        -
        bin/gen-status.sh -v 1
        +
        bin/gen-status.sh -v 1

        To force the contest_status to be closed:

        -
        bin/gen-status.sh -v 1 closed
        +
        bin/gen-status.sh -v 1 closed

        To force the contest_status to be open:

        -
        bin/gen-status.sh -v 1 open
        +
        bin/gen-status.sh -v 1 open

        To see other valid statuses:

        -
        bin/gen-status -h
        +
        bin/gen-status -h

        We recommend that this tool be invoked via the top level Makefile:

        -
        make gen_status
        +
        make gen_status

        gen-top-html.sh

        Generate a number of top level HTML pages for the IOCCC web sites.

        Usage:

        -
        bin/gen-top-html.sh -v 1
        +
        bin/gen-top-html.sh -v 1

        Examples of top level HTML pages built by this tool include:

        We recommend that this tool be invoked via the top level Makefile:

        -
        make gen_top_html
        +
        make gen_top_html

        gen-year-index.sh

        Generate an index.html page for an given IOCCC year.

        Usage:

        -
        bin/gen-year-index.sh -v 1 2020
        +
        bin/gen-year-index.sh -v 1 2020

        We recommend that this tool be invoked via the top level Makefile:

        -
        make gen_year_index
        +
        make gen_year_index

        gen-years.sh

        Generate the top level /years.html page.

        Usage:

        -
        bin/gen-years.sh -v 1
        +
        bin/gen-years.sh -v 1

        We recommend that this tool be invoked via the top level Makefile:

        -
        make gen_years
        +
        make gen_years

        md2html.sh

        This is the primary tool that forms IOCCC generated HTML content from markdown files (permanent markdown files or temporarily generated @@ -247,19 +247,19 @@ the extra time can add up.

        If only a few index.hmtl files need updating, then this command will only briefly pause while the slightly longer readme2index.sh is run:

        -
        bin/all-run.sh -v 3 bin/quick-readme2index.sh -v 1
        +
        bin/all-run.sh -v 3 bin/quick-readme2index.sh -v 1

        NOTE: This command assumes that the relative modification times for index.hmtl, .entry.json, and index.html are correct. If in doubt, use:

        We recommend that this tool be invoked via the top level Makefile:

        -
        make quick_entry_index
        +
        make quick_entry_index

        readme2index.sh

        Convert an entry README.md into entry directory index.html.

        -
        bin/all-run.sh -v 3 bin/readme2index.sh -v 1
        +
        bin/all-run.sh -v 3 bin/readme2index.sh -v 1

        To build index.html files for all entries:

        -
        bin/all-run.sh -v 3 bin/readme2index.sh -v 1
        +
        bin/all-run.sh -v 3 bin/readme2index.sh -v 1

        We recommend that this tool be invoked via the top level Makefile:

        -
        make entry_index
        +
        make entry_index

        status2html.sh

        Convert status.json into HTML.

        This tool is a ‘before tool’ (-b tool) that is intended @@ -274,11 +274,11 @@ We sort with lines starting with ! fourth.

        sort.gitignore.sh

        Sort a .gitignore in a entry directory.

        Usage:

        -
        bin/sort.gitignore.sh -v 1 YYYY/dir
        +
        bin/sort.gitignore.sh -v 1 YYYY/dir

        Suggested usage:

        -
        bin/all-run.sh bin/sort.gitignore.sh -v 1
        +
        bin/all-run.sh bin/sort.gitignore.sh -v 1

        We recommend that this tool be invoked via the top level Makefile:

        -
        make sort_gitignore
        +
        make sort_gitignore

        subst.default.sh

        Print default substitutions.

        subst.entry-index.sh

        @@ -292,33 +292,33 @@ We sort with lines starting with ! fourth.

        tar-entry.sh

        Form a compressed tarball for an entry.

        Usage:

        -
        bin/tar-entry.sh -v 1 YYYY/dir
        +
        bin/tar-entry.sh -v 1 YYYY/dir

        Suggested usage:

        -
        bin/all-run.sh -v 3 bin/tar-entry.sh -v 1 -W
        +
        bin/all-run.sh -v 3 bin/tar-entry.sh -v 1 -W

        tar-year.sh

        Form a compressed tarball for an IOCCC year.

        Usage:

        -
        bin/tar-year.sh -v 1 YYYY
        +
        bin/tar-year.sh -v 1 YYYY

        Suggested usage:

        -
        bin/all-years.sh -v 3 bin/tar-year.sh -v 1 -W
        +
        bin/all-years.sh -v 3 bin/tar-year.sh -v 1 -W

        We recommend that this tool be invoked via the top level Makefile:

        -
        make form_year_tarball
        +
        make form_year_tarball

        untar-entry.sh

        Untar an entry’s a compressed tarball.

        Usage:

        -
        bin/untar-entry.sh -v 1 YYYY/dir
        +
        bin/untar-entry.sh -v 1 YYYY/dir

        Suggested usage:

        -
        bin/all-run.sh -v 3 bin/untar-entry.sh -v 1
        +
        bin/all-run.sh -v 3 bin/untar-entry.sh -v 1

        We recommend that this tool be invoked via the top level Makefile:

        -
        make untar_entry_tarball
        +
        make untar_entry_tarball

        untar-year.sh

        Untar an IOCCC year’s compressed tarball.

        Usage:

        -
        bin/untar-year.sh -v 1 YYYY
        +
        bin/untar-year.sh -v 1 YYYY

        Suggested usage:

        -
        bin/all-years.sh -v 3 bin/untar-year.sh -v 1
        +
        bin/all-years.sh -v 3 bin/untar-year.sh -v 1

        We recommend that this tool be invoked via the top level Makefile:

        -
        make untar_year_tarball
        +
        make untar_year_tarball

        How IOCCC HTML content is built

        The md2html.sh tool is the primary tool that is used to form all IOCCC related HTML pages for the official IOCCC web @@ -335,16 +335,16 @@ built uses, by default, files from the inc directory the file name form:

        *.default.html

        By using command line options of the form:

        -
        -H phase=name
        +
        -H phase=name

        where phase is the name of an HTML phase, a non-default file may be used. For example:

        -
        -H topnav=up2index
        +
        -H topnav=up2index

        will cause inc/topnav.up2index.html instead of inc/topnav.default.html to be used during the topnav HTML phase.

        If name is dot (i.e., .), then the given HTML phase is skipped. For example:

        -
        -H footer=.
        +
        -H footer=.

        will cause no HTML content to be produced during the footer HTML phase.

        HTML phases

        The following HTML phase files are used to build HTML content:

        @@ -560,7 +560,7 @@ IOCCC. Each author has EXACTLY ONE author_handle.< a POSIX safe string with the addition of + (for technical reasons beyond this document). In particular, the author_handle must be an ASCII string that matches this regexp:

        -
        ^[0-9A-Za-z][0-9A-Za-z._+-]*$"
        +
        ^[0-9A-Za-z][0-9A-Za-z._+-]*$"

        Default author_handle’s do not have multiple consecutive _ (underscore) characters. Nevertheless, multiple consecutive _ (underscore) characters are allowed. Contest submitters who wish to override the author_handle may do so.

        @@ -581,7 +581,7 @@ year.

        NOTE: even if the directory name is not anonymous the above rules apply as in in the case of 2005/anon.

        Anonymous author_handle’s match this regexp:

        -
        Anonymous_[0-9][0-9][0-9][0-9][.0-9]*$
        +
        Anonymous_[0-9][0-9][0-9][0-9][.0-9]*$

        entry

        An IOCCC entry that won an award for a given IOCCC.

        An entry has one more more authors.

        @@ -598,7 +598,7 @@ may be limited to previous entrys that used them.

        represent the year. Some special year strings are possible, such as mock. Non-numeric year strings are lower case.

        A year string matches this regexp:

        -
        [0-9a-z][0-9a-z][0-9a-z][0-9a-z]
        +
        [0-9a-z][0-9a-z][0-9a-z][0-9a-z]

        The year directories reside directly below the top level directory.

        .year

        Each year directory will have a file under it named:

        @@ -608,7 +608,7 @@ instance, 2020/.year has the string: 2020dir

        A dir is a POSIX safe string that holds an entry.

        A dir is a string that matches this regexp:

        -
        ^[a-z][0-9a-z.-]*$
        +
        ^[a-z][0-9a-z.-]*$

        Each entry is under its own individual directory. This directory is directly under a year directory.

        entry_id

        diff --git a/bugs.html b/bugs.html index c9c140f78..65107ec52 100644 --- a/bugs.html +++ b/bugs.html @@ -417,9 +417,9 @@ own fix or suggest that they’re fixed!

        Information: 1984/decot/index.html

        The purpose of this program is to print out a string of rubbish. In particular you should see something like:

        -
            $ ./decot
        -    '",x);      /*
        -    \
        +
            $ ./decot
        +    '",x);      /*
        +    \

        without a newline after the \. This is not a bug.

        1984/mullender

        STATUS: INABIAF - please DO NOT fix

        @@ -479,7 +479,7 @@ operators like /. To see what operators are supported check the sou

        With version 2 it sometimes segfaults even with the same input where other times it does not. We don’t believe this is because of the fix that lets some versions be compiled with clang. An example invocation is:

        -
            ./ver2 < westley.c
        +
            ./ver2 < westley.c

        A useful note on changing/fixing this program

        It should be noted that in additional to rot13 names there is code that is the reverse of other code (also wrt names). See the source file and the index.html @@ -511,12 +511,12 @@ the code. But it’s trickier than that as one might expect.

        The comments are processed too. Furthermore it happens that the last line becomes the first and the first line becomes the last! Now if you look at the code you’ll see on the first line:

        -
            /**//*/};)/**/pain(*//**/tang         ,gnat/**//*/,ABBA~,0-0(avnz;)0-0,tang,raeN
        +
            /**//*/};)/**/pain(*//**/tang         ,gnat/**//*/,ABBA~,0-0(avnz;)0-0,tang,raeN

        In ver0 it’ll be the same but the others are more interesting.

        In ver1 you’ll see on the last line:

        -
            cnva((vag)NOON&2/*//*\\**/,gnat,tang        ,NOON/**//*/(niam/**/);}/*//**/
        +
            cnva((vag)NOON&2/*//*\\**/,gnat,tang        ,NOON/**//*/(niam/**/);}/*//**/

        and on the first line:

        -
            /**//*/};)/**/cnva(*//**/gnat         ,tang/**//*/,NOON~,0-0(niam;)0-0,gnat,enrA
        +
            /**//*/};)/**/cnva(*//**/gnat         ,tang/**//*/,NOON~,0-0(niam;)0-0,gnat,enrA

        Observe that the ROT13 of pain is cnva and the ROT13 of main is znva. The ROT13 of NOON is ABBA. vag is ROT13 of int, gnat and tang are ROT13 of each other as well which is the reverse of the original (this is not @@ -563,61 +563,61 @@ Enjoy! :-)

        A point worth considering is that as the number passed into the program gets bigger the number of lines of output gets substantially larger and it takes much more time and resources to run as well. For instance:

        -
            $ for n in $(seq 1 18); do echo "$n"; echo "$n" | time "./baruch" | wc -l | sed -E -e 's/[[:space:]]//g'; done
        -    1
        -    3
        -    ./baruch  0.00s user 0.00s system 5% cpu 0.115 total
        -    2
        -    1
        -    ./baruch  0.00s user 0.00s system 64% cpu 0.004 total
        -    3
        -    1
        -    ./baruch  0.00s user 0.00s system 60% cpu 0.003 total
        -    4
        -    11
        -    ./baruch  0.00s user 0.00s system 64% cpu 0.003 total
        -    5
        -    61
        -    ./baruch  0.00s user 0.00s system 66% cpu 0.003 total
        -    6
        -    29
        -    ./baruch  0.00s user 0.00s system 61% cpu 0.003 total
        -    7
        -    321
        -    ./baruch  0.00s user 0.00s system 69% cpu 0.002 total
        -    8
        -    829
        -    ./baruch  0.00s user 0.00s system 76% cpu 0.003 total
        -    9
        -    3521
        -    ./baruch  0.00s user 0.00s system 87% cpu 0.005 total
        -    10
        -    7965
        -    ./baruch  0.01s user 0.00s system 95% cpu 0.014 total
        -    11
        -    32161
        -    ./baruch  0.05s user 0.00s system 98% cpu 0.053 total
        -    12
        -    184601
        -    ./baruch  0.29s user 0.00s system 99% cpu 0.294 total
        -    13
        -    1031969
        -    ./baruch  1.78s user 0.00s system 99% cpu 1.794 total
        -    14
        -    5483941
        -    ./baruch  11.26s user 0.02s system 99% cpu 11.311 total
        -    15
        -    36466945
        -    ./baruch  79.20s user 0.15s system 99% cpu 1:19.72 total
        -    16
        -    251132705
        -    ./baruch  592.89s user 0.77s system 99% cpu 9:55.34 total
        -    17
        -    1724671873
        -    ./baruch  4535.71s user 5.25s system 99% cpu 1:15:49.76 total
        -    18
        -    12655721857
        -    ./baruch  37496.97s user 58.50s system 99% cpu 10:27:48.29 total
        +
            $ for n in $(seq 1 18); do echo "$n"; echo "$n" | time "./baruch" | wc -l | sed -E -e 's/[[:space:]]//g'; done
        +    1
        +    3
        +    ./baruch  0.00s user 0.00s system 5% cpu 0.115 total
        +    2
        +    1
        +    ./baruch  0.00s user 0.00s system 64% cpu 0.004 total
        +    3
        +    1
        +    ./baruch  0.00s user 0.00s system 60% cpu 0.003 total
        +    4
        +    11
        +    ./baruch  0.00s user 0.00s system 64% cpu 0.003 total
        +    5
        +    61
        +    ./baruch  0.00s user 0.00s system 66% cpu 0.003 total
        +    6
        +    29
        +    ./baruch  0.00s user 0.00s system 61% cpu 0.003 total
        +    7
        +    321
        +    ./baruch  0.00s user 0.00s system 69% cpu 0.002 total
        +    8
        +    829
        +    ./baruch  0.00s user 0.00s system 76% cpu 0.003 total
        +    9
        +    3521
        +    ./baruch  0.00s user 0.00s system 87% cpu 0.005 total
        +    10
        +    7965
        +    ./baruch  0.01s user 0.00s system 95% cpu 0.014 total
        +    11
        +    32161
        +    ./baruch  0.05s user 0.00s system 98% cpu 0.053 total
        +    12
        +    184601
        +    ./baruch  0.29s user 0.00s system 99% cpu 0.294 total
        +    13
        +    1031969
        +    ./baruch  1.78s user 0.00s system 99% cpu 1.794 total
        +    14
        +    5483941
        +    ./baruch  11.26s user 0.02s system 99% cpu 11.311 total
        +    15
        +    36466945
        +    ./baruch  79.20s user 0.15s system 99% cpu 1:19.72 total
        +    16
        +    251132705
        +    ./baruch  592.89s user 0.77s system 99% cpu 9:55.34 total
        +    17
        +    1724671873
        +    ./baruch  4535.71s user 5.25s system 99% cpu 1:15:49.76 total
        +    18
        +    12655721857
        +    ./baruch  37496.97s user 58.50s system 99% cpu 10:27:48.29 total

        1990/jaw

        STATUS: known bug - please help us fix

        Source code: 1990/jaw/jaw.c

        @@ -627,19 +627,19 @@ fixed some issues in this program and Yus Endoh provided the btoa script but it appears there is a bug in this entry. The judges wrote that to test the entry one can do:

        -
            echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
        +
            echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw

        which should apply the identity transformation to a minimal holoalphabetic sentence.

        But doing this shows instead:

        -
            echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
        -    a얖?)V...?????777??hC??h??-? )SSSSXXX????r?L=???*?-???ppp,,,?R
        -    ?j
        -    111-)))? '..F@E
        -                   ???b111?
        -    ..F..F.?n,,,,,L@E$
        +
            echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
        +    a얖?)V...?????777??hC??h??-? )SSSSXXX????r?L=???*?-???ppp,,,?R
        +    ?j
        +    111-)))? '..F@E
        +                   ???b111?
        +    ..F..F.?n,,,,,L@E$

        Notice how there’s no newline at the end: that final $ is the prompt.

        If one does, however:

        -
            echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw | ./jaw
        +
            echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw | ./jaw

        they will get just

            oops

        which seems to be an error message (one of the fixes was to make it not use @@ -697,7 +697,7 @@ or do something funny. For instance adsleep and adbasename

        Another thing is that the code:

        -
            printf((W,Y));
        +
            printf((W,Y));

        appears to be wrong because W is a FILE * and Y is a char[] but if one changes it to use fprintf() on the file (which, incidentally, is opened in read only mode which is another reason) with the %s specifier it will make @@ -726,22 +726,22 @@ have to remove the outer () pair.

        the first factor is 101 and is usually found in an instant.

        A quick debugging session from Cody suggests that the problem with this value is that:

        -
            if ( ppp->qq!=48 ) return;
        +
            if ( ppp->qq!=48 ) return;

        is never reached because the value is never 48 (it is in other cases but not for the example input). It varies in value at this point. Observe that the next lines of code are:

        -
            while ( ppp->qq==48 )
        -    {
        -        printf("%ld\n",qqq-45);
        -        *pp = ppp;
        -        ppp = ppp->p;
        -    }
        +
            while ( ppp->qq==48 )
        +    {
        +        printf("%ld\n",qqq-45);
        +        *pp = ppp;
        +        ppp = ppp->p;
        +    }

        so it is expected that that value is 48, before printing the numbers, but if it’s not it should not proceed at all, not even to go past that loop. In other words that loop should always be entered for at least one iteration. The check for the != 48 is also required.

        Perhaps more useful to know is that at this point in the code the code:

        -
            if ((((( !(aa=setjmp(ppp->ppp))||aa==aaaaaa )))))
        +
            if ((((( !(aa=setjmp(ppp->ppp))||aa==aaaaaa )))))

        appears to be entered because of the return value of setjmp(), not the other condition.

        The alt version does fix the problem but it is not obfuscated and not like the @@ -851,12 +851,12 @@ terminal columns is >= 80 it will display properly, rather than having to wra at 80 columns. However due to the nature of the program if the terminal is < 80 in column width it will not display right. To see the number of columns in your terminal try:

        -
            echo $COLUMNS
        +
            echo $COLUMNS

        STATUS: known bug - please help us fix

        The author suggested that the alternate version, which Cody added (but fixed for modern systems), should print

        -
            main(l,a,n,d)...
        -    [A M E R I C A]...
        +
            main(l,a,n,d)...
        +    [A M E R I C A]...

        …going down the left edge if your terminal auto-wraps at 80 characters.

        This however does not seem to work. It does not appear to be because of the fix for modern systems as it doesn’t work for gcc either, even before any changes. @@ -909,18 +909,18 @@ through ctrl-c or such.

        fixed except for an exercise to yourself, should you wish to try.

        This program uses system(3) so if you provide invalid characters in the question you might cause an error. For instance don’t do this:

        -
            $ ./schnitzi schnitzi.info
        -    This program answers questions about paragraphs
        -    of text posed to it in English.  It is written
        -    in C.  Mark Schnitzius is the author of this
        -    program.
        -
        -    The Loch Ness monster has been captured.  Elvis
        -    is alive.  Hostler was a woman.  The NASA moon
        -    landings were clearly faked.
        -
        -
        -    ? What is foo'?
        +
            $ ./schnitzi schnitzi.info
        +    This program answers questions about paragraphs
        +    of text posed to it in English.  It is written
        +    in C.  Mark Schnitzius is the author of this
        +    program.
        +
        +    The Loch Ness monster has been captured.  Elvis
        +    is alive.  Hostler was a woman.  The NASA moon
        +    landings were clearly faked.
        +
        +
        +    ? What is foo'?

        because doing so will result in something like:

            sh: -c: line 0: unexpected EOF while looking for matching `''
             sh: -c: line 1: syntax error: unexpected end of file
        @@ -982,10 +982,10 @@ like getting to a place that the next contest can run must be done first.

        how this entry works, which will be necessary if this entry is to be fixed, below.

        You might wish to run the command:

        -
            make diff_orig_prog
        +
            make diff_orig_prog

        to see what had to change for the buffer size, when looking at the below. Furthermore you will want to look at:

        -
            diff schnitzi.alt.c schnitzi.alt2.c
        +
            diff schnitzi.alt.c schnitzi.alt2.c

        as the fgets() version can compile it just can’t generate compilable code (let alone using fgets()) when fed itself (to reiterate, just changing the call to fgets(3) does not mean it can compile and there’s a further problem in that @@ -1022,7 +1022,7 @@ o h >

    If you join the lines you end up with:

    -
    #include <stdio.h>
    +
    #include <stdio.h>

    If you look at column 25 which is the end of the word ‘mh111’ and you go down to the next row you’ll see a 0 and if you go one row down another 0. This is the buffer size, 100, for u! The column to the left is the same for the t @@ -1041,7 +1041,7 @@ size but that only works on the original source.

    To say just how sensitive this entry is: even a space, lack of space or a character, wrong character, lack of character or character in the wrong place can cause a compilation error! Make sure that the output of:

    -
        ./schnitzi < schnitzi.c
    +
        ./schnitzi < schnitzi.c

    can be compiled and the output of that new program when fed itself can also be compiled!

    1994/shapiro

    @@ -1100,12 +1100,12 @@ it calls getchar() via the pointer m. So this is a fea

    Source code: 1995/leo/leo.c

    Information: 1995/leo/index.html

    The judges suggested that the following commands should result in output:

    -
        ./leo 1 | cat - /dev/tty | gs -
    -
    -    ./leo 37 80 | cat - /dev/tty | gs -
    +
        ./leo 1 | cat - /dev/tty | gs -
    +
    +    ./leo 37 80 | cat - /dev/tty | gs -

    The first one can work if one does instead:

    -
        echo "" | ./leo 1 > foo.ps
    -    gs foo.ps
    +
        echo "" | ./leo 1 > foo.ps
    +    gs foo.ps

    but it is supposed to work in the pipeline as is. The second one does not appear to work at all even if one redirects to a file (like the workaround for the first) as it appears to just block.

    @@ -1140,28 +1140,28 @@ it was instead requiring a login / password.

    almost be done except that some of the output of the try.sh is wrong, especially the last one.

    This diff almost does it but not quite:

    -
        diff --git i/1996/huffman/huffman.c w/1996/huffman/huffman.c
    -    index a5745bc7f4fa28b834c004f4cf19633e40ad9165..5e5e5334f33f9dbd95c70eddece3189d9bcff5e9 100644
    -    --- i/1996/huffman/huffman.c
    -    +++ w/1996/huffman/huffman.c
    -    @@ -1,15 +1,16 @@
    -     #define x char
    -     #define z else
    -     #define w gets
    -    +#define gets(b) ((b)[0]='\0',(fgets((b), 100, stdin)))
    -     #define r if
    -     #define u int
    -     #define s main
    -     #define v putchar
    -     #define y while
    -     #define t " A?B?K?L?CIF?MSP?E?H?O?R?DJG?NTQ?????U?V?????X???????Z????W??Y??"
    -    - s (   )  {   x* c  ,  b[ 5  * 72   ]; u  a, e  ,  d   [  9
    -    + s (   )  {   x* c  ,  b[ 5  * 72  ]; u  a, e  ,  d   [  9
    -     *9 *9 ]  ;    y  (w  ( b) ){            r  ( 0   [ b] -7 *
    -     5        )    {  c  =     b    ;       y  (  (*    c  -  6
    -     * 7 )* *  c )c =  c+ 1  ;   r ((   -0 )  [ c  ] &&  w (  b   +
    -       8 *  5*    3        ) && w          (b   +8      *5  * 6) )
    -       { a       =  0; y     (                  a       [     b  ]
    +
        diff --git i/1996/huffman/huffman.c w/1996/huffman/huffman.c
    +    index a5745bc7f4fa28b834c004f4cf19633e40ad9165..5e5e5334f33f9dbd95c70eddece3189d9bcff5e9 100644
    +    --- i/1996/huffman/huffman.c
    +    +++ w/1996/huffman/huffman.c
    +    @@ -1,15 +1,16 @@
    +     #define x char
    +     #define z else
    +     #define w gets
    +    +#define gets(b) ((b)[0]='\0',(fgets((b), 100, stdin)))
    +     #define r if
    +     #define u int
    +     #define s main
    +     #define v putchar
    +     #define y while
    +     #define t " A?B?K?L?CIF?MSP?E?H?O?R?DJG?NTQ?????U?V?????X???????Z????W??Y??"
    +    - s (   )  {   x* c  ,  b[ 5  * 72   ]; u  a, e  ,  d   [  9
    +    + s (   )  {   x* c  ,  b[ 5  * 72  ]; u  a, e  ,  d   [  9
    +     *9 *9 ]  ;    y  (w  ( b) ){            r  ( 0   [ b] -7 *
    +     5        )    {  c  =     b    ;       y  (  (*    c  -  6
    +     * 7 )* *  c )c =  c+ 1  ;   r ((   -0 )  [ c  ] &&  w (  b   +
    +       8 *  5*    3        ) && w          (b   +8      *5  * 6) )
    +       { a       =  0; y     (                  a       [     b  ]

    But since it does not for the time being it is advisable to just redirect stderr to /dev/null (2>/dev/null).

    1996/jonth

    @@ -1199,8 +1199,8 @@ to the page as well! You’ll have IOCCC fame for reviving a pootifier! :-)

    Information: 1998/schnitzi/index.html

    A point worth considering is that as the number passed into the program gets bigger the number of lines of output gets substantially larger. For instance:

    -
        $ ./schnitzi 9|wc -l
    -      771999
    +
        $ ./schnitzi 9|wc -l
    +      771999

    The larger the number the bigger the file can become too, even becoming gigabytes in size. The range is checked for >0 && <27 as not having this can be a problem including a segfault.

    @@ -1215,43 +1215,43 @@ is in the index.html file as something to try and ponder.

    Source code: 2000/dlowe/dlowe.c

    Information: 2000/dlowe/index.html

    The author gives an example command:

    -
        echo "7 P 6 d P P 8 p" | ./dlowe | tr 876 tpo
    +
        echo "7 P 6 d P P 8 p" | ./dlowe | tr 876 tpo

    which should print out poot but it doesn’t, not in linux and not in macOS.

    In linux it doesn’t crash but it doesn’t print anything out either.

    In macOS it crashes; it might appear to not crash in macOS but this is because of the pipeline. If you remove the | tr 876 tpo part of the command you will see that it does indeed crash!

    The reason for this not working is really strange.

    -
        $ echo "7 P 6 d P P 8 p" | ./dlowe
    -    7668
    -    $ echo "7 P 6 d P P 8 p" | ./dlowe | grep 7
    -    $
    +
        $ echo "7 P 6 d P P 8 p" | ./dlowe
    +    7668
    +    $ echo "7 P 6 d P P 8 p" | ./dlowe | grep 7
    +    $

    Why? Is it writing to stdout? Let’s try some other things:

    -
        $ echo 7668 | tr 876 tpo
    -    poot
    +
        $ echo 7668 | tr 876 tpo
    +    poot

    Okay so we know that it SHOULD work. But we also know something funny is going on with stdout and the entry. Another experiment:

    -
        $ echo "7 P 6 d P P 8 p" | ./dlowe 1>&2 | grep 7
    -    7668
    +
        $ echo "7 P 6 d P P 8 p" | ./dlowe 1>&2 | grep 7
    +    7668

    Okay so now it sees it, grep. But watch!

    -
        $ echo "7 P 6 d P P 8 p" | ./dlowe 2>foo 1>&1
    -    7668
    -    $ cat foo
    +
        $ echo "7 P 6 d P P 8 p" | ./dlowe 2>foo 1>&1
    +    7668
    +    $ cat foo

    .. so at this hour it does appear to be writing to stdout but yet somehow it doesn’t? But watch:

    -
        $ echo "7 P 6 d P P 8 p" | ./dlowe 1>foo 1>&1
    -    $ cat foo
    -    $
    +
        $ echo "7 P 6 d P P 8 p" | ./dlowe 1>foo 1>&1
    +    $ cat foo
    +    $

    Well this explains why the tr does not transliterate it to poot but why is this happening? Why can’t it be redirected to another file even?

    If it could be figured out why it’s not writing to stdout and yet at the same time is writing to stdout one bug could be fixed. Maybe it’s the perl messing with things but we don’t know.

    Other commands do work, however, and give the appropriate output, such as:

    -
        $ echo 1 2 + p | ./dlowe
    -    3
    +
        $ echo 1 2 + p | ./dlowe
    +    3

    so something is wrong with some commands/operators.

    Another feature that does work in linux is:

    -
        $ echo poot | ./dlowe
    -    poot was here!
    +
        $ echo poot | ./dlowe
    +    poot was here!

    Can you help fix these problems?

    Cody provided the C code that creates an unformatted perl script that will just print ‘unimplemented’ for operators but it seems to work in some other ways (see @@ -1259,29 +1259,29 @@ below for how to go further than unimplemented) which is the exact perl from the C program except that it has the #!/usr/bin/env perl and use warnings; as well. A note below might suggest that doing this creates incomplete perl. Anyway:

    -
        #include <stdio.h>
    -    int main(void)
    -    {
    -        printf("#!/usr/bin/env perl\nuse warnings;_:$_=               <> ; defined               or exit; @ARGV"
    -            "=split; __:$_=             shift;defined or             goto _; chomp "
    -            ";(m*^\\x70oO"              "\\x74$*i)?(pri"              "nt \"$_ w\\x"
    -            "61s h\\145r\\x"            "65!\\n\"):((m*"            "^\\s\\*(-?\\d+"
    -            "(\\.\\d+)?)\\s"            "\\*$*)?(push@SS            ,$1):(&{chr(((o"
    -            "rd)%%39)+3**4)x2             } )); goto __;             sub ff { @SS= ("
    -            ")} sub __{print            \"stack empty\\"            "n\"} sub ss{$#"
    -            "SS<0 and goto &            __; print $SS[$"            "#SS].\"\\n\"} "
    -            "sub SS{ $#SS<0              and goto &__ ;              print pop @SS}"
    -            "sub _ { print              \"divide by zer"            "o\\n\"}sub ii{"
    -            "map{ print\"$_"            "\\n\" } reverse            @SS} sub AUTOLO"
    -            "AD { print\"un"            "implemented\\n"            "\"} sub gg{ $#"
    -            "SS<0 and goto              &__;push@SS,$SS[            $#SS]} sub uu{ "
    -            "$#SS<1 and goto            &__;$SS[ $#SS]+=            $SS[$#SS-1];$SS"
    -            "[$#SS-1]=$SS[$"            "#SS]-$SS[$#SS-"            "1]; $SS[$#SS]-"
    -            "=$SS[$#SS-1]}");
    -    }
    +
        #include <stdio.h>
    +    int main(void)
    +    {
    +        printf("#!/usr/bin/env perl\nuse warnings;_:$_=               <> ; defined               or exit; @ARGV"
    +            "=split; __:$_=             shift;defined or             goto _; chomp "
    +            ";(m*^\\x70oO"              "\\x74$*i)?(pri"              "nt \"$_ w\\x"
    +            "61s h\\145r\\x"            "65!\\n\"):((m*"            "^\\s\\*(-?\\d+"
    +            "(\\.\\d+)?)\\s"            "\\*$*)?(push@SS            ,$1):(&{chr(((o"
    +            "rd)%%39)+3**4)x2             } )); goto __;             sub ff { @SS= ("
    +            ")} sub __{print            \"stack empty\\"            "n\"} sub ss{$#"
    +            "SS<0 and goto &            __; print $SS[$"            "#SS].\"\\n\"} "
    +            "sub SS{ $#SS<0              and goto &__ ;              print pop @SS}"
    +            "sub _ { print              \"divide by zer"            "o\\n\"}sub ii{"
    +            "map{ print\"$_"            "\\n\" } reverse            @SS} sub AUTOLO"
    +            "AD { print\"un"            "implemented\\n"            "\"} sub gg{ $#"
    +            "SS<0 and goto              &__;push@SS,$SS[            $#SS]} sub uu{ "
    +            "$#SS<1 and goto            &__;$SS[ $#SS]+=            $SS[$#SS-1];$SS"
    +            "[$#SS-1]=$SS[$"            "#SS]-$SS[$#SS-"            "1]; $SS[$#SS]-"
    +            "=$SS[$#SS-1]}");
    +    }

    Compiling this you can generate:

    -
        #!/usr/bin/env perl
    -    use warnings;_:=               <> ; defined               or exit; =split; __:=             shift;defined or             goto _; chomp ;(m*^oOi)?(print " ws hr!\n"):((m*^\s\*(-?\d+(\.\d+)?)\s\*)?(push@SS            ,):(&{chr(((ord)%39)+3**4)x2             } )); goto __;             sub ff { @SS= ()} sub __{print            "stack empty\n"} sub ss{$#SS<0 and goto &            __; print $SS[$#SS]."\n"} sub SS{ $#SS<0              and goto &__ ;              print pop @SS}sub _ { print              "divide by zero\n"}sub ii{map{ print"\n" } reverse            @SS} sub AUTOLOAD { print"unimplemented\n"} sub gg{ $#SS<0 and goto              &__;push@SS,$SS[            $#SS]} sub uu{ $#SS<1 and goto            &__;$SS[ $#SS]+=            $SS[$#SS-1];$SS[$#SS-1]=$SS[$#SS]-$SS[$#SS-1]; $SS[$#SS]-=$SS[$#SS-1]}
    +
        #!/usr/bin/env perl
    +    use warnings;_:$_=               <> ; defined               or exit; @ARGV=split; __:$_=             shift;defined or             goto _; chomp ;(m*^\x70oO\x74$*i)?(print "$_ w\x61s h\145r\x65!\n"):((m*^\s\*(-?\d+(\.\d+)?)\s\*$*)?(push@SS            ,$1):(&{chr(((ord)%39)+3**4)x2             } )); goto __;             sub ff { @SS= ()} sub __{print            "stack empty\n"} sub ss{$#SS<0 and goto &            __; print $SS[$#SS]."\n"} sub SS{ $#SS<0              and goto &__ ;              print pop @SS}sub _ { print              "divide by zero\n"}sub ii{map{ print"$_\n" } reverse            @SS} sub AUTOLOAD { print"unimplemented\n"} sub gg{ $#SS<0 and goto              &__;push@SS,$SS[            $#SS]} sub uu{ $#SS<1 and goto            &__;$SS[ $#SS]+=            $SS[$#SS-1];$SS[$#SS-1]=$SS[$#SS]-$SS[$#SS-1]; $SS[$#SS]-=$SS[$#SS-1]}

    Here is example input/output:

        p
         stack empty
    @@ -1298,32 +1298,32 @@ Anyway:

    how this does not happen in the C program in linux!) but if one uses ‘p’ by itself it will print what’s on the stack (for example).

    To not get ‘unimplemented’ you can remove from the perl:

    -
        sub AUTOLOAD { print"unimplemented\n"}
    +
        sub AUTOLOAD { print"unimplemented\n"}

    (Note that the author stated this was used for exception handling so another possibility is that the C code doesn’t generate the correct perl and indeed even spaces is known to break the perl in at least one way, syntax errors, but maybe others too.)

    Here is an example run of several operations in the perl script after removing that subroutine:

    -
        $ echo 5 5 p | ./dlowe.pl
    -    5
    -    $ echo 5 5 + p | ./dlowe.pl
    -    5
    -    Undefined subroutine &main::UU called at ./pl.pl line 2, <> line 1.
    -    $ echo 5 5 * p | ./dlowe.pl
    -    5
    -    Undefined subroutine &main::ww called at ./pl.pl line 2, <> line 1.
    -    $ echo 5 5 - p | ./dlowe.pl
    -    5
    -    Undefined subroutine &main::WW called at ./pl.pl line 2, <> line 1.
    -    $ echo 5 5 / p | ./dlowe.pl
    -    5
    -    Undefined subroutine &main::YY called at ./pl.pl line 2, <> line 1.
    -    $ echo 5 P | ./dlowe.pl
    -    5$ echo p | ./dlowe.pl
    -    stack empty
    -    $ echo P | ./dlowe.pl
    -    stack empty
    +
        $ echo 5 5 p | ./dlowe.pl
    +    5
    +    $ echo 5 5 + p | ./dlowe.pl
    +    5
    +    Undefined subroutine &main::UU called at ./pl.pl line 2, <> line 1.
    +    $ echo 5 5 * p | ./dlowe.pl
    +    5
    +    Undefined subroutine &main::ww called at ./pl.pl line 2, <> line 1.
    +    $ echo 5 5 - p | ./dlowe.pl
    +    5
    +    Undefined subroutine &main::WW called at ./pl.pl line 2, <> line 1.
    +    $ echo 5 5 / p | ./dlowe.pl
    +    5
    +    Undefined subroutine &main::YY called at ./pl.pl line 2, <> line 1.
    +    $ echo 5 P | ./dlowe.pl
    +    5$ echo p | ./dlowe.pl
    +    stack empty
    +    $ echo P | ./dlowe.pl
    +    stack empty

    Note the undefined subroutine error: that happens with commands that are not even in the program. Again the author used AUTOLOAD for exception handling so it seems likely that there is something missing (which the below shows as well). @@ -1336,9 +1336,9 @@ works in the code, at least in some cases.

    invalid input. But as can be seen by the input I (Cody) gave the input is not actually incorrect. It is also curious to note that it ends up printing what’s on the stack at that point:

    -
        $ echo 5 5 + p | ./dlowe.pl
    -    unimplemented
    -    5
    +
        $ echo 5 5 + p | ./dlowe.pl
    +    unimplemented
    +    5

    which might (?) suggest that the + operator is unimplemented. Unfortunately it has been many years since I have used perl and I was never a guru either.

    STATUS: INABIAF - please DO NOT fix

    @@ -1346,34 +1346,34 @@ has been many years since I have used perl and I was never a guru either.

    they said is in Perl_sv_upgrade. As this is documented it is not considered a bug to be fixed. For the curious this will crash in macOS. Cody notes that the code that crashes is:

    -
        perl_eval_sv
    -    (newSVpv("_:$_=               <> ; defined               or exit; @ARGV"
    -    "=split; __:$_=             shift;defined or             goto _; chomp "
    -    ";(m*^\\x70oO"              "\\x74$*i)?(pri"              "nt \"$_ w\\x"
    -    "61s h\\145r\\x"            "65!\\n\"):((m*"            "^\\s\\*(-?\\d+"
    -    "(\\.\\d+)?)\\s"            "\\*$*)?(push@SS            ,$1):(&{chr(((o"
    -    "rd)%39)+3**4)x2             } )); goto __;             sub ff { @SS= ("
    -    ")} sub __{print            \"stack empty\\"            "n\"} sub ss{$#"
    -    "SS<0 and goto &            __; print $SS[$"            "#SS].\"\\n\"} "
    -    "sub SS{ $#SS<0              and goto &__ ;              print pop @SS}"
    -    "sub _ { print              \"divide by zer"            "o\\n\"}sub ii{"
    -    "map{ print\"$_"            "\\n\" } reverse            @SS} sub AUTOLO"
    -    "AD { print\"un"            "implemented\\n"            "\"} sub gg{ $#"
    -    "SS<0 and goto              &__;push@SS,$SS[            $#SS]} sub uu{ "
    -    "$#SS<1 and goto            &__;$SS[ $#SS]+=            $SS[$#SS-1];$SS"
    -    "[$#SS-1]=$SS[$"            "#SS]-$SS[$#SS-"            "1]; $SS[$#SS]-"
    -    "=$SS[$#SS-1]}                   ",0),0                   );
    +
        perl_eval_sv
    +    (newSVpv("_:$_=               <> ; defined               or exit; @ARGV"
    +    "=split; __:$_=             shift;defined or             goto _; chomp "
    +    ";(m*^\\x70oO"              "\\x74$*i)?(pri"              "nt \"$_ w\\x"
    +    "61s h\\145r\\x"            "65!\\n\"):((m*"            "^\\s\\*(-?\\d+"
    +    "(\\.\\d+)?)\\s"            "\\*$*)?(push@SS            ,$1):(&{chr(((o"
    +    "rd)%39)+3**4)x2             } )); goto __;             sub ff { @SS= ("
    +    ")} sub __{print            \"stack empty\\"            "n\"} sub ss{$#"
    +    "SS<0 and goto &            __; print $SS[$"            "#SS].\"\\n\"} "
    +    "sub SS{ $#SS<0              and goto &__ ;              print pop @SS}"
    +    "sub _ { print              \"divide by zer"            "o\\n\"}sub ii{"
    +    "map{ print\"$_"            "\\n\" } reverse            @SS} sub AUTOLO"
    +    "AD { print\"un"            "implemented\\n"            "\"} sub gg{ $#"
    +    "SS<0 and goto              &__;push@SS,$SS[            $#SS]} sub uu{ "
    +    "$#SS<1 and goto            &__;$SS[ $#SS]+=            $SS[$#SS-1];$SS"
    +    "[$#SS-1]=$SS[$"            "#SS]-$SS[$#SS-"            "1]; $SS[$#SS]-"
    +    "=$SS[$#SS-1]}                   ",0),0                   );

    and in particular it appears that it is the perl itself. In other words if one changes it to be:

    -
        perl_eval_sv(newSVpv("",0),0);
    +
        perl_eval_sv(newSVpv("",0),0);

    it will not crash. But of course it won’t do anything either. So it’s more specifically that the call to newSVpv() crashes the code but INSIDE (key point!) the call to perl_eval_sv() that does it. Given what the author stated and that the version of perl is < than 5.6.0 which the author states can crash this makes sense.

    The example command above should print:

    -
        $ echo "13 14 15 16 17 + - * / p" | ./dlowe
    -    -0.0515873015873016
    +
        $ echo "13 14 15 16 17 + - * / p" | ./dlowe
    +    -0.0515873015873016

    and that’s what it shows in linux.

    Note that with different perl libraries in macOS (for instance from Homebrew and MacPorts) it will @@ -1385,7 +1385,7 @@ of 92 warnings! Nonetheless neither works okay and both crash.

    Source code: 2000/primenum/primenum.c

    Information: 2000/primenum/index.html

    This program does not do what you might think it does! Running it like:

    -
        ./primenum 13
    +
        ./primenum 13

    will seemingly wait for input exactly because it is waiting for input. See the index.html file or look at the source.

    Although the name of the program suggests it prints prime numbers this is not @@ -1556,17 +1556,17 @@ identified by R.

    Since the game never ends properly the score is not printed either.

    It appears that the crash happens in more than one place. For instance it has happened at

    -
        XCheckMaskEvent(d, 4,&e)
    +
        XCheckMaskEvent(d, 4,&e)

    but it’s also happened at

    -
        else XDrawPoint(d    ,w,g,(l.s+=l.a)>>9,    h=(l.c+=l.b)>>9)
    +
        else XDrawPoint(d    ,w,g,(l.s+=l.a)>>9,    h=(l.c+=l.b)>>9)

    In both cases the pointer d was corrupted:

        (lldb) p d
         (Display *) 0x0000000000000001

    It is believed that it also happened at

    -
        XDrawString(d,w,g,W/3,H/2,m,B);
    +
        XDrawString(d,w,g,W/3,H/2,m,B);

    in J() and for the same reason.

    The loop seems to be stuck in the call to usleep(3) like:

    -
        usleep(p*200);
    +
        usleep(p*200);

    which happens to be in a while() loop.

    There is a way to get the code to crash. If you don’t do anything until everything is destroyed (where you’d lose the game if it ended) and then you @@ -1587,7 +1587,7 @@ sleeping.

    Information: 2004/gavin//index.html

    Segmentation fault will occur in some systems. For instance on macOS with the arm64 chip:

    -
        ./gavin > kernel
    +
        ./gavin > kernel

    When trying to link gavin.o to produce sh, the linker generates:

        Undefined symbols for architecture arm64:
           "start", referenced from:
    @@ -1599,32 +1599,32 @@ you have a fix? We welcome your help!

    Recent 2004/gavin mods:

    Although not related some recent changes were made to 2004/gavin to let it compile under clang. The following patch was applied:

    -
        diff --git a/2004/gavin/gavin.c b/2004/gavin/gavin.c
    -    index c967b7e..2082b49 100644
    -    --- a/2004/gavin/gavin.c
    -    +++ b/2004/gavin/gavin.c
    -    @@ -1,8 +1,9 @@
    -    +int main(int t, char **q, char **d) { return cain(t, (int)q, (int)d); }
    -     #define G(n) int n(int t, int q, int d)
    -     #define X(p,t,s) (p>=t&&p<(t+s)&&(p-(t)&1023)<(s&1023))
    -     #define U(m) *((signed char *)(m))
    -     #define F if(!--q){
    -    -#define I(s) (int)main-(int)s
    -    +#define I(s) (int)cain-(int)s
    -     #define P(s,c,k) for(h=0; h>>14==0; h+=129)Y(16*c+h/1024+Y(V+36))&128>>(h&7)?U(s+(h&15367))=k:k
    -
    -     G (B)
    -    @@ -52,7 +53,7 @@ else
    -
    -     G (_);
    -     G (o);
    -    -G (main)
    -    +G (cain)
    -     {
    -       Z, k = K;
    -       if (!t)
    +
        diff --git a/2004/gavin/gavin.c b/2004/gavin/gavin.c
    +    index c967b7e..2082b49 100644
    +    --- a/2004/gavin/gavin.c
    +    +++ b/2004/gavin/gavin.c
    +    @@ -1,8 +1,9 @@
    +    +int main(int t, char **q, char **d) { return cain(t, (int)q, (int)d); }
    +     #define G(n) int n(int t, int q, int d)
    +     #define X(p,t,s) (p>=t&&p<(t+s)&&(p-(t)&1023)<(s&1023))
    +     #define U(m) *((signed char *)(m))
    +     #define F if(!--q){
    +    -#define I(s) (int)main-(int)s
    +    +#define I(s) (int)cain-(int)s
    +     #define P(s,c,k) for(h=0; h>>14==0; h+=129)Y(16*c+h/1024+Y(V+36))&128>>(h&7)?U(s+(h&15367))=k:k
    +
    +     G (B)
    +    @@ -52,7 +53,7 @@ else
    +
    +     G (_);
    +     G (o);
    +    -G (main)
    +    +G (cain)
    +     {
    +       Z, k = K;
    +       if (!t)

    The original Makefile from 2004 had the following to say about this entry:

    -
        # Special flags for the gavin entry
    +
        # Special flags for the gavin entry
         #
         # FYI: Older versions of GCC have a bug in -O2 optimization, hence -O1
         #
    @@ -1791,8 +1791,8 @@ used decimal mode, or any of the “undocumented” instructions.

    obnoxious in macOS as it shows it at runtime (redirecting stderr to /dev/null will silence it). The following diff will almost work but it crashes with at least computer.tofu input file:

    -
        12a13
    -    #define gets(c) fgets((c),PI,stdin)&&(((c)[strlen((c))-1]='\0'),c!=NULL)
    +
        12a13
    +    #define gets(c) fgets((c),PI,stdin)&&(((c)[strlen((c))-1]='\0'),c!=NULL)

    2006/borsanyi

    STATUS: INABIAF - please DO NOT fix

    Source code: 2006/borsanyi/borsanyi.c

    @@ -1919,14 +1919,14 @@ macOS. A few things that were noticed depending on asan sanitisers With address in linux:

        richards.c:101:9: runtime error: null pointer passed as argument 2, which is declared to never be null

    but it actually works. This code is:

    -
        } else
    -                p++;
    -        W(c)} /* LINE 101 */
    -    }
    +
        } else
    +                p++;
    +        W(c)} /* LINE 101 */
    +    }

    Okay but what about argument 2? Well W is defined as:

    -
        #define W(c) e=memmove(e,x[(u)c], y[(u)c])+y[(u)c];
    +
        #define W(c) e=memmove(e,x[(u)c], y[(u)c])+y[(u)c];

    so it would appear that

    -
        x[(u)c]
    +
        x[(u)c]

    (at least in my tired head?) is NULL. But why does it work then?

    NOTE: u is int.

    Under macOS (with the arm64 chip) we get:

    @@ -2006,11 +2006,11 @@ address allocated in macOS? Or is it?

    ==10983==ABORTING /bin/bash: line 1: 10983 Abort trap: 6 ./richards

    which corresponds to the code:

    -
        o rd(u v)
    -    {
    -        o *a = 0, **b = &a, **c = b + 32;
    -        x[v] = w;
    -        for (; b < c && (*b < (o *)w || *b > (o *) T || *b == &v); b++); /* LINE 132 */
    +
        o rd(u v)
    +    {
    +        o *a = 0, **b = &a, **c = b + 32;
    +        x[v] = w;
    +        for (; b < c && (*b < (o *)w || *b > (o *) T || *b == &v); b++); /* LINE 132 */

    but this seems to not necessarily be relevant since without it it works in linux.

    A warning of interest when compiling is:

    @@ -2265,9 +2265,9 @@ but this is not known.

    machine to find problems as it will allow you to verify what is correct and what is not. Again see his index.html for details. However it is also possible to not rely on the entry as the below shows. One should be able to do:

    -
        echo 'No. I want chocolate!' | ./prog > chocolate.raw
    -
    -./prog e < chocolate.raw
    +
        echo 'No. I want chocolate!' | ./prog > chocolate.raw
    +
    +./prog e < chocolate.raw

    and get:

        No. I want some chocolate!

    but instead we get:

    @@ -2350,9 +2350,9 @@ loop printing whitespace.

    Source code: 2018/hou/prog.c

    Information: 2018/hou/index.html

    When you run it on a JSON file you will see something like:

    -
        $ ./prog < ioccc.json > ioccc.html
    -    Assertion failed: (rulez), function C, file prog.c, line 124.
    -    Abort trap: 6
    +
        $ ./prog < ioccc.json > ioccc.html
    +    Assertion failed: (rulez), function C, file prog.c, line 124.
    +    Abort trap: 6

    (from say running ./try.sh) but this is expected and the fileioccc.html` will be generated properly.

    Some JSON files might cause the program to continue to run and seemingly @@ -2445,7 +2445,7 @@ values but his implementation matches that of macOS and FreeBSD.

    that they can work but it might end up that the scripts don’t show any output anyway as they use the full alphabet. To test that it works one can have a script like:

    -
        LC_ALL=C  aäbcdefghijklmnoöpqrsßtuüvwxyz | LC_ALL=C grep .. | LC_ALL=de_DE.UTF-8 ./prog aäbcdefghijklmnoöpqrsßtuüvwxyz
    +
        LC_ALL=C  aäbcdefghijklmnoöpqrsßtuüvwxyz | LC_ALL=C grep .. | LC_ALL=de_DE.UTF-8 ./prog aäbcdefghijklmnoöpqrsßtuüvwxyz

    If you run this you should see:

        aäbcdefghijklmnoöpqrsßtuüvwxyz

    which shows it works. However as the de.sh script refers to all letters it can’t @@ -2477,20 +2477,20 @@ beginning.

    This program will also very likely leave sockets lying about in the current working directory. For instance Cody Boone Ferguson showed us this:

    -
        $ ls -al |grep '^s'
    -    srwxr-xr-x   1 cody  staff     0 Apr  6 08:19 .BDHFHALG=
    -    srwxr-xr-x   1 cody  staff     0 Apr  6 08:15 .CGGHAMGC=
    -    srwxr-xr-x   1 cody  staff     0 Apr  6 08:16 .CMDGAELH=
    -    srwxr-xr-x   1 cody  staff     0 Apr  3 08:47 .CMLBCCDA=
    -    [...]
    +
        $ ls -al |grep '^s'
    +    srwxr-xr-x   1 cody  staff     0 Apr  6 08:19 .BDHFHALG=
    +    srwxr-xr-x   1 cody  staff     0 Apr  6 08:15 .CGGHAMGC=
    +    srwxr-xr-x   1 cody  staff     0 Apr  6 08:16 .CMDGAELH=
    +    srwxr-xr-x   1 cody  staff     0 Apr  3 08:47 .CMLBCCDA=
    +    [...]

    This is NOT a bug and you’ll have to (at least at this time?) delete the files manually. You shouldn’t have to worry about these being added to git: it seems to ignore sockets (it did at least in macOS).

    He provides the following tips on this situation. A simpler way to find sockets in the directory:

    -
        file .*|grep socket|cut -f1 -d:
    +
        file .*|grep socket|cut -f1 -d:

    To delete them you can do:

    -
        find . -exec file '{}' \;|grep socket|cut -f 1 -d: | xargs rm -f
    +
        find . -exec file '{}' \;|grep socket|cut -f 1 -d: | xargs rm -f

    though one might want to check that the program is not currently running. :-)

    2019/endoh

    STATUS: INABIAF - please DO NOT fix

    diff --git a/bugs.md b/bugs.md index 14c88f753..d95045dcd 100644 --- a/bugs.md +++ b/bugs.md @@ -421,7 +421,7 @@ own fix or suggest that they're fixed! The purpose of this program is to print out a string of rubbish. In particular you should see something like: -```sh +``` $ ./decot '",x); /* \ @@ -527,7 +527,7 @@ With version 2 it sometimes segfaults even with the same input where other times it does not. We don't believe this is because of the fix that lets some versions be compiled with clang. An example invocation is: -```sh +``` ./ver2 < westley.c ``` @@ -575,7 +575,7 @@ The comments are processed too. Furthermore it happens that the last line becomes the first and the first line becomes the last! Now if you look at the code you'll see on the first line: -```c +``` /**//*/};)/**/pain(*//**/tang ,gnat/**//*/,ABBA~,0-0(avnz;)0-0,tang,raeN ``` @@ -583,13 +583,13 @@ In `ver0` it'll be the same but the others are more interesting. In `ver1` you'll see on the last line: -```c +``` cnva((vag)NOON&2/*//*\\**/,gnat,tang ,NOON/**//*/(niam/**/);}/*//**/ ``` and on the first line: -```c +``` /**//*/};)/**/cnva(*//**/gnat ,tang/**//*/,NOON~,0-0(niam;)0-0,gnat,enrA ``` @@ -653,7 +653,7 @@ A point worth considering is that as the number passed into the program gets bigger the number of lines of output gets substantially larger and it takes much more time and resources to run as well. For instance: -```sh +``` $ for n in $(seq 1 18); do echo "$n"; echo "$n" | time "./baruch" | wc -l | sed -E -e 's/[[:space:]]//g'; done 1 3 @@ -724,7 +724,7 @@ Endoh](../authors.html#Yusuke_Endoh) provided the `btoa` script but it appears there is a bug in this entry. The judges wrote that to test the entry one can do: -```sh +``` echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw ``` @@ -733,7 +733,7 @@ sentence. But doing this shows instead: -```sh +``` echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw a얖?)V...?????777??hC??h??-? )SSSSXXX????r?L=???*?-???ppp,,,?R ?j @@ -746,7 +746,7 @@ Notice how there's no newline at the end: that final `$` is the prompt. If one does, however: -```sh +``` echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw | ./jaw ``` @@ -842,7 +842,7 @@ that that is the error message. Another thing is that the code: -```c +``` printf((W,Y)); ``` @@ -885,7 +885,7 @@ Leo Broukhis, before he was an IOCCC judge, sent the IOCCC judges an email: A quick debugging session from Cody suggests that the problem with this value is that: -```c +``` if ( ppp->qq!=48 ) return; ``` @@ -893,7 +893,7 @@ is never reached because the value is never 48 (it is in other cases but not for the example input). It varies in value at this point. Observe that the next lines of code are: -```c +``` while ( ppp->qq==48 ) { printf("%ld\n",qqq-45); @@ -909,7 +909,7 @@ for the `!= 48` is also required. Perhaps more useful to know is that at this point in the code the code: -```c +``` if ((((( !(aa=setjmp(ppp->ppp))||aa==aaaaaa ))))) ``` @@ -1064,7 +1064,7 @@ at 80 columns. However due to the nature of the program if the terminal is < 80 in column width it will not display right. To see the number of columns in your terminal try: -```sh +``` echo $COLUMNS ``` @@ -1074,7 +1074,7 @@ terminal try: The author suggested that the alternate version, which Cody added (but fixed for modern systems), should print -```c +``` main(l,a,n,d)... [A M E R I C A]... ``` @@ -1163,7 +1163,7 @@ fixed except for an exercise to yourself, should you wish to try. This program uses `system(3)` so if you provide invalid characters in the question you might cause an error. For instance don't do this: -```sh +``` $ ./schnitzi schnitzi.info This program answers questions about paragraphs of text posed to it in English. It is written @@ -1275,7 +1275,7 @@ below. You might wish to run the command: -```sh +``` make diff_orig_prog ``` @@ -1283,7 +1283,7 @@ to see what had to change for the buffer size, when looking at the below. Furthermore you will want to look at: -```sh +``` diff schnitzi.alt.c schnitzi.alt2.c ``` @@ -1335,7 +1335,7 @@ h If you join the lines you end up with: -```c +``` #include ``` @@ -1362,7 +1362,7 @@ To say just how sensitive this entry is: even a space, lack of space or a character, wrong character, lack of character or character in the wrong place can cause a compilation error! Make sure that the output of: -```sh +``` ./schnitzi < schnitzi.c ``` @@ -1462,7 +1462,7 @@ it calls `getchar()` via the pointer `m`. So this is a feature not a bug. The judges suggested that the following commands should result in output: -```sh +``` ./leo 1 | cat - /dev/tty | gs - ./leo 37 80 | cat - /dev/tty | gs - @@ -1470,7 +1470,7 @@ The judges suggested that the following commands should result in output: The first one can work if one does instead: -```sh +``` echo "" | ./leo 1 > foo.ps gs foo.ps ``` @@ -1532,7 +1532,7 @@ almost be done except that some of the output of the This diff almost does it but not quite: -```diff +``` diff --git i/1996/huffman/huffman.c w/1996/huffman/huffman.c index a5745bc7f4fa28b834c004f4cf19633e40ad9165..5e5e5334f33f9dbd95c70eddece3189d9bcff5e9 100644 --- i/1996/huffman/huffman.c @@ -1620,7 +1620,7 @@ See above entry [1998/dlowe](1998/dlowe/dlowe.c). A point worth considering is that as the number passed into the program gets bigger the number of lines of output gets substantially larger. For instance: -```sh +``` $ ./schnitzi 9|wc -l 771999 ``` @@ -1651,7 +1651,7 @@ There was no IOCCC in 1999. The author gives an example command: -```sh +``` echo "7 P 6 d P P 8 p" | ./dlowe | tr 876 tpo ``` @@ -1665,7 +1665,7 @@ see that it does indeed crash! The reason for this not working is really strange. -```sh +``` $ echo "7 P 6 d P P 8 p" | ./dlowe 7668 $ echo "7 P 6 d P P 8 p" | ./dlowe | grep 7 @@ -1674,21 +1674,21 @@ The reason for this not working is really strange. Why? Is it writing to stdout? Let's try some other things: -```sh +``` $ echo 7668 | tr 876 tpo poot ``` Okay so we know that it SHOULD work. But we also know something funny is going on with stdout and the entry. Another experiment: -```sh +``` $ echo "7 P 6 d P P 8 p" | ./dlowe 1>&2 | grep 7 7668 ``` Okay so now it sees it, `grep`. But watch! -```sh +``` $ echo "7 P 6 d P P 8 p" | ./dlowe 2>foo 1>&1 7668 $ cat foo @@ -1696,7 +1696,7 @@ Okay so now it sees it, `grep`. But watch! .. so at this hour it does appear to be writing to stdout but yet somehow it doesn't? But watch: -```sh +``` $ echo "7 P 6 d P P 8 p" | ./dlowe 1>foo 1>&1 $ cat foo $ @@ -1712,7 +1712,7 @@ with things but we don't know. Other commands do work, however, and give the appropriate output, such as: -```sh +``` $ echo 1 2 + p | ./dlowe 3 ``` @@ -1721,7 +1721,7 @@ so something is wrong with some commands/operators. Another feature that does work in linux is: -```sh +``` $ echo poot | ./dlowe poot was here! ``` @@ -1735,7 +1735,7 @@ C program except that it has the `#!/usr/bin/env perl` and `use warnings;` as well. A note below might suggest that doing this creates incomplete perl. Anyway: -```c +``` #include int main(void) { @@ -1761,7 +1761,7 @@ Anyway: Compiling this you can generate: -```perl +``` #!/usr/bin/env perl use warnings;_:$_= <> ; defined or exit; @ARGV=split; __:$_= shift;defined or goto _; chomp ;(m*^\x70oO\x74$*i)?(print "$_ w\x61s h\145r\x65!\n"):((m*^\s\*(-?\d+(\.\d+)?)\s\*$*)?(push@SS ,$1):(&{chr(((ord)%39)+3**4)x2 } )); goto __; sub ff { @SS= ()} sub __{print "stack empty\n"} sub ss{$#SS<0 and goto & __; print $SS[$#SS]."\n"} sub SS{ $#SS<0 and goto &__ ; print pop @SS}sub _ { print "divide by zero\n"}sub ii{map{ print"$_\n" } reverse @SS} sub AUTOLOAD { print"unimplemented\n"} sub gg{ $#SS<0 and goto &__;push@SS,$SS[ $#SS]} sub uu{ $#SS<1 and goto &__;$SS[ $#SS]+= $SS[$#SS-1];$SS[$#SS-1]=$SS[$#SS]-$SS[$#SS-1]; $SS[$#SS]-=$SS[$#SS-1]} ``` @@ -1789,7 +1789,7 @@ itself it will print what's on the stack (for example). To not get 'unimplemented' you can remove from the perl: -```perl +``` sub AUTOLOAD { print"unimplemented\n"} ``` @@ -1801,7 +1801,7 @@ others too.) Here is an example run of several operations in the perl script after removing that subroutine: -```sh +``` $ echo 5 5 p | ./dlowe.pl 5 $ echo 5 5 + p | ./dlowe.pl @@ -1841,7 +1841,7 @@ invalid input. But as can be seen by the input I (Cody) gave the input is not actually incorrect. It is also curious to note that it ends up printing what's on the stack at that point: -```sh +``` $ echo 5 5 + p | ./dlowe.pl unimplemented 5 @@ -1858,7 +1858,7 @@ they said is in `Perl_sv_upgrade`. As this is documented it is not considered a bug to be fixed. For the curious this will crash in macOS. Cody notes that the code that crashes is: -```c +``` perl_eval_sv (newSVpv("_:$_= <> ; defined or exit; @ARGV" "=split; __:$_= shift;defined or goto _; chomp " @@ -1881,7 +1881,7 @@ code that crashes is: and in particular it appears that it is the perl itself. In other words if one changes it to be: -```c +``` perl_eval_sv(newSVpv("",0),0); ``` @@ -1893,7 +1893,7 @@ crash this makes sense. The example command above _should_ print: -```sh +``` $ echo "13 14 15 16 17 + - * / p" | ./dlowe -0.0515873015873016 ``` @@ -1916,7 +1916,7 @@ of 92 warnings! Nonetheless neither works okay and both crash. This program does not do what you might think it does! Running it like: -```sh +``` ./primenum 13 ``` @@ -2173,13 +2173,13 @@ Since the game never ends properly the score is not printed either. It appears that the crash happens in more than one place. For instance it has happened at -```c +``` XCheckMaskEvent(d, 4,&e) ``` but it's also happened at -```c +``` else XDrawPoint(d ,w,g,(l.s+=l.a)>>9, h=(l.c+=l.b)>>9) ``` @@ -2192,7 +2192,7 @@ In both cases the pointer `d` was corrupted: It is believed that it also happened at -```c +``` XDrawString(d,w,g,W/3,H/2,m,B); ``` @@ -2200,7 +2200,7 @@ in `J()` and for the same reason. The loop seems to be stuck in the call to `usleep(3)` like: -```c +``` usleep(p*200); ``` @@ -2238,7 +2238,7 @@ There was no IOCCC in 2003. Segmentation fault will occur in some systems. For instance on macOS with the arm64 chip: -```sh +``` ./gavin > kernel ``` @@ -2260,7 +2260,7 @@ you have a fix? We welcome your help! Although not related some recent changes were made to 2004/gavin to let it compile under clang. The following patch was applied: -```patch +``` diff --git a/2004/gavin/gavin.c b/2004/gavin/gavin.c index c967b7e..2082b49 100644 --- a/2004/gavin/gavin.c @@ -2289,7 +2289,7 @@ compile under clang. The following patch was applied: The original Makefile from 2004 had the following to say about this entry: -```make +``` # Special flags for the gavin entry # # FYI: Older versions of GCC have a bug in -O2 optimization, hence -O1 @@ -2519,7 +2519,7 @@ obnoxious in macOS as it shows it at runtime (redirecting `stderr` to `/dev/null` will silence it). The following diff will almost work but it crashes with at least `computer.tofu` input file: -```diff +``` 12a13 #define gets(c) fgets((c),PI,stdin)&&(((c)[strlen((c))-1]='\0'),c!=NULL) ``` @@ -2731,7 +2731,7 @@ With `address` in linux: but it actually works. This code is: -```c +``` } else p++; W(c)} /* LINE 101 */ @@ -2740,13 +2740,13 @@ but it actually works. This code is: Okay but what about argument 2? Well `W` is defined as: -```c +``` #define W(c) e=memmove(e,x[(u)c], y[(u)c])+y[(u)c]; ``` so it would appear that -```c +``` x[(u)c] ``` @@ -2842,7 +2842,7 @@ Now with `address` sanitiser both linux and macOS crash at: which corresponds to the code: -```c +``` o rd(u v) { o *a = 0, **b = &a, **c = b + 32; @@ -3224,7 +3224,7 @@ is not. Again see his index.html for details. However it is also possible to not rely on the entry as the below shows. One should be able to do: -```sh +``` echo 'No. I want chocolate!' | ./prog > chocolate.raw ./prog e < chocolate.raw @@ -3367,7 +3367,7 @@ loop printing whitespace. When you run it on a JSON file you will see something like: -```sh +``` $ ./prog < ioccc.json > ioccc.html Assertion failed: (rulez), function C, file prog.c, line 124. Abort trap: 6 @@ -3505,7 +3505,7 @@ that they can work but it might end up that the scripts don't show any output anyway as they use the full alphabet. To test that it works one can have a script like: -```sh +``` LC_ALL=C aäbcdefghijklmnoöpqrsßtuüvwxyz | LC_ALL=C grep .. | LC_ALL=de_DE.UTF-8 ./prog aäbcdefghijklmnoöpqrsßtuüvwxyz ``` @@ -3557,7 +3557,7 @@ This program will also very likely leave sockets lying about in the current working directory. For instance [Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson) showed us this: -```sh +``` $ ls -al |grep '^s' srwxr-xr-x 1 cody staff 0 Apr 6 08:19 .BDHFHALG= srwxr-xr-x 1 cody staff 0 Apr 6 08:15 .CGGHAMGC= @@ -3573,13 +3573,13 @@ to ignore sockets (it did at least in macOS). He provides the following tips on this situation. A simpler way to find sockets in the directory: -```sh +``` file .*|grep socket|cut -f1 -d: ``` To delete them you can do: -```sh +``` find . -exec file '{}' \;|grep socket|cut -f 1 -d: | xargs rm -f ``` diff --git a/faq.html b/faq.html index 69d2f68f8..52466a4b3 100644 --- a/faq.html +++ b/faq.html @@ -379,7 +379,7 @@ command that is compatible with GNU Make version 3.81.

    FAQ 0.3: May I use a different source or compiled filename than prog.c or prog?

    While your entry’s source filename, as submitted, must be prog.c, your entry’s Makefile may copy prog.c to a different filename as part of the compiling/building process. For example:

    -
        all: desired_name
    +
        all: desired_name
     
         desired_name: desired_name.c
                 cc desired_name.c -o $@
    @@ -394,7 +394,7 @@ may copy prog.c to a different filename as part of the compiling/bu
     creates as part of the compiling/building process.

    You may also copy the compiled prog into a different file as part of compiling process. For example:

    -
        different_name: prog
    +
        different_name: prog
                 rm -f $@
                 cp -f prog $@

    FAQ 0.4: What platform should I assume for my entry?

    @@ -779,7 +779,7 @@ winning entries page.

    Section 3: Compiling and running IOCCC entries

    FAQ 3.0: What Makefile rules are available to build or clean up IOCCC entries?

    In general the best way to compile everything in an entry directory is to run:

    -
        make clobber all
    +
        make clobber all

    If you wish to compile every entry for every year you should go to the top level directory and run the same command as above, make clobber all.

    The all rule will build everything necessary except for the alternate @@ -788,10 +788,10 @@ alternate version exists. To build all the entries along with any alternate code you can do from the top level directory:

        make clobber everything

    If you wish to only build alternate code you can do:

    -
        make clobber alt
    +
        make clobber alt

    If you wish to not remove the entry binaries and only compile the additional alt versions:

    -
        make alt
    +
        make alt

    The following Makefile rules should be in all Makefiles:

    • all: build the entry programs (main program and any supplementary program)
    • @@ -948,7 +948,7 @@ the thanks-for-help.html file.

      Red Hat based Linux

      First, see the above note on installing and starting Xorg.

      Install Xorg and related packages:

      -
          sudo dnf install --skip-broken --best --exclude xorgxrdp --exclude xorgxrdp-glamor '*xorg*' 'libx*' 'libX*' 'fontconfig*'
      +
          sudo dnf install --skip-broken --best --exclude xorgxrdp --exclude xorgxrdp-glamor '*xorg*' 'libx*' 'libX*' 'fontconfig*'

      See also:

      For systems that have the dnf(1) command:

      -
          sudo dnf install --skip-broken --best --exclude xorgxrdp --exclude xorgxrdp-glamor '*xorg*' 'libx*' 'libX*' 'fontconfig*'
      +
          sudo dnf install --skip-broken --best --exclude xorgxrdp --exclude xorgxrdp-glamor '*xorg*' 'libx*' 'libX*' 'fontconfig*'

      For systems that have the yum(1) command:

      -
          sudo yum install --skip-broken --best --exclude xorgxrdp --exclude xorgxrdp-glamor '*xorg*' 'libx*' 'libX*' 'fontconfig*'
      +
          sudo yum install --skip-broken --best --exclude xorgxrdp --exclude xorgxrdp-glamor '*xorg*' 'libx*' 'libX*' 'fontconfig*'

      IMPORTANT NOTE: The X.org server has been deprecated. See the above note for details.

      package website

      @@ -1020,13 +1020,13 @@ See the above note for details.

      macOS with alternative methods for macOS and different package managers with Linux.

      Red Hat based Linux

      Execute the following as root or via sudo:

      -
          dnf install SDL2 SDL2-devel sdl12-compat sdl12-compat-devel
      +
          dnf install SDL2 SDL2-devel sdl12-compat sdl12-compat-devel

      Older RHEL distributions might have to use “yum” instead of “dnf” in the above command.

      In the past it was said that one might need to run make like:

      -
          make ... SDL2_INCLUDE_ROOT=/usr
      +
          make ... SDL2_INCLUDE_ROOT=/usr

      or set the following environment variable:

      -
          export SDL2_INCLUDE_ROOT=/usr
      +
          export SDL2_INCLUDE_ROOT=/usr

      but this might not be necessary in more modern days especially as we use sdl-config and sdl2-config which should find the proper paths.

      macOS

      @@ -1038,20 +1038,20 @@ the package website.

      macOS via Homebrew

      If you have not already done so, install Homebrew.

      Then to install SDL and SDL2, execute the following command:

      -
          brew install sdl2 sdl12-compat
      -    eval "$(opt/homebrew/bin/brew shellenv)"
      +
          brew install sdl2 sdl12-compat
      +    eval "$(opt/homebrew/bin/brew shellenv)"
      macos via MacPorts

      If you haven’t already, install MacPorts. Then run:

      -
          sudo port install libsdl libsdl2
      +
          sudo port install libsdl libsdl2

      Debian based Linux

      Execute the following as root or via sudo:

      -
          apt install libsdl1.2debian libsdl1.2-dev libsdl2-dev
      +
          apt install libsdl1.2debian libsdl1.2-dev libsdl2-dev

      and then try make all again.

      In the past it was said that one might need to run make like:

      -
          make ... SDL2_INCLUDE_ROOT=/usr
      +
          make ... SDL2_INCLUDE_ROOT=/usr

      or set the following environment variable:

      -
          export SDL2_INCLUDE_ROOT=/usr
      +
          export SDL2_INCLUDE_ROOT=/usr

      but this might not be necessary in more modern days especially as we use sdl-config and sdl2-config which should find the proper paths.

      Other Linux distributions

      @@ -1075,10 +1075,10 @@ as a GitHub pull request for more information about pull requests.

      macOS with alternative methods for macOS and different package managers with Linux.

      Red Hat based Linux

      Execute the following as root or via sudo:

      -
          dnf install ncurses ncurses-devel
      +
          dnf install ncurses ncurses-devel

      macOS

      With macOS it should already be installed. If it is not you might have to do:

      -
          xcode-select --install
      +
          xcode-select --install

      and agree to the terms and conditions and proceed with the install.

      macOS via Homebrew

      Not applicable, see above.

      @@ -1086,7 +1086,7 @@ macOS with alternative methods for macOS and different package managers with Lin

      Not applicable, see above.

      Debian based Linux

      Execute the following as root or via sudo:

      -
          apt install libncurses6
      +
          apt install libncurses6

      and then try make all again.

      Other Linux distributions

      Use your package manager to install the appropriate packages. Try the search @@ -1103,18 +1103,18 @@ processing programs, SoX, will work. H install depends on your OS.

      Red Hat based Linux

      As root or via sudo:

      -
          dnf install -y sox sox-devel
      +
          dnf install -y sox sox-devel

      macOS

      For macOS there are two well known options.

      macOS via Homebrew

      If you have not already done so, install Homebrew.

      Then to install SoX, execute the following command:

      -
          brew install sox
      -    eval "$(opt/homebrew/bin/brew shellenv)"
      +
          brew install sox
      +    eval "$(opt/homebrew/bin/brew shellenv)"
      macOS via MacPorts

      If you haven’t already, install MacPorts. Then run:

      -
          sudo port install sox
      +
          sudo port install sox

      Debian based Linux

      Usually the index.html file will explain how to use it under Debian so we do not include this here, at least for now.

      @@ -1135,13 +1135,13 @@ when they do, -Weverything is enabled with all of its challenges, p warnings, and sometimes warnings about things that do not matter, some of which are frankly frivolous and often downright dubious.

      To enable this feature:

      -
          make clobber all CC=clang
      +
          make clobber all CC=clang

      or:

      -
          make clobber all 'CWARN+= -Weverything'
      +
          make clobber all 'CWARN+= -Weverything'

      though it should be noted that if one tries -Weverything with compilers that are not clang they might see something like:

      -
          echo 'int main(void) {}' > foo.c ; cc -Weverything foo.c -o foo
      -    cc: error: unrecognized command-line option '-Weverything'
      +
          echo 'int main(void) {}' > foo.c ; cc -Weverything foo.c -o foo
      +    cc: error: unrecognized command-line option '-Weverything'

      which means that it can’t even be compiled. Thus the proper way to do it is the first way, make clobber all CC=clang.

      IOCCC authors who have access to clang might wish to try their @@ -1184,11 +1184,11 @@ Ferguson was able to get much of it to work and looking at that entry might be of value to your submissions, at least if you can figure the code out :-). To see the differences, try from 1989/westley:

      -
          make diff_orig_prog
      +
          make diff_orig_prog

      If you have colordiff try:

      -
          make DIFF=colordiff diff_orig_prog
      +
          make DIFF=colordiff diff_orig_prog

      Alternatively you can try:

      -
          git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..eb9e69fde657acc8c85a618a8a99af4c2f93b21d westley.c
      +
          git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..eb9e69fde657acc8c85a618a8a99af4c2f93b21d westley.c

      As you can see, using clang has some additional problems to work out but if you can get your entry to work well in clang it might very well be considered better than other entries.

      @@ -1202,14 +1202,14 @@ special characters. There are typical defaults like (where ^ = ctrl

    and various others. But if you don’t know this you can find out through the stty(1) command with the -a option. For instance with macOS you might see:

    -
        $ stty -a
    -    speed 9600 baud; rows 40; columns 155;
    -    intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; [..snip..]
    +
        $ stty -a
    +    speed 9600 baud; rows 40; columns 155;
    +    intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; [..snip..]

    If you know the name you can use grep to find the correct line and if your implementation of grep(1) has the -o option you can filter it. For instance to find what the intr is set to:

    -
        $ stty -a |grep -o 'intr = ^[[:alpha:]]'
    -    intr = ^C
    +
        $ stty -a |grep -o 'intr = ^[[:alpha:]]'
    +    intr = ^C

    … assuming of course that it’s a ctrl combination :-) If for some strange reason it’s not you might have to do something else including just piping it to just grep intr or whatever.

    @@ -1246,19 +1246,19 @@ Please see FAQ 5.2 for how to submit a fix to an IOC

    If your OS package manager does not have the package tcpserver you can download, making sure you’re in a temporary directory, and compile the source like:

    -
        wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
    -    tar ucspi-tcp-0.88.tar.gz
    -    cd ucspi-tcp-0.88
    -    make
    +
        wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
    +    tar ucspi-tcp-0.88.tar.gz
    +    cd ucspi-tcp-0.88
    +    make

    Then as root or via sudo(1) enter:

    -
        make setup check
    +
        make setup check

    That will install it to /usr/local/bin. Now you should be able to use the entry in question.

    3.15 - How do I compile and install netpbm for entries that require it?

    This depends on your operating system for which we describe a couple below.

    Red Hat based Linux

    Execute the following as root or via sudo:

    -
        dnf install netpbm-progs netpbm
    +
        dnf install netpbm-progs netpbm

    Older RHEL distributions might have to use “yum” instead of “dnf” in the above command.

    macOS

    @@ -1270,14 +1270,14 @@ the package website.

    macOS via Homebrew

    If you have not already done so, install Homebrew.

    Then to install netpbm, execute the following command:

    -
        brew install netpbm
    +
        brew install netpbm
    macos via MacPorts

    If you haven’t already, install MacPorts. Then run:

    -
        sudo port install libnetpbm netpbm
    +
        sudo port install libnetpbm netpbm

    Debian based Linux

    Execute the following as root or via sudo:

    -
        apt install netpbm
    +
        apt install netpbm

    and then try make all again.

    Other Linux distributions

    Use your package manager to install the appropriate packages. Try the search @@ -1292,7 +1292,7 @@ for downloading, installing and using netpbm.

    This depends on your operating system for which we describe a couple below.

    Red Hat based Linux

    Execute the following as root or via sudo:

    -
        dnf install libjpeg-turbo-utils libjpeg-turbo-devel libjpeg-turbo
    +
        dnf install libjpeg-turbo-utils libjpeg-turbo-devel libjpeg-turbo

    Older RHEL distributions might have to use “yum” instead of “dnf” in the above command.

    macOS

    @@ -1304,14 +1304,14 @@ the package website.

    macOS via Homebrew

    If you have not already done so, install Homebrew.

    Then to install libjpeg-turbo, execute the following command:

    -
        brew install libjpeg-turbo
    +
        brew install libjpeg-turbo
    macos via MacPorts

    If you haven’t already, install MacPorts. Then run:

    -
        sudo port install libjpeg-turbo libjpeg-turbo-devel
    +
        sudo port install libjpeg-turbo libjpeg-turbo-devel

    Debian based Linux

    Execute the following as root or via sudo:

    -
        apt install libturbojpeg0 libturbojpeg0-dev
    +
        apt install libturbojpeg0 libturbojpeg0-dev

    and then try make all again.

    Other Linux distributions

    Use your package manager to install the appropriate packages. Try the search @@ -1326,7 +1326,7 @@ for downloading, installing and using libjpeg-turbo.

    This depends on your operating system for which we describe a couple below.

    Red Hat based Linux

    Execute the following as root or via sudo:

    -
        dnf install ImageMagick
    +
        dnf install ImageMagick

    Older RHEL distributions might have to use “yum” instead of “dnf” in the above command.

    macOS

    @@ -1338,14 +1338,14 @@ the package website.

    macOS via Homebrew

    If you have not already done so, install Homebrew.

    Then to install ImageMagick, execute the following command:

    -
        brew install ImageMagick
    +
        brew install ImageMagick
    macos via MacPorts

    If you haven’t already, install MacPorts. Then run:

    -
        sudo port install ImageMagick
    +
        sudo port install ImageMagick

    Debian based Linux

    Execute the following as root or via sudo:

    -
        apt install imagemagick
    +
        apt install imagemagick

    and then try make all again.

    Other Linux distributions

    Use your package manager to install the appropriate packages. Try the search @@ -1363,12 +1363,12 @@ See FAQ 3.7: How do I run an IOCCC entry that requires X1 general information about X11.

    Once X11 is install and the X Window Server is running, one needs to compile and link with the two libraries, GL and GLU:

    -
        cc ... -lGL -lGLU -L _location-where-X11-libs-are-installed_ -lX11
    +
        cc ... -lGL -lGLU -L _location-where-X11-libs-are-installed_ -lX11

    NOTE: The OpenGL development effort is being manageed by vulkan.org. We suggest you check out their resource for further information on OpenGL.

    Red Hat based Linux

    Execute the following as root or via sudo:

    -
        sudo dnf install glew-devel SDL2-devel SDL2_image-devel glm-devel freetype-devel
    +
        sudo dnf install glew-devel SDL2-devel SDL2_image-devel glm-devel freetype-devel

    See OpenGL Programming/Installation/Linux for details.

    Older RHEL distributions might have to use “yum” instead of “dnf” in the above command.

    @@ -1380,7 +1380,7 @@ should be able to go. However in Apple drops support for OpenGL later on, you might look to install OpenGL via Homebrew or MacPorts.

    Debian based Linux

    Execute the following as root or via sudo:

    -
        sudo apt-get install libglew-dev libsdl2-dev libsdl2-image-dev libglm-dev libfreetype6-dev
    +
        sudo apt-get install libglew-dev libsdl2-dev libsdl2-image-dev libglm-dev libfreetype6-dev

    and then try make all again.

    See OpenGL Programming/Installation/Linux for details.

    Other Linux distributions

    @@ -1409,9 +1409,9 @@ because of alarming warnings that can be displayed, in some systems at runtime interspersed with the output of the program.

    For instance in macOS the entry 1990/tbr would output the warning in such a way that caused confusing output for the entry, looking like:

    -
        $ ./tbr
    -    $ warning: this program uses gets(), which is unsafe.
    -    # nothing here, what to do?
    +
        $ ./tbr
    +    $ warning: this program uses gets(), which is unsafe.
    +    # nothing here, what to do?

    In some cases changing the code to use fgets() is not so easy to fix and in one case at least there is an alternate version that has the fix instead due to a problem it creates (correct output but segfaults after the output in one of @@ -1486,7 +1486,7 @@ allows for easily seeing the diffs.

    As some examples we’ll first look at one that has really long lines which will make it harder to see what is different, 2001/anonymous. What you would do is cd 2001/anonymous and then do:

    -
        make diff_orig_prog
    +
        make diff_orig_prog

    and then be really confused! :-)

    But for an entry like 1991/dds, you can see the differences much more easily. 1991/dds is a good example where it’s very @@ -1503,13 +1503,13 @@ when you have compiler errors :-) (though there are, as noted, some examples where it’s quite easy to see the differences).

    1991/dds is also a good example to see the alt difference very easily. To do that cd 1991/dds and then do:

    -
        make diff_alt_prog
    +
        make diff_alt_prog

    and you’ll see a single line changed and very simply.

    Tip: if you have colordiff installed it’s a lot easier to see the differences

    To use these rules but provide a different diff, for instance colordiff, just do:

    -
        make DIFF=colordiff diff_orig_prog # for orig to prog diff
    -    make DIFF=colordiff diff_alt_prog # for alt to prog diff
    +
        make DIFF=colordiff diff_orig_prog # for orig to prog diff
    +    make DIFF=colordiff diff_alt_prog # for alt to prog diff

    Obviously if you want to view the alt code or the orig code you can just open the files as described above.

    FAQ 4.3 - Why do author remarks sometimes not match the source and/or why are there other inconsistencies with the original entry?

    @@ -1778,7 +1778,7 @@ how they are used.

    POSIX safe string plus the use of + (for technical reasons beyond this answer). In particular, the author_handle must be an ASCII string that matches this regexp:

    -
        ^[0-9A-Za-z][0-9A-Za-z._+-]*$"
    +
        ^[0-9A-Za-z][0-9A-Za-z._+-]*$"

    Default author_handle’s do not have multiple consecutive _ (underscore) characters. Nevertheless, multiple consecutive _ (underscore) characters are allowed. Contest submitters who wish to override their default author_handle may do so.

    @@ -1799,7 +1799,7 @@ year.

    NOTE: even if the directory name is not anonymous the above rules apply as in in the case of 2005/anon.

    Anonymous author_handle’s match this regexp:

    -
        Anonymous_[0-9][0-9][0-9][0-9][.0-9]*$
    +
        Anonymous_[0-9][0-9][0-9][0-9][.0-9]*$

    See FAQ 5.5 for information about how to update and/or correct IOCCC author information.

    FAQ 6.6: What is a author_handle.json file and how are they used?

    @@ -1828,52 +1828,52 @@ for information on the So-called JSON spec.

    is to look at an example, the author_handle.json file for Yusuke Endoh:

        author/Yusuke_Endoh.json

    As of Thu Nov 30 23:51:12 UTC 2023, the contents was as follows:

    -
        {
    -        "no_comment" : "mandatory comment: because comments were removed from the original JSON spec",
    -        "author_JSON_format_version" : "1.0 2023-06-10",
    -        "author_handle" : "Yusuke_Endoh",
    -        "full_name" : "Yusuke Endoh",
    -        "sort_word" : "endoh",
    -        "location_code" : "JP",
    -        "email" : "mame@ruby-lang.org",
    -        "url" : "https://mametter.hatenablog.com",
    -        "alt_url" : null,
    -        "deprecated_twitter_handle" : null,
    -        "mastodon" : "@mame@ruby.social",
    -        "mastodon_url" : "https://ruby.social/@mame",
    -        "github" : "@mame",
    -        "affiliation" : null,
    -        "winning_entry_set" : [
    -            { "entry_id" : "2012_endoh1" },
    -            { "entry_id" : "2012_endoh2" },
    -            { "entry_id" : "2013_endoh1" },
    -            { "entry_id" : "2013_endoh2" },
    -            { "entry_id" : "2013_endoh3" },
    -            { "entry_id" : "2013_endoh4" },
    -            { "entry_id" : "2014_endoh1" },
    -            { "entry_id" : "2014_endoh2" },
    -            { "entry_id" : "2015_endoh1" },
    -            { "entry_id" : "2015_endoh2" },
    -            { "entry_id" : "2015_endoh3" },
    -            { "entry_id" : "2015_endoh4" },
    -            { "entry_id" : "2018_endoh1" },
    -            { "entry_id" : "2018_endoh2" },
    -            { "entry_id" : "2019_endoh" },
    -            { "entry_id" : "2020_endoh1" },
    -            { "entry_id" : "2020_endoh2" },
    -            { "entry_id" : "2020_endoh3" }
    -        ]
    -    }
    +
        {
    +        "no_comment" : "mandatory comment: because comments were removed from the original JSON spec",
    +        "author_JSON_format_version" : "1.0 2023-06-10",
    +        "author_handle" : "Yusuke_Endoh",
    +        "full_name" : "Yusuke Endoh",
    +        "sort_word" : "endoh",
    +        "location_code" : "JP",
    +        "email" : "mame@ruby-lang.org",
    +        "url" : "https://mametter.hatenablog.com",
    +        "alt_url" : null,
    +        "deprecated_twitter_handle" : null,
    +        "mastodon" : "@mame@ruby.social",
    +        "mastodon_url" : "https://ruby.social/@mame",
    +        "github" : "@mame",
    +        "affiliation" : null,
    +        "winning_entry_set" : [
    +            { "entry_id" : "2012_endoh1" },
    +            { "entry_id" : "2012_endoh2" },
    +            { "entry_id" : "2013_endoh1" },
    +            { "entry_id" : "2013_endoh2" },
    +            { "entry_id" : "2013_endoh3" },
    +            { "entry_id" : "2013_endoh4" },
    +            { "entry_id" : "2014_endoh1" },
    +            { "entry_id" : "2014_endoh2" },
    +            { "entry_id" : "2015_endoh1" },
    +            { "entry_id" : "2015_endoh2" },
    +            { "entry_id" : "2015_endoh3" },
    +            { "entry_id" : "2015_endoh4" },
    +            { "entry_id" : "2018_endoh1" },
    +            { "entry_id" : "2018_endoh2" },
    +            { "entry_id" : "2019_endoh" },
    +            { "entry_id" : "2020_endoh1" },
    +            { "entry_id" : "2020_endoh2" },
    +            { "entry_id" : "2020_endoh3" }
    +        ]
    +    }

    We now will walk thru the above JSON document looking at various JSON members:

    no_comment
    -
        "no_comment" : "mandatory comment: because comments were removed from the original JSON spec",
    +

    <!--- json--> "no_comment" : "mandatory comment: because comments were removed from the original JSON spec",

    Because the authors of the so-called JSON spec removed the ability to use comments in JSON (for reason(s) that seem to be less than credible), the IOCCC mandates this JSON member be present in all IOCCC related JSON files.

    There MUST be one and only one no_comment JSON member and the JSON value MUST be the exact JSON string as shown above.

    author_JSON_format_version
    -
        "author_JSON_format_version" : "1.0 2023-06-10",
    +
        "author_JSON_format_version" : "1.0 2023-06-10",

    This JSON member holds the format version of the author_handle.json JSON file.

    There MUST be one and only one author_JSON_format_version JSON member and the JSON value MUST be a JSON string.

    @@ -1885,7 +1885,7 @@ of the these files is modified: and then only those who maintain the official IOCCC web site would be the one to do this in conjunction with changes to bin directory tools.

    author_handle
    -
        "author_handle" : "Yusuke_Endoh",
    +
        "author_handle" : "Yusuke_Endoh",

    This JSON member holds the author handle of the author.

    There MUST be one and only one author_handle JSON member and the JSON value MUST be a JSON string that is also a value author handle.

    @@ -1899,14 +1899,14 @@ without the trailing .json) of the author_handle.json a change of author_handle JSON value would also require the author_handle.json file to also be renamed.

    full_name
    -
        "full_name" : "Yusuke Endoh",
    +
        "full_name" : "Yusuke Endoh",

    This JSON member holds the full name of the author.

    There MUST be one and only one full_name JSON member and the JSON value MUST be a JSON string.

    The full name of an author may use non-ASCII characters so long as the full name is properly encoded as a JSON string.

    sort_word
    -
        "sort_word" : "endoh",
    +
        "sort_word" : "endoh",

    This JSON member holds the string that will be used to sort the author.

    There MUST be one and only one sort_word JSON member and the JSON value MUST be a JSON string. Moreover the string MUST be a lower case ASCII @@ -1920,7 +1920,7 @@ wishes to be found in the /authors.html file under a different string, such as if they wish to be listed under their first name or their username, then they may change this accordingly.

    location_code
    -
        "location_code" : "JP",
    +
        "location_code" : "JP",

    This JSON member holds the string that is the ISO 3166-1 alpha-2 code of the author’s location or country.

    @@ -1937,38 +1937,38 @@ ISO 3166-1 alpha-2 codes belong to locations that are not technically a country, such as “Antarctica” or a User-assigned code.

    If the author wishes to not specify a location, they should select XX.

    email
    -
        "email" : "mame@ruby-lang.org",
    +
        "email" : "mame@ruby-lang.org",

    This JSON member holds the email address of the author, or is the value null.

    There MUST be one and only one email JSON member and the JSON value MUST be a JSON string or it MUST be a JSON null.

    If the author wishes to not specify an email address, or if the email address is unknown, they should use the JSON null as the JSON value of this JSON member. For example:

    -
        "email" : null,
    +
        "email" : null,

    NOTE: The JSON null is NOT enclosed in quotes!

    url
    -
        "url" : "https://mametter.hatenablog.com",
    +
        "url" : "https://mametter.hatenablog.com",

    This JSON member holds the URL of the author’s home page.

    There MUST be one and only one url JSON member and the JSON value MUST be a JSON string or it MUST be a JSON null.

    If the author wishes to not specify an email address, or if the URL is unknown, they should use the JSON null as the JSON value of this JSON member. For example:

    -
        "url" : null,
    +
        "url" : null,

    NOTE: The JSON null is NOT enclosed in quotes!

    alt_url
    -
        "alt_url" : null,
    +
        "alt_url" : null,

    This JSON member holds an alternate or 2nd URL a home page for the author.

    There MUST be one and only one url JSON member and the JSON value MUST be a JSON string or it MUST be a JSON null.

    In some cases the author may wish to record a special URL for their IOCCC entry, or a 2nd URL such as a work or school or personal home page. For example, Cody as of Thu Nov 30 23:51:12 UTC 2023 used:

    -
        "alt_url" : "https://ioccc.xexyl.net",
    +
        "alt_url" : "https://ioccc.xexyl.net",

    If the author wishes to not specify an email address, or if the alternate URL is unknown, they should use the JSON null as the JSON value of this JSON member. For example:

    -
        "url" : null,
    +
        "url" : null,

    NOTE: The JSON null is NOT enclosed in quotes!

    deprecated_twitter_handle

    This JSON member used to hold the twitter handle of the author.

    @@ -1978,14 +1978,14 @@ be a JSON string or it MUST be a JSON null.deprecated_twitter_handle
    is no longer used. A JSON value that is not a JSON null is kept for only historic reasons. For example, Anthony C. Howe once used:

    -
        "deprecated_twitter_handle" : "@SirWumpus",
    +
        "deprecated_twitter_handle" : "@SirWumpus",

    If the author wishes to not specify an twitter handle, or if the twitter handle is unknown, they should use the JSON null as the JSON value of this JSON member. For example:

    -
        "deprecated_twitter_handle" : null,
    +
        "deprecated_twitter_handle" : null,

    NOTE: The JSON null is NOT enclosed in quotes!

    mastodon
    -
        "mastodon" : "@mame@ruby.social",
    +
        "mastodon" : "@mame@ruby.social",

    This JSON member holds the Mastodon social network handle of the author.

    @@ -1997,7 +1997,7 @@ used by the author.

    For more information in Mastodon, see the Mastodon help guide. See the “Mastodon Address” section of that page in particular.

    The IOCCC Mastodon handle is:

    -
        @ioccc@fosstodon.org
    +
        @ioccc@fosstodon.org

    The IOCCC uses the Mastodon social network for announcements such as the opening and closing of a new IOCCC, changes to the IOCCC web site, updates during the judging process, and when new IOCCC entries @@ -2005,10 +2005,10 @@ are selected. We recommend you follow us on Mastodon.

    If the author wishes to not specify an Mastodon handle, or if the Mastodon handle is unknown, they should use the JSON null as the JSON value of this JSON member. For example:

    -
        "mastodon" : null,
    +
        "mastodon" : null,

    NOTE: The JSON null is NOT enclosed in quotes!

    mastodon_url
    -
        "mastodon_url" : "https://ruby.social/@mame",
    +
        "mastodon_url" : "https://ruby.social/@mame",

    This JSON member holds the URL of the author’s Mastodon page.

    There MUST be one and only one mastodon_url JSON member and the JSON value MUST be a JSON string or it MUST be a JSON null. The JSON string just be a valid URL. @@ -2022,10 +2022,10 @@ For example, if the Mastodon handle is:

    If the author wishes to not specify an Mastodon URL, or if the Mastodon URL is unknown, they should use the JSON null as the JSON value of this JSON member. For example:

    -
        "mastodon_url" : null,
    +
        "mastodon_url" : null,

    NOTE: The JSON null is NOT enclosed in quotes!

    github
    -
        "github" : "@mame",
    +
        "github" : "@mame",

    This JSON member holds the GitHub handle of the author.

    There MUST be one and only one github JSON member and the JSON value MUST be a JSON string or it MUST be a JSON null. The github JSON string MUST @@ -2037,10 +2037,10 @@ and hosts official IOCCC web site on GitHub

    If the author wishes to not specify an GitHub handle, or if the GitHub handle is unknown, they should use the JSON null as the JSON value of this JSON member. For example:

    -
        "github" : null,
    +
        "github" : null,

    NOTE: The JSON null is NOT enclosed in quotes!

    affiliation
    -
        "affiliation" : null,
    +
        "affiliation" : null,

    This JSON member holds the affiliation of the author.

    There MUST be one and only one affiliation JSON member and the JSON value MUST be a JSON string or it MUST be a JSON null.

    @@ -2051,19 +2051,19 @@ For example, the affiliation for the IOCCC would be:

    If the author wishes to not specify an affiliation, or if the affiliation is unknown, they should use the JSON null as the JSON value of this JSON member. For example:

    -
        "affiliation" : null,
    +
        "affiliation" : null,

    NOTE: The JSON null is NOT enclosed in quotes!

    winning_entry_set
    entry_id
    -
        "winning_entry_set" : [
    -        { "entry_id" : "2012_endoh1" },
    -        { "entry_id" : "2012_endoh2" },
    -        { "entry_id" : "2013_endoh1" },
    -    ...
    -        { "entry_id" : "2020_endoh1" },
    -        { "entry_id" : "2020_endoh2" },
    -        { "entry_id" : "2020_endoh3" }
    -    ]
    +
        "winning_entry_set" : [
    +        { "entry_id" : "2012_endoh1" },
    +        { "entry_id" : "2012_endoh2" },
    +        { "entry_id" : "2013_endoh1" },
    +    ...
    +        { "entry_id" : "2020_endoh1" },
    +        { "entry_id" : "2020_endoh2" },
    +        { "entry_id" : "2020_endoh3" }
    +    ]

    The winning_entry_set JSON member holds JSON array containing one or more entry_id _JSON member_s.

    There MUST be one and only one winning_entry_set and the JSON value MUST be a non-empty JSON array. Each value in that JSON array MUST must contain @@ -2091,7 +2091,7 @@ of the IOCCC entry directories for a given year. For example, see the 1984/anonymous/.path.

    The .top, .year and .path files are generated from the top level Makefile, by:

    -
        make genpath
    +
        make genpath

    <a name”terms”>FAQ 6.9: What is the current meaning of the IOCCC terms Author, Entry, and Submission?

    The IOCCC is now attempting to use the following terms:

      @@ -2163,7 +2163,7 @@ instructions. Once you’ve completed this task make sure you log in to GitHub.<

      Assuming you do not have an ssh key you should go to the command prompt and type (if you already have one and are okay using it for GitHub you can use that one):

      -
          ssh-keygen -t rsa -b 4096 -C "luser@example.com"
      +
          ssh-keygen -t rsa -b 4096 -C "luser@example.com"

      where luser@example.com is the email you want associated with your key. Follow the instructions. It will tell you the key files.

      Once you have an ssh key you need to go to your account @@ -2188,11 +2188,11 @@ instructions in forking the repo.

      Cloning the temp-test-ioccc repo

      Once you have forked the repo you are ready to clone it to your system. For instance Cody Boone Ferguson has the GitHub handle xexyl so he would type in:

      -
          git clone https://github.com/xexyl/temp-test-ioccc [target_dir]
      +
          git clone https://github.com/xexyl/temp-test-ioccc [target_dir]

      Once that is completed you will need to change to that directory. The default directory would be the name of the repo but if you specified a target directory it will be that. For instance using the above example you might do:

      -
          cd temp-test-ioccc
      +
          cd temp-test-ioccc

      You’re ready to make your changes now!

      Making changes, fixes etc.

      Here you must use your wits, knowledge, creativity and whatever else you have. @@ -2210,7 +2210,7 @@ or an exercise in sibilance!

      starts with # Last updated: to refer to 01 March 2024 rather than what it is now (at the time of writing this), 15 April 2023.

      But what if he wanted to add a file? He’d create the file and then type:

      -
          git add foo
      +
          git add foo

      where foo is the file to add.

      When he’s ready to make a commit he would need to create a new branch for the pull request.

      @@ -2218,26 +2218,26 @@ pull request.

      First, as an aside, if this is your first pull request (which we assume is if you’re reading this :-) ) you need to make sure that you can push changes to GitHub with your ssh key. To do this you need to do:

      -
          ssh -T git@github.com
      +
          ssh -T git@github.com

      Cody would see:

      Hi xexyl! You’ve successfully authenticated, but GitHub does not provide shell access.

      Now, assuming that the forked repo is https://github.com/xexyl/temp-test-ioccc, you’d type:

      -
          git remote set-url origin git@github.com:xexyl/temp-test-ioccc.git
      +
          git remote set-url origin git@github.com:xexyl/temp-test-ioccc.git

      Now you’d be ready to make your commits.

      Before doing anything else, however, a new branch needs to be created. Continuing the example above for 2020/ferguson1/play.sh, it might be that:

      -
          git checkout -B human-snakes
      +
          git checkout -B human-snakes

      This would change the branch to the newly created branch human-snakes branch. Now Cody could commit the changes:

      -
          git commit play.sh # if specifying specific files
      -    git commit -a # if committing everything
      +
          git commit play.sh # if specifying specific files
      +    git commit -a # if committing everything

      He could also have done:

      -
          git add play.sh
      -    git commit
      +
          git add play.sh
      +    git commit

      In any case this would open an editor (in his case vim) to write a commit log. It is recommended that the first line is <=51 chars and the next line is blank. Then if necessary add a description for the log. For instance the above might @@ -2250,7 +2250,7 @@ warrant the log:

      Opening a pull request

      To do this depends on the branch name. Assuming the branch from above, human-snakes, you would type:

      -
          git push --set-upstream origin human-snakes
      +
          git push --set-upstream origin human-snakes

      This might show:

          Enumerating objects: 9, done.
           Counting objects: 100% (9/9), done.
      @@ -2296,7 +2296,7 @@ in the matter.

      When the judges have merged the pull request you now need to make sure your fork has the merge. To do this from the command line, assuming the fork in the above example, you would type:

      -
          git checkout master && git pull https://github.com/ioccc-src/temp-test-ioccc.git master && git push origin master
      +
          git checkout master && git pull https://github.com/ioccc-src/temp-test-ioccc.git master && git push origin master

      This will merge your pull request to your fork.

      all: desired_name desired_name: desired_name.c @@ -336,7 +336,7 @@ creates as part of the compiling/building process. You may also copy the compiled `prog` into a different file as part of compiling process. For example: -```make +``` different_name: prog rm -f $@ cp -f prog $@ @@ -840,7 +840,7 @@ winning entries page](../years.html). In general the best way to compile everything in an entry directory is to run: -```sh +``` make clobber all ``` @@ -858,14 +858,14 @@ you can do from the top level directory: If you wish to only build alternate code you can do: -```sh +``` make clobber alt ``` If you wish to not remove the entry binaries and only compile the additional alt versions: -```sh +``` make alt ``` @@ -1078,7 +1078,7 @@ First, see the above note on [installing and starting Xorg](#X11_general). Install Xorg and related packages: -```sh +``` sudo dnf install --skip-broken --best --exclude xorgxrdp --exclude xorgxrdp-glamor '*xorg*' 'libx*' 'libX*' 'fontconfig*' ``` @@ -1107,7 +1107,7 @@ macOS, preferably the most recent version](https://support.apple.com/macos). After it is installed, open the "XQuartz" application (usually located in `/Applications/Utilities/XQuartz.app`) by typing at the command line: -```sh +``` open /Applications/Utilities/XQuartz.app ``` @@ -1141,7 +1141,7 @@ First, see the above note on [installing and starting Xorg](#X11_general). According to the [Debian Xorg wiki](https://wiki.debian.org/Xorg), installing X11 requires: -```sh +``` sudo apt install xorg ``` @@ -1167,13 +1167,13 @@ See also: For systems that have the `dnf(1)` command: -```sh +``` sudo dnf install --skip-broken --best --exclude xorgxrdp --exclude xorgxrdp-glamor '*xorg*' 'libx*' 'libX*' 'fontconfig*' ``` For systems that have the `yum(1)` command: -```sh +``` sudo yum install --skip-broken --best --exclude xorgxrdp --exclude xorgxrdp-glamor '*xorg*' 'libx*' 'libX*' 'fontconfig*' ``` @@ -1201,7 +1201,7 @@ macOS with alternative methods for macOS and different package managers with Lin Execute the following as root or via sudo: -```sh +``` dnf install SDL2 SDL2-devel sdl12-compat sdl12-compat-devel ``` @@ -1210,13 +1210,13 @@ in the above command. In the past it was said that one might need to run `make` like: -```sh +``` make ... SDL2_INCLUDE_ROOT=/usr ``` or set the following environment variable: -```sh +``` export SDL2_INCLUDE_ROOT=/usr ``` @@ -1239,7 +1239,7 @@ If you have not already done so, install [Homebrew](https://brew.sh). Then to install SDL and SDL2, execute the following command: -```sh +``` brew install sdl2 sdl12-compat eval "$(opt/homebrew/bin/brew shellenv)" ``` @@ -1251,7 +1251,7 @@ If you haven't already, install [MacPorts](https://www.macports.org/install.php). Then run: -```sh +``` sudo port install libsdl libsdl2 ``` @@ -1260,7 +1260,7 @@ If you haven't already, install Execute the following as root or via sudo: -```sh +``` apt install libsdl1.2debian libsdl1.2-dev libsdl2-dev ``` @@ -1268,13 +1268,13 @@ and then try `make all` again. In the past it was said that one might need to run `make` like: -```sh +``` make ... SDL2_INCLUDE_ROOT=/usr ``` or set the following environment variable: -```sh +``` export SDL2_INCLUDE_ROOT=/usr ``` @@ -1319,7 +1319,7 @@ macOS with alternative methods for macOS and different package managers with Lin Execute the following as root or via sudo: -```sh +``` dnf install ncurses ncurses-devel ``` @@ -1328,7 +1328,7 @@ Execute the following as root or via sudo: With macOS it should already be installed. If it is not you might have to do: -```sh +``` xcode-select --install ``` @@ -1349,7 +1349,7 @@ Not applicable, see above. Execute the following as root or via sudo: -```sh +``` apt install libncurses6 ``` @@ -1382,7 +1382,7 @@ install depends on your OS. As root or via sudo: -```sh +``` dnf install -y sox sox-devel ``` @@ -1396,7 +1396,7 @@ If you have not already done so, install [Homebrew](https://brew.sh). Then to install SoX, execute the following command: -```sh +``` brew install sox eval "$(opt/homebrew/bin/brew shellenv)" ``` @@ -1408,7 +1408,7 @@ If you haven't already, install [MacPorts](https://www.macports.org/install.php). Then run: -```sh +``` sudo port install sox ``` @@ -1447,20 +1447,20 @@ are frankly frivolous and often downright dubious. To enable this feature: -```sh +``` make clobber all CC=clang ``` or: -```sh +``` make clobber all 'CWARN+= -Weverything' ``` though it should be noted that if one tries `-Weverything` with compilers that are not `clang` they _might_ see something like: -```sh +``` echo 'int main(void) {}' > foo.c ; cc -Weverything foo.c -o foo cc: error: unrecognized command-line option '-Weverything' ``` @@ -1513,19 +1513,19 @@ get much of it to work and looking at that entry might be of value to your submissions, at least if you can figure the code out :-). To see the differences, try from `1989/westley`: -```sh +``` make diff_orig_prog ``` If you have `colordiff` try: -```sh +``` make DIFF=colordiff diff_orig_prog ``` Alternatively you can try: -```sh +``` git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..eb9e69fde657acc8c85a618a8a99af4c2f93b21d westley.c ``` @@ -1546,7 +1546,7 @@ special characters. There are typical defaults like (where `^` = ctrl): and various others. But if you don't know this you can find out through the `stty(1)` command with the `-a` option. For instance with macOS you might see: -```sh +``` $ stty -a speed 9600 baud; rows 40; columns 155; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; [..snip..] @@ -1556,7 +1556,7 @@ If you know the name you can use `grep` to find the correct line and if your implementation of `grep(1)` has the `-o` option you can filter it. For instance to find what the `intr` is set to: -```sh +``` $ stty -a |grep -o 'intr = ^[[:alpha:]]' intr = ^C ``` @@ -1610,7 +1610,7 @@ If your OS package manager does not have the package `tcpserver` you can download, making sure you're in a temporary directory, and compile the source like: -```sh +``` wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz tar ucspi-tcp-0.88.tar.gz cd ucspi-tcp-0.88 @@ -1619,7 +1619,7 @@ like: Then as root or via `sudo(1)` enter: -```sh +``` make setup check ``` @@ -1636,7 +1636,7 @@ This depends on your operating system for which we describe a couple below. Execute the following as root or via sudo: -```sh +``` dnf install netpbm-progs netpbm ``` @@ -1660,7 +1660,7 @@ If you have not already done so, install [Homebrew](https://brew.sh). Then to install netpbm, execute the following command: -```sh +``` brew install netpbm ``` @@ -1671,7 +1671,7 @@ If you haven't already, install [MacPorts](https://www.macports.org/install.php). Then run: -```sh +``` sudo port install libnetpbm netpbm ``` @@ -1680,7 +1680,7 @@ If you haven't already, install Execute the following as root or via sudo: -```sh +``` apt install netpbm ``` @@ -1713,7 +1713,7 @@ This depends on your operating system for which we describe a couple below. Execute the following as root or via sudo: -```sh +``` dnf install libjpeg-turbo-utils libjpeg-turbo-devel libjpeg-turbo ``` @@ -1737,7 +1737,7 @@ If you have not already done so, install [Homebrew](https://brew.sh). Then to install libjpeg-turbo, execute the following command: -```sh +``` brew install libjpeg-turbo ``` @@ -1748,7 +1748,7 @@ If you haven't already, install [MacPorts](https://www.macports.org/install.php). Then run: -```sh +``` sudo port install libjpeg-turbo libjpeg-turbo-devel ``` @@ -1758,7 +1758,7 @@ If you haven't already, install Execute the following as root or via sudo: -```sh +``` apt install libturbojpeg0 libturbojpeg0-dev ``` @@ -1790,7 +1790,7 @@ This depends on your operating system for which we describe a couple below. Execute the following as root or via sudo: -```sh +``` dnf install ImageMagick ``` @@ -1813,7 +1813,7 @@ If you have not already done so, install [Homebrew](https://brew.sh). Then to install ImageMagick, execute the following command: -```sh +``` brew install ImageMagick ``` @@ -1824,7 +1824,7 @@ If you haven't already, install [MacPorts](https://www.macports.org/install.php). Then run: -```sh +``` sudo port install ImageMagick ``` @@ -1833,7 +1833,7 @@ If you haven't already, install Execute the following as root or via sudo: -```sh +``` apt install imagemagick ``` @@ -1867,7 +1867,7 @@ general information about X11. Once X11 is install and the X Window Server is running, one needs to compile and link with the two libraries, _GL_ and _GLU_: -```sh +``` cc ... -lGL -lGLU -L _location-where-X11-libs-are-installed_ -lX11 ``` @@ -1879,7 +1879,7 @@ We suggest you check out their resource for further information on OpenGL. Execute the following as root or via sudo: -```sh +``` sudo dnf install glew-devel SDL2-devel SDL2_image-devel glm-devel freetype-devel ``` @@ -1903,7 +1903,7 @@ you might look to install OpenGL via Homebrew or MacPorts. Execute the following as root or via sudo: -```sh +``` sudo apt-get install libglew-dev libsdl2-dev libsdl2-image-dev libglm-dev libfreetype6-dev ``` @@ -1954,7 +1954,7 @@ interspersed with the output of the program. For instance in macOS the entry [1990/tbr](1990/tbr/index.html) would output the warning in such a way that caused confusing output for the entry, looking like: -```sh +``` $ ./tbr $ warning: this program uses gets(), which is unsafe. # nothing here, what to do? @@ -2044,7 +2044,7 @@ will make it harder to see what is different, [2001/anonymous](2001/anonymous/index.html). What you would do is `cd 2001/anonymous` and then do: -```sh +``` make diff_orig_prog ``` @@ -2069,7 +2069,7 @@ where it's quite easy to see the differences). [1991/dds](1991/dds/index.html) is also a good example to see the alt difference very easily. To do that `cd 1991/dds` and then do: -```sh +``` make diff_alt_prog ``` @@ -2081,7 +2081,7 @@ and you'll see a single line changed and very simply. To use these rules but provide a different `diff`, for instance `colordiff`, just do: -```sh +``` make DIFF=colordiff diff_orig_prog # for orig to prog diff make DIFF=colordiff diff_alt_prog # for alt to prog diff ``` @@ -2475,7 +2475,7 @@ POSIX safe string plus the use of `+` (for technical reasons beyond this answer). In particular, the `author_handle` must be an ASCII string that matches this regexp: -```re +``` ^[0-9A-Za-z][0-9A-Za-z._+-]*$" ``` @@ -2514,7 +2514,7 @@ in the case of [2005/anon](2005/anon/anon.c). Anonymous `author_handle`'s match this regexp: -```re +``` Anonymous_[0-9][0-9][0-9][0-9][.0-9]*$ ``` @@ -2564,7 +2564,7 @@ is to look at an example, the `author_handle.json` file for Yusuke Endoh: As of _Thu Nov 30 23:51:12 UTC 2023_, the contents was as follows: -```json +``` { "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", "author_JSON_format_version" : "1.0 2023-06-10", @@ -2608,7 +2608,7 @@ We now will walk thru the above JSON document looking at various JSON members: ##### no_comment -``` json +``` "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", ``` @@ -2622,7 +2622,7 @@ be the exact _JSON string_ as shown above. ##### author_JSON_format_version -```json +``` "author_JSON_format_version" : "1.0 2023-06-10", ``` @@ -2643,7 +2643,7 @@ in conjunction with changes to [bin directory tools](bin/index.html). ##### author_handle -```json +``` "author_handle" : "Yusuke_Endoh", ``` @@ -2666,7 +2666,7 @@ a change of _author_handle_ _JSON value_ would also require the ##### full_name -```json +``` "full_name" : "Yusuke Endoh", ``` @@ -2681,7 +2681,7 @@ full name is properly encoded as a _JSON string_. ##### sort_word -```json +``` "sort_word" : "endoh", ``` @@ -2704,7 +2704,7 @@ or their username, then they may change this accordingly. ##### location_code -```json +``` "location_code" : "JP", ``` @@ -2731,7 +2731,7 @@ If the author wishes to not specify a location, they should select **XX**. ##### email -```json +``` "email" : "mame@ruby-lang.org", ``` @@ -2744,7 +2744,7 @@ If the author wishes to not specify an email address, or if the email address is unknown, they should use the _JSON null_ as the _JSON value_ of this _JSON member_. For example: -```json +``` "email" : null, ``` @@ -2753,7 +2753,7 @@ NOTE: The _JSON null_ is **NOT** enclosed in quotes! ##### url -```json +``` "url" : "https://mametter.hatenablog.com", ``` @@ -2766,7 +2766,7 @@ If the author wishes to not specify an email address, or if the URL is unknown, they should use the _JSON null_ as the _JSON value_ of this _JSON member_. For example: -```json +``` "url" : null, ``` @@ -2775,7 +2775,7 @@ NOTE: The _JSON null_ is **NOT** enclosed in quotes! ##### alt_url -```json +``` "alt_url" : null, ``` @@ -2788,7 +2788,7 @@ In some cases the author may wish to record a special URL for their IOCCC entry, or a 2nd URL such as a work or school or personal home page. For example, Cody as of _Thu Nov 30 23:51:12 UTC 2023_ used: -```json +``` "alt_url" : "https://ioccc.xexyl.net", ``` @@ -2796,7 +2796,7 @@ If the author wishes to not specify an email address, or if the alternate URL is unknown, they should use the _JSON null_ as the _JSON value_ of this _JSON member_. For example: -```json +``` "url" : null, ``` @@ -2815,7 +2815,7 @@ and so the `deprecated_twitter_handle` is **no longer used**. A _JSON value_ th not a _JSON null_ is kept for only historic reasons. For example, Anthony C. Howe once used: -```json +``` "deprecated_twitter_handle" : "@SirWumpus", ``` @@ -2823,7 +2823,7 @@ If the author wishes to not specify an twitter handle, or if the twitter handle unknown, they should use the _JSON null_ as the _JSON value_ of this _JSON member_. For example: -```json +``` "deprecated_twitter_handle" : null, ``` @@ -2832,7 +2832,7 @@ NOTE: The _JSON null_ is **NOT** enclosed in quotes! ##### mastodon -```json +``` "mastodon" : "@mame@ruby.social", ``` @@ -2851,7 +2851,7 @@ See the "Mastodon Address" section of that page in particular. The IOCCC Mastodon handle is: -```json +``` @ioccc@fosstodon.org ``` @@ -2864,7 +2864,7 @@ If the author wishes to not specify an Mastodon handle, or if the Mastodon handl unknown, they should use the _JSON null_ as the _JSON value_ of this _JSON member_. For example: -```json +``` "mastodon" : null, ``` @@ -2873,7 +2873,7 @@ NOTE: The _JSON null_ is **NOT** enclosed in quotes! ##### mastodon_url -```json +``` "mastodon_url" : "https://ruby.social/@mame", ``` @@ -2901,7 +2901,7 @@ If the author wishes to not specify an Mastodon URL, or if the Mastodon URL is unknown, they should use the _JSON null_ as the _JSON value_ of this _JSON member_. For example: -```json +``` "mastodon_url" : null, ``` @@ -2910,7 +2910,7 @@ NOTE: The _JSON null_ is **NOT** enclosed in quotes! ##### github -```json +``` "github" : "@mame", ``` @@ -2933,7 +2933,7 @@ If the author wishes to not specify an GitHub handle, or if the GitHub handle is unknown, they should use the _JSON null_ as the _JSON value_ of this _JSON member_. For example: -```json +``` "github" : null, ``` @@ -2942,7 +2942,7 @@ NOTE: The _JSON null_ is **NOT** enclosed in quotes! ##### affiliation -```json +``` "affiliation" : null, ``` @@ -2963,7 +2963,7 @@ If the author wishes to not specify an affiliation, or if the affiliation is unknown, they should use the _JSON null_ as the _JSON value_ of this _JSON member_. For example: -```json +``` "affiliation" : null, ``` @@ -2973,7 +2973,7 @@ NOTE: The _JSON null_ is **NOT** enclosed in quotes! ##### winning_entry_set ##### entry_id -```json +``` "winning_entry_set" : [ { "entry_id" : "2012_endoh1" }, { "entry_id" : "2012_endoh2" }, @@ -3035,7 +3035,7 @@ For example see [1984/anonymous/.path](1984/anonymous/.path). The .top, .year and .path files are generated from the top level Makefile, by: -```sh +``` make genpath ``` @@ -3128,7 +3128,7 @@ Assuming you do not have an ssh key you should go to the command prompt and type (if you already have one and are okay using it for GitHub you can use that one): -```sh +``` ssh-keygen -t rsa -b 4096 -C "luser@example.com" ``` @@ -3165,7 +3165,7 @@ instructions in forking the repo. Once you have forked the repo you are ready to clone it to your system. For instance Cody Boone Ferguson has the GitHub handle _xexyl_ so he would type in: -```sh +``` git clone https://github.com/xexyl/temp-test-ioccc [target_dir] ``` @@ -3173,7 +3173,7 @@ Once that is completed you will need to change to that directory. The default directory would be the name of the repo but if you specified a target directory it will be that. For instance using the above example you might do: -```sh +``` cd temp-test-ioccc ``` @@ -3199,7 +3199,7 @@ is now (at the time of writing this), `15 April 2023`. But what if he wanted to add a file? He'd create the file and then type: -```sh +``` git add foo ``` @@ -3214,7 +3214,7 @@ First, as an aside, if this is your first pull request (which we assume is if yo reading this :-) ) you need to make sure that you can push changes to GitHub with your ssh key. To do this you need to do: -```sh +``` ssh -T git@github.com ``` @@ -3226,7 +3226,7 @@ Now, assuming that the forked repo is , you'd type: -```sh +``` git remote set-url origin git@github.com:xexyl/temp-test-ioccc.git ``` @@ -3237,21 +3237,21 @@ Continuing the example above for [2020/ferguson1/play.sh](2020/ferguson1/play.sh), it might be that: -```sh +``` git checkout -B human-snakes ``` This would change the branch to the newly created branch `human-snakes` branch. Now Cody could commit the changes: -```sh +``` git commit play.sh # if specifying specific files git commit -a # if committing everything ``` He could also have done: -```sh +``` git add play.sh git commit ``` @@ -3276,7 +3276,7 @@ Now a pull request has to be opened. To do this depends on the branch name. Assuming the branch from above, `human-snakes`, you would type: -```sh +``` git push --set-upstream origin human-snakes ``` @@ -3339,7 +3339,7 @@ When the judges have merged the pull request you now need to make sure your fork has the merge. To do this from the command line, assuming the fork in the above example, you would type: -```sh +``` git checkout master && git pull https://github.com/ioccc-src/temp-test-ioccc.git master && git push origin master ``` diff --git a/news.html b/news.html index c4b9f134a..71f22d4b3 100644 --- a/news.html +++ b/news.html @@ -206,8 +206,8 @@ in date(1) format.

      status.json page, a “latest_news” JSON member whose value is the date of the most recent news item.

      -
          "status_date" : "Mon Jan 30 02:28:44 PST 2023",
      -    "latest_news" : "Mon Jan 30 02:28:44 PST 2023"
      +
          "status_date" : "Mon Jan 30 02:28:44 PST 2023",
      +    "latest_news" : "Mon Jan 30 02:28:44 PST 2023"

      2022-12-18

      As per the suggestion of Toni Mikkola (_@Virtaava@home.social_) we now maintain a diff --git a/news.md b/news.md index 2327166fc..536c448bd 100644 --- a/news.md +++ b/news.md @@ -107,7 +107,7 @@ We also added to the a _"latest_news"_ JSON member whose value is the date of the most recent news item. -```json +``` "status_date" : "Mon Jan 30 02:28:44 PST 2023", "latest_news" : "Mon Jan 30 02:28:44 PST 2023" ``` diff --git a/status.html b/status.html index a5db42d87..7e0b0b75c 100644 --- a/status.html +++ b/status.html @@ -132,7 +132,7 @@ "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", "IOCCC_status_version" : "1.0 2024-03-09", "contest_status" : "closed", - "news_update" : "2024-04-01T09:56:43+00:00", + "news_update" : "2024-04-04T21:27:31+00:00", "status_update" : "2024-03-31T05:02:06+00:00" }

      @@ -147,7 +147,7 @@

      This is a mandatory comment for which we offer no comment other than this comment. :-)

      The JSON member value must be the following JSON quoted string:

      -
          "mandatory comment: because comments were removed from the original JSON spec"
      +
          "mandatory comment: because comments were removed from the original JSON spec"

      IOCCC_status_version

      This is the version of format of the status.json file.

      The JSON member value of is a JSON quoted string the form “version YYYY-MM-DD”.

      @@ -197,7 +197,7 @@ mastodon feed for information about future IOCCC openings.

      This shows the latest modification date for the IOCCC news page.

      The JSON member value is a JSON quoted string obtained from the date field of the following ls(1) command:

      -
          TZ=UTC ls -D '%FT%T+00:00' -ld news.html
      +
          TZ=UTC ls -D '%FT%T+00:00' -ld news.html

      NOTE: The date and time are given with respect to UTC timezone.

      Sorry: It is possible that for some reason, the IOCCC news page was modified without the content being changed. While we will try to minimize @@ -206,7 +206,7 @@ the cases where this happen, we apologize in advance (Sorry tm Canada 🇨🇦)

      This shows the latest modification date status.json file.

      The JSON member value is a JSON quoted string obtained from the date field of the following ls(1) command:

      -
          TZ=UTC ls -D '%FT%T+00:00' -ld status.json
      +
          TZ=UTC ls -D '%FT%T+00:00' -ld status.json

      NOTE: The date and time are given with respect to UTC timezone.

      Sorry: It is possible that for some reason, the status.json file was modified without the content being changed. While we will try to minimize diff --git a/status.json b/status.json index 53efeec6a..6367b1d25 100644 --- a/status.json +++ b/status.json @@ -2,6 +2,6 @@ "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", "IOCCC_status_version" : "1.0 2024-03-09", "contest_status" : "closed", - "news_update" : "2024-04-01T09:56:43+00:00", + "news_update" : "2024-04-04T21:27:31+00:00", "status_update" : "2024-03-31T05:02:06+00:00" } diff --git a/status.md b/status.md index 27e981ecb..7e371daf4 100644 --- a/status.md +++ b/status.md @@ -10,7 +10,7 @@ than this comment. :-) The JSON member value must be the following JSON quoted string: -```json +``` "mandatory comment: because comments were removed from the original JSON spec" ``` @@ -100,7 +100,7 @@ This shows the latest modification date for the [IOCCC news](news.html) page. The JSON member value is a JSON quoted string obtained from the date field of the following `ls(1)` command: -```ls +``` TZ=UTC ls -D '%FT%T+00:00' -ld news.html ``` @@ -118,7 +118,7 @@ This shows the latest modification date [status.json](status.json) file. The JSON member value is a JSON quoted string obtained from the date field of the following `ls(1)` command: -```ls +``` TZ=UTC ls -D '%FT%T+00:00' -ld status.json ``` diff --git a/thanks-for-help.html b/thanks-for-help.html index 9b8ec4056..fbb965865 100644 --- a/thanks-for-help.html +++ b/thanks-for-help.html @@ -186,9 +186,9 @@ bringing back an extern declaration (slightly changing it to match the symbol that it is i.e. extern double floor(double); instead of extern int floor;) and also bringing back double (x1, y1) b; and even this funny code that could be kept in:

      -
          #define char k['a']
      -    char x {sizeof(
      -         double(%s,%D)(*)())
      +
          #define char k['a']
      +    char x {sizeof(
      +         double(%s,%D)(*)())

      This does mean that there cannot be a second arg to main() as clang requires that to be a char ** and thecharredefined would not allow this. Some versions of clang say thatmain()must have either 0, 2 or 3 args but these versions do not object to 1 arg. However as thecharmacro seems more obscure and it is possible that a new version of clang will be even more strict theint iparameter inmain()was moved to be insidemain(), set to non-zero (settingito 0 will not work). This waymain()` has zero args.

      @@ -203,7 +203,7 @@ seems possible) it is easy to fix but it is hoped that this won’t happen.

      Originally Yusuke supplied a patch so that this entry would compile with gcc - but not clang - or at least some versions.

      To see the difference from start to fixed:

      -
          cd 1984/decot ; make diff_orig_prog
      +
          cd 1984/decot ; make diff_orig_prog

      1984/laman (index.html)

      Cody added the try.sh script.

      Cody also fixed this to not crash when no arg is specified. Note that if the arg @@ -288,7 +288,7 @@ as close to the original as one can get without causing compiler errors.

      To get this to all work the following changes were made. If you really want to understand this Cody provides the following. First run the following command from the directory:

      -
          make diff_orig_prog
      +
          make diff_orig_prog

      and then read the following (you might also wish to look at the code in an editor with syntax highlighting):

        @@ -296,11 +296,11 @@ editor with syntax highlighting):

        were actually not what they appear: the only arg that existed in main() was Manual. Thus it now looks like:
      -
          main(
      -    /*  C program. (If you don't
      -     *  understand it look it
      -     *  up.) (In the C*/ Manual)
      -    {
      +
          main(
      +    /*  C program. (If you don't
      +     *  understand it look it
      +     *  up.) (In the C*/ Manual)
      +    {
      • The macros C and V were changed to lower case. This is because it felt like the C=" ..’ part in subr() would be better to be upper case as it talks @@ -318,13 +318,13 @@ in case the first does not. Originally the macros were kept the same and the case as c.

      • The code:

      -
          C="Lint says "argument Manual isn't used."  What's that
      -    mean?"; while (write((read(C_C('"'-'/*"'/*"*/))?__:__-_+
      -    '\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1));
      +
          C="Lint says "argument Manual isn't used."  What's that
      +    mean?"; while (write((read(C_C('"'-'/*"'/*"*/))?__:__-_+
      +    '\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1));

      had to be changed to:

      -
          C="Lint says \"argument Manual isn't used.\" What's that\
      -    mean?"; while (write((read(('"'-'/*"'))?__:__-_+
      -    '\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1));
      +
          C="Lint says \"argument Manual isn't used.\" What's that\
      +    mean?"; while (write((read(('"'-'/*"'))?__:__-_+
      +    '\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1));

      because of the missing " at the end of the line and because _|_ is not a function call.

      The \" had to be done to keep the "s there though the string could be @@ -340,12 +340,12 @@ rename to c.

      • The code in main() is where there are significant changes, changing from:
      -
          while (read(0,&__,1) & write((_=(_=C_C_(__),C)),
      -    _C_,1)) _=C-V+subr(&V);
      +
          while (read(0,&__,1) & write((_=(_=C_C_(__),C)),
      +    _C_,1)) _=C-V+subr(&V);

      to:

      -
          while (read(0,&__,1) & write((_=(_=C_C_(__),
      -    V))?__:__-_+'\b'b'\b'|((_-52)%('\b'b'\b'+~
      -    ' '&'\t'b'\n')+1),1),&_,1))_=c-v+subr(&v));
      +
          while (read(0,&__,1) & write((_=(_=C_C_(__),
      +    V))?__:__-_+'\b'b'\b'|((_-52)%('\b'b'\b'+~
      +    ' '&'\t'b'\n')+1),1),&_,1))_=c-v+subr(&v));

      Note how numerous of the macros (though two changed in case) can still be used but some cannot be. Can you figure out why? Why too is it that the subr() function is called but it appears that some of the code in that @@ -399,14 +399,14 @@ for entertainment!

      Cody changed the alt code (which was not the same as the original - see above for details or try make diff_orig_alt in the directory) slightly so that it was possible to silence it. In particular:

      -
            P  (    a  )   char a   ;  {    a  ;   while(    a  >      "  B   "
      +
            P  (    a  )   char a   ;  {    a  ;   while(    a  >      "  B   "

      which gave:

          marshall.alt.c:13:55: warning: ordered comparison between pointer and integer ('char' and 'char *')
             P  (    a  )   char a   ;  {    a  ;   while(    a  >      "  B   "
                                                              ~  ^      ~~~~~~~~
           1 warning generated.

      was changed to:

      -
            P  (    a  )   char a   ;  {    a  ;   while((char *)a  >   "  B   "
      +
            P  (    a  )   char a   ;  {    a  ;   while((char *)a  >   "  B   "

      which gave:

          marshall.alt.c:13:48: warning: cast to 'char *' from smaller integer type 'char' [-Wint-to-pointer-cast]
             P  (    a  )   char a   ;  {    a  ;   while((char *)a  >   "  B   "
      @@ -435,54 +435,54 @@ below.

      work with gcc but it still required -traditional-cpp.

      If you’d like to see the difference between the version that requires -traditional-cpp and the fixed version, try:

      -
          cd 1986/wall ; make diff_orig_prog
      +
          cd 1986/wall ; make diff_orig_prog

      Some of the changes required:

      • Instead of using the c_, defined as c_(cc)c cc=, like:
      -
          c_(+)o
      -
      -    /* ... */
      -
      -    :c_(+)' '-1;
      -    }}c_(&)'z'+5;
      +
          c_(+)o
      +
      +    /* ... */
      +
      +    :c_(+)' '-1;
      +    }}c_(&)'z'+5;

      use:

      -
          :c +=o[c&__LINE__-007];
      -
      -    /* ... */
      -
      -    :c+=' '-1;
      -    }}c&='z'+5;
      +
          :c +=o[c&__LINE__-007];
      +
      +    /* ... */
      +
      +    :c+=' '-1;
      +    }}c&='z'+5;

      Observe however that this macro is still used in the code like:

      -
          main(;c_(=(*cc);*cc++)c,for);
      +
          main(;c_(=(*cc);*cc++)c,for);
      • Instead of code like:
      -
          main(0xb+(c>>5),C_(s))
      -    _'\v'
      -    :__ _'\f':
      -    main(c,C_(s));
      +
          main(0xb+(c>>5),C_(s))
      +    _'\v'
      +    :__ _'\f':
      +    main(c,C_(s));

      use instead:

      -
          main(;c_(=(*cc);*cc++)c,for);
      -    #define _O(s)s
      -    switch(0xb+(c>>5)){
      -    _'\v'
      -    :__ _'\f':
      -    switch(c){;
      +
          main(;c_(=(*cc);*cc++)c,for);
      +    #define _O(s)s
      +    switch(0xb+(c>>5)){
      +    _'\v'
      +    :__ _'\f':
      +    switch(c){;
      • The macro:
      -
          #define C_(sand)_O(sand)witch
      +
          #define C_(sand)_O(sand)witch

      could not be used like:

      -
          C_(s));_
      +
          C_(s));_

      to create:

      -
          switch);_
      +
          switch);_

      and neither could the macro:

      -
          #define O_(O)_O(O)stem(ccc(
      +
          #define O_(O)_O(O)stem(ccc(

      be used like:

      -
          :O_(sy)";kkt -oa, dijszdijs QQ"))_C
      +
          :O_(sy)";kkt -oa, dijszdijs QQ"))_C

      to create:

      -
          :system(ccc(";kkt -oa, dijszdijs QQ"));return
      +
          :system(ccc(";kkt -oa, dijszdijs QQ"));return
      • And of course as noted two strings had to be strdup()d.
      @@ -562,45 +562,45 @@ as well, however.

      First of all, as noted above, the entry required -traditional-cpp (which not all compilers support clang does not support). It needed that option in modern systems because of two things it did:

      -
          #define a(x)get/***/x/***/id())
      -
      -    /* ... */
      -
      -    p Z=chroot("/");L(!a(u)execv((q(v="/ipu6ljov"),v),C);Z-=kill(l);
      -
      -    /* ... */
      -
      -    case_2:L(!--V){O/*/*/c*c+c);wait(A+c*c-c);L(!Z)f(A,"\n",c);return(A*getgid());};C++;
      +
          #define a(x)get/***/x/***/id())
      +
      +    /* ... */
      +
      +    p Z=chroot("/");L(!a(u)execv((q(v="/ipu6ljov"),v),C);Z-=kill(l);
      +
      +    /* ... */
      +
      +    case_2:L(!--V){O/*/*/c*c+c);wait(A+c*c-c);L(!Z)f(A,"\n",c);return(A*getgid());};C++;

      This macro, a, formed the functions (the names) getuid() and getgid(), but this no longer works. The code still uses the macro a to form the names but it’s done differently, using the C token paste operator ##. It’s done like thus:

      -
          --- i/1988/dale/dale.c
      -    +++ w/1988/dale/dale.c
      -    @@ -9,18 +9,18 @@
      -     #define L if
      -     #define I goto
      -     #define l 1
      -     #define f write
      -     #define J else
      -    -#define a(x)get/***/x/***/id())
      -    +#define a(x)get##x##id())
      +
          --- i/1988/dale/dale.c
      +    +++ w/1988/dale/dale.c
      +    @@ -9,18 +9,18 @@
      +     #define L if
      +     #define I goto
      +     #define l 1
      +     #define f write
      +     #define J else
      +    -#define a(x)get/***/x/***/id())
      +    +#define a(x)get##x##id())

      The second is that

      -
          for/*/(;;);/*/k()){O/*/*/c);
      +
          for/*/(;;);/*/k()){O/*/*/c);

      cannot form fork()) in modern C compilers. Since it was not done through a macro it was simply changed to be fork(), rather than adding a new macro.

      The other problem that could not be resolved by the -traditional-cpp was that modern compilers do not allow directives like:

      -
          #define _ define
      -    #_ P char
      -    #_ p int
      -    #_ O close(
      -    /* ... */
      +
          #define _ define
      +    #_ P char
      +    #_ p int
      +    #_ O close(
      +    /* ... */

      so Cody changed the lines to be in the form of:

      -
          #define P char
      -    #define p int
      -    #define O close(
      -    /* ... */
      +
          #define P char
      +    #define p int
      +    #define O close(
      +    /* ... */

      However, to keep the entry as close to as possible in look, Cody kept the _ macro in place it’s just no longer used.

      See the index.html file for details on the original code, provided as an alt @@ -658,21 +658,21 @@ not strictly necessary but nonetheless more correct, even if not warned against. fubar.sh.

      A strange problem occurred where if one made modifications to the C file it might end up failing to work even after changing it back. This was resolved by:

      -
          --- i/1989/fubar/fubar.sh
      -    +++ w/1989/fubar/fubar.sh
      -    @@ -7,13 +7,12 @@ if [[ $# -ne 1 ]]; then
      -         exit 1
      -     fi
      -
      -     # run/compile it
      -     rm -f ouroboros.c x1 x
      -    -ex - <<EOF
      -    -r fubar.c
      -    +ex fubar.c <<EOF
      -     8,9j
      -     w ouroboros.c
      -     EOF
      -     chmod +x ouroboros.c
      +
          --- i/1989/fubar/fubar.sh
      +    +++ w/1989/fubar/fubar.sh
      +    @@ -7,13 +7,12 @@ if [[ $# -ne 1 ]]; then
      +         exit 1
      +     fi
      +
      +     # run/compile it
      +     rm -f ouroboros.c x1 x
      +    -ex - <<EOF
      +    -r fubar.c
      +    +ex fubar.c <<EOF
      +     8,9j
      +     w ouroboros.c
      +     EOF
      +     chmod +x ouroboros.c

      Cody also ‘modernised’ the script to use bash and fixed for ShellCheck. The if [ .. ] was changed in the C code as well as the script.

      Cody also added the try.sh script.

      @@ -692,11 +692,11 @@ entry and the alt code) anyway, it works out well.

      1989/jar.2 (index.html)

      Cody fixed this to work with modern compilers. Modern compilers do not allow code like:

      -
          #define D define
      -    #define a include
      -
      -    #D foo bar
      -    #a <stdio.h>
      +
          #define D define
      +    #define a include
      +
      +    #D foo bar
      +    #a <stdio.h>

      He notes that there is a way to get it (or something close to it) to work. Do you know how?

      Cody also provided the try.sh script and the @@ -739,7 +739,7 @@ index.html for details.

      1989/robison (index.html)

      Yusuke Endoh fixed this to compile under modern systems. To see the changes made, try:

      -
          cd 1989/robison ; make diff_orig_prog
      +
          cd 1989/robison ; make diff_orig_prog

      (It adds the C token pasting operator ## instead of /**/.)

      Cody also added the try.sh script.

      1989/tromp (index.html)

      @@ -848,11 +848,11 @@ operator itself.

      1990/dg (index.html)

      Cody fixed this for modern systems. There were two problems to be resolved.

      One can no longer do:

      -
          #define d define
      -
      -    #d b12(x) 12 x
      -
      -    /* etc. */
      +
          #define d define
      +
      +    #d b12(x) 12 x
      +
      +    /* etc. */

      so the use of #d is now instead #define (the macro was originally deleted but later Cody added it back to make it more like the original).

      The second problem was suggested by the judges at the time of judging, to do @@ -904,7 +904,7 @@ again (since it did not work anyway a segfault prevention was added here). He also fixed some array addressing (some of which might not be strictly necessary but as he was testing the fibonacci.c bug he ended up changing it anyway).

      BTW: why can’t the fix:

      -
          if (a[1]==NULL||a[2]==NULL||a[3]==NULL||a[4]==NULL||a[5]==NULL) return 1;
      +
          if (a[1]==NULL||a[2]==NULL||a[3]==NULL||a[4]==NULL||a[5]==NULL) return 1;

      be changed to just test the value of A when a is argv and A is argc?

      Cody also changed the code to use fgets(3).

      Since this program is so incredible the extra fixes were deemed worth having and @@ -993,21 +993,21 @@ making the generated code return a value from main() rather than ju changed from char*s to char s[]):

          !.Xop.fssps!.Xop.sfuvso.uzqf!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo

      and then the call to system() had to be changed to:

      -
          system(q-69);
      +
          system(q-69);

      An important point is that the placement of this string in the s array does matter. This is because of the code:

      -
          *o=fopen(q-3,"w");
      +
          *o=fopen(q-3,"w");

      which means the file name that translates to a.c has to be at the end of the string. Thus the end of the string actually looks like:

          !.Xop.fssps!.Xop.sfuvso.uzqf!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo!b/d

      But then there is the matter of getting the C to use fgets(3). As can be seen above it’s not as simple as changing gets(3) to fgets(3). This was more magic characters that had to be updated and some added. The C code:

      -
          atoi(gets(b))
      +
          atoi(gets(b))

      is in the string:

          bupj)hfut)c**

      which was changed to be (in C):

      -
          atoi(fgets(b,99,stdin))
      +
          atoi(fgets(b,99,stdin))

      which in the program is:

          bupj)ghfut)c-::-tuejo**

      That’s fine and well but since the code does not include stdio.h there @@ -1024,16 +1024,16 @@ the system(q-86) had to be changed to system(q-104).But then to prevent the need for disabling a warning and to be more correct code, the generated code was changed to return 1; rather than just return;. Thus in full the string became:

      -
          char s[]="Qjou!s\\311^-g\\311^-n\\311^-c\\::^-q-ma%mO1JBHm%BQ-aP1J[O1HB%[Q<n\
      -    bjo)*|gps)<<*txjudi)m*|aQdbtf!::::;sfuvso!2<aQefgbvmu;aQ<m,,a%CQ<csfbla%bQ<a\
      -    N2!Q\ndbtf!aP2Q;m>aP2Q<a%!D12J!JGJHJOJQJFJSJJJMHS%HD12D12N3!N4\nJUJT%UQm>aP4\
      -    HC%TQs\\q,,^>m,2<m>aP4HC%SD12N1\nJNQm>s\\..q^aHC%NHb%GN1!D32P3%RN1UP1D12JPQU\
      -    aP1HR%PN4\nQ<g\\(aP3Q(^>aP2Q,2<n\\(aP3Q(^>aP4Hb%OD12D12N2!N3\nJVP3Q,,<jg)aP3\
      -    Q=>n\\(aP3Q(^*m>g\\(aP3Q(^<fmtf!m,,aHC%QN1!N1\nJ#Qqsjoug)#&e]o#-aP1Q*aHb%#Qq\
      -    vut)aP1Q*aHb%FN1\nQm>::::aHC%VP3Q>bupj)ghfut)c-::-tuejo**aHb%JD12JON1!Qjg)a%\
      -    LN1UP1D12JIQUaP1HL%IQ*m>aN2!N2\nP2Q<fmtf!m,,aHC%MN1!N2>P2Q>aN2\nP2Hbdd!.Xop.\
      -    fssps!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo!.Xop.jnqmjdju.jou!.jodmvef!tuejp/i!\
      -    b/d";
      +
          char s[]="Qjou!s\\311^-g\\311^-n\\311^-c\\::^-q-ma%mO1JBHm%BQ-aP1J[O1HB%[Q<n\
      +    bjo)*|gps)<<*txjudi)m*|aQdbtf!::::;sfuvso!2<aQefgbvmu;aQ<m,,a%CQ<csfbla%bQ<a\
      +    N2!Q\ndbtf!aP2Q;m>aP2Q<a%!D12J!JGJHJOJQJFJSJJJMHS%HD12D12N3!N4\nJUJT%UQm>aP4\
      +    HC%TQs\\q,,^>m,2<m>aP4HC%SD12N1\nJNQm>s\\..q^aHC%NHb%GN1!D32P3%RN1UP1D12JPQU\
      +    aP1HR%PN4\nQ<g\\(aP3Q(^>aP2Q,2<n\\(aP3Q(^>aP4Hb%OD12D12N2!N3\nJVP3Q,,<jg)aP3\
      +    Q=>n\\(aP3Q(^*m>g\\(aP3Q(^<fmtf!m,,aHC%QN1!N1\nJ#Qqsjoug)#&e]o#-aP1Q*aHb%#Qq\
      +    vut)aP1Q*aHb%FN1\nQm>::::aHC%VP3Q>bupj)ghfut)c-::-tuejo**aHb%JD12JON1!Qjg)a%\
      +    LN1UP1D12JIQUaP1HL%IQ*m>aN2!N2\nP2Q<fmtf!m,,aHC%MN1!N2>P2Q>aN2\nP2Hbdd!.Xop.\
      +    fssps!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo!.Xop.jnqmjdju.jou!.jodmvef!tuejp/i!\
      +    b/d";

      and it now is system(q-87);.

      It is hoped that this is the last time the string has to be updated to work with all versions of clang but if not the above is how it works.

      @@ -1104,16 +1104,16 @@ the change to check for a NULL file was added. Then it was noticed problem is that adgrep.c was an incorrect reference that never existed and it was never fixed in any of the files, not the code or the documentation, and thus was entirely incorrect code. A fun fact is that one can do:

      -
          W= fopen(wc>= 2 ? V[1] : __FILE__,"rt");if(!W)exit(1);
      +
          W= fopen(wc>= 2 ? V[1] : __FILE__,"rt");if(!W)exit(1);

      but one CANNOT do:

      -
          W= fopen(wc>= 2 ? V[1] : __FILE__,"rt");if(!W)exit(1);
      -    if (W==NULL)exit(1);
      +
          W= fopen(wc>= 2 ? V[1] : __FILE__,"rt");if(!W)exit(1);
      +    if (W==NULL)exit(1);

      because adwc.c will be empty! The difference is it is on a newline, the check. This is an example of how a simple change in code can break it and this is also true of another change as further below.

      Cody also restored a slightly more obscure line of code that had been changed:

      -
          -   putc("}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"[i]+i-9,stderr);
      -    +   putc(i["}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"]+i-9,stderr);
      +
          -   putc("}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"[i]+i-9,stderr);
      +    +   putc(i["}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"]+i-9,stderr);

      though it’s questionable how much more (if at all) obscure that is :-)

      Cody also changed the location that it used gets() to be fgets(3). This was complicated because of how the other source files are generated (as @@ -1133,7 +1133,7 @@ removal of the extra line (as in with a comma operator or a &&adwc.c)! Thus after the gets(3) call in the line that looks like:

      -
          while( gets(Y) ){ Y[strlen(Y)-1]='\0'; if(A(Y)) puts(Y); }
      +
          while( gets(Y) ){ Y[strlen(Y)-1]='\0'; if(A(Y)) puts(Y); }

      one must keep the Y[strlen(Y)-1]='\0'; part and keep it there.

      These fixes are complex changes due to the way the program and Makefile generate the additional tools.

      @@ -1305,8 +1305,8 @@ mentioned script on all the data files.

      Both Cody and Yusuke fixed this so that it will work with modern systems. Yusuke provided some fixes of the X code and Cody fixed the C pre-processor directives so that it would compile. It used to be that you could get away with code like:

      -
          G        int i,j
      -    K        case
      +
          G        int i,j
      +    K        case

      and expect G; to equate to int i, j; (though it’s now a long) and K to mean case but that’s no longer the case so the offending lines had #define prepended to them.

      @@ -1708,7 +1708,7 @@ larger the resulting program becomes. It can be gigabytes in length if it doesn’t crash. At this point since the author stated it has no while, do...while, for, if/else, switch, ?: Cody removed the if statement by doing:

      -
          ((V[1]&&((atoi(V[1])>0&&atoi(V[1])<27))||(exit(1),1)));
      +
          ((V[1]&&((atoi(V[1])>0&&atoi(V[1])<27))||(exit(1),1)));

      Cody also added the try.sh script to help users try the commands that we recommended as well as some added by him.

      1998/schweikh1 (index.html)

      @@ -1732,7 +1732,7 @@ was changed back to the original.)

      not exist, it would dereference a NULL pointer and very likely crash or halt and catch fire :-), preventing the entry from working. Notice how H is a funny macro defined as:

      -
          %:define H(x) <st%:%:x##.h>
      +
          %:define H(x) <st%:%:x##.h>

      and yet the FILE * can be called H! This might or might not make sense to you but if it doesn’t can you figure out why?

      Another fix is that previously the program would return 1 if a file failed to @@ -1928,9 +1928,9 @@ was supposed to do; instead it reported text file busy error.

      Notice that the location of munmap() and close() followed by execv() does matter!

      To get this to compile with clang, main() had to change from:

      -
          main (char *ck, char **k)
      +
          main (char *ck, char **k)

      to:

      -
          main (int cka, char **k) { char *ck = (char *)cka; /* ... */ }
      +
          main (int cka, char **k) { char *ck = (char *)cka; /* ... */ }

      The following change was also made to be more portable, in case the constants PROT_READ and/or PROT_WRITE are not standardised or some platform does not follow it:

      @@ -1939,16 +1939,16 @@ follow it:

      macOS and Linux).

      NOTE: there might be educational value to see the progress of this fix; if you wish to see, try the following commands from the 2001/anonymous directory:

      -
          git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..93aa8d79f208dcccc3c5a2370a727b5cf64e9c53 anonymous.c
      -    git diff 93aa8d79f208dcccc3c5a2370a727b5cf64e9c53..c48629017117379a52b1a512ef8f2593ca9569c8 anonymous.c
      -    git diff c48629017117379a52b1a512ef8f2593ca9569c8..efdee208a2bc650256637b9357ddfd0de82d2f41 anonymous.c
      -    git diff efdee208a2bc650256637b9357ddfd0de82d2f41..e9a3f77ea3b209e63ac3f9c06bb84ad86e5ea706 anonymous.c
      -    git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..2159caec4677e0f25ad704a74e04c8196fd6c343 anonymous.c
      -    git diff 2159caec4677e0f25ad704a74e04c8196fd6c343..4bc03de321612869aebf855850c6500df95cb6ef anonymous.c
      +
          git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..93aa8d79f208dcccc3c5a2370a727b5cf64e9c53 anonymous.c
      +    git diff 93aa8d79f208dcccc3c5a2370a727b5cf64e9c53..c48629017117379a52b1a512ef8f2593ca9569c8 anonymous.c
      +    git diff c48629017117379a52b1a512ef8f2593ca9569c8..efdee208a2bc650256637b9357ddfd0de82d2f41 anonymous.c
      +    git diff efdee208a2bc650256637b9357ddfd0de82d2f41..e9a3f77ea3b209e63ac3f9c06bb84ad86e5ea706 anonymous.c
      +    git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..2159caec4677e0f25ad704a74e04c8196fd6c343 anonymous.c
      +    git diff 2159caec4677e0f25ad704a74e04c8196fd6c343..4bc03de321612869aebf855850c6500df95cb6ef anonymous.c

      Finally to see from start to finish:

      -
          git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..4bc03de321612869aebf855850c6500df95cb6ef anonymous.c
      +
          git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..4bc03de321612869aebf855850c6500df95cb6ef anonymous.c

      or to not use git:

      -
          make diff_orig_prog
      +
          make diff_orig_prog

      Cody also added a program like anonymous.ten.c Ten Green Bottles but which sings Ten in the Bed instead.

      @@ -2001,12 +2001,12 @@ valid, BTW.

      Cody added a value to return in main() to make it more portable.

      Cody fixed this to compile with clang in Linux. The problem was C99 does not support implicit int:

      -
          coupard.c:31:10: error: parameter 'h' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
      -    void e(n,h){
      -             ^
      -    coupard.c:31:8: error: parameter 'n' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
      -    void e(n,h){
      -           ^
      +
          coupard.c:31:10: error: parameter 'h' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
      +    void e(n,h){
      +             ^
      +    coupard.c:31:8: error: parameter 'n' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
      +    void e(n,h){
      +           ^

      and for some reason it was being reported as an error. This was not really worth a thanks per se but it was originally done by adding int. The better solution is to disable the warning which is what was done later on to make it more like @@ -2156,20 +2156,20 @@ Wayback Machine.

      Cody fixed this to compile with gcc (it worked with clang). The problem was the cpp being unable to parse the generated code (see the index.html for details) and this ended up with a number of errors like:

      -
          jdalbec.c:64:5: error: stray '##' in program
      -       64 | B N##B (I) ; \
      -          |     ^~
      -
      -
      -    ..
      -
      -    jdalbec.c:65:5: error: stray '##' in program
      -       65 | V F##B (B) ; \
      -          |     ^~
      -    jdalbec.c:65:5: error: expected ';' before 'B'
      -       65 | V F##B (B) ; \
      -          |     ^ ~
      -          |     ;
      +
          jdalbec.c:64:5: error: stray '##' in program
      +       64 | B N##B (I) ; \
      +          |     ^~
      +
      +
      +    ..
      +
      +    jdalbec.c:65:5: error: stray '##' in program
      +       65 | V F##B (B) ; \
      +          |     ^~
      +    jdalbec.c:65:5: error: expected ';' before 'B'
      +       65 | V F##B (B) ; \
      +          |     ^ ~
      +          |     ;

      and various other problems.

      Cody also added alt code which allows one to control how many numbers after the : to print before printing a @@ -2209,41 +2209,41 @@ to the repo for the script instead.

      2004/vik2 (index.html)

      Cody fixed this to compile in Linux. Although it compiled cleanly in macOS (and BSD?) the code failed to compile at all in Linux due to:

      -
          cc -E vik2_1.c > vik2_2.c
      -    In file included from vik2.c:945,
      -                     from vik2.c:959,
      -                     from vik2.c:972,
      -                     from vik2.c:1025:
      -    vik2.c:383:8: error: no macro name given in #ifdef directive
      -      383 | O  \
      -          |        ^
      -    In file included from vik2.c:946:
      -    vik2.c:383:8: error: no macro name given in #ifdef directive
      -      383 | O  \
      -          |        ^
      -    In file included from vik2.c:947:
      -    vik2.c:383:8: error: no macro name given in #ifdef directive
      -      383 | O  \
      -          |        ^
      -    In file included from vik2.c:948:
      -    vik2.c:383:8: error: no macro name given in #ifdef directive
      -      383 | O  \
      -          |        ^
      -
      -    ...
      -
      -    In file included from vik2.c:182:
      -
      -    vik2.c:992:85: error: #include nested depth 201 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      -      992 | I
      -          |                                                                                     ^
      -    vik2.c:1497:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      -    vik2.c:1498:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      -    vik2.c:1499:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      -    vik2.c:1500:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      -    vik2.c:1501:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      -    vik2.c:1504:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      -    make: *** [Makefile:133: vik2] Error 1
      +
          cc -E vik2_1.c > vik2_2.c
      +    In file included from vik2.c:945,
      +                     from vik2.c:959,
      +                     from vik2.c:972,
      +                     from vik2.c:1025:
      +    vik2.c:383:8: error: no macro name given in #ifdef directive
      +      383 | O  \
      +          |        ^
      +    In file included from vik2.c:946:
      +    vik2.c:383:8: error: no macro name given in #ifdef directive
      +      383 | O  \
      +          |        ^
      +    In file included from vik2.c:947:
      +    vik2.c:383:8: error: no macro name given in #ifdef directive
      +      383 | O  \
      +          |        ^
      +    In file included from vik2.c:948:
      +    vik2.c:383:8: error: no macro name given in #ifdef directive
      +      383 | O  \
      +          |        ^
      +
      +    ...
      +
      +    In file included from vik2.c:182:
      +
      +    vik2.c:992:85: error: #include nested depth 201 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      +      992 | I
      +          |                                                                                     ^
      +    vik2.c:1497:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      +    vik2.c:1498:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      +    vik2.c:1499:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      +    vik2.c:1500:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      +    vik2.c:1501:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      +    vik2.c:1504:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      +    make: *** [Makefile:133: vik2] Error 1

      Unfortunately the fix required heavy modification to the original file (see below) and also inclusion of what used to be generated by the Makefile but now it at least works for both Linux and @@ -2294,7 +2294,7 @@ and 64-bit. The solution has to do with the size difference between intlong so that the long*E is now int*E. This solves a specific problem for Linux (32-bit, 64-bit) and macOS (arm64).

      To get the self-test feature to work it was required to remove from the code:

      -
          O-b-f-u -s-c-a-t-e;
      +
          O-b-f-u -s-c-a-t-e;

      as it caused a compilation error in some of the generated code but served no purpose, didn’t affect the output of the puzzle and since the ‘string’ is already in the code there is no problem omitting it.

      @@ -2305,19 +2305,19 @@ also not have been necessary if using different flags to cc but thi portable and caused other problems. This was a complicated fix as it’s in the comments but in a funny way; the final result to get the test feature to work is:

      -
          ;; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/
      -    /*-e/'s,intZ,int/ Z,g'>c.c;make/c;/ rm/-f/c*/
      -    ;;
      +
          ;; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/
      +    /*-e/'s,intZ,int/ Z,g'>c.c;make/c;/ rm/-f/c*/
      +    ;;

      changed from:

      -
          ;; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/
      -    /*c.c;cc/c.c /-c*/;;
      +
          ;; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/
      +    /*c.c;cc/c.c /-c*/;;

      or as a diff:

      -
          -(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/
      -    -/*c.c;cc/c.c /-c*/;;char*A=0,*_,*R,*Q, D[9999],*r,l
      -    -[9999],T=42, M,V=32;long*E,k[9999],B[1 <<+21],*N=B+
      -    +(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/
      -    +/*-e/'s,intZ,int/ Z,g'>c.c;make/c;/ rm/-f/c*/
      -    +;;char*A=0,*_,*R,*Q, D[9999],*r,l[9999],T=42, M,V=32;int *E,k[9999],B[1 <<+21],*N=B+
      +
          -(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/
      +    -/*c.c;cc/c.c /-c*/;;char*A=0,*_,*R,*Q, D[9999],*r,l
      +    -[9999],T=42, M,V=32;long*E,k[9999],B[1 <<+21],*N=B+
      +    +(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/
      +    +/*-e/'s,intZ,int/ Z,g'>c.c;make/c;/ rm/-f/c*/
      +    +;;char*A=0,*_,*R,*Q, D[9999],*r,l[9999],T=42, M,V=32;int *E,k[9999],B[1 <<+21],*N=B+

      Cody also added the try.sh script which also lets one see the beauty of the entry without having to use vi(m), should they be afraid of getting stuck in it (and for ease of use). :-)

      @@ -2335,12 +2335,12 @@ not do it implicitly (like macOS does).

      2005/mikeash (index.html)

      Cody fixed this to work in Linux. The problem was an unknown escape sequence, \N, which caused a funny compiler error:

      -
          };n b[2048];int i
      -    mikeash.c: In function 'R':
      -    mikeash.c:7:1: error: '\N' not followed by '{'
      -        7 | ;C!='\n';A()
      -          | ^
      -    mikeash.c:7:1: error: incomplete universal character name \Ne
      +
          };n b[2048];int i
      +    mikeash.c: In function 'R':
      +    mikeash.c:7:1: error: '\N' not followed by '{'
      +        7 | ;C!='\n';A()
      +          | ^
      +    mikeash.c:7:1: error: incomplete universal character name \Ne

      The problem was that in the string above there was a \Newline but this is invalid C. This was changed to be \nNewline and then, because the code is supposed to output itself when fed itself, the reference to 'N' had to be @@ -2370,7 +2370,7 @@ test it on.

      Cody also added the try.sh script.

      2005/sykes (index.html)

      Cody added the saved (with the SAVE command) BASIC program PET which was:

      -
          10 PRINT "2005'S IOCCC BEST EMULATOR"
      +
          10 PRINT "2005'S IOCCC BEST EMULATOR"
           20 PRINT "BY STEPHEN SYKES!"

      followed by the commands:

          SAVE "PET"
      @@ -2799,12 +2799,12 @@ might violate rule 2: the program is really just a decompressor to generate the
       real source of the program. So the source of the entry has to be compiled and
       then run, and the output has to be compiled to be hou. This allows the real
       program to be used. Thus the Makefile rule looks like:

      -
          ${PROG}: ${PROG}.c
      -            ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
      -        ./${PROG} | ${CC} ${CFLAGS} -xc - -o $@ ${LDFLAGS}
      +
          ${PROG}: ${PROG}.c
      +            ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
      +        ./${PROG} | ${CC} ${CFLAGS} -xc - -o $@ ${LDFLAGS}

      which then compiles like:

      -
          cc -std=gnu11 -Wall -Wextra -pedantic -Wno-sign-compare -Wno-strict-prototypes    -O3 hou.c -o hou -lm
      -    ./hou | cc -std=gnu11 -Wall -Wextra -pedantic -Wno-sign-compare -Wno-strict-prototypes    -O3 -xc - -o hou -lm
      +
          cc -std=gnu11 -Wall -Wextra -pedantic -Wno-sign-compare -Wno-strict-prototypes    -O3 hou.c -o hou -lm
      +    ./hou | cc -std=gnu11 -Wall -Wextra -pedantic -Wno-sign-compare -Wno-strict-prototypes    -O3 -xc - -o hou -lm

      The LDFLAGS were updated to have -lm as the author suggested it uses the math.h library which not all systems link in by default (Linux for instance does not).

      @@ -2925,12 +2925,12 @@ output.

      Cody fixed the code so one can make use of the echo feature, where the first character of the filename starts with e. The only way it would work before that is if one did something like:

      -
          ln -sf prog eprog
      -    PATH=$PATH:. ; eprog '...'
      +
          ln -sf prog eprog
      +    PATH=$PATH:. ; eprog '...'

      since otherwise the first character would not be e but rather a dot (./eprog). This was done by adding to the Makefile -include libgen.h and adding to main() after the variable declaration (V*A;) the code:

      -
          *K=basename(*K);
      +
          *K=basename(*K);

      This was done for both the prog.c and prog.alt.c. The Makefile was also updated to build eprog and eprog.alt to make use of the feature more easily. Each is a new @@ -3241,8 +3241,8 @@ longer known.

      2020/endoh3 (index.html)

      Cody fixed the script run_clock.sh which gave a funny error when running it:

      -
          $ ./run_clock.sh
      -    -bash: ./run_clock.sh: cannot execute: required file not found
      +
          $ ./run_clock.sh
      +    -bash: ./run_clock.sh: cannot execute: required file not found

      If run from within vim a different error message occurred:

          /bin/bash: ./run_clock.sh: /usr/bin/end: bad interpreter: No such file or directory

      though this was only noticed later on after it was fixed.

      diff --git a/thanks-for-help.md b/thanks-for-help.md index 1d80afb17..3600745b1 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -82,7 +82,7 @@ that it is i.e. `extern double floor(double);` instead of `extern int floor;`) and also bringing back `double (x1, y1) b;` and even this funny code that could be kept in: -```c +``` #define char k['a'] char x {sizeof( double(%s,%D)(*)()) @@ -114,7 +114,7 @@ but not clang - or at least some versions. To see the difference from start to fixed: -```sh +``` cd 1984/decot ; make diff_orig_prog ``` @@ -237,7 +237,7 @@ To get this to all work the following changes were made. If you really want to understand this Cody provides the following. First run the following command from the directory: -```sh +``` make diff_orig_prog ``` @@ -248,7 +248,7 @@ editor with syntax highlighting): were actually not what they appear: the only arg that existed in `main()` was `Manual`. Thus it now looks like: -```c +``` main( /* C program. (If you don't * understand it look it @@ -273,7 +273,7 @@ case as `c`. - The code: -```c +``` C="Lint says "argument Manual isn't used." What's that mean?"; while (write((read(C_C('"'-'/*"'/*"*/))?__:__-_+ '\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1)); @@ -281,7 +281,7 @@ case as `c`. had to be changed to: -```c +``` C="Lint says \"argument Manual isn't used.\" What's that\ mean?"; while (write((read(('"'-'/*"'))?__:__-_+ '\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1)); @@ -305,14 +305,14 @@ case as `c`. - The code in `main()` is where there are significant changes, changing from: -```c +``` while (read(0,&__,1) & write((_=(_=C_C_(__),C)), _C_,1)) _=C-V+subr(&V); ``` to: -```c +``` while (read(0,&__,1) & write((_=(_=C_C_(__), V))?__:__-_+'\b'b'\b'|((_-52)%('\b'b'\b'+~ ' '&'\t'b'\n')+1),1),&_,1))_=c-v+subr(&v)); @@ -397,7 +397,7 @@ Cody changed the alt code (which was not the same as the original - see above for details or try `make diff_orig_alt` in the directory) slightly so that it was possible to silence it. In particular: -```c +``` P ( a ) char a ; { a ; while( a > " B " ``` @@ -412,7 +412,7 @@ which gave: was changed to: -```c +``` P ( a ) char a ; { a ; while((char *)a > " B " ``` @@ -461,7 +461,7 @@ work with gcc but it still required `-traditional-cpp`. If you'd like to see the difference between the version that requires `-traditional-cpp` and the fixed version, try: -```sh +``` cd 1986/wall ; make diff_orig_prog ``` @@ -469,7 +469,7 @@ Some of the changes required: - Instead of using the `c_`, defined as `c_(cc)c cc=`, like: -```c +``` c_(+)o /* ... */ @@ -480,7 +480,7 @@ Some of the changes required: use: -```c +``` :c +=o[c&__LINE__-007]; /* ... */ @@ -491,13 +491,13 @@ Some of the changes required: Observe however that this macro is still used in the code like: -```c +``` main(;c_(=(*cc);*cc++)c,for); ``` - Instead of code like: -```c +``` main(0xb+(c>>5),C_(s)) _'\v' :__ _'\f': @@ -506,7 +506,7 @@ Some of the changes required: use instead: -```c +``` main(;c_(=(*cc);*cc++)c,for); #define _O(s)s switch(0xb+(c>>5)){ @@ -517,37 +517,37 @@ Some of the changes required: - The macro: -```c +``` #define C_(sand)_O(sand)witch ``` could not be used like: -```c +``` C_(s));_ ``` to create: -```c +``` switch);_ ``` and neither could the macro: -```c +``` #define O_(O)_O(O)stem(ccc( ``` be used like: -```c +``` :O_(sy)";kkt -oa, dijszdijs QQ"))_C ``` to create: -```c +``` :system(ccc(";kkt -oa, dijszdijs QQ"));return ``` @@ -668,7 +668,7 @@ First of all, as noted above, the entry required `-traditional-cpp` (which not all compilers support `clang` does not support). It needed that option in modern systems because of two things it did: -```c +``` #define a(x)get/***/x/***/id()) /* ... */ @@ -685,7 +685,7 @@ this no longer works. The code still uses the macro `a` to form the names but it's done differently, using the C token paste operator `##`. It's done like thus: -```diff +``` --- i/1988/dale/dale.c +++ w/1988/dale/dale.c @@ -9,18 +9,18 @@ @@ -700,7 +700,7 @@ thus: The second is that -```c +``` for/*/(;;);/*/k()){O/*/*/c); ``` @@ -710,7 +710,7 @@ macro it was simply changed to be `fork()`, rather than adding a new macro. The other problem that could not be resolved by the `-traditional-cpp` was that modern compilers do not allow directives like: -```c +``` #define _ define #_ P char #_ p int @@ -720,7 +720,7 @@ modern compilers do not allow directives like: so Cody changed the lines to be in the form of: -```c +``` #define P char #define p int #define O close( @@ -819,7 +819,7 @@ not strictly necessary but nonetheless more correct, even if not warned against. A strange problem occurred where if one made modifications to the C file it might end up failing to work even after changing it back. This was resolved by: -```diff +``` --- i/1989/fubar/fubar.sh +++ w/1989/fubar/fubar.sh @@ -7,13 +7,12 @@ if [[ $# -ne 1 ]]; then @@ -865,7 +865,7 @@ entry and the alt code) anyway, it works out well. [Cody](#cody) fixed this to work with modern compilers. Modern compilers do not allow code like: -```c +``` #define D define #define a include @@ -936,7 +936,7 @@ index.html for details. made, try: -```sh +``` cd 1989/robison ; make diff_orig_prog ``` @@ -1103,7 +1103,7 @@ Cody also made this use `fgets(3)`. One can no longer do: -```c +``` #define d define #d b12(x) 12 x @@ -1188,7 +1188,7 @@ but as he was testing the `fibonacci.c` bug he ended up changing it anyway). BTW: why can't the fix: -```c +``` if (a[1]==NULL||a[2]==NULL||a[3]==NULL||a[4]==NULL||a[5]==NULL) return 1; ``` @@ -1325,14 +1325,14 @@ changed from `char*s` to `char s[]`): ``` and then the call to `system()` had to be changed to: -```c +``` system(q-69); ``` An important point is that the placement of this string in the `s` array does matter. This is because of the code: -```c +``` *o=fopen(q-3,"w"); ``` @@ -1347,7 +1347,7 @@ But then there is the matter of getting the C to use `fgets(3)`. As can be seen above it's not as simple as changing `gets(3)` to `fgets(3)`. This was more magic characters that had to be updated and some added. The C code: -```c +``` atoi(gets(b)) ``` @@ -1359,7 +1359,7 @@ is in the string: which was changed to be (in C): -```c +``` atoi(fgets(b,99,stdin)) ``` @@ -1395,7 +1395,7 @@ But then to prevent the need for disabling a warning and to be more correct code, the generated code was changed to `return 1;` rather than just `return;`. Thus in full the string became: -```c +``` char s[]="Qjou!s\\311^-g\\311^-n\\311^-c\\::^-q-ma%mO1JBHm%BQ-aP1J[O1HB%[QaP2QaP4\ @@ -1506,13 +1506,13 @@ problem is that `adgrep.c` was an incorrect reference that never existed and it was never fixed in any of the files, not the code or the documentation, and thus was entirely incorrect code. A fun fact is that one can do: -```c +``` W= fopen(wc>= 2 ? V[1] : __FILE__,"rt");if(!W)exit(1); ``` but one _CANNOT_ do: -```c +``` W= fopen(wc>= 2 ? V[1] : __FILE__,"rt");if(!W)exit(1); if (W==NULL)exit(1); ``` @@ -1523,7 +1523,7 @@ true of another change as further below. Cody also restored a slightly more obscure line of code that had been changed: -```diff +``` - putc("}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"[i]+i-9,stderr); + putc(i["}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"]+i-9,stderr); ``` @@ -1552,7 +1552,7 @@ might be expected from the above, caused compilation errors with another generated file (`adwc.c`)! Thus after the `gets(3)` call in the line that looks like: -```c +``` while( gets(Y) ){ Y[strlen(Y)-1]='\0'; if(A(Y)) puts(Y); } ``` @@ -1809,7 +1809,7 @@ Both [Cody](#cody) and [Yusuke](#yusuke) fixed this so that it will work with mo provided some fixes of the X code and Cody fixed the C pre-processor directives so that it would compile. It used to be that you could get away with code like: -```c +``` G int i,j K case ``` @@ -2421,7 +2421,7 @@ doesn't crash. At this point since the author stated it has no `while`, `do...while`, `for`, `if/else`, `switch`, `?:` Cody removed the if statement by doing: -```c +``` ((V[1]&&((atoi(V[1])>0&&atoi(V[1])<27))||(exit(1),1))); ``` @@ -2456,7 +2456,7 @@ not exist, it would dereference a NULL pointer and very likely crash or halt and catch fire :-), preventing the entry from working. Notice how `H` is a funny macro defined as: -```c +``` %:define H(x) ``` @@ -2757,13 +2757,13 @@ matter_! To get this to compile with clang, `main()` had to change from: -```c +``` main (char *ck, char **k) ``` to: -```c +``` main (int cka, char **k) { char *ck = (char *)cka; /* ... */ } ``` @@ -2778,7 +2778,7 @@ macOS and Linux). NOTE: there might be educational value to see the progress of this fix; if you wish to see, try the following commands from the `2001/anonymous` directory: -```sh +``` git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..93aa8d79f208dcccc3c5a2370a727b5cf64e9c53 anonymous.c git diff 93aa8d79f208dcccc3c5a2370a727b5cf64e9c53..c48629017117379a52b1a512ef8f2593ca9569c8 anonymous.c git diff c48629017117379a52b1a512ef8f2593ca9569c8..efdee208a2bc650256637b9357ddfd0de82d2f41 anonymous.c @@ -2789,13 +2789,13 @@ wish to see, try the following commands from the `2001/anonymous` directory: Finally to see from start to finish: -```sh +``` git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..4bc03de321612869aebf855850c6500df95cb6ef anonymous.c ``` or to not use `git`: -```sh +``` make diff_orig_prog ``` @@ -2874,7 +2874,7 @@ He also fixed it to check the number of args. Cody fixed this to compile with clang in Linux. The problem was C99 does not support implicit int: -```c +``` coupard.c:31:10: error: parameter 'h' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] void e(n,h){ ^ @@ -3113,7 +3113,7 @@ cpp being unable to parse the generated code (see the index.html for details) an this ended up with a number of errors like: -```c +``` jdalbec.c:64:5: error: stray '##' in program 64 | B N##B (I) ; \ | ^~ @@ -3196,7 +3196,7 @@ to the repo for the script instead. [Cody](#cody) fixed this to compile in Linux. Although it compiled cleanly in macOS (and BSD?) the code failed to compile at all in Linux due to: -```c +``` cc -E vik2_1.c > vik2_2.c In file included from vik2.c:945, from vik2.c:959, @@ -3310,7 +3310,7 @@ Linux (32-bit, 64-bit) and macOS (arm64). To get the self-test feature to work it was required to remove from the code: -```c +``` O-b-f-u -s-c-a-t-e; ``` @@ -3326,7 +3326,7 @@ portable and caused other problems. This was a complicated fix as it's in the comments but in a funny way; the final result to get the test feature to work is: -```c +``` ;; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/ /*-e/'s,intZ,int/ Z,g'>c.c;make/c;/ rm/-f/c*/ ;; @@ -3334,7 +3334,7 @@ is: changed from: -```c +``` ;; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/ /*c.c;cc/c.c /-c*/;; ``` @@ -3342,7 +3342,7 @@ changed from: or as a diff: -```diff +``` -(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/ -/*c.c;cc/c.c /-c*/;;char*A=0,*_,*R,*Q, D[9999],*r,l -[9999],T=42, M,V=32;long*E,k[9999],B[1 <<+21],*N=B+ @@ -3380,7 +3380,7 @@ not do it implicitly (like macOS does). [Cody](#cody) fixed this to work in Linux. The problem was an unknown escape sequence, `\N`, which caused a funny compiler error: -```c +``` };n b[2048];int i mikeash.c: In function 'R': mikeash.c:7:1: error: '\N' not followed by '{' @@ -3433,7 +3433,7 @@ Cody also added the [try.sh](2005/persano/try.sh) script. [Cody](#cody) added the saved (with the `SAVE` command) BASIC program `PET` which was: -```basic +``` 10 PRINT "2005'S IOCCC BEST EMULATOR" 20 PRINT "BY STEPHEN SYKES!" ``` @@ -4107,7 +4107,7 @@ real source of the program. So the source of the entry has to be compiled and then run, and the output has to be compiled to be `hou`. This allows the real program to be used. Thus the Makefile rule looks like: -```makefile +``` ${PROG}: ${PROG}.c ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} ./${PROG} | ${CC} ${CFLAGS} -xc - -o $@ ${LDFLAGS} @@ -4117,7 +4117,7 @@ program to be used. Thus the Makefile rule looks like: which then compiles like: -```sh +``` cc -std=gnu11 -Wall -Wextra -pedantic -Wno-sign-compare -Wno-strict-prototypes -O3 hou.c -o hou -lm ./hou | cc -std=gnu11 -Wall -Wextra -pedantic -Wno-sign-compare -Wno-strict-prototypes -O3 -xc - -o hou -lm ``` @@ -4311,7 +4311,7 @@ output. first character of the filename starts with `e`. The only way it would work before that is if one did something like: -```sh +``` ln -sf prog eprog PATH=$PATH:. ; eprog '...' ``` @@ -4320,7 +4320,7 @@ since otherwise the first character would not be `e` but rather a dot (`./eprog`). This was done by adding to the Makefile `-include libgen.h` and adding to `main()` after the variable declaration (`V*A;`) the code: -```c +``` *K=basename(*K); ``` @@ -4820,7 +4820,7 @@ He also added the [try.sh](2020/endoh2/try.sh) script. [Cody](#cody) fixed the script [run_clock.sh](2020/endoh3/run_clock.sh) which gave a funny error when running it: -```sh +``` $ ./run_clock.sh -bash: ./run_clock.sh: cannot execute: required file not found ``` diff --git a/tmp/OLD_manifest/README.md b/tmp/OLD_manifest/README.md index 650a79999..62d79299c 100644 --- a/tmp/OLD_manifest/README.md +++ b/tmp/OLD_manifest/README.md @@ -37,7 +37,7 @@ Because the `author_handle` is used to form a JSON filename, the string must be lower case POSIX safe string. Furthermore, the `author_handle` must be an ASCII string that matches this regexp: -```re +``` ^[0-9a-z][0-9a-z_]*$ ``` @@ -76,7 +76,7 @@ in the case of [2005/anon](/2005/anon/anon.c). Anonymous `author_handle`'s match this regexp: -```re +``` Anonymous_[0-9][0-9][0-9][0-9][.0-9]*$ ``` @@ -105,7 +105,7 @@ Non-numeric `year` strings are lower case. A `year` string matches this regexp: -```re +``` [0-9a-z][0-9a-z][0-9a-z][0-9a-z] ``` @@ -130,7 +130,7 @@ A `dir` is a POSIX safe string that holds an winner. A `dir` is a string that matches this regexp: -```re +``` ^[a-z][0-9a-z.-]*$ ``` @@ -164,7 +164,7 @@ an `author` and the `winners` they submitted are to be listed. A `sort_word` match this regexp: -```re +``` ^[a-z][0-9a-z]* ``` @@ -281,7 +281,7 @@ Run the script from the top level directory. The output should end in ":1". For example, this command should not produce any output. -```sh +``` tmp/awards_check.sh | grep -v ':1$' ``` @@ -419,7 +419,7 @@ Temporary tool used to generate the `author/author_handle.json` files. The following command, executed in this directory, created the `author/` directory: -```sh +``` rm -rf ../author ; ./gen_author_json.sh author_handle.txt author.csv author_wins.csv ../author ``` diff --git a/tmp/README.md b/tmp/README.md index 9b4bd554b..ac8a37fcc 100644 --- a/tmp/README.md +++ b/tmp/README.md @@ -156,7 +156,7 @@ returns and appending a newline if it was missing. Fixing involves these actions: -```sh +``` tr -d '\015' < input.csv > tmp.csv echo >> tmp.csv mv -f tmp.csv input.csv @@ -342,7 +342,7 @@ A tool to run another tool over all _YYYY/dir_ entry directories. Examples: -```sh +``` ./run_all.sh -v 3 ./fake.gen_index.sh ./run_all.sh -v 1 ./gen_entry_json.sh ```