diff --git a/1984/anonymous/README.md b/1984/anonymous/README.md
index e7ffd0413..bd17bfca2 100644
--- a/1984/anonymous/README.md
+++ b/1984/anonymous/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./anonymous
+ ./anonymous
```
@@ -23,7 +23,7 @@ as the alternate code. See below for the tattoo side-by-side with the code.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -32,7 +32,7 @@ make alt
NOTE: this version might not work on some systems like macOS.
```sh
-./anonymous.alt
+ ./anonymous.alt
```
diff --git a/1984/anonymous/index.html b/1984/anonymous/index.html
index 2ead307e3..1f28b0380 100644
--- a/1984/anonymous/index.html
+++ b/1984/anonymous/index.html
@@ -132,8 +132,7 @@
Author:
Name: Anonymous 1984
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 e879810d3..c1f1fdab9 100644
--- a/1984/decot/README.md
+++ b/1984/decot/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
NOTE: there is an [alternate version](#alternate-code) which will only work if
@@ -14,7 +14,7 @@ The original code was fixed in 2023 to not require this.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1984 decot bugs](../../bugs.html#1984_decot).
@@ -23,7 +23,7 @@ For more detailed information see [1984 decot bugs](../../bugs.html#1984_decot).
## To use:
```sh
-./decot
+ ./decot
```
@@ -37,14 +37,14 @@ can use this version.
### Alternate build:
```sh
-make alt
+ make alt
```
### Alternate use:
```sh
-./decot.alt
+ ./decot.alt
```
@@ -62,13 +62,13 @@ 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 {
+ for(signal=0;*k * x * __FILE__ *i;) do {
```
to:
```c
-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](decot.orig.c). The
@@ -76,7 +76,7 @@ To see what we mean look at the [original source file](decot.orig.c). The
fixed version has instead:
```c
-for(signal=0;*k *= * __FILE__ *i;) do {
+ for(signal=0;*k *= * __FILE__ *i;) do {
```
diff --git a/1984/decot/index.html b/1984/decot/index.html
index cfffc7a99..5e3ae6c0b 100644
--- a/1984/decot/index.html
+++ b/1984/decot/index.html
@@ -132,8 +132,7 @@
Author:
Name: Dave Decot
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,24 +141,24 @@ 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.
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
@@ -167,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:
diff --git a/1984/mullender/README.md b/1984/mullender/README.md
index 6c268e29f..577e0f7d2 100644
--- a/1984/mullender/README.md
+++ b/1984/mullender/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make alt
+ make alt
```
NOTE: the original code will not work on any system other than
@@ -16,7 +16,7 @@ the original version.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1984 mullender bugs](../../bugs.html#1984_mullender).
@@ -25,7 +25,7 @@ For more detailed information see [1984 mullender bugs](../../bugs.html#1984_mul
## To use:
```sh
-./mullender.alt [microseconds]
+ ./mullender.alt [microseconds]
```
Hit ctrl-c/intr to exit the program.
@@ -49,13 +49,13 @@ which is probably not as uncommon as you think :-).
## Try:
```sh
-./mullender.alt
+ ./mullender.alt
-./mullender.alt 5000 # wait for 5000 microseconds and see what happens
+ ./mullender.alt 5000 # wait for 5000 microseconds and see what happens
-./mullender.alt 20000 # wait for 20000 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 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
@@ -73,14 +73,14 @@ machine dependent code was discouraged.
### Original build:
```sh
-make all
+ make all
```
### Original use:
```sh
-./mullender
+ ./mullender
```
@@ -138,19 +138,19 @@ Repo](https://github.com/dspinellis/unix-history-repo/tree/Research-Release).
```sh
-make gentab
+ make gentab
```
### gentab use:
```sh
-./gentab file
+ ./gentab file
```
### gentab try:
```sh
-./gentab gentab > g.c
+ ./gentab gentab > g.c
```
NOTE: it is highly unlikely that you will be able to run the output of `gentab`
@@ -285,18 +285,18 @@ 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)
- 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
@@ -332,26 +332,26 @@ program that we came up with is as follows:
```asm
-vax: .word 0400 + (pdp - vax) / 2 - 1
-1:
- pushl $9
- pushal str
- pushl $1
- calls $3, write
- cvtwl $32767, r2
+ 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
+ 2:
+ decl r2
+ jneq 2b
+ jbr 1b
-write: .word 0
- chmk $4
- ret
+ write: .word 0
+ chmk $4
+ ret
-str: .ascii " :-)\b\b\b\b"
+ str: .ascii " :-)\b\b\b\b"
-pdp: .word 4548, 3044, 58820, 9, 4407, 6, 5568, 1, 35076, 0, 9, 5570, 512, 35117, 32386, 496
+ 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
@@ -390,60 +390,59 @@ extracted the machine code from the object file.
compiled in modern systems.
```c
-\#include
-\#include
+ #include
+ #include
-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;
+ 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 (32 <= n && n < 127 && (rand() % 4)) fmt = "'%c'";
- printf(n < 8 ? "%d" : fmt, n);
- printf(",");
- if (pos++ == 8) {
- printf("\n");
- pos = 0;
+ if ((fp = fopen(argv[1], "r")) == NULL) {
+ fprintf(stderr, "%s: can't open %s\n", argv[0], argv[1]);
+ exit(2);
}
- else printf(" ");
- printf("};\n");
+ 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
diff --git a/1984/mullender/index.html b/1984/mullender/index.html
index 0fd693a4d..d3f526552 100644
--- a/1984/mullender/index.html
+++ b/1984/mullender/index.html
@@ -135,8 +135,7 @@
Location: US - United States of America (United States)
Name: Sjoerd Mullender
-Location: NL - Kingdom of the Netherlands (Netherlands)
-
+Location: NL - Kingdom of the Netherlands (Netherlands)
@@ -145,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
@@ -153,10 +152,10 @@ to use the alt version instead. See original code b
the original version.
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
@@ -170,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
-./mullender.alt 5000 # wait for 5000 microseconds and see what happens
+./mullender.alt 5000 # wait for 5000 microseconds and see what happens
-./mullender.alt 20000 # wait for 20000 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 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:
@@ -185,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
@@ -226,11 +225,11 @@ in the fabulousgentab build:
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
@@ -374,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:
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 3bfb61327..f6a386a10 100644
--- a/1985/applin/README.md
+++ b/1985/applin/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## Try:
```sh
-./applin
+ ./applin
```
diff --git a/1985/applin/index.html b/1985/applin/index.html
index 706ad2187..ccc775f21 100644
--- a/1985/applin/index.html
+++ b/1985/applin/index.html
@@ -135,8 +135,7 @@
Location: US - United States of America (United States)
Name: Robert Heckendorn
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -145,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 9660254bc..5850c3904 100644
--- a/1985/august/README.md
+++ b/1985/august/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./august
+ ./august
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
If you have the `primes(6)` tool (sometimes part of [BSD
@@ -23,8 +23,8 @@ 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
+ ./primes.sh # 15
+ ./primes.sh 25
```
Note that `try.sh` will run this script anyway, telling you where to get
diff --git a/1985/august/index.html b/1985/august/index.html
index 2b8880964..d6559bff4 100644
--- a/1985/august/index.html
+++ b/1985/august/index.html
@@ -132,8 +132,7 @@
@@ -142,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 a7d93a829..c723ed3b7 100644
--- a/1985/lycklama/README.md
+++ b/1985/lycklama/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make alt
+ make alt
```
## To use:
```sh
-./lycklama.alt < some_file
+ ./lycklama.alt < some_file
```
To see why we recommend the alternate version instead of the original version,
@@ -25,13 +25,13 @@ reconfigure it like:
```sh
-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:
```sh
-./try.alt.sh
+ ./try.alt.sh
```
@@ -46,24 +46,24 @@ modern systems.
### Original build:
```sh
-make all
+ make all
```
### Original use:
```sh
-./lycklama < some_file
+ ./lycklama < some_file
```
### Original try:
```sh
-./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
```
diff --git a/1985/lycklama/index.html b/1985/lycklama/index.html
index b74ec3ec9..1d47354be 100644
--- a/1985/lycklama/index.html
+++ b/1985/lycklama/index.html
@@ -132,8 +132,7 @@
Author:
Name: Ed Lycklama
-Location: ZZ - Unknown location
-
To see why we recommend the alternate version instead of the original version,
see below and the Original code section.
Try:
@@ -153,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.
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 8c0e1e4ed..9f4ae46f0 100644
--- a/1985/shapiro/README.md
+++ b/1985/shapiro/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
There is alternate code which allows one to change the size of the maze. See
@@ -11,7 +11,7 @@ There is alternate code which allows one to change the size of the maze. See
### To run:
```sh
-./shapiro
+ ./shapiro
```
@@ -24,7 +24,7 @@ of the maze. The alt code allows one to easily do this.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -33,7 +33,7 @@ make alt
If you wish to change the value you can do it like:
```sh
-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
@@ -42,7 +42,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
+ ./try.alt.sh
```
This script will compile the program five times with a random value and then
diff --git a/1985/shapiro/index.html b/1985/shapiro/index.html
index 9332e7f10..363da534a 100644
--- a/1985/shapiro/index.html
+++ b/1985/shapiro/index.html
@@ -132,8 +132,7 @@
Author:
Name: Carl Shapiro
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 17cbfc355..13032d87f 100644
--- a/1985/sicherman/README.md
+++ b/1985/sicherman/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
There is another version that will be compiled in case the first fails. This
@@ -12,19 +12,19 @@ more details on it.
## To use:
```sh
-./sicherman < file
+ ./sicherman < file
-echo foo | ./sicherman
+ echo foo | ./sicherman
-./sicherman
-# type or paste some text, making sure to hit enter after each line typed
+ ./sicherman
+ # type or paste some text, making sure to hit enter after each line typed
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -44,7 +44,7 @@ Although this will be built if the original fails to compile you can do it
manually like:
```sh
-make alt
+ make alt
```
In this case it will be built as `sicherman.alt`.
@@ -53,14 +53,14 @@ In this case it will be built as `sicherman.alt`.
### Alternate use:
```sh
-./sicherman.alt < file
+ ./sicherman.alt < file
```
### Alternate try:
```sh
-./try.alt.sh
+ ./try.alt.sh
```
@@ -81,7 +81,7 @@ 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
+ ./sicherman < sicherman.c | ./sicherman | diff - ./sicherman.c
```
results in diff reporting a difference on some machines.
diff --git a/1985/sicherman/index.html b/1985/sicherman/index.html
index c178da2ee..75abc49b7 100644
--- a/1985/sicherman/index.html
+++ b/1985/sicherman/index.html
@@ -132,8 +132,7 @@
+Location: US - United States of America (United States)
@@ -142,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
+
./sicherman< file
-echo foo |./sicherman
+echo foo |./sicherman
-./sicherman
-# type or paste some text, making sure to hit enter after each line typed
+./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
@@ -165,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
@@ -183,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:
-
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 92bb27bae..a313cf685 100644
--- a/1986/applin/README.md
+++ b/1986/applin/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./applin
+ ./applin
```
## Try:
```sh
-./applin.c
+ ./applin.c
```
diff --git a/1986/applin/index.html b/1986/applin/index.html
index d62deea32..672d6ff64 100644
--- a/1986/applin/index.html
+++ b/1986/applin/index.html
@@ -132,8 +132,7 @@
Author:
Name: Jack Applin
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 9c466ee88..83986a7f8 100644
--- a/1986/august/README.md
+++ b/1986/august/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -10,7 +10,7 @@ make all
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1986 august bugs](../../bugs.html#1986_august).
@@ -19,7 +19,7 @@ For more detailed information see [1986 august bugs](../../bugs.html#1986_august
## Try:
```sh
-./august
+ ./august
```
diff --git a/1986/august/index.html b/1986/august/index.html
index 558e89cf3..25549b3cc 100644
--- a/1986/august/index.html
+++ b/1986/august/index.html
@@ -132,8 +132,7 @@
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 cfe6624b6..af7816df7 100644
--- a/1986/bright/README.md
+++ b/1986/bright/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./bright some_file
+ ./bright some_file
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
diff --git a/1986/bright/index.html b/1986/bright/index.html
index b29f30955..10a439b11 100644
--- a/1986/bright/index.html
+++ b/1986/bright/index.html
@@ -132,8 +132,7 @@
Author:
Name: Walter Bright
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 06edbbb5e..87f8ce071 100644
--- a/1986/hague/README.md
+++ b/1986/hague/README.md
@@ -1,22 +1,22 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./hague 2>/dev/null
-# enter some text
+ ./hague 2>/dev/null
+ # enter some text
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
Note that you can run the program without feeding it anything and then type in a
diff --git a/1986/hague/index.html b/1986/hague/index.html
index 515994a11..2a66c5d6a 100644
--- a/1986/hague/index.html
+++ b/1986/hague/index.html
@@ -132,8 +132,7 @@
Author:
Name: Jim Hague
-Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
-
+Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
@@ -142,12 +141,12 @@ Location: GB - United Kingdom of Great
To build:
-
make all
+
make all
To use:
-
./hague2>/dev/null
-# enter some text
+
./hague2>/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 3bcd5e2fa..81368e750 100644
--- a/1986/holloway/README.md
+++ b/1986/holloway/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## Try:
```sh
-./holloway
+ ./holloway
```
diff --git a/1986/holloway/index.html b/1986/holloway/index.html
index 449d39d6e..87dee4a32 100644
--- a/1986/holloway/index.html
+++ b/1986/holloway/index.html
@@ -132,8 +132,7 @@
Author:
Name: Bruce Holloway
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 25636911f..f991cc8c7 100644
--- a/1986/marshall/README.md
+++ b/1986/marshall/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
NOTE: we FORCE disable the optimiser due to a funny problem with different
@@ -19,7 +19,7 @@ if nothing else.
## To use:
```sh
-./marshall
+ ./marshall
```
@@ -37,14 +37,14 @@ To see if your compiler has the problems noted:
```sh
-make alt
+ make alt
```
### Alternate use:
```sh
-./marshall.alt
+ ./marshall.alt
```
Does it work in your system? That is does it not segfault, does it print it only
diff --git a/1986/marshall/compilers.html b/1986/marshall/compilers.html
index 52e7ab80a..4c735585b 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 72d00b927..91948df78 100644
--- a/1986/marshall/compilers.md
+++ b/1986/marshall/compilers.md
@@ -55,7 +55,7 @@ The call was:
```c
-_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
@@ -73,9 +73,9 @@ 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
+ $ ./marshall
+ choo choo
+ Segmentation fault: 11
```
Observe how it doesn't print it twice. But of course it segfaults so it's not
diff --git a/1986/marshall/index.html b/1986/marshall/index.html
index 2ae59ae12..21f264bc0 100644
--- a/1986/marshall/index.html
+++ b/1986/marshall/index.html
@@ -132,8 +132,7 @@
Author:
Name: Eric Marshall
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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:
@@ -153,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
@@ -161,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 b119a98e8..57239169c 100644
--- a/1986/pawka/README.md
+++ b/1986/pawka/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## Try:
```sh
-./pawka
+ ./pawka
```
diff --git a/1986/pawka/index.html b/1986/pawka/index.html
index 278ce432e..691347053 100644
--- a/1986/pawka/index.html
+++ b/1986/pawka/index.html
@@ -132,8 +132,7 @@
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 2758bf273..f0dc9deda 100644
--- a/1986/stein/README.md
+++ b/1986/stein/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./stein $(printf "\015\015"); echo
+ ./stein $(printf "\015\015"); echo
```
@@ -25,7 +25,7 @@ One some machines, a control-M control-N arg is needed
to get the command to output cleanly:
```sh
-./stein $(printf "\014\015"); echo
+ ./stein $(printf "\014\015"); echo
```
Your system may require another set of characters.
diff --git a/1986/stein/index.html b/1986/stein/index.html
index e759470ae..7bc5b0d4f 100644
--- a/1986/stein/index.html
+++ b/1986/stein/index.html
@@ -132,8 +132,7 @@
Author:
Name: Jan Stein
-Location: ZZ - Unknown location
-
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
@@ -152,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 ebee23d1e..e0f36c4fc 100644
--- a/1986/wall/README.md
+++ b/1986/wall/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./wall
+ ./wall
```
diff --git a/1986/wall/index.html b/1986/wall/index.html
index b59f88c13..b9ad8de4c 100644
--- a/1986/wall/index.html
+++ b/1986/wall/index.html
@@ -132,8 +132,7 @@
Author:
Name: Larry Wall
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 a09949a76..9d2f5c92c 100644
--- a/1987/biggar/README.md
+++ b/1987/biggar/README.md
@@ -1,23 +1,23 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-some_command | ./biggar | od -c
+ some_command | ./biggar | od -c
-./biggar < file | od -c
+ ./biggar < file | od -c
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
diff --git a/1987/biggar/index.html b/1987/biggar/index.html
index 57d49ff03..6dd42a983 100644
--- a/1987/biggar/index.html
+++ b/1987/biggar/index.html
@@ -132,8 +132,7 @@
Author:
Name: Mark Biggar
-Location: ZZ - Unknown location
-
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 e808cc6ee..68c95d321 100644
--- a/1987/heckbert/README.md
+++ b/1987/heckbert/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
On System V systems, we had to compile with `-Dindex=strchr`.
@@ -11,7 +11,7 @@ To compile on a 16 bit machine, change 300000 to 30000.
## To use:
```sh
-./heckbert col < file
+ ./heckbert col < file
```
where col is the number of columns to fold at and file is the file to fold.
@@ -20,7 +20,7 @@ where col is the number of columns to fold at and file is the file to fold.
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -29,7 +29,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
+ ./heckbert 40 < heckbert.c > ph.c ; make ph ; ./ph 20 < heckbert.c > bar.c ; make bar
```
Try not to
diff --git a/1987/heckbert/index.html b/1987/heckbert/index.html
index 10b627687..ee086d6ac 100644
--- a/1987/heckbert/index.html
+++ b/1987/heckbert/index.html
@@ -132,8 +132,7 @@
Author:
Name: Paul Heckbert
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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:
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 b1274bbf8..ce7e30bfa 100644
--- a/1987/korn/README.md
+++ b/1987/korn/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./korn
+ ./korn
```
@@ -30,14 +30,14 @@ Several points are important to understand this program:
characters, or `'h'`, or a string) Consider the fact that:
```c
-char *x;
+ char *x;
```
defines a pointer to a `char` (i.e. an address), and that the `=` assigns
things of compatible types. Since:
```c
-x = "have";
+ x = "have";
```
is legal C, what type of value is `"have"`?
@@ -45,13 +45,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)
+ x[3] *(x+3) *(3+x)
```
since addition is commutative. What can be said about this value?
```c
-3[x]
+ 3[x]
```
[David
diff --git a/1987/korn/index.html b/1987/korn/index.html
index 210955ad4..c1d9098cb 100644
--- a/1987/korn/index.html
+++ b/1987/korn/index.html
@@ -132,8 +132,7 @@
Author:
Name: David Korn
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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
@@ -159,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"?
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 9a5d6c581..876c8f65c 100644
--- a/1987/lievaart/README.md
+++ b/1987/lievaart/README.md
@@ -1,15 +1,15 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./lievaart
-# enter a level and start playing as described below
+ ./lievaart
+ # enter a level and start playing as described below
```
@@ -18,8 +18,8 @@ make all
To see what it would have looked like without the size restrictions:
```sh
-./lievaart2
-# enter a level and start playing as described below
+ ./lievaart2
+ # enter a level and start playing as described below
```
diff --git a/1987/lievaart/index.html b/1987/lievaart/index.html
index 530e0034c..e60b6cab0 100644
--- a/1987/lievaart/index.html
+++ b/1987/lievaart/index.html
@@ -132,8 +132,7 @@
Author:
Name: Roemer B. Lievaart
-Location: NL - Kingdom of the Netherlands (Netherlands)
-
+Location: NL - Kingdom of the Netherlands (Netherlands)
@@ -142,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 4a904ea93..435c0fbba 100644
--- a/1987/wall/README.md
+++ b/1987/wall/README.md
@@ -1,42 +1,42 @@
## To build:
```sh
-make all
-```
+ make all
+ ```
## To use:
```sh
-./wall
-# enter some numbers
+ ./wall
+ # enter some numbers
-./wall | some_command
-# enter some strings or numbers, depending on command
+ ./wall | some_command
+ # enter some strings or numbers, depending on command
```
## Try:
```sh
-./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 | bc
-./wall | cat
+ ./wall | cat
```
and enter some input like:
```
-x*x
-2^x
-quit # for the cat version
+ x*x
+ 2^x
+ quit # for the cat version
```
which the script does through a pipeline except that here you can enter more
diff --git a/1987/wall/index.html b/1987/wall/index.html
index cd381c051..5d751686e 100644
--- a/1987/wall/index.html
+++ b/1987/wall/index.html
@@ -132,8 +132,7 @@
Author:
Name: Larry Wall
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,24 +141,24 @@ Location: US - United States of America
To build:
-
make all
+
make all
To use:
-
./wall
-# enter some numbers
+
./wall
+# enter some numbers
-./wall|some_command
-# enter some strings or numbers, depending on command
+./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|bc
-./wall|cat
+./wall|cat
and enter some input like:
-
x*x
-2^x
-quit # for the cat version
+
x*x
+ 2^x
+ quit # for the cat version
which the script does through a pipeline except that here you can enter more
text if you wish, line by line.
Judges’ remarks:
diff --git a/1987/westley/README.md b/1987/westley/README.md
index d72f208db..ff0635f16 100644
--- a/1987/westley/README.md
+++ b/1987/westley/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./westley
+ ./westley
```
diff --git a/1987/westley/index.html b/1987/westley/index.html
index ae029ed9f..518059f0b 100644
--- a/1987/westley/index.html
+++ b/1987/westley/index.html
@@ -132,8 +132,7 @@
Author:
Name: Brian Westley
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 840cd677a..c70dc626d 100644
--- a/1988/applin/README.md
+++ b/1988/applin/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
A smaller version, originally called `zsmall.c` (and still exists as such, as
@@ -13,7 +13,7 @@ program. See the [Alternate code](#alternate-code) section below for details.
## Try:
```sh
-./applin
+ ./applin
```
@@ -26,7 +26,7 @@ with this entry.
### Alternate build:
```sh
-make alt
+ make alt
```
Use `applin.alt` as you would `applin` above.
diff --git a/1988/applin/index.html b/1988/applin/index.html
index 0fca76473..9d3cb009e 100644
--- a/1988/applin/index.html
+++ b/1988/applin/index.html
@@ -132,8 +132,7 @@
Author:
Name: Jack Applin
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 cb8091e48..5740e7d27 100644
--- a/1988/dale/README.md
+++ b/1988/dale/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -10,7 +10,7 @@ make all
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1988 dale bugs](../../bugs.html#1988_dale).
@@ -19,15 +19,15 @@ For more detailed information see [1988 dale bugs](../../bugs.html#1988_dale).
## Try:
```sh
-./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" *)"
+ ./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
diff --git a/1988/dale/index.html b/1988/dale/index.html
index cc43b9874..09c40a938 100644
--- a/1988/dale/index.html
+++ b/1988/dale/index.html
@@ -132,8 +132,7 @@
Author:
Name: Paul Dale
-Location: AU - Commonwealth of Australia (Australia)
-
+Location: AU - Commonwealth of Australia (Australia)
@@ -142,17 +141,17 @@ Location: AU - Commonwealth of Australi
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 a84456f1a..3b056c3ef 100644
--- a/1988/isaak/README.md
+++ b/1988/isaak/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
There is an alternate version, the original, that can't be compiled in modern
@@ -12,7 +12,7 @@ code](#alternate-code) below.
## To use:
```sh
-./isaak
+ ./isaak
```
@@ -22,7 +22,7 @@ The original version of this code is in [isaak.alt.c](isaak.alt.c).
The original entry starts with the line:
```c
-main(){};
+ main(){};
```
This works on some systems. Why? Note that `#include ` is given on
@@ -38,7 +38,7 @@ compile.
### Alternate build:
```sh
-make alt
+ make alt
```
Use `isaak.alt` as you would `isaak` above.
@@ -65,8 +65,8 @@ due to the fact that BSD style systems have an `sprintf(3)` that returns a `char
file: isaak.encode. To read this file do.
```sh
-uudecode < isaak.encode
-cat isaak.output
+ uudecode < isaak.encode
+ cat isaak.output
```
Since this was fixed, this file is not strictly necessary. See the
diff --git a/1988/isaak/index.html b/1988/isaak/index.html
index 44fffe22d..5a21420fb 100644
--- a/1988/isaak/index.html
+++ b/1988/isaak/index.html
@@ -132,8 +132,7 @@
Author:
Name: Mark Isaak
-Location: ZZ - Unknown location
-
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
@@ -159,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
@@ -174,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 a16c5ee59..82dd7ef80 100644
--- a/1988/litmaath/README.md
+++ b/1988/litmaath/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./litmaath some text
+ ./litmaath some text
```
There is an alternate version provided. See the [Alternate
@@ -18,7 +18,7 @@ code](#alternate-code) section below.
## Try:
```sh
-./litmaath eschew obfuscation
+ ./litmaath eschew obfuscation
```
@@ -32,7 +32,7 @@ a file.
### Alternate build:
```sh
-make alt
+ make alt
```
Use `litmaath.alt` as you would `litmaath` above.
@@ -41,7 +41,7 @@ Use `litmaath.alt` as you would `litmaath` above.
### Alternate try:
```sh
-./litmaath.alt six was afraid of seven because seven eight nine
+ ./litmaath.alt six was afraid of seven because seven eight nine
```
@@ -51,8 +51,8 @@ Note the unusual structure:
```c
-while ()
- ;
+ while ()
+ ;
```
Did you notice that the body is empty?
@@ -67,10 +67,10 @@ 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 : '@',
- (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](#alternate-code) is.
diff --git a/1988/litmaath/index.html b/1988/litmaath/index.html
index 781db8221..f72d5f603 100644
--- a/1988/litmaath/index.html
+++ b/1988/litmaath/index.html
@@ -132,8 +132,7 @@
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.
@@ -169,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:
-
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 d994ae18d..885f75ae5 100644
--- a/1988/reddy/README.md
+++ b/1988/reddy/README.md
@@ -1,22 +1,22 @@
## To build:
```sh
-make all
+ make all
```
## Try:
```sh
-./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?
```c
-char *(*(*(*(*(*fun[32])))))());
+ char *(*(*(*(*(*fun[32])))))());
```
diff --git a/1988/reddy/index.html b/1988/reddy/index.html
index d3c376160..7aa165538 100644
--- a/1988/reddy/index.html
+++ b/1988/reddy/index.html
@@ -132,8 +132,7 @@
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 436ec3ca1..f22e77bb2 100644
--- a/1988/robison/README.md
+++ b/1988/robison/README.md
@@ -1,22 +1,22 @@
## To build:
```sh
-make all
+ make all
```
## Try:
```sh
-./robison 80 10
-./robison 40 16
+ ./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
+ ./robison 80 2 # <--- can you find the bug?
+ ./robison 80 -246
```
@@ -25,8 +25,7 @@ The first and second parameters are optional. You might also try:
The following might make an interesting benchmark:
```sh
-./robison 100
-
+ ./robison 100
```
[Amdahl 5890-300E with System V cc: 8.40 seconds]
diff --git a/1988/robison/index.html b/1988/robison/index.html
index 025418aa0..687eb1735 100644
--- a/1988/robison/index.html
+++ b/1988/robison/index.html
@@ -132,8 +132,7 @@
Author:
Name: Arch D. Robison
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 c31348ad7..31e87cf2c 100644
--- a/1988/spinellis/README.md
+++ b/1988/spinellis/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make clobber all
+ make clobber all
```
and follow the instructions this will give you.
@@ -13,7 +13,7 @@ code](#alternate-code) section below.
## To use:
```sh
-./spinellis
+ ./spinellis
```
Type in or copy paste some C code, perhaps from [input.txt](input.txt), and send
@@ -22,7 +22,7 @@ EOF (typically ctrl-d).
Now run again:
```sh
-./spinellis
+ ./spinellis
```
@@ -34,7 +34,7 @@ For clang or compilers that won't read from `/dev/tty`, we provide this version.
### Alternate build:
```sh
-make clobber alt
+ make clobber alt
```
and follow the instructions.
@@ -43,7 +43,7 @@ and follow the instructions.
### Alternate use:
```sh
-./spinellis.alt
+ ./spinellis.alt
```
Type in or copy paste some C code, perhaps from [input.txt](input.txt), and send
@@ -52,7 +52,7 @@ EOF (typically ctrl-d).
Now run again:
```sh
-./spinellis.alt
+ ./spinellis.alt
```
diff --git a/1988/spinellis/index.html b/1988/spinellis/index.html
index dab5cb9aa..dad63885a 100644
--- a/1988/spinellis/index.html
+++ b/1988/spinellis/index.html
@@ -132,8 +132,7 @@
@@ -142,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 01cac7faa..a554eaacb 100644
--- a/1988/westley/README.md
+++ b/1988/westley/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
NOTE: this version is a fixed version for modern C compilers. See the [Alternate
@@ -12,13 +12,13 @@ might wish to do so.
## Try:
```sh
-./westley
+ ./westley
```
Also try:
```sh
-./try.sh
+ ./try.sh
```
to show the code with followed by the result so you can truly see the magic.
@@ -32,7 +32,7 @@ This version is the original which might not work as you expect nowadays.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -42,7 +42,7 @@ To see if your compiler has the problem described in the Judges' remarks below,
try:
```sh
-./westley.alt
+ ./westley.alt
```
Does it show the same output as `westley`?
@@ -53,8 +53,8 @@ Does it show the same output as `westley`?
Your compiler must parse
```c
-#define _ -a
--_
+ #define _ -a
+ -_
```
as `--a` and not `-(-a)` or some other tokenized form. Some strictly
@@ -63,7 +63,7 @@ compilers, you can elide the non-standard token-pasting requirement
by changing the #define line to:
```c
-#define _ F-->00||F-OO--;
+ #define _ F-->00||F-OO--;
```
This is what the modified code in [westley.c](westley.c) does whereas the alt
@@ -72,7 +72,7 @@ code is the original.
You might enjoy looking at the output of:
```sh
-cc -E westley.alt.c
+ cc -E westley.alt.c
```
diff --git a/1988/westley/index.html b/1988/westley/index.html
index e2caba08f..fbac68a51 100644
--- a/1988/westley/index.html
+++ b/1988/westley/index.html
@@ -132,8 +132,7 @@
Author:
Name: Brian Westley
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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.
@@ -142,18 +141,18 @@ Location: US - United States of America
./try.sh# run on 1 - 7
-./fubar.sh 2 # run via script
-./fubar 2 # run directly
+./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 06a803785..067ad9990 100644
--- a/1989/jar.1/README.md
+++ b/1989/jar.1/README.md
@@ -3,7 +3,7 @@
NOTE: this will run the program itself.
```sh
-make clobber all
+ make clobber all
```
There is an alternate version with a slight difference that you may wish to try.
@@ -13,7 +13,7 @@ See the [Alternate code](#alternate-code) section below for more details.
## To use:
```sh
-./jar.1
+ ./jar.1
```
@@ -27,14 +27,14 @@ This alternate code, which prints something slightly different, is provided as w
NOTE: this will run the program itself.
```sh
-make clobber alt
+ make clobber alt
```
### Alternate use:
```sh
-./jar.1.alt
+ ./jar.1.alt
```
@@ -44,7 +44,7 @@ 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
+ cc -c -o /dev/tty jar.1.c
```
As a last resort the `jar.1.sh` script provided simulates
diff --git a/1989/jar.1/index.html b/1989/jar.1/index.html
index e44df7e50..928cc4b99 100644
--- a/1989/jar.1/index.html
+++ b/1989/jar.1/index.html
@@ -132,8 +132,7 @@
Author:
Name: Jari Arkko
-Location: SE - Kingdom of Sweden (Sweden)
-
This is the most useful program submitted this year. It is a
rather large subset of lisp. It has no error recovery, and
@@ -193,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.53.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 12) (fn 34)))
-(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.53.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 12) (fn 34)))
+ (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 1149825b6..f69c14cc6 100644
--- a/1989/ovdluhe/README.md
+++ b/1989/ovdluhe/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
To get this to compile with a modern CPP, we had to replace `#D` with `#define`.
@@ -12,7 +12,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
+ ./ovdluhe < textfile
```
The program stops when it reaches the end of the template buffer
@@ -22,7 +22,7 @@ by chance or is killed.
## Try:
```sh
-./try.sh ; sleep 2 ; ./try.sh
+ ./try.sh ; sleep 2 ; ./try.sh
```
@@ -35,7 +35,7 @@ it's a `#define` it's easy to set up.
### Alternate build:
```sh
-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
@@ -47,16 +47,16 @@ program to fail and a negative value will cause a compilation error.
### Alternate use:
```sh
-./ovdluhe.alt
+ ./ovdluhe.alt
```
### Alternate try:
```sh
-./try.alt.sh
+ ./try.alt.sh
-P=5 ./try.alt.sh
+ P=5 ./try.alt.sh
```
NOTE: if you specify too high a value for `P` the program might fail. If you
diff --git a/1989/ovdluhe/index.html b/1989/ovdluhe/index.html
index 63ffd92ac..45bc66698 100644
--- a/1989/ovdluhe/index.html
+++ b/1989/ovdluhe/index.html
@@ -132,8 +132,7 @@
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
+
./try.alt.sh
-P=5 ./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 16cb894a9..c091e6b26 100644
--- a/1989/paul/README.md
+++ b/1989/paul/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
There is an alternate version with a trace routine that the author had commented
@@ -11,7 +11,7 @@ out. See [alternate code](#alternate-code) below for more details.
## Try:
```sh
-./paul
+ ./paul
```
@@ -29,14 +29,14 @@ could easily be added.
### Alternate build:
```sh
-make alt
+ make alt
```
### Alternate use:
```sh
-./paul.alt
+ ./paul.alt
```
diff --git a/1989/paul/index.html b/1989/paul/index.html
index 14e343f3b..76ee0b93d 100644
--- a/1989/paul/index.html
+++ b/1989/paul/index.html
@@ -132,8 +132,7 @@
Author:
Name: Paul E. Black
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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:
@@ -157,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 aaa2af456..fbe613620 100644
--- a/1989/robison/README.md
+++ b/1989/robison/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -10,7 +10,7 @@ make all
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1989 robison bugs](../../bugs.html#1989_robison).
@@ -19,21 +19,21 @@ For more detailed information see [1989 robison bugs](../../bugs.html#1989_robis
## To use:
```sh
-./robison
-# enter valid expressions
+ ./robison
+ # enter valid expressions
```
## Try:
```sh
-./robison
-11x10
-# enter other expressions
+ ./robison
+ 11x10
+ # enter other expressions
-./try.sh
+ ./try.sh
-echo 100 / 100 | ./robison # <-- what happens here ?
+ echo 100 / 100 | ./robison # <-- what happens here ?
```
NOTE: This program will very likely crash or break into tiny bits :-) if you
@@ -64,13 +64,13 @@ numerals must be binary. Parentheses may be used for
grouping. For example:
```
-101x111-100
+ 101x111-100
```
prints:
```
-1111
+ 1111
```
That is `5x(7-4)` is `15`. (APL groups from right to left.)
diff --git a/1989/robison/index.html b/1989/robison/index.html
index dd9fb4a44..d52e769fd 100644
--- a/1989/robison/index.html
+++ b/1989/robison/index.html
@@ -132,8 +132,7 @@
Author:
Name: Arch D. Robison
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,22 +141,22 @@ Location: US - United States of America
./robison
+11x10
+# enter other expressions
-./try.sh
+./try.sh
-echo 100 / 100 |./robison# <-- what happens here ?
+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
@@ -176,9 +175,9 @@ outputs the evaluation of an
input. Functions are limited to dyadic +,-,x, and unary -;
numerals must be binary. Parentheses may be used for
grouping. For example:
-
101x111-100
+
101x111-100
prints:
-
1111
+
1111
That is 5x(7-4) is 15. (APL groups from right to left.)
Extending it to the full APL language should be trivial.
The C-- language improves the C language by removing superfluous
diff --git a/1989/roemer/README.md b/1989/roemer/README.md
index cf81b3202..0e0924b83 100644
--- a/1989/roemer/README.md
+++ b/1989/roemer/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## Try:
```sh
-./roemer
+ ./roemer
```
diff --git a/1989/roemer/index.html b/1989/roemer/index.html
index 9cfb332f8..899137470 100644
--- a/1989/roemer/index.html
+++ b/1989/roemer/index.html
@@ -132,8 +132,7 @@
Author:
Name: Roemer B. Lievaart
-Location: NL - Kingdom of the Netherlands (Netherlands)
-
+Location: NL - Kingdom of the Netherlands (Netherlands)
@@ -142,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 366043481..e9dec993d 100644
--- a/1989/tromp/README.md
+++ b/1989/tromp/README.md
@@ -1,23 +1,23 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./tromp [drops_per_sec [cmd_string]]
+ ./tromp [drops_per_sec [cmd_string]]
```
## Try:
```sh
-./tromp 5
+ ./tromp 5
-./tromp 10 "hkl jq"
+ ./tromp 10 "hkl jq"
```
The second command, `./tromp 10 "hkl jq"`, will set up the keys kind of like
@@ -30,15 +30,14 @@ vim:
- space - pause (space)
- q - quit (:q)
-
NOTE: after the game ends a file called `HI` will be in the directory with the
high scores (up to 20 runs saved) so one can see who has the highest score. The
file might look like:
```
-330 by luser
-136 by loser
-100 by winner
+ 330 by luser
+ 136 by loser
+ 100 by winner
```
... or so, where in this case the [luser is the winner, the loser is in second
@@ -55,7 +54,7 @@ the judges' additional remarks in the author's remarks, for more details.
### Alternate build:
```sh
-make alt
+ make alt
```
diff --git a/1989/tromp/index.html b/1989/tromp/index.html
index 78d0d8e96..f7e6a5b5c 100644
--- a/1989/tromp/index.html
+++ b/1989/tromp/index.html
@@ -132,8 +132,7 @@
Author:
Name: John Tromp
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 5
-./tromp 10 "hkl jq"
+./tromp 10 "hkl jq"
The second command, ./tromp 10 "hkl jq", will set up the keys kind of like
vim:
@@ -162,9 +161,9 @@ vim:
NOTE: after the game ends a file called HI will be in the directory with the
high scores (up to 20 runs saved) so one can see who has the highest score. The
file might look like:
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
diff --git a/1989/vanb/README.md b/1989/vanb/README.md
index 5aeffde85..2860e9c9c 100644
--- a/1989/vanb/README.md
+++ b/1989/vanb/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
diff --git a/1989/vanb/index.html b/1989/vanb/index.html
index 9cf8a765e..17b8c2be0 100644
--- a/1989/vanb/index.html
+++ b/1989/vanb/index.html
@@ -132,8 +132,7 @@
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 290f0679c..73389b49d 100644
--- a/1989/westley/README.md
+++ b/1989/westley/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -10,7 +10,7 @@ make all
The current status of this entry is:
```
-STATUS: known bug - please help us fix
+ STATUS: known bug - please help us fix
```
For more detailed information see [1989 westley bugs](../../bugs.html#1989_westley).
@@ -21,29 +21,29 @@ For more detailed information see [1989 westley bugs](../../bugs.html#1989_westl
Try compiling and running the 4 resulting programs like:
```sh
-./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:
```sh
-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:
```sh
-DELAY=2 ./compile.sh
+ DELAY=2 ./compile.sh
```
Finally try:
```sh
-./westley
-# input some lines of text, sending EOF (usually ctrl-d) to end
+ ./westley
+ # input some lines of text, sending EOF (usually ctrl-d) to end
-./try.sh # demo of some input
+ ./try.sh # demo of some input
```
@@ -71,7 +71,7 @@ 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
+ cc -Dtrgpune=putchar ver3.c -o ver3
```
`trgpune` is the ROT13 of `getchar()`, so `getchar()` and `putchar()`
@@ -110,13 +110,13 @@ 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);
+ expr1 && expr2 && (expr3=etc);
```
which is the same as:
```c
-if (expr1 && expr2) expr3=etc;
+ if (expr1 && expr2) expr3=etc;
```
A/UX on the Macintosh doesn't get this right; it evaluates ALL
@@ -125,7 +125,7 @@ statement. This might warrant a warning, since other compilers
may do this. I found MANY compilers botched:
```c
-expr1 && (expr2,expr3);
+ expr1 && (expr2,expr3);
```
`expr2` was OFTEN evaluated even if `expr1` was false. I removed
@@ -147,7 +147,7 @@ such statements to make it more portable.
Normally (!), a reversible C program is done thus:
```c
-/**/ forward code /*/ edoc drawkcab /**/
+ /**/ forward code /*/ edoc drawkcab /**/
```
If your compiler nests comments, it will get this wrong.
@@ -155,7 +155,7 @@ However, I have made some bits of the code palindromic,
(or different, but reversible) so it is more like:
```c
-/**/forward/*//**/ palindromic /**//*/drawkcab/**/
+ /**/forward/*//**/ palindromic /**//*/drawkcab/**/
```
The code can therefore be interlaced. There are eight
diff --git a/1989/westley/index.html b/1989/westley/index.html
index e0ffea681..c864ec738 100644
--- a/1989/westley/index.html
+++ b/1989/westley/index.html
@@ -132,8 +132,7 @@
Author:
Name: Brian Westley
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,24 +141,24 @@ Location: US - United States of America
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
+
./westley
+# input some lines of text, sending EOF (usually ctrl-d) to end
-./try.sh# demo of some input
+./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?
@@ -176,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
@@ -208,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
@@ -225,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:
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 6eade6ccd..b9db0e742 100644
--- a/1990/baruch/README.md
+++ b/1990/baruch/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
There is an alternate version for those using Turbo-C or MSC. See [alternate
@@ -13,7 +13,7 @@ code](#alternate-code) below for details.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1990 baruch bugs](../../bugs.html#1990_baruch).
@@ -22,15 +22,15 @@ For more detailed information see [1990 baruch bugs](../../bugs.html#1990_baruch
## To use:
```sh
-echo 4 | ./baruch
-echo 7 | ./baruch
+ echo 4 | ./baruch
+ echo 7 | ./baruch
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -48,7 +48,7 @@ question. YMMV.
### Alternate build:
```sh
-make alt
+ make alt
```
diff --git a/1990/baruch/index.html b/1990/baruch/index.html
index 498c6143c..5405766cf 100644
--- a/1990/baruch/index.html
+++ b/1990/baruch/index.html
@@ -135,8 +135,7 @@
Location: IL - State of Israel (Israel)
This alternate code is for the very fewusers
@@ -166,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 a0ed53cd1..4a24c37ba 100644
--- a/1990/cmills/README.md
+++ b/1990/cmills/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./cmills [starting_cash]
+ ./cmills [starting_cash]
```
## Try:
```sh
-./cmills 5000
+ ./cmills 5000
```
diff --git a/1990/cmills/index.html b/1990/cmills/index.html
index 95a775063..0beba9f6b 100644
--- a/1990/cmills/index.html
+++ b/1990/cmills/index.html
@@ -132,8 +132,7 @@
Author:
Name: Christopher Mills
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 e5255e6fe..c402de7b6 100644
--- a/1990/dds/README.md
+++ b/1990/dds/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./dds
+ ./dds
```
@@ -17,8 +17,8 @@ make all
Give the following lines as input:
```basic
-OLD LANDER.BAS
-RUN
+ OLD LANDER.BAS
+ RUN
```
NOTE: this entry is probably one of the only times CAPS LOCK might be worth
diff --git a/1990/dds/index.html b/1990/dds/index.html
index c7c18a19b..adf7e1d09 100644
--- a/1990/dds/index.html
+++ b/1990/dds/index.html
@@ -132,8 +132,7 @@
@@ -142,13 +141,13 @@ Location: GR - Hellenic Republic (
To build:
-
make all
+
make all
To use:
-
./dds
+
./dds
Try:
Give the following lines as input:
-
OLD LANDER.BAS
-RUN
+
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
UPPER CASE.
diff --git a/1990/dg/README.md b/1990/dg/README.md
index 67da4233f..5315a3576 100644
--- a/1990/dg/README.md
+++ b/1990/dg/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-echo foo bar | ./dg
+ echo foo bar | ./dg
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -25,13 +25,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))))))))))))))))))))))))))))))
+ 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'))))))))))))))))))))))))))))
+ b12(ase(bco(acp(bi(acp(bcp(acp(bpl('A'))))))))))))))))))))))))))))
```
particularly if the C preprocessor botches single quotes in cpp expansions,
@@ -57,7 +57,7 @@ character is in the set `A-Za-z`. `l[]` is an array that gets filled
with:
```c
-"nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM"
+ "nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM"
```
If `index(3)` says the char is in the alphabet, then XOR the offset
diff --git a/1990/dg/index.html b/1990/dg/index.html
index e369e8e25..5d9f466cb 100644
--- a/1990/dg/index.html
+++ b/1990/dg/index.html
@@ -132,8 +132,7 @@
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:
@@ -166,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:
@@ -263,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 0a3210d59..ad33dc46f 100644
--- a/1990/pjr/README.md
+++ b/1990/pjr/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
There is an [alternate version](#alternate-code) that does something different
@@ -12,7 +12,7 @@ that can be used if your compiler is incapable of compiling `X=g()...` in
## To use:
```sh
-./pjr
+ ./pjr
```
@@ -23,7 +23,7 @@ Note that some compilers will be unable to compile the expression `X=g()...` in
`main()` with:
```c
-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.
@@ -35,14 +35,14 @@ well.
### Alternate build:
```sh
-make alt
+ make alt
```
### Alternate use:
```sh
-./pjr.alt
+ ./pjr.alt
```
@@ -69,20 +69,20 @@ alphabetical character from a to z is printed out as its
opposite:
```
-a->z b->y c->x etc
+ a->z b->y c->x etc
```
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();
+ 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
+ hello world
```
By the way, there is actually a piece of code which is not used
diff --git a/1990/pjr/index.html b/1990/pjr/index.html
index 2b872758f..9f71c4ade 100644
--- a/1990/pjr/index.html
+++ b/1990/pjr/index.html
@@ -132,8 +132,7 @@
Author:
Name: Peter J Ruczynski
-Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
-
+Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
@@ -142,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:
Note: S() represents a space and N() a newline. This will now
produce…
-
hello world
+
hello world
By the way, there is actually a piece of code which is not used
in the original program! I leave it as an intellectual exercise
to the reader to find out what it is.
diff --git a/1990/scjones/README.md b/1990/scjones/README.md
index 5eca16c0c..1f7e87e08 100644
--- a/1990/scjones/README.md
+++ b/1990/scjones/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./scjones
+ ./scjones
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
diff --git a/1990/scjones/index.html b/1990/scjones/index.html
index 211c917b4..e204458a0 100644
--- a/1990/scjones/index.html
+++ b/1990/scjones/index.html
@@ -132,8 +132,7 @@
Author:
Name: Larry Jones
-Location: ZZ - Unknown location
-
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 c06049705..edf4c363e 100644
--- a/1990/stig/README.md
+++ b/1990/stig/README.md
@@ -1,20 +1,20 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-make all
+ make all
```
NOTE: that's not a typo or mistake but one can also do:
```sh
-./o
+ ./o
```
diff --git a/1990/stig/index.html b/1990/stig/index.html
index 506a3cb71..f627d087b 100644
--- a/1990/stig/index.html
+++ b/1990/stig/index.html
@@ -132,8 +132,7 @@
Author:
Name: Stig Hemmer
-Location: NO - Kingdom of Norway (Norway)
-
@@ -142,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 6355f5e27..3831a1eab 100644
--- a/1990/tbr/README.md
+++ b/1990/tbr/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
The authors provided another version of this program. See the [alternate
@@ -13,7 +13,7 @@ version](#alternate-code) section below.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1990 tbr bugs](../../bugs.html#1990_tbr).
@@ -26,8 +26,8 @@ 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.
+ ./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
@@ -41,8 +41,8 @@ below, in the [alternate version](#alternate-code) section.
## To use:
```sh
-./tbr
-$ enter some shell commands
+ ./tbr
+ $ enter some shell commands
```
NOTE: globs do not work with this entry. Why?
@@ -55,16 +55,16 @@ just `exit` or `logout`? Hint: see the authors' remarks.
## Try:
```sh
-./tbr
-$ ls -l tbr tbr.c
+ ./tbr
+ $ ls -l tbr tbr.c
-# notice how the following does not work:
-ls tbr*
+ # notice how the following does not work:
+ ls tbr*
-# try figuring out how this entry works in an editor:
-vi tbr.c
+ # try figuring out how this entry works in an editor:
+ vi tbr.c
-# then figure out how to exit vi :-)
+ # then figure out how to exit vi :-)
```
What happens if you try using `cd -` to return to previous directory? What about
@@ -80,16 +80,16 @@ 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;);}
-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](tbr.alt.c). It has the `exit()` returns `void` fix
@@ -100,14 +100,14 @@ equivalent like the authors intended.
### Alternate build:
```sh
-make alt
+ make alt
```
### Alternate use:
```sh
-./tbr.alt
+ ./tbr.alt
```
@@ -166,13 +166,13 @@ shell flags an error if no arguments are on the stack. Thus, for
example:
```sh
-cat > foo > bar
+ cat > foo > bar
```
cats to `foo`, since it was pushed last, but
```sh
-cat > > foo bar
+ cat > > foo bar
```
cats to `bar`, since `bar` was pushed under `foo` (remember we're
diff --git a/1990/tbr/index.html b/1990/tbr/index.html
index ed68e5562..0f7c09f5a 100644
--- a/1990/tbr/index.html
+++ b/1990/tbr/index.html
@@ -135,8 +135,7 @@
Location: US - United States of America (United States)
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
+
./tbr
+$ ls -l tbr tbr.c
-# notice how the following does not work:
-ls tbr*
+# notice how the following does not work:
+ls tbr*
-# try figuring out how this entry works in an editor:
-vi tbr.c
+# try figuring out how this entry works in an editor:
+vi tbr.c
-# then figure out how to exit vi :-)
+# 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
@@ -188,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
@@ -246,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 536e612ab..9d0c76dab 100644
--- a/1990/theorem/README.md
+++ b/1990/theorem/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -10,7 +10,7 @@ make all
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1990 theorem bugs](../../bugs.html#1990_theorem).
@@ -19,24 +19,24 @@ For more detailed information see [1990 theorem bugs](../../bugs.html#1990_theor
## To use:
```sh
-./theorem expression x1 x2 h y1
+ ./theorem expression x1 x2 h y1
```
where:
```
-expression - function f(x,y) (see below)
-x1 - start of interval
-x2 - end of interval
-h - step size
-y1 - initial value (y(x1) == y1)
+ expression - function f(x,y) (see below)
+ x1 - start of interval
+ x2 - end of interval
+ h - step size
+ y1 - initial value (y(x1) == y1)
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -53,7 +53,7 @@ The 'expression' `f(x,y)` is any function of `x` and `y` with the
operators:
```
-+ - * / ^
+ + - * / ^
```
The symbol `^` is the power operator. Note that it only supports
@@ -63,24 +63,24 @@ 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
+ ./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:
```sh
-./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:
```sh
-make sorter
-ls | ./sorter
+ make sorter
+ ls | ./sorter
```
This program is safe for home use as well. The author has
@@ -88,17 +88,17 @@ included a safety feature in case you misplace the original
program source:
```sh
-./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:
```sh
-./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
diff --git a/1990/theorem/index.html b/1990/theorem/index.html
index 3dfba3de5..3aea42e67 100644
--- a/1990/theorem/index.html
+++ b/1990/theorem/index.html
@@ -132,8 +132,7 @@
Author:
Name: Adrian Mariano
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,21 +141,21 @@ Location: US - United States of America
expression - function f(x,y) (see below)
-x1 - start of interval
-x2 - end of interval
-h - step size
-y1 - initial value (y(x1) == y1)
+
expression - function f(x,y) (see below)
+ x1 - start of interval
+ x2 - end of interval
+ 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!
@@ -165,31 +164,31 @@ numerically solves the equation y'=f(x,y), with a step size of x=[x1,x2], with the initial condition of y(x1)=y1.
The ‘expression’ f(x,y) is any function of x and y with the
operators:
-
+ - * / ^
+
+ - * / ^
The symbol ^ is the power operator. Note that it only supports
integer powers. Also note that all expressions are evaluated strictly
left to right. (i.e., parenthesis aren’t supported).
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 9a21b468e..75e8aa9a8 100644
--- a/1990/westley/README.md
+++ b/1990/westley/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./westley
+ ./westley
```
The number should be greater than 0.
@@ -17,7 +17,7 @@ The number should be greater than 0.
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -31,14 +31,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
+ make alt
```
### Alternate use:
```sh
-./westley.alt
+ ./westley.alt
```
@@ -51,11 +51,11 @@ Read each block of code as if it were a piece of correspondence.
For example, the first block of code would read:
```
-charlie,
- doubletime me, OXFACE!
- not interested, get out
- mainly die, charly, *die*
- signed charlotte
+ charlie,
+ doubletime me, OXFACE!
+ not interested, get out
+ mainly die, charly, *die*
+ signed charlotte
```
The original source had control-L's after each code block. To
diff --git a/1990/westley/index.html b/1990/westley/index.html
index 83c7bfc1b..4d4132ef9 100644
--- a/1990/westley/index.html
+++ b/1990/westley/index.html
@@ -132,8 +132,7 @@
Author:
Name: Brian Westley
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,29 +141,29 @@ 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. :-)
Read each block of code as if it were a piece of correspondence.
For example, the first block of code would read:
-
charlie,
- doubletime me, OXFACE!
- not interested, get out
- mainly die, charly, *die*
- signed charlotte
+
charlie,
+ doubletime me, OXFACE!
+ not interested, get out
+ mainly die, charly, *die*
+ signed charlotte
The original source had control-L’s after each code block. To
make it easier on news readers, we converted each control-L to
a blank line.
diff --git a/1991/README.md b/1991/README.md
index 14521f1fe..4e9f2d2f2 100644
--- a/1991/README.md
+++ b/1991/README.md
@@ -36,8 +36,8 @@ 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
+ #define X define
+ #X foo bar
```
This is not permitted under ANSI C. Some ANSI C compilers do allow this. In
@@ -61,10 +61,10 @@ In order to encourage more 'normal' looking C programs, we are considering
the following change to the maximum size rule:
```
-Your source, not counting any , , and a character,
-and not counting any ';', '{' and '}' character followed by a
-character, must be 1536 bytes or less. The entire source, counting all
-characters, be 4096 bytes or less.
+ Your source, not counting any , , and a character,
+ and not counting any ';', '{' and '}' character followed by a
+ character, must be 1536 bytes or less. The entire source, counting all
+ characters, be 4096 bytes or less.
```
Some thought has been given to adding some C++ categories, however this
@@ -80,8 +80,8 @@ Also include anything else that you would like to see in future contests.
Send such email to:
```
-...!{sun,pacbell,uunet,pyramid}!hoptoad!judges
-judges@toad.com
+ ...!{sun,pacbell,uunet,pyramid}!hoptoad!judges
+ judges@toad.com
```
diff --git a/1991/ant/README.md b/1991/ant/README.md
index 7d382007e..77c5497e6 100644
--- a/1991/ant/README.md
+++ b/1991/ant/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
There is an [alternate version](#alternate-code) that might feel a bit more
@@ -11,7 +11,7 @@ familiar to vi(m) users.
## To use:
```sh
-./ant some_file
+ ./ant some_file
```
NOTE: the file must already exist and not specifying any arg will make the
@@ -21,13 +21,13 @@ program exit without doing anything.
## Try:
```sh
-make hill
-./ant hill
+ make hill
+ ./ant hill
```
```sh
-make mole
-./ant mole
+ make mole
+ ./ant mole
```
@@ -47,7 +47,7 @@ rest was unchanged.
### Alternate build:
```sh
-make alt
+ make alt
```
diff --git a/1991/ant/index.html b/1991/ant/index.html
index 0a8d8ad0f..1fa9c75ff 100644
--- a/1991/ant/index.html
+++ b/1991/ant/index.html
@@ -132,8 +132,7 @@
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
@@ -164,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 c4700ea2a..531b48c37 100644
--- a/1991/brnstnd/README.md
+++ b/1991/brnstnd/README.md
@@ -1,16 +1,16 @@
## To build:
```sh
-make all
+ make all
```
## Try:
```sh
-./try.sh
+ ./try.sh
-./sorta < sorta.itailrec
+ ./sorta < sorta.itailrec
```
diff --git a/1991/brnstnd/index.html b/1991/brnstnd/index.html
index b0851ea04..7752f6fe8 100644
--- a/1991/brnstnd/index.html
+++ b/1991/brnstnd/index.html
@@ -132,8 +132,7 @@
Author:
Name: Daniel J. Bernstein
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,11 +141,11 @@ Location: US - United States of America
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 44fd7b940..3a4e5bb1b 100644
--- a/1991/buzzard/README.md
+++ b/1991/buzzard/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
There is an [alternate version](#alternate-code) which might feel more at home
@@ -13,7 +13,7 @@ for vi(m) users in navigation.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1991 buzzard bugs](../../bugs.html#1991_buzzard).
@@ -22,7 +22,7 @@ For more detailed information see [1991 buzzard bugs](../../bugs.html#1991_buzza
## To use:
```sh
-./buzzard
+ ./buzzard
```
@@ -38,14 +38,14 @@ code directly so the keys are not made a `-D` at the compiler.
### Alternate build:
```sh
-make alt
+ make alt
```
### Alternate use:
```sh
-./buzzard.alt
+ ./buzzard.alt
```
@@ -90,7 +90,7 @@ so make sure to convert tabs to spaces before using it.
Usage:
```sh
-./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
diff --git a/1991/buzzard/index.html b/1991/buzzard/index.html
index c608f0b55..edd36ac16 100644
--- a/1991/buzzard/index.html
+++ b/1991/buzzard/index.html
@@ -132,8 +132,7 @@
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
@@ -158,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! :-)
@@ -187,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.
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 0f69ea210..4851deaec 100644
--- a/1991/cdupont/README.md
+++ b/1991/cdupont/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./cdupont
+ ./cdupont
```
@@ -17,7 +17,7 @@ make all
Why is the following label necessary?
```c
-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
diff --git a/1991/cdupont/index.html b/1991/cdupont/index.html
index 30fc8bd2e..94287df76 100644
--- a/1991/cdupont/index.html
+++ b/1991/cdupont/index.html
@@ -132,8 +132,7 @@
@@ -142,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 faf690dd9..a98707dac 100644
--- a/1991/davidguy/README.md
+++ b/1991/davidguy/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./davidguy ip_address:server.screen
+ ./davidguy ip_address:server.screen
```
where `ip_address` in an IP address of an X server.
@@ -17,7 +17,7 @@ where `ip_address` in an IP address of an X server.
## Try:
```sh
-./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. :-)
@@ -25,8 +25,8 @@ 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
+ cp -f davidguy guydavid
+ ./guydavid 127.0.0.1:0.0
```
Can you determine why this makes a difference?
diff --git a/1991/davidguy/index.html b/1991/davidguy/index.html
index 0bd21cc6c..f9024da23 100644
--- a/1991/davidguy/index.html
+++ b/1991/davidguy/index.html
@@ -132,8 +132,7 @@
Author:
Name: David Applegate
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 842a12c63..82d624e16 100644
--- a/1991/dds/README.md
+++ b/1991/dds/README.md
@@ -1,15 +1,15 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./dds basic_program
-./a.out 2>/dev/null
+ ./dds basic_program
+ ./a.out 2>/dev/null
```
@@ -18,8 +18,8 @@ make all
The author suggests trying:
```sh
-./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
@@ -28,7 +28,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
+ ./dds dds.c
```
You'll get errors yes but what does the generated file look like? What about
diff --git a/1991/dds/index.html b/1991/dds/index.html
index d6908b3f3..f1f746b79 100644
--- a/1991/dds/index.html
+++ b/1991/dds/index.html
@@ -132,8 +132,7 @@
@@ -142,18 +141,18 @@ Location: GR - Hellenic Republic (
To build:
-
make all
+
make all
To use:
-
./dds basic_program
-./a.out2>/dev/null
+
./dds basic_program
+./a.out2>/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 83d6a77e2..4df99404b 100644
--- a/1991/fine/README.md
+++ b/1991/fine/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-echo text | ./fine
+ echo text | ./fine
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
Make sure that you read the last line backwards! Credit goes to [Merlyn LeRoy (Brian
diff --git a/1991/fine/index.html b/1991/fine/index.html
index c2767bf3d..866869bd3 100644
--- a/1991/fine/index.html
+++ b/1991/fine/index.html
@@ -132,8 +132,7 @@
Author:
Name: Thomas A. Fine
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,11 +141,11 @@ Location: US - United States of America
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
@@ -173,10 +173,10 @@ specific display hardware, or a specific user interface (Openl**k,
explanation of our viewpoint in next year’s rules.
In order to encourage more ‘normal’ looking C programs, we are considering
the following change to the maximum size rule:
-
Your source, not counting any <space>, <tab>, and a <newline> character,
-and not counting any ';', '{' and '}' character followed by a <newline>
-character, must be 1536 bytes or less. The entire source, counting all
-characters, be 4096 bytes or less.
+
Your source, not counting any <space>, <tab>, and a <newline> character,
+ and not counting any ';', '{' and '}' character followed by a <newline>
+ character, must be 1536 bytes or less. The entire source, counting all
+ characters, be 4096 bytes or less.
Some thought has been given to adding some C++ categories, however this
is not likely to happen soon. We are waiting until C++ compilers become
common place on a wide number of systems. We also need time to brace
@@ -186,8 +186,8 @@ We may fine tune the rules to reflect the some ideas above.
Please send us comments and suggestions what we have expressed above.
Also include anything else that you would like to see in future contests.
Send such email to:
IMPORTANT NOTE: The email addresses found above are for historical
purposes only, and should not be used today. See
diff --git a/1991/rince/README.md b/1991/rince/README.md
index 58ef274fe..dcd8535c9 100644
--- a/1991/rince/README.md
+++ b/1991/rince/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
There are two [alternate versions](#alternate-code) which allow one to not be
@@ -12,7 +12,7 @@ that's fewer than the original program.
## To use:
```sh
-./rince
+ ./rince
```
@@ -31,7 +31,7 @@ The author set the maximum number of moves to 484.
### Alternate build:
```sh
-make alt
+ make alt
```
This will build both alt versions where the first one, `rince.alt`, has no
@@ -42,7 +42,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
+ make clobber MAXMOVES=700 alt
```
@@ -51,13 +51,13 @@ make clobber MAXMOVES=700 alt
To run the first alt version:
```sh
-./rince.alt
+ ./rince.alt
```
To run the second alt version:
```sh
-./rince.alt2
+ ./rince.alt2
```
Can you figure out how to make the two alternate versions equivalent in
@@ -83,23 +83,23 @@ enjoyment high.
Key to map:
```
- |
- ###### | | | /\ /--\ ==| /\ | | Directonal keys
- ###### Solid Wall | ----|| \/ /\ ||---- (unlock doors of
- ###### | \/ ==| \--/ \/ the same direction)
- |\
- | << >> Doors. Unlocked by
- Blank space | << vvvvvv ^^^^^^ >> the above keys.
- | << >>
- |\
- ___ | o__O\ O__O ^__^ /O__o\
- / \ 'Crushable' | \___/ /----\ /----\ \___/ The four sprites for
- \___/ boulder | _/_\ _/ \_ _/ \_ /_\_ your character :-)
- |\
- ___ uncrushable | /\ Diamonds. They can either be found lying
- /@@@\ boulder | < > around (if only!) or manufacture by pushing
- \@@@/ | \/ two 'crushable' rocks together.
- |
+ |
+ ###### | | | /\ /--\ ==| /\ | | Directonal keys
+ ###### Solid Wall | ----|| \/ /\ ||---- (unlock doors of
+ ###### | \/ ==| \--/ \/ the same direction)
+ |\
+ | << >> Doors. Unlocked by
+ Blank space | << vvvvvv ^^^^^^ >> the above keys.
+ | << >>
+ |\
+ ___ | o__O\ O__O ^__^ /O__o\
+ / \ 'Crushable' | \___/ /----\ /----\ \___/ The four sprites for
+ \___/ boulder | _/_\ _/ \_ _/ \_ /_\_ your character :-)
+ |\
+ ___ uncrushable | /\ Diamonds. They can either be found lying
+ /@@@\ boulder | < > around (if only!) or manufacture by pushing
+ \@@@/ | \/ two 'crushable' rocks together.
+ |
```
The general idea of the game is to collect all the diamonds. This must
diff --git a/1991/rince/index.html b/1991/rince/index.html
index 0a6f5bd89..70be75eb9 100644
--- a/1991/rince/index.html
+++ b/1991/rince/index.html
@@ -132,8 +132,7 @@
Author:
Name: James Bonfield
-Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
-
+Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
@@ -142,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,
@@ -157,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?
@@ -182,23 +181,23 @@ write the smallest playable game, but keep the playability and
enjoyment high.
Instructions:
Key to map:
-
|
- ###### | | | /\ /--\ ==| /\ | | Directonal keys
- ###### Solid Wall | ----|| \/ /\ ||---- (unlock doors of
- ###### | \/ ==| \--/ \/ the same direction)
- |\
- | << >> Doors. Unlocked by
- Blank space | << vvvvvv ^^^^^^ >> the above keys.
- | << >>
- |\
- ___ | o__O\ O__O ^__^ /O__o\
- / \ 'Crushable' | \___/ /----\ /----\ \___/ The four sprites for
- \___/ boulder | _/_\ _/ \_ _/ \_ /_\_ your character :-)
- |\
- ___ uncrushable | /\ Diamonds. They can either be found lying
- /@@@\ boulder | < > around (if only!) or manufacture by pushing
- \@@@/ | \/ two 'crushable' rocks together.
- |
+
|
+ ###### | | | /\ /--\ ==| /\ | | Directonal keys
+ ###### Solid Wall | ----|| \/ /\ ||---- (unlock doors of
+ ###### | \/ ==| \--/ \/ the same direction)
+ |\
+ | << >> Doors. Unlocked by
+ Blank space | << vvvvvv ^^^^^^ >> the above keys.
+ | << >>
+ |\
+ ___ | o__O\ O__O ^__^ /O__o\
+ / \ 'Crushable' | \___/ /----\ /----\ \___/ The four sprites for
+ \___/ boulder | _/_\ _/ \_ _/ \_ /_\_ your character :-)
+ |\
+ ___ uncrushable | /\ Diamonds. They can either be found lying
+ /@@@\ boulder | < > around (if only!) or manufacture by pushing
+ \@@@/ | \/ two 'crushable' rocks together.
+ |
The general idea of the game is to collect all the diamonds. This must
be done in the minimum amount of moves. I’ve allowed a margin of 5
moves which brings the moves allowed to 484. (alter the value of u in
diff --git a/1991/westley/README.md b/1991/westley/README.md
index 2ab949383..59a2a630c 100644
--- a/1991/westley/README.md
+++ b/1991/westley/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
There is an [alternate version](#alternate-code) that is supposed to win all the
@@ -13,7 +13,7 @@ time.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1991 westley bugs](../../bugs.html#1991_westley).
@@ -28,24 +28,24 @@ Make and then run as follows:
```sh
-./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
-4 5 6
-7 8 9
+ 1 2 3
+ 4 5 6
+ 7 8 9
```
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
+ make nextmove
+ ./nextmove move_location | tee nextmove.c
```
@@ -55,10 +55,9 @@ 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
-
+ 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
@@ -66,50 +65,50 @@ The shell script determines when the game is over, and automatically replaces
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
+ ./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
+ ./ttt 1
+ ./ttt 4
+ ./ttt 6
```
The final might look like:
```c
- 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<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<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;}/*/
+ 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<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<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!
+ ttt: I win!
```
Redirects stderr to `/dev/null` by default. If you need errors or warnings use
@@ -125,7 +124,7 @@ can lose if you cheat. That's supposed to happen. Can you win any other time?
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -159,7 +158,7 @@ This is supposed to happen. As is written in the
[The Jargon File](http://catb.org/jargon/html/F/feature.html):
```
-That's not a bug, that's a feature.
+ That's not a bug, that's a feature.
```
Try not to cheat (even though it's very easy :-) ), the computer has not learned
@@ -196,7 +195,7 @@ variables `X` and `O` contain bitmasks of where all the `X`s and `O`s are placed
The statement:
```c
-X=- -1;
+ X=- -1;
```
evaluates to `1`, `-1`, or `-2` when `X` is `1` and `` is one of `"X"`,
@@ -234,9 +233,9 @@ possible moves by making the `e()` function return "winning" moves,
e.g. the template:
```
-. . .
-O , O (this is the value 40; 2^3+2^5)
-. . . ("O"s are 1 bits, "." and "," are 0 bits)
+ . . .
+ O , O (this is the value 40; 2^3+2^5)
+ . . . ("O"s are 1 bits, "." and "," are 0 bits)
```
...will make the `e()` function return a center move, as this is the only move
@@ -254,45 +253,45 @@ changing the compile line.
The templates are:
```
-O , O
-, , ,
-O , O
+ O , O
+ , , ,
+ O , O
-, . .
-. O .
-. . O
+ , . .
+ . O .
+ . . O
-. . .
-O , O
-. . .
+ . . .
+ O , O
+ . . .
-. . .
-O O ,
-. . .
+ . . .
+ O O ,
+ . . .
-. . .
-O , O
-. . .
+ . . .
+ O , O
+ . . .
-. , ,
-. O .
-O O ,
+ . , ,
+ . O .
+ O O ,
-O , O
-, , .
-O . .
+ O , O
+ , , .
+ O . .
-, . O
-O , O
-O . ,
+ , . O
+ O , O
+ O . ,
-O . ,
-O , O
-, . O
+ O . ,
+ O , O
+ , . O
-O , O
-, , ,
-O , O
+ O , O
+ , , ,
+ O , O
```
A digit of `9` means start with the first template, `8` starts at
diff --git a/1991/westley/index.html b/1991/westley/index.html
index 15ab6a1aa..fa01995fd 100644
--- a/1991/westley/index.html
+++ b/1991/westley/index.html
@@ -132,8 +132,7 @@
Author:
Name: Brian Westley
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,78 +141,78 @@ Location: US - United States of America
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
-4 5 6
-7 8 9
+
1 2 3
+ 4 5 6
+ 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
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:
@@ -236,7 +235,7 @@ you can win tic-tac-toe, that there can be acceptable draws.
This is supposed to happen. As is written in the
The Jargon File:
-
That's not a bug, that's a feature.
+
That's not a bug, that's a feature.
Try not to cheat (even though it’s very easy :-) ), the computer has not learned
how to catch you doing it.
Author’s remarks:
@@ -260,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
@@ -288,9 +287,9 @@ an X or O is returned.
The “move templates” are static tic-tac-toe positions that generate
possible moves by making the e() function return “winning” moves,
e.g. the template:
-
. . .
-O , O (this is the value 40; 2^3+2^5)
-. . . ("O"s are 1 bits, "." and "," are 0 bits)
+
. . .
+ O , O (this is the value 40; 2^3+2^5)
+ . . . ("O"s are 1 bits, "." and "," are 0 bits)
…will make the e() function return a center move, as this is the only move
that produces three in a row. Notice that the computer does not consider which
cells contain Xs and Os when making a template move, only which cells are
@@ -301,45 +300,45 @@ try, by just blundering in the way.
compile line, making it possible to change the rules of the game by
changing the compile line.
The templates are:
-
O , O
-, , ,
-O , O
+
O , O
+ , , ,
+ O , O
-, . .
-. O .
-. . O
+ , . .
+ . O .
+ . . O
-. . .
-O , O
-. . .
+ . . .
+ O , O
+ . . .
-. . .
-O O ,
-. . .
+ . . .
+ O O ,
+ . . .
-. . .
-O , O
-. . .
+ . . .
+ O , O
+ . . .
-. , ,
-. O .
-O O ,
+ . , ,
+ . O .
+ O O ,
-O , O
-, , .
-O . .
+ O , O
+ , , .
+ O . .
-, . O
-O , O
-O . ,
+ , . O
+ O , O
+ O . ,
-O . ,
-O , O
-, . O
+ O . ,
+ O , O
+ , . O
-O , O
-, , ,
-O , O
+ O , O
+ , , ,
+ O , O
A digit of 9 means start with the first template, 8 starts at
the second, etc. The templates are scanned until a legal move is
found. A template is scanned from bottom to top, right to left
diff --git a/1992/README.md b/1992/README.md
index 8b0c0d9fa..f418053bc 100644
--- a/1992/README.md
+++ b/1992/README.md
@@ -69,8 +69,8 @@ Also include anything else that you would like to see in future contests.
Send such email to:
```
-...!{sun,pacbell,uunet,pyramid}!hoptoad!judges
-judges@toad.com
+ ...!{sun,pacbell,uunet,pyramid}!hoptoad!judges
+ judges@toad.com
```
If you use, distribute or publish these entries in some way, please drop
diff --git a/1992/adrian/README.md b/1992/adrian/README.md
index ed22e149d..1c88a8f4f 100644
--- a/1992/adrian/README.md
+++ b/1992/adrian/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -10,8 +10,8 @@ make all
The current status of this entry is:
```
-STATUS: known bug - please help us fix
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: known bug - please help us fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1992 adrian bugs](../../bugs.html#1992_adrian).
@@ -20,13 +20,13 @@ For more detailed information see [1992 adrian bugs](../../bugs.html#1992_adrian
## Try:
```sh
-./try.sh
+ ./try.sh
```
For the slow minded, try:
```sh
-./adsleep 32767
+ ./adsleep 32767
```
@@ -59,7 +59,7 @@ The deterministic finite automaton is specified as a series of rules for
each state:
```
- chars1 chars2 ...
+ chars1 chars2 ...
```
`chars1` is a list of characters (_only the first 8_ are significant) which
@@ -72,10 +72,10 @@ significant to only eight characters like `chars1`.
### Example 1: matches `^abc$`
```
- a The first state to appear is the start state
- b
- c [q3]
-[q3]
+ a The first state to appear is the start state
+ b
+ c [q3]
+ [q3]
```
Technically, a deterministic finite automaton should have a rule for each
@@ -88,54 +88,54 @@ character list.
### Example 2: `^abc`
```
- a
- b
- c [q3]
-[q3] . [q3]
+ a
+ b
+ c [q3]
+ [q3] . [q3]
```
### Example 3: `abc$`
```
- a .
- b a .
- c [q3] a .
-[q3] .
+ a .
+ b a .
+ c [q3] a .
+ [q3] .
```
### Example 4: `^(abc)*$`
```
-[q0] a
- b
- c [q0]
+ [q0] a
+ b
+ c [q0]
```
### Example 5: `^[ab][cd][ef]$`
```
- ab
- cd
- ef [q3]
-[q3]
+ ab
+ cd
+ ef [q3]
+ [q3]
```
### Example 6: `^(abc|efg)$`
```
- a e
- b
- c [q5]
- f
- g [q5]
-[q5]
+ a e
+ b
+ c [q5]
+ f
+ g [q5]
+ [q5]
```
With the automaton specification in `filename`, invoke the program by
typing
```sh
-./adrian filename
+ ./adrian filename
```
@@ -152,7 +152,7 @@ occurs if your automaton has more than 257 states.
Running:
```sh
-./adrian from < your_mailbox
+ ./adrian from < your_mailbox
```
will perform a function similar to that of the unix `from` command.
@@ -164,13 +164,13 @@ changed to `__FILE__`.) In this case, the program will search for matches to
the regular expression:
```
-^.[^|C][^w[Q]*(Q|[w[]c).*|^.[C|]$
+ ^.[^|C][^w[Q]*(Q|[w[]c).*|^.[C|]$
```
I suggest using `adrian.c` as input, and storing the output in `adwc.c`:
```sh
-./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
@@ -182,19 +182,19 @@ Another possibly interesting automaton can be created by slightly
adjusting the `adrian.c` file. Change the first line to read
```c
-/* . echo| . */
+ /* . echo| . */
```
and repeat the process above
```sh
-./adrian adecho.c
+ ./adrian adecho.c
```
The new file now contains all lines which match
```
-^.[^5|m^]*[m^]([e=p,;]|[^e=+p,;].*)$
+ ^.[^5|m^]*[m^]([e=p,;]|[^e=+p,;].*)$
```
Compile and run. This is an `echo(1)` clone. Note the efficient algorithm
@@ -205,13 +205,13 @@ Two other adjustments to the first line also yield useful results. By
changing it to
```c
-/* . head; . */
+ /* . head; . */
```
you can search for matches to
```
-^.[^W]*W..*$
+ ^.[^W]*W..*$
```
By some freak happenstance, lines of `adrian.c` which match this regular
@@ -222,14 +222,14 @@ specified (again this was changed to `__FILE__`).
By setting the first line to
```c
-/* . basename . */
+ /* . basename . */
```
a clone of the unix `basename(1)` command can be unearthed. The automaton will
search for
```
-^.[^j]*jr.*$
+ ^.[^j]*jr.*$
```
on standard input. And the program which results by running `adrian.c`
@@ -241,13 +241,13 @@ The resulting base name is printed to stdout.
Lastly, by setting the first line to
```c
-/* . sleep . */
+ /* . sleep . */
```
you can search for
```
-^.[^(~][^s]*sl.*$
+ ^.[^(~][^s]*sl.*$
```
Filtering `adrian.c` through this search yields a clone of the `sleep(1)`
diff --git a/1992/adrian/index.html b/1992/adrian/index.html
index 22e3f8546..1f7d7b014 100644
--- a/1992/adrian/index.html
+++ b/1992/adrian/index.html
@@ -132,8 +132,7 @@
Author:
Name: Adrian Mariano
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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
+
STATUS: known bug - please help us fix
+ STATUS: INABIAF - please **DO NOT** fix
Once you get past the obfuscation, you have an opportunity to learn
about regular expressions and state machines.
@@ -171,51 +170,51 @@ string is consumed. If the current state at this point is one of the
accepting states, then the string is accepted.
The deterministic finite automaton is specified as a series of rules for
each state:
-
<state> chars1 <dest1> chars2 <dest2> ...
+
<state> chars1 <dest1> chars2 <dest2> ...
chars1 is a list of characters (only the first 8 are significant) which
should trigger a transition to <dest1>. <dest1> is another state which
should have a similar specification somewhere. A state is accepting if
it is specified in square brackets: [final]; state strings are
significant to only eight characters like chars1.
Example 1: matches ^abc$
-
<q0> a <q1> The first state to appear is the start state
-<q1> b <q2>
-<q2> c [q3]
-[q3]
+
<q0> a <q1> The first state to appear is the start state
+ <q1> b <q2>
+ <q2> c [q3]
+ [q3]
Technically, a deterministic finite automaton should have a rule for each
possible input character at each state. To simplify descriptions of the
automata, if no rule is present, the string will not be accepted. Also,
the . character matches any character if it occurs first in the
character list.
Example 2: ^abc
-
<q0> a <q1>
-<q1> b <q2>
-<q2> c [q3]
-[q3] . [q3]
+
<q0> a <q1>
+ <q1> b <q2>
+ <q2> c [q3]
+ [q3] . [q3]
Example 3: abc$
-
<q0> a <q1> . <q0>
-<q1> b <q2> a <q1> . <q0>
-<q2> c [q3] a <q1> . <q0>
-[q3] . <q1>
+
<q0> a <q1> . <q0>
+ <q1> b <q2> a <q1> . <q0>
+ <q2> c [q3] a <q1> . <q0>
+ [q3] . <q1>
Example 4: ^(abc)*$
-
[q0] a <q1>
-<q1> b <q2>
-<q2> c [q0]
+
[q0] a <q1>
+ <q1> b <q2>
+ <q2> c [q0]
Example 5: ^[ab][cd][ef]$
-
<q0> ab <q1>
-<q1> cd <q2>
-<q2> ef [q3]
-[q3]
+
<q0> ab <q1>
+ <q1> cd <q2>
+ <q2> ef [q3]
+ [q3]
Example 6: ^(abc|efg)$
-
<q0> a <q1> e <q3>
-<q1> b <q2>
-<q2> c [q5]
-<q3> f <q4>
-<q4> g [q5]
-[q5]
+
<q0> a <q1> e <q3>
+ <q1> b <q2>
+ <q2> c [q5]
+ <q3> f <q4>
+ <q4> g [q5]
+ [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
@@ -226,52 +225,52 @@ 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
was renamed to adrian.c by the judges and for more portability the arg was
changed to __FILE__.) In this case, the program will search for matches to
the regular expression:
-
^.[^|C][^w[Q]*(Q|[w[]c).*|^.[C|]$
+
^.[^|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,;].*)$
+
^.[^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..*$
+
^.[^W]*W..*$
By some freak happenstance, lines of adrian.c which match this regular
expression form a unix head(1) command. It prints the first ten lines of
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.*$
+
^.[^j]*jr.*$
on standard input. And the program which results by running adrian.c
through this filter requires two parameters. The first is meant to be a
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.*$
+
^.[^(~][^s]*sl.*$
Filtering adrian.c through this search yields a clone of the sleep(1)
command. Invoke with a single integer parameter, and it will pause for that
many seconds.
diff --git a/1992/albert/README.md b/1992/albert/README.md
index 788a66a37..f3cb6bbeb 100644
--- a/1992/albert/README.md
+++ b/1992/albert/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -13,7 +13,7 @@ An [alternate version](#alternate-code) exists that fixes a bug.
The current status of this entry is:
```
-STATUS: known bug - please help us fix
+ STATUS: known bug - please help us fix
```
For more detailed information see [1992 albert bugs](../../bugs.html#1992_albert).
@@ -22,14 +22,14 @@ For more detailed information see [1992 albert bugs](../../bugs.html#1992_albert
## To use:
```sh
-./albert number
+ ./albert number
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -40,20 +40,20 @@ Leo Broukhis, before he was an IOCCC judge, sent the IOCCC
judges this Email message:
```
-From: leo _at_ zycad -dot- com (Leo Broukhis)
-Date: Tue, 30 Jan 96 17:37:51 PST
-To: judges _at_ toad -dot- com
-Subject: IOCCC 1992 - a bug
+ From: leo _at_ zycad -dot- com (Leo Broukhis)
+ Date: Tue, 30 Jan 96 17:37:51 PST
+ To: judges _at_ toad -dot- com
+ Subject: IOCCC 1992 - a bug
-Dear Judges,
+ Dear Judges,
-albert.c (even in its fixed form) still has a bug. Although I don't
-remember the number that exposed the bug (afair, resulting in coredump)
-in albert.orig.c that has been fixed in albert.c,
+ albert.c (even in its fixed form) still has a bug. Although I don't
+ remember the number that exposed the bug (afair, resulting in coredump)
+ in albert.orig.c that has been fixed in albert.c,
-I've found a number exposing another bug: 10000000001 (that's 9 0's).
-Both albert and albert.orig loop without printing anything, although
-the first factor is 101 and is usually found in an instant.
+ I've found a number exposing another bug: 10000000001 (that's 9 0's).
+ Both albert and albert.orig loop without printing anything, although
+ the first factor is 101 and is usually found in an instant.
```
The [albert.alt.c](albert.c) file is the fixed file, whereas the
@@ -65,7 +65,7 @@ The [albert.alt.c](albert.c) file is the fixed file, whereas the
To compile this alternate version:
```sh
-make alt
+ make alt
```
@@ -77,7 +77,7 @@ Use `albert.alt` as you would `albert` above.
### Alternate try:
```sh
-./try.alt.sh
+ ./try.alt.sh
```
@@ -107,7 +107,7 @@ Or you may type `./albert `
A nice one is also (30 ones):
```sh
-./albert 111111111111111111111111111111
+ ./albert 111111111111111111111111111111
```
Apart from the foregoing there are no special execution instructions.
@@ -115,7 +115,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
+ cc albert.c -o 4294967297
```
or some such.
diff --git a/1992/albert/index.html b/1992/albert/index.html
index b184e6224..aa7e5bc51 100644
--- a/1992/albert/index.html
+++ b/1992/albert/index.html
@@ -132,8 +132,7 @@
An alternate version of this entry, albert.alt.c, is provided.
Leo Broukhis, before he was an IOCCC judge, sent the IOCCC
judges this Email message:
-
From: leo _at_ zycad -dot- com (Leo Broukhis)
-Date: Tue, 30 Jan 96 17:37:51 PST
-To: judges _at_ toad -dot- com
-Subject: IOCCC 1992 - a bug
+
From: leo _at_ zycad -dot- com (Leo Broukhis)
+ Date: Tue, 30 Jan 96 17:37:51 PST
+ To: judges _at_ toad -dot- com
+ Subject: IOCCC 1992 - a bug
-Dear Judges,
+ Dear Judges,
-albert.c (even in its fixed form) still has a bug. Although I don't
-remember the number that exposed the bug (afair, resulting in coredump)
-in albert.orig.c that has been fixed in albert.c,
+ albert.c (even in its fixed form) still has a bug. Although I don't
+ remember the number that exposed the bug (afair, resulting in coredump)
+ in albert.orig.c that has been fixed in albert.c,
-I've found a number exposing another bug: 10000000001 (that's 9 0's).
-Both albert and albert.orig loop without printing anything, although
-the first factor is 101 and is usually found in an instant.
+ I've found a number exposing another bug: 10000000001 (that's 9 0's).
+ Both albert and albert.orig loop without printing anything, although
+ the first factor is 101 and is usually found in an instant.
The albert.alt.c file is the fixed file, whereas the
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
@@ -195,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 28c331e5d..63e0c3238 100644
--- a/1992/ant/README.md
+++ b/1992/ant/README.md
@@ -1,16 +1,16 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./ant Makefile
+ ./ant Makefile
-./ant Makefile rule
+ ./ant Makefile rule
```
where `Makefile` is a Makefile to use and `rule` is an optional rule to use.
@@ -19,7 +19,7 @@ where `Makefile` is a Makefile to use and `rule` is an optional rule to use.
## Try:
```sh
-./try.sh
+ ./try.sh
```
diff --git a/1992/ant/index.html b/1992/ant/index.html
index 044458a57..51a29f2a0 100644
--- a/1992/ant/index.html
+++ b/1992/ant/index.html
@@ -132,8 +132,7 @@
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 8b0c6f0ff..0c141c346 100644
--- a/1992/buzzard.1/README.md
+++ b/1992/buzzard.1/README.md
@@ -1,22 +1,21 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./buzzard.1 num num
-
+ ./buzzard.1 num num
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -25,8 +24,8 @@ make all
To see good C Preprocessor buzzard.1, try:
```sh
-make babble.cppcb
-cat babble.cppcb
+ make babble.cppcb
+ cat babble.cppcb
```
Notice how many statements it takes to do anything useful?
@@ -56,19 +55,19 @@ short strings.
arguments.
```sh
-./buzzard.1 0
+ ./buzzard.1 0
```
will print out the factorial of ``.
```sh
-./buzzard.1
+ ./buzzard.1
```
will print out the largest common factor of `num1` and `num2`.
```sh
-./buzzard.1 1
+ ./buzzard.1 1
```
will print out a factor of `num2` if it's composite, or else
@@ -127,37 +126,36 @@ place to site some references on the AE, but I don't have any.
[Don't read this unless you're stumped!]
```
+ MACRO FUNCTION MNEMONIC
-MACRO FUNCTION MNEMONIC
+ V begin variable declarations Variable
+ C begin program Code
-V begin variable declarations Variable
-C begin program Code
+ Q(b,a) let b = a eQuals
+ A(c,a,b) let c = a + b Add
+ S(c,a,b) let c = a - b Subtract
+ D(c,a,b) let c = a / b, where b is a *constant* Divide
+ U(c,a,b) let c = a / b, where b is anything Unknown
+ M(c,a,b) let c = a * b Multiply
-Q(b,a) let b = a eQuals
-A(c,a,b) let c = a + b Add
-S(c,a,b) let c = a - b Subtract
-D(c,a,b) let c = a / b, where b is a *constant* Divide
-U(c,a,b) let c = a / b, where b is anything Unknown
-M(c,a,b) let c = a * b Multiply
+ O(c,a,b) let c = a boolean-or b (a,b are 0 or 1) Or
+ B(b, a) let b = boolean value of a Boolean
+ P(b, a) let b = 1 if a>0, else 0. Positive
-O(c,a,b) let c = a boolean-or b (a,b are 0 or 1) Or
-B(b, a) let b = boolean value of a Boolean
-P(b, a) let b = 1 if a>0, else 0. Positive
+ l emit next sequential label Label
+ J(x) goto label #x Jump
-l emit next sequential label Label
-J(x) goto label #x Jump
+ Z(a,d) if a is 0 goto d (a is 0 or 1) Zero
+ E(a,d) if a is 1 goto d (a is 0 or 1) Else
-Z(a,d) if a is 0 goto d (a is 0 or 1) Zero
-E(a,d) if a is 1 goto d (a is 0 or 1) Else
+ H halt Haly
-H halt Haly
+ K(x) let x = number of cmd line arguments Kount
+ G(x,y) let x = the value if the yth argument Get argument
-K(x) let x = number of cmd line arguments Kount
-G(x,y) let x = the value if the yth argument Get argument
-
-T end of code; begin output section Terminate
-X(y) print out hexadecimal value of y heXadecimal
-T end of output section and program Terminate
+ T end of code; begin output section Terminate
+ X(y) print out hexadecimal value of y heXadecimal
+ T end of output section and program Terminate
```
You can figure out the other macros yourself. In the sample program, I've
@@ -174,26 +172,26 @@ Since all you can do in the given operation output set is
assignment, we implement "conditional assignment":
```c
-if (x) y = z;
+ 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));
+ 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)
-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](https://en.wikipedia.org/wiki/Program_counter).
@@ -202,7 +200,7 @@ 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;
+ if (pc == some_constant) y = z;
```
To combine this with other operations, we simply multiply by our
diff --git a/1992/buzzard.1/index.html b/1992/buzzard.1/index.html
index 857d65449..12c033952 100644
--- a/1992/buzzard.1/index.html
+++ b/1992/buzzard.1/index.html
@@ -132,8 +132,7 @@
Notice how many statements it takes to do anything useful?
Author’s remarks:
What you shouldn’t think about buzzard.1:
@@ -163,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
@@ -206,37 +205,36 @@ simulate any existing machine–although not quickly). This would be a good
place to site some references on the AE, but I don’t have any.
Definition of the input language to buzzard.1 (OR What Exactly Do All The Macros Do?)
[Don’t read this unless you’re stumped!]
-
-MACRO FUNCTION MNEMONIC
+
MACRO FUNCTION MNEMONIC
-V begin variable declarations Variable
-C begin program Code
+ V begin variable declarations Variable
+ C begin program Code
-Q(b,a) let b = a eQuals
-A(c,a,b) let c = a + b Add
-S(c,a,b) let c = a - b Subtract
-D(c,a,b) let c = a / b, where b is a *constant* Divide
-U(c,a,b) let c = a / b, where b is anything Unknown
-M(c,a,b) let c = a * b Multiply
+ Q(b,a) let b = a eQuals
+ A(c,a,b) let c = a + b Add
+ S(c,a,b) let c = a - b Subtract
+ D(c,a,b) let c = a / b, where b is a *constant* Divide
+ U(c,a,b) let c = a / b, where b is anything Unknown
+ M(c,a,b) let c = a * b Multiply
-O(c,a,b) let c = a boolean-or b (a,b are 0 or 1) Or
-B(b, a) let b = boolean value of a Boolean
-P(b, a) let b = 1 if a>0, else 0. Positive
+ O(c,a,b) let c = a boolean-or b (a,b are 0 or 1) Or
+ B(b, a) let b = boolean value of a Boolean
+ P(b, a) let b = 1 if a>0, else 0. Positive
-l emit next sequential label Label
-J(x) goto label #x Jump
+ l emit next sequential label Label
+ J(x) goto label #x Jump
-Z(a,d) if a is 0 goto d (a is 0 or 1) Zero
-E(a,d) if a is 1 goto d (a is 0 or 1) Else
+ Z(a,d) if a is 0 goto d (a is 0 or 1) Zero
+ E(a,d) if a is 1 goto d (a is 0 or 1) Else
-H halt Haly
+ H halt Haly
-K(x) let x = number of cmd line arguments Kount
-G(x,y) let x = the value if the yth argument Get argument
+ K(x) let x = number of cmd line arguments Kount
+ G(x,y) let x = the value if the yth argument Get argument
-T end of code; begin output section Terminate
-X(y) print out hexadecimal value of y heXadecimal
-T end of output section and program Terminate
+ T end of code; begin output section Terminate
+ X(y) print out hexadecimal value of y heXadecimal
+ T end of output section and program Terminate
You can figure out the other macros yourself. In the sample program, I’ve
actually implemented subroutines by saving a return address in a variable and
then jumping to a routine– specifically, a routine that converts a number into
@@ -246,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:
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 ab021d685..e0bf9e803 100644
--- a/1992/buzzard.2/README.md
+++ b/1992/buzzard.2/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
There is an alternate version of this program. See [Alternate
@@ -14,29 +14,29 @@ First, you must make sure that `first` is made first (even though `make all`
should make first first :-) ):
```sh
-make first
+ make first
```
Second:
```sh
-# get help:
-echo help | cat third help.th - | ./first
+ # get help:
+ echo help | cat third help.th - | ./first
-# try out a demo:
-cat third demo5.th | ./first
+ # try out a demo:
+ cat third demo5.th | ./first
```
Third:
```sh
-cat third help.th - | ./first
+ cat third help.th - | ./first
```
NOTE: Wait until 'Ok' is printed and the type:
```
-2 3 + . cr
+ 2 3 + . cr
```
Yes you should really type the 2 letters: `cr`.
@@ -44,14 +44,14 @@ Yes you should really type the 2 letters: `cr`.
Fourth:
```
-Sorry, this is third!
+ Sorry, this is third!
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -64,7 +64,7 @@ fix that the author notes in their remarks.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -76,7 +76,7 @@ Use `buzzard.2.alt` as you would `buzzard.2` above.
### Alternate try:
```sh
-./try.alt.sh
+ ./try.alt.sh
```
@@ -126,7 +126,7 @@ 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
+ cat third help.th - | ./first
```
to do this. Hopefully most operating systems will provide a way to do this. It
@@ -227,7 +227,7 @@ you in a normal way. It only prints `'Ok.'` after you define a word).
```sh
-2 3 + . cr
+ 2 3 + . cr
```
(which adds 2 and 3, and print the result and a newline.)
@@ -235,20 +235,20 @@ you in a normal way. It only prints `'Ok.'` after you define a word).
THIRD responds:
```
-5
+ 5
```
Now try:
```
-: test 11 1 do i . loop cr ;
-test
+ : test 11 1 do i . loop cr ;
+ test
```
and THIRD responds
```
-1 2 3 4 5 6 7 8 9 10
+ 1 2 3 4 5 6 7 8 9 10
```
@@ -256,7 +256,7 @@ When in `THIRD`, you can see how much space you're currently
using by typing:
```
-here .
+ here .
```
The number THIRD replies with is the number of machine words (`int`s) that the
diff --git a/1992/buzzard.2/buzzard.2.design.html b/1992/buzzard.2/buzzard.2.design.html
index 12b023a89..46f60e9cd 100644
--- a/1992/buzzard.2/buzzard.2.design.html
+++ b/1992/buzzard.2/buzzard.2.design.html
@@ -188,64 +188,64 @@ when they are used. Normal instructions compile a pointer to their
executable part onto the end of the dictionary. As we will see, this
means that by default FIRST simply compiles things.
Integer Operations
-
SYMBOL NAME FUNCTION
+
SYMBOL NAME FUNCTION
- - binary minus pop top 2 elements of stack, subtract, push
+ - binary minus pop top 2 elements of stack, subtract, push
- * multiply pop top 2 elements of stack, multiply, push
+ * multiply pop top 2 elements of stack, multiply, push
- / divide pop top 2 elements of stack, divide, push
+ / divide pop top 2 elements of stack, divide, push
- <0 less than 0 pop top element of stack, push 1 if < 0 else 0
+ <0 less than 0 pop top element of stack, push 1 if < 0 else 0
Note that we can synthesize addition and negation from binary minus,
but we cannot synthesize a time efficient divide or multiply from it.
<0 is synthesize-able, but only in a non-portable way.
Memory Operations
-
SYMBOL NAME FUNCTION
+
SYMBOL NAME FUNCTION
- @ fetch pop top of stack, treat as address to push contents of
+ @ fetch pop top of stack, treat as address to push contents of
- ! store top of stack is address, 2nd is value; store to memory
- and pop both off the stack
+ ! store top of stack is address, 2nd is value; store to memory
+ and pop both off the stack
Input/Output Operations
-
NAME FUNCTION
+
NAME FUNCTION
-echo output top of stack through C's putchar()
+ echo output top of stack through C's putchar()
-key push C's getchar() onto top of stack
+ key push C's getchar() onto top of stack
-_read read a space-delimited word, find it in the
- dictionary, and compile a pointer to
- that word's code pointer onto the
- current end of the dictionary
+ _read read a space-delimited word, find it in the
+ dictionary, and compile a pointer to
+ that word's code pointer onto the
+ current end of the dictionary
Although _read could be synthesized from key, we need _read to be able
to compile words to be able to start any syntheses.
Execution Operations
-
NAME FUNCTION
+
NAME FUNCTION
-exit leave the current function: pop the return stack
- into the program counter
+ exit leave the current function: pop the return stack
+ into the program counter
Immediate (compilation) Operations
-
SYMBOL NAME FUNCTION
+
SYMBOL NAME FUNCTION
- : define read in the next space-delimited word, add it to
- the end of our string storage, and generate
- a header for the new word so that when it
- is typed it compiles a pointer to itself
- so that it can be executed.
+ : define read in the next space-delimited word, add it to
+ the end of our string storage, and generate
+ a header for the new word so that when it
+ is typed it compiles a pointer to itself
+ so that it can be executed.
-immediate immediate when used immediately after a name following a ':',
- it makes the word being defined run whenever
- it is typed.
+ immediate immediate when used immediately after a name following a ':',
+ it makes the word being defined run whenever
+ it is typed.
: cannot be synthesized, because we could not synthesize anything.
immediate has to be an immediate operation, so it could not be
synthesized unless by default operations were immediate; but that
would preclude our being able to do any useful compilation.
Stack Operations
-
NAME FUNCTION
+
NAME FUNCTION
-pick pop top of stack, use as index into stack and copy up
- that element
+ pick pop top of stack, use as index into stack and copy up
+ that element
If the data stack were stored in main memory, we could synthesize pick;
but putting the stack and stack pointer in main memory would significantly
increase the C source code size.
@@ -264,16 +264,16 @@ word internally that it executes as its main loop. This word calls
up a word on the return stack, so it will eventually trash things.
This is discussed some more in section 2.
Here’s a handy summary of all the FIRST words:
-
WORD DESCRIPTION
+
WORD DESCRIPTION
-- * / binary integer operations on the stack
-<0 is top of stack less than 0?
-@ ! read from or write to memory
-echo key output or input one character
-_read read a word from input and compile a pointer to it
-exit stop running the current function
-: compile the header of a definition
-immediate modify the header to create an immediate word
+ - * / binary integer operations on the stack
+ <0 is top of stack less than 0?
+ @ ! read from or write to memory
+ echo key output or input one character
+ _read read a word from input and compile a pointer to it
+ exit stop running the current function
+ : compile the header of a definition
+ immediate modify the header to create an immediate word
Here is a sample FIRST program. I’m assuming you’re using
the ASCII character set. FIRST does not depend upon ASCII, but
since FIRST has no syntax for character constants, one normally has
@@ -286,33 +286,33 @@ differently if you wanted.
inside parentheses. FIRST programs cannot have FORTH comments; but I need
some device to indicate what’s going on. (THIRD programs are an entirely
different subject.)
-
( Our first line gives the symbols for the built-ins )
-: immediate _read @ ! - * / <0 exit echo key _pick
+
( Our first line gives the symbols for the built-ins )
+ : immediate _read @ ! - * / <0 exit echo key _pick
- ( now we define a simple word that will print out a couple characters )
+ ( now we define a simple word that will print out a couple characters )
-: L ( define a word named 'L' )
- 108 echo ( output an ascii 'l' )
- exit
+ : L ( define a word named 'L' )
+ 108 echo ( output an ascii 'l' )
+ exit
-: hello ( define a word named 'hello')
- 72 echo ( output an ascii 'H' )
- 101 echo ( output an ascii 'e' )
- 111 ( push ascii 'o' onto the stack )
- L L ( output two ascii 'l's )
- echo ( output the 'o' we pushed on the stack before )
- 10 echo ( print a newline )
- exit ( stop running this routine )
+ : hello ( define a word named 'hello')
+ 72 echo ( output an ascii 'H' )
+ 101 echo ( output an ascii 'e' )
+ 111 ( push ascii 'o' onto the stack )
+ L L ( output two ascii 'l's )
+ echo ( output the 'o' we pushed on the stack before )
+ 10 echo ( print a newline )
+ exit ( stop running this routine )
-: test immediate ( define a word named 'test' that runs whenever typed )
- hello ( call hello )
- exit
+ : test immediate ( define a word named 'test' that runs whenever typed )
+ hello ( call hello )
+ exit
-test
+ test
-( The result of running this program should be:
-Hello
-)
+ ( The result of running this program should be:
+ Hello
+ )
Section 2: Motivating THIRD
What is missing from FIRST? There are a large number of
important primitives that aren’t implemented, but which are
@@ -350,47 +350,46 @@ be 0–it’s a fake dictionary entry that means pushint
Section 3: Building THIRD
In this section we’ll eventually have real comments.
The first thing we have to do is give the symbols for our built-ins.
-
: immediate _read @ ! - * / < exit echo key _pick
+
: immediate _read @ ! - * / < exit echo key _pick
Next we want to be mildly self commenting, so we define the word r to push
the address of the return stack pointer onto the stack–NOT the value of the
return stack pointer. (In fact, when we run r, the value of the return stack
pointer is temporarily changed.)
-
: r 1 exit
+
: r 1 exit
Next, we’re currently executing a short loop that contains _read and
recursion, which is slowly blowing up the return stack. So let’s define a new
word, from which you can never return. What it does is drops the top value off
the return stack, calls _read, then calls itself. Because it kills the top of
the return stack, it can recurse indefinitely.
-
: ]
- r @ Get the value of the return stack pointer
- 1 - Subtract one
- r ! Store it back into the return stack pointer
- _read Read and compile one word
- ] Start over
+
: ]
+ r @ Get the value of the return stack pointer
+ 1 - Subtract one
+ r ! Store it back into the return stack pointer
+ _read Read and compile one word
+ ] Start over
Notice that we don’t need to exit, since we never come back. Also, it’s
possible that an immediate word may get run during _read, and that _read
will never return!
Now let’s get compile running.
-
: main immediate ]
-main
+
: main immediate ]
+ main
Next off, I’m going to do this the easy but non-portable way, and put some
character constant definitions in. I wanted them at the top of the file, but
that would have burned too much of the return stack.
OK. Now, we want to make THIRD look vaguely like FORTH,
so we’re going to define ;. What ; ought to do is
terminate a compilation, and turn control over to the
@@ -399,41 +398,39 @@ command-mode handler. We don’t have one, so all we want
current word. To do this we’ll need several other words.
Swap by writing out the top two elements into temps, and
then reading them back in the other order.
-
: swap _x! _y! _x _y exit
+
: swap _x! _y! _x _y exit
Take another look and make sure you see why that works,
since it LOOKS like I’m reading them back in the same
order–in fact, it not only looks like it, but I AM!
Addition might be nice to have. To add, we need to
negate the top element of the stack, and then subtract.
To negate, we subtract from 0.
-
: +
- 0 swap -
- -
- exit
-
+
: +
+ 0 swap -
+ -
+ exit
Create a copy of the top of stack.
-
: dup _x! _x _x exit
+
: dup _x! _x _x exit
Get a mnemonic name for our dictionary pointer–we need
to compile stuff, so it goes through this.
-
: h 0 exit
+
: h 0 exit
We’re going to need to advance that pointer, so let’s
make a generic pointer-advancing function.
Given a pointer to a memory location, increment the value
at that memory location.
-
: inc
- dup @ Get another copy of the address, and get the value
- so now we have value, address on top of stack.
- 1 + Add one to the value
- swap Swap to put the address on top of the stack
- ! exit Write it to memory
-
+
: inc
+ dup @ Get another copy of the address, and get the value
+ so now we have value, address on top of stack.
+ 1 + Add one to the value
+ swap Swap to put the address on top of the stack
+ ! exit Write it to memory
, is a standard FORTH word. It should write the top of
stack into the dictionary, and advance the pointer
-
: ,
- h @ Get the value of the dictionary pointer
- ! Write the top of stack there
- h inc And increment the dictionary pointer
- exit
+
: ,
+ h @ Get the value of the dictionary pointer
+ ! Write the top of stack there
+ h inc And increment the dictionary pointer
+ exit
' is a standard FORTH word. It should push the address
of the word that follows it onto the stack. We could
do this by making ' immediate, but then it’d need to
@@ -442,30 +439,29 @@ as normal. When ' is executed, the top of the return
stack will point into the instruction stream immediately
after the '. We push the word there, and advance the
return stack pointer so that we don’t execute it.
-
: '
- r @ Get the address of the top of return stack
- We currently have a pointer to the top of return stack
- @ Get the value from there
- We currently have a pointer to the instruction stream
- dup Get another copy of it--the bottom copy will stick
- around until the end of this word
- 1 + Increment the pointer, pointing to the NEXT instruction
- r @ ! Write it back onto the top of the return stack
- We currently have our first copy of the old pointer
- to the instruction stream
- @ Get the value there--the address of the "next word"
- exit
-
+
: '
+ r @ Get the address of the top of return stack
+ We currently have a pointer to the top of return stack
+ @ Get the value from there
+ We currently have a pointer to the instruction stream
+ dup Get another copy of it--the bottom copy will stick
+ around until the end of this word
+ 1 + Increment the pointer, pointing to the NEXT instruction
+ r @ ! Write it back onto the top of the return stack
+ We currently have our first copy of the old pointer
+ to the instruction stream
+ @ Get the value there--the address of the "next word"
+ exit
Now we’re set. ; should be an immediate word that pushes
the address of exit onto the stack, then writes it out.
-
: ; immediate
- ' exit Get the address of exit
- , Compile it
- exit And we should return
+
: ; immediate
+ ' exit Get the address of exit
+ , Compile it
+ exit And we should return
Now let’s test out ; by defining a useful word:
-
: drop 0 * + ;
+
: drop 0 * + ;
Since we have inc, we ought to make dec:
-
: dec dup @ 1 - swap ! ;
+
: dec dup @ 1 - swap ! ;
Our next goal, now that we have ;, is to implement
if-then. To do this, we’ll need to play fast and
loose with the return stack, so let’s make some
@@ -478,22 +474,22 @@ return stack–tor’s return address! So we have to pop
that off first… We better just bite the bullet and
code it out–but we can’t really break it into smaller
words, because that’ll trash the return stack.
-
: tor
- r @ @ Get the value off the top of the return stack
- swap Bring the value to be pushed to the top of stack
- r @ ! Write it over the current top of return stack
- r @ 1 + r ! Increment the return stack pointer--but can't use inc
- r @ ! Store our return address back on the return stack
-;
+
: tor
+ r @ @ Get the value off the top of the return stack
+ swap Bring the value to be pushed to the top of stack
+ r @ ! Write it over the current top of return stack
+ r @ 1 + r ! Increment the return stack pointer--but can't use inc
+ r @ ! Store our return address back on the return stack
+ ;
Next we want the opposite routine, which pops the top
of the return stack, and puts it on the normal stack.
-
: fromr
- r @ @ Save old value
- r @ 1 - r ! Decrement pointer
- r @ @ Get value that we want off
- swap Bring return address to top
- r @ ! Store it and return
-;
+
: fromr
+ r @ @ Save old value
+ r @ 1 - r ! Decrement pointer
+ r @ @ Get value that we want off
+ swap Bring return address to top
+ r @ ! Store it and return
+ ;
Now, if we have a routine that’s recursing, and we
want to be polite about the return stack, right before
we recurse we can run { fromr drop } so the stack won’t
@@ -503,324 +499,324 @@ address–so when we’re done, we’ll return up two levels.
To save a little, we make tail mean { fromr drop };
however, it’s more complex since there’s a new value on
top of the return stack.
-
: tail fromr fromr drop tor ;
+
: tail fromr fromr drop tor ;
Now, we want to do if. To do this, we need to convert
values to boolean values. The next few words set this
up.
minus gives us unary negation.
-
: minus 0 swap - ;
+
: minus 0 swap - ;
If top of stack is boolean, bnot gives us inverse
-
: bnot 1 swap - ;
+
: bnot 1 swap - ;
To compare two numbers, subtract and compare to 0.
-
: < - <0 ;
+
: < - <0 ;
logical turns the top of stack into either 0 or 1.
-
: logical
- dup Get two copies of it
- 0 < 1 if < 0, 0 otherwise
- swap minus Swap number back up, and take negative
- 0 < 1 if original was > 0, 0 otherwise
- + Add them up--has to be 0 or 1!
-;
+
: logical
+ dup Get two copies of it
+ 0 < 1 if < 0, 0 otherwise
+ swap minus Swap number back up, and take negative
+ 0 < 1 if original was > 0, 0 otherwise
+ + Add them up--has to be 0 or 1!
+ ;
not returns 1 if top of stack is 0, and 0 otherwise
-
: not logical bnot ;
+
: not logical bnot ;
We can test equality by subtracting and comparing to 0.
-
: = - not ;
+
: = - not ;
Just to show how you compute a branch: Suppose you’ve
compiled a call to branch, and immediately after it is
an integer constant with the offset of how far to branch.
To branch, we use the return stack to read the offset, and
add that on to the top of the return stack, and return.
-
: branch
- r @ Address of top of return stack
- @ Our return address
- @ Value from there: the branch offset
- r @ @ Our return address again
- + The address we want to execute at
- r @ ! Store it back onto the return stack
-;
+
: branch
+ r @ Address of top of return stack
+ @ Our return address
+ @ Value from there: the branch offset
+ r @ @ Our return address again
+ + The address we want to execute at
+ r @ ! Store it back onto the return stack
+ ;
For conditional branches, we want to branch by a certain
amount if true, otherwise we want to skip over the branch
offset constant–that is, branch by one. Assuming that
the top of the stack is the branch offset, and the second
on the stack is 1 if we should branch, and 0 if not, the
following computes the correct branch offset.
-
: computebranch 1 - * 1 + ;
+
: computebranch 1 - * 1 + ;
Branch if the value on top of the stack is 0.
-
: notbranch
- not
- r @ @ @ Get the branch offset
- computebranch Adjust as necessary
- r @ @ + Calculate the new address
- r @ ! Store it
-;
+
: notbranch
+ not
+ r @ @ @ Get the branch offset
+ computebranch Adjust as necessary
+ r @ @ + Calculate the new address
+ r @ ! Store it
+ ;
here is a standard FORTH word which returns a pointer to
the current dictionary address–that is, the value of
the dictionary pointer.
-
: here h @ ;
+
: here h @ ;
We’re ALL SET to compile if...else...then constructs!
Here’s what we do. When we get if, we compile a call
to notbranch, and then compile a dummy offset, because
we don’t know where the then will be. On the stack
we leave the address where we compiled the dummy offset.
then will calculate the offset and fill it in for us.
-
: if immediate
- ' notbranch , Compile notbranch
- here Save the current dictionary address
- 0 , Compile a dummy value
-;
+
: if immediate
+ ' notbranch , Compile notbranch
+ here Save the current dictionary address
+ 0 , Compile a dummy value
+ ;
then expects the address to fixup to be on the stack.
-
: then immediate
- dup Make another copy of the address
- here Find the current location, where to branch to
- swap - Calculate the difference between them
- swap ! Bring the address to the top, and store it.
-;
+
: then immediate
+ dup Make another copy of the address
+ here Find the current location, where to branch to
+ swap - Calculate the difference between them
+ swap ! Bring the address to the top, and store it.
+ ;
Now that we can do if...then statements, we can do
some parsing! Let’s introduce real FORTH comments.
find-) will scan the input until it finds a ), and
exit.
-
: find-)
- key Read in a character
- ')' = Compare it to close parentheses
- not if If it's not equal
- tail find-) repeat (popping R stack)
- then Otherwise branch here and exit
-;
+
: find-)
+ key Read in a character
+ ')' = Compare it to close parentheses
+ not if If it's not equal
+ tail find-) repeat (popping R stack)
+ then Otherwise branch here and exit
+ ;
-: ( immediate
- find-)
-;
+ : ( immediate
+ find-)
+ ;
-( we should be able to do FORTH-style comments now )
+ ( we should be able to do FORTH-style comments now )
-( now that we've got comments, we can comment the rest of the code
- in a legitimate [self parsing] fashion. Note that you can't
- nest parentheses... )
+ ( now that we've got comments, we can comment the rest of the code
+ in a legitimate [self parsing] fashion. Note that you can't
+ nest parentheses... )
-: else immediate
- ' branch , ( compile a definite branch )
- here ( push the backpatching address )
- 0 , ( compile a dummy offset for branch )
- swap ( bring old backpatch address to top )
- dup here swap - ( calculate the offset from old address )
- swap ! ( put the address on top and store it )
-;
+ : else immediate
+ ' branch , ( compile a definite branch )
+ here ( push the backpatching address )
+ 0 , ( compile a dummy offset for branch )
+ swap ( bring old backpatch address to top )
+ dup here swap - ( calculate the offset from old address )
+ swap ! ( put the address on top and store it )
+ ;
-: over _x! _y! _y _x _y ;
+ : over _x! _y! _y _x _y ;
-: add
- _x! ( save the pointer in a temp variable )
- _x @ ( get the value pointed to )
- + ( add the incremement from on top of the stack )
- _x ! ( and save it )
-;
+ : add
+ _x! ( save the pointer in a temp variable )
+ _x @ ( get the value pointed to )
+ + ( add the incremement from on top of the stack )
+ _x ! ( and save it )
+ ;
-: allot h add ;
+ : allot h add ;
-: maybebranch
- logical ( force the TOS to be 0 or 1 )
- r @ @ @ ( load the branch offset )
- computebranch ( calculate the condition offset [either TOS or 1])
- r @ @ + ( add it to the return address )
- r @ ! ( store it to our return address and return )
-;
+ : maybebranch
+ logical ( force the TOS to be 0 or 1 )
+ r @ @ @ ( load the branch offset )
+ computebranch ( calculate the condition offset [either TOS or 1])
+ r @ @ + ( add it to the return address )
+ r @ ! ( store it to our return address and return )
+ ;
-: mod _x! _y! ( get x then y off of stack )
- _y _y _x / _x * ( y - y / x * x )
- -
-;
+ : mod _x! _y! ( get x then y off of stack )
+ _y _y _x / _x * ( y - y / x * x )
+ -
+ ;
-: printnum
- dup
- 10 mod '0' +
- swap 10 / dup
- if
- printnum
- echo
- else
- drop
- echo
- then
-;
+ : printnum
+ dup
+ 10 mod '0' +
+ swap 10 / dup
+ if
+ printnum
+ echo
+ else
+ drop
+ echo
+ then
+ ;
-: .
- dup 0 <
- if
- '-' echo minus
- then
- printnum
- 'space' echo
-;
+ : .
+ dup 0 <
+ if
+ '-' echo minus
+ then
+ printnum
+ 'space' echo
+ ;
-: debugprint dup . cr ;
+ : debugprint dup . cr ;
-( the following routine takes a pointer to a string, and prints it,
- except for the trailing quote. returns a pointer to the next word
- after the trailing quote )
+ ( the following routine takes a pointer to a string, and prints it,
+ except for the trailing quote. returns a pointer to the next word
+ after the trailing quote )
-: _print
- dup 1 +
- swap @
- dup '"' =
- if
- drop exit
- then
- echo
- tail _print
-;
+ : _print
+ dup 1 +
+ swap @
+ dup '"' =
+ if
+ drop exit
+ then
+ echo
+ tail _print
+ ;
-: print _print ;
+ : print _print ;
- ( print the next thing from the instruction stream )
-: immprint
- r @ @
- print
- r @ !
-;
+ ( print the next thing from the instruction stream )
+ : immprint
+ r @ @
+ print
+ r @ !
+ ;
-: find-"
- key dup ,
- '"' =
- if
- exit
- then
- tail find-"
-;
+ : find-"
+ key dup ,
+ '"' =
+ if
+ exit
+ then
+ tail find-"
+ ;
-: " immediate
- key drop
- ' immprint ,
- find-"
-;
+ : " immediate
+ key drop
+ ' immprint ,
+ find-"
+ ;
-: do immediate
- ' swap , ( compile 'swap' to swap the limit and start )
- ' tor , ( compile to push the limit onto the return stack )
- ' tor , ( compile to push the start on the return stack )
- here ( save this address so we can branch back to it )
-;
+ : do immediate
+ ' swap , ( compile 'swap' to swap the limit and start )
+ ' tor , ( compile to push the limit onto the return stack )
+ ' tor , ( compile to push the start on the return stack )
+ here ( save this address so we can branch back to it )
+ ;
-: i r @ 1 - @ ;
-: j r @ 3 - @ ;
+ : i r @ 1 - @ ;
+ : j r @ 3 - @ ;
-: > swap < ;
-: <= 1 + < ;
-: >= swap <= ;
+ : > swap < ;
+ : <= 1 + < ;
+ : >= swap <= ;
-: inci
- r @ 1 - ( get the pointer to i )
- inc ( add one to it )
- r @ 1 - @ ( find the value again )
- r @ 2 - @ ( find the limit value )
- <=
- if
- r @ @ @ r @ @ + r @ ! exit ( branch )
- then
- fromr 1 +
- fromr drop
- fromr drop
- tor
-;
+ : inci
+ r @ 1 - ( get the pointer to i )
+ inc ( add one to it )
+ r @ 1 - @ ( find the value again )
+ r @ 2 - @ ( find the limit value )
+ <=
+ if
+ r @ @ @ r @ @ + r @ ! exit ( branch )
+ then
+ fromr 1 +
+ fromr drop
+ fromr drop
+ tor
+ ;
-: loop immediate ' inci @ here - , ;
+ : loop immediate ' inci @ here - , ;
-: loopexit
+ : loopexit
- fromr drop ( pop off our return address )
- fromr drop ( pop off i )
- fromr drop ( pop off the limit of i )
-; ( and return to the caller's caller routine )
+ fromr drop ( pop off our return address )
+ fromr drop ( pop off i )
+ fromr drop ( pop off the limit of i )
+ ; ( and return to the caller's caller routine )
-: execute
- 8 !
- ' exit 9 !
- 8 tor
-;
+ : execute
+ 8 !
+ ' exit 9 !
+ 8 tor
+ ;
-: :: ; ( :: is going to be a word that does ':' at runtime )
+ : :: ; ( :: is going to be a word that does ':' at runtime )
-: fix-:: immediate 3 ' :: ! ;
-fix-::
+ : fix-:: immediate 3 ' :: ! ;
+ fix-::
- ( Override old definition of ':' with a new one that invokes ] )
-: : immediate :: ] ;
+ ( Override old definition of ':' with a new one that invokes ] )
+ : : immediate :: ] ;
-: command
- here 5 ! ( store dict pointer in temp variable )
- _read ( compile a word )
- ( if we get control back: )
- here 5 @
- = if
- tail command ( we didn't compile anything )
- then
- here 1 - h ! ( decrement the dictionary pointer )
- here 5 @ ( get the original value )
- = if
- here @ ( get the word that was compiled )
- execute ( and run it )
- else
- here @ ( else it was an integer constant, so push it )
- here 1 - h ! ( and decrement the dictionary pointer again )
- then
- tail command
-;
+ : command
+ here 5 ! ( store dict pointer in temp variable )
+ _read ( compile a word )
+ ( if we get control back: )
+ here 5 @
+ = if
+ tail command ( we didn't compile anything )
+ then
+ here 1 - h ! ( decrement the dictionary pointer )
+ here 5 @ ( get the original value )
+ = if
+ here @ ( get the word that was compiled )
+ execute ( and run it )
+ else
+ here @ ( else it was an integer constant, so push it )
+ here 1 - h ! ( and decrement the dictionary pointer again )
+ then
+ tail command
+ ;
-: make-immediate ( make a word just compiled immediate )
- here 1 - ( back up a word in the dictionary )
- dup dup ( save the pointer to here )
- h ! ( store as the current dictionary pointer )
- @ ( get the run-time code pointer )
- swap ( get the dict pointer again )
- 1 - ( point to the compile-time code pointer )
- ! ( write run-time code pointer on compile-time pointer )
-;
+ : make-immediate ( make a word just compiled immediate )
+ here 1 - ( back up a word in the dictionary )
+ dup dup ( save the pointer to here )
+ h ! ( store as the current dictionary pointer )
+ @ ( get the run-time code pointer )
+ swap ( get the dict pointer again )
+ 1 - ( point to the compile-time code pointer )
+ ! ( write run-time code pointer on compile-time pointer )
+ ;
-: <build immediate
- make-immediate ( make the word compiled so far immediate )
- ' :: , ( compile '::', so we read next word )
- 2 , ( compile 'pushint' )
- here 0 , ( write out a 0 but save address for does> )
- ' , , ( compile a push that address onto dictionary )
-;
+ : <build immediate
+ make-immediate ( make the word compiled so far immediate )
+ ' :: , ( compile '::', so we read next word )
+ 2 , ( compile 'pushint' )
+ here 0 , ( write out a 0 but save address for does> )
+ ' , , ( compile a push that address onto dictionary )
+ ;
-: does> immediate
- ' command , ( jump back into command mode at runtime )
- here swap ! ( backpatch the build> to point to here )
- 2 , ( compile run-code primitive so we look like a word )
- ' fromr , ( compile fromr, which leaves var address on stack )
-;
+ : does> immediate
+ ' command , ( jump back into command mode at runtime )
+ here swap ! ( backpatch the build> to point to here )
+ 2 , ( compile run-code primitive so we look like a word )
+ ' fromr , ( compile fromr, which leaves var address on stack )
+ ;
-: _dump ( dump out the definition of a word, sort of )
- dup " (" . " , "
- dup @ ( save the pointer and get the contents )
- dup ' exit
- = if
- " ;)" cr exit
- then
- . " ), "
- 1 +
- tail _dump
-;
+ : _dump ( dump out the definition of a word, sort of )
+ dup " (" . " , "
+ dup @ ( save the pointer and get the contents )
+ dup ' exit
+ = if
+ " ;)" cr exit
+ then
+ . " ), "
+ 1 +
+ tail _dump
+ ;
-: dump _dump ;
+ : dump _dump ;
-: # . cr ;
+ : # . cr ;
-: var <build , does> ;
-: constant <build , does> @ ;
-: array <build allot does> + ;
+ : var <build , does> ;
+ : constant <build , does> @ ;
+ : array <build allot does> + ;
-: [ immediate command ;
-: _welcome " Welcome to THIRD.
-Ok.
-" ;
+ : [ immediate command ;
+ : _welcome " Welcome to THIRD.
+ Ok.
+ " ;
-: ; immediate ' exit , command exit
+ : ; immediate ' exit , command exit
-[
+ [
-_welcome
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
+
# get help:
+echo help |cat third help.th -|./first
-# try out a demo:
-cat third demo5.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
+
2 3 + . cr
Yes you should really type the 2 letters: cr.
Fourth:
-
Sorry, this is third!
+
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:
@@ -205,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
@@ -284,18 +283,18 @@ 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
+
5
Now try:
-
: test 11 1 do i . loop cr ;
-test
+
: test 11 1 do i . loop cr ;
+ test
and THIRD responds
-
1 2 3 4 5 6 7 8 9 10
+
1 2 3 4 5 6 7 8 9 10
When in THIRD, you can see how much space you’re currently
using by typing:
-
here .
+
here .
The number THIRD replies with is the number of machine words (ints) that the
dictionary (the first code) takes up, plus the 512 ints for the return stack.
If you compile the basic THIRD system without the help word (strings take up one
diff --git a/1992/gson/README.md b/1992/gson/README.md
index a169aa902..739147fb4 100644
--- a/1992/gson/README.md
+++ b/1992/gson/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
NOTE: we DISABLE the optimiser because having it enabled causes some invocations
@@ -13,7 +13,7 @@ to crash in some systems.
The current status of this entry is:
```
-STATUS: uses gets() - change to fgets() if possible
+ STATUS: uses gets() - change to fgets() if possible
```
For more detailed information see [1992 gson bugs](../../bugs.html#1992_gson).
@@ -22,14 +22,14 @@ For more detailed information see [1992 gson bugs](../../bugs.html#1992_gson).
## To use:
```sh
-./ag word word2 word3 < /path/to/dictionary
+ ./ag word word2 word3 < /path/to/dictionary
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
This script will determine (or try and determine) where your system dictionary
@@ -37,22 +37,22 @@ 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:
```
-/usr/share/dict/words
-/usr/share/lib/spell/words
-/usr/ucblib/dict/words
-/dev/null # <-- for machines with nothing to say
+ /usr/share/dict/words
+ /usr/share/lib/spell/words
+ /usr/ucblib/dict/words
+ /dev/null # <-- for machines with nothing to say
```
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
-./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.
@@ -74,7 +74,7 @@ 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
+ cat README.md | ./mkdict.sh > words
```
Then try using the program as shown above with the file `words`.
@@ -104,8 +104,8 @@ 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
+ #!/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
@@ -259,7 +259,7 @@ 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);}
+ 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
diff --git a/1992/gson/index.html b/1992/gson/index.html
index 50ff330b8..e08e32a8e 100644
--- a/1992/gson/index.html
+++ b/1992/gson/index.html
@@ -132,8 +132,7 @@
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:
-
/usr/share/dict/words
-/usr/share/lib/spell/words
-/usr/ucblib/dict/words
-/dev/null # <-- for machines with nothing to say
+
/usr/share/dict/words
+ /usr/share/lib/spell/words
+ /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
@@ -180,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:
@@ -196,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:
-
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.
@@ -324,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:
-
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 f56fd3a2e..22c1e17fb 100644
--- a/1992/imc/README.md
+++ b/1992/imc/README.md
@@ -1,17 +1,17 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-# text mode
-./imc -text
+ # text mode
+ ./imc -text
-./imc
+ ./imc
```
@@ -20,7 +20,7 @@ make all
To see a number of options and configurations:
```sh
-./try.sh
+ ./try.sh
```
@@ -125,26 +125,26 @@ raster size; not a good idea!).
The options of this program are:
```
--centre x y (float x,y) Centre the picture at x+iy in the complex
- plane (default x=0 y=0)
+ -centre x y (float x,y) Centre the picture at x+iy in the complex
+ plane (default x=0 y=0)
--factor f (float f) Use f pixels per unit of the plane (default
- f=x/4 where x is the width)
+ -factor f (float f) Use f pixels per unit of the plane (default
+ f=x/4 where x is the width)
--julia x y (float x,y) Draw a julia set. Use x+iy as the constant
- to add after squaring (default x=0 y=0)
+ -julia x y (float x,y) Draw a julia set. Use x+iy as the constant
+ to add after squaring (default x=0 y=0)
--limit l (int l) Use l iterations maximum (default l=128)
+ -limit l (int l) Use l iterations maximum (default l=128)
--mask m (int m) Use m as a mask in deciding the colour of each
- pixel (see below) (default m=1)
+ -mask m (int m) Use m as a mask in deciding the colour of each
+ pixel (see below) (default m=1)
--size x y (int x,y) Produce an x-by-y output (default for raster
- x=768 y=768; default for text x=63 y=23)
+ -size x y (int x,y) Produce an x-by-y output (default for raster
+ x=768 y=768; default for text x=63 y=23)
--text Produce text instead of raster.
+ -text Produce text instead of raster.
```
The colour of each point is determined by taking the bitwise AND of the
@@ -165,8 +165,8 @@ 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
+ ./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 1ec9e2919..67ebe9137 100644
--- a/1992/imc/index.html
+++ b/1992/imc/index.html
@@ -132,8 +132,7 @@
Author:
Name: Ian Collier
-Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
-
+Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
@@ -142,15 +141,15 @@ Location: GB - United Kingdom of Great
To build:
-
make all
+
make all
To use:
-
# text mode
-./imc-text
+
# text mode
+./imc-text
-./imc
+./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
@@ -231,26 +230,26 @@ appears before t, specifying an option without numbers has no effec
raster size; not a good idea!).
Options
The options of this program are:
-
-centre x y (float x,y) Centre the picture at x+iy in the complex
- plane (default x=0 y=0)
+
-centre x y (float x,y) Centre the picture at x+iy in the complex
+ plane (default x=0 y=0)
--factor f (float f) Use f pixels per unit of the plane (default
- f=x/4 where x is the width)
+ -factor f (float f) Use f pixels per unit of the plane (default
+ f=x/4 where x is the width)
--julia x y (float x,y) Draw a julia set. Use x+iy as the constant
- to add after squaring (default x=0 y=0)
+ -julia x y (float x,y) Draw a julia set. Use x+iy as the constant
+ to add after squaring (default x=0 y=0)
--limit l (int l) Use l iterations maximum (default l=128)
+ -limit l (int l) Use l iterations maximum (default l=128)
--mask m (int m) Use m as a mask in deciding the colour of each
- pixel (see below) (default m=1)
+ -mask m (int m) Use m as a mask in deciding the colour of each
+ pixel (see below) (default m=1)
--size x y (int x,y) Produce an x-by-y output (default for raster
- x=768 y=768; default for text x=63 y=23)
+ -size x y (int x,y) Produce an x-by-y output (default for raster
+ x=768 y=768; default for text x=63 y=23)
--text Produce text instead of raster.
+ -text Produce text instead of raster.
The colour of each point is determined by taking the bitwise AND of the
number of iterations and the mask. For a raster, the point is black
(1-bit) if the result is zero, white otherwise. For text, the result of
@@ -264,8 +263,8 @@ bits (e.g. 8).
standard error to indicate its progress (one dot per pixel line).
@@ -143,34 +142,34 @@ 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.
./kivinen.alt
-./kivinen.alt a
+./kivinen.alt a
-./kivinen.alt a b
+./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=30000 alt # make it slower
-make clobber SLEEP=10000 alt # make it faster
+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 28658612c..1a6ec7774 100644
--- a/1992/lush/README.md
+++ b/1992/lush/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -10,7 +10,7 @@ make all
The current status of this entry is:
```
-STATUS: doesn't work with some compilers - please provide alternative code or fix for more compilers
+ STATUS: doesn't work with some compilers - please provide alternative code or fix for more compilers
```
For more detailed information see [1992 lush bugs](../../bugs.html#1992_lush).
@@ -19,7 +19,7 @@ For more detailed information see [1992 lush bugs](../../bugs.html#1992_lush).
## To use:
```sh
-./lush.sh
+ ./lush.sh
```
diff --git a/1992/lush/index.html b/1992/lush/index.html
index 5bdd1e5bf..2f4af753b 100644
--- a/1992/lush/index.html
+++ b/1992/lush/index.html
@@ -132,8 +132,7 @@
Author:
Name: Ed Luke
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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
+
STATUS: doesn't work with some compilers - please provide alternative code or fix for more compilers
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 e2b87328d..838912d95 100644
--- a/1992/marangon/README.md
+++ b/1992/marangon/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./marangon
+ ./marangon
```
diff --git a/1992/marangon/index.html b/1992/marangon/index.html
index 084d5d460..dfb19efae 100644
--- a/1992/marangon/index.html
+++ b/1992/marangon/index.html
@@ -132,8 +132,7 @@
@@ -142,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 e14a82d0f..446e47e55 100644
--- a/1992/nathan/README.md
+++ b/1992/nathan/README.md
@@ -1,15 +1,15 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./nathan
-# enter some text
+ ./nathan
+ # enter some text
```
@@ -18,7 +18,7 @@ make all
To see some other fun uses:
```sh
-./try.sh
+ ./try.sh
```
@@ -59,8 +59,8 @@ 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
+ make nathan
+ ./nathan
```
to learn how to get a copy of the code.
diff --git a/1992/nathan/index.html b/1992/nathan/index.html
index a3e49400f..0eb81e94a 100644
--- a/1992/nathan/index.html
+++ b/1992/nathan/index.html
@@ -132,8 +132,7 @@
Author:
Name: Nathan Sidwell
-Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
-
+Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
@@ -142,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
@@ -174,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 1462de0ea..dc8b0b821 100644
--- a/1992/vern/README.md
+++ b/1992/vern/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -10,7 +10,7 @@ make all
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1992 vern bugs](../../bugs.html#1992_vern).
@@ -19,7 +19,7 @@ For more detailed information see [1992 vern bugs](../../bugs.html#1992_vern).
## To use:
```sh
-./vern 3 # <-- default is 2
+ ./vern 3 # <-- default is 2
```
@@ -28,10 +28,10 @@ For more detailed information see [1992 vern bugs](../../bugs.html#1992_vern).
You might start off by giving the following input:
```
-63 43
-76 55
-71 52
-67 57 # <-- this may take a while
+ 63 43
+ 76 55
+ 71 52
+ 67 57 # <-- this may take a while
```
@@ -43,10 +43,10 @@ suggested above. :-)
For a real quick game try:
```sh
-./vern
+ ./vern
-65 55
-66 46
+ 65 55
+ 66 46
```
NOTE: Move values must be restricted to the range 00 to 77.
@@ -125,8 +125,8 @@ initial source is gloriously difficult to peruse. In particular, the Makefile
does:
```sh
-sed vern.tmp.c
+ sed vern.tmp.c
```
and compiles `vern.tmp.c`.
diff --git a/1992/vern/index.html b/1992/vern/index.html
index 3d71e46b7..c5572cfcc 100644
--- a/1992/vern/index.html
+++ b/1992/vern/index.html
@@ -132,8 +132,7 @@
Author:
Name: Vern Paxson
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,27 +141,27 @@ Location: US - United States of America
You might start off by giving the following input:
-
63 43
-76 55
-71 52
-67 57 # <-- this may take a while
+
63 43
+ 76 55
+ 71 52
+ 67 57 # <-- this may take a while
Judges’ remarks:
The judges assume no responsibility for the obfuscated opening
suggested above. :-)
For a real quick game try:
-
./vern
+
./vern
-65 55
-66 46
+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.
@@ -226,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:
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 af35c8f4b..efda4b11d 100644
--- a/1992/westley/README.md
+++ b/1992/westley/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -10,8 +10,8 @@ make all
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
-STATUS: known bug - please help us fix
+ STATUS: INABIAF - please **DO NOT** fix
+ STATUS: known bug - please help us fix
```
For more detailed information see [1992 westley bugs](../../bugs.html#1992_westley).
@@ -23,7 +23,7 @@ If lost:
```sh
-./whereami.sh lat long
+ ./whereami.sh lat long
```
Where `lat` and `long` correspond to your latitude and longitude.
@@ -37,7 +37,7 @@ should just use the `westley` and `westley.alt` programs directly.
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -49,15 +49,14 @@ The author provided a version for the US which we added. To build:
### Alternate build:
```sh
-make alt
+ make alt
```
### Alternate use:
```sh
-./whereami.alt.sh lat long
-
+ ./whereami.alt.sh lat long
```
NOTE: this alternative version also needs a terminal with at least 80 columns.
@@ -69,7 +68,7 @@ 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
+ ./try.sh
```
@@ -78,10 +77,10 @@ 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
+ ./whereami 37 -122 # NOTE: - means west of meridian
-# or if you don't have curses installed:
-./westley 37 -122 # NOTE: - means west of meridian
+ # or if you don't have curses installed:
+ ./westley 37 -122 # NOTE: - means west of meridian
```
@@ -166,17 +165,17 @@ 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);}
+ 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:
```c
-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.
diff --git a/1992/westley/index.html b/1992/westley/index.html
index 5a15baefb..66a9b2e32 100644
--- a/1992/westley/index.html
+++ b/1992/westley/index.html
@@ -132,8 +132,7 @@
Author:
Name: Brian Westley
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,39 +141,39 @@ 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
-STATUS: known bug - please help us fix
+
STATUS: INABIAF - please **DO NOT** fix
+ STATUS: known bug - please help us fix
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
+
./whereami 37 -122# NOTE: - means west of meridian
-# or if you don't have curses installed:
-./westley 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
@@ -244,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.
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 d1d6a47fb..3772c4e9c 100644
--- a/1993/cmills/README.md
+++ b/1993/cmills/README.md
@@ -5,7 +5,7 @@ this entry was like back in 1993. See the [original code](#original-code)
section below to run the original.
```sh
-make alt
+ make alt
```
NOTE: this entry requires the `X11/Xlib.h` header file and the X11 library to
@@ -17,7 +17,7 @@ requires X11?](../../faq.html#X11macos).
To configure how many microseconds to sleep before updates try:
```sh
-make clobber SLEEP=200 alt
+ make clobber SLEEP=200 alt
```
@@ -26,7 +26,7 @@ make clobber SLEEP=200 alt
The current status of this entry is:
```
-STATUS: known bug - please help us fix
+ STATUS: known bug - please help us fix
```
For more detailed information see [1993 cmills bugs](../../bugs.html#1993_cmills).
@@ -35,9 +35,9 @@ 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
+ DISPLAY="your_X_server_display"
+ export DISPLAY
+ ./cmills.alt [speed] # must be run on an X11 server
```
where:
@@ -57,7 +57,7 @@ on but you can use the original without any delays if you wish.
### Original build:
```sh
-make all
+ make all
```
@@ -71,16 +71,15 @@ Use `cmills` as you would `cmills.alt` above.
From the San Jose Mercury News (May 15, 1993 page 20A "West Hackers
trounce East in computer quiz game"):
-
```
-"Since 1984, a contest has been held on Usenet for the most
-unreadable, creative, bizarre but working C program", Gates
-said. "What is the name of this contest"
+ "Since 1984, a contest has been held on Usenet for the most
+ unreadable, creative, bizarre but working C program", Gates
+ said. "What is the name of this contest"
-"Windows," shot back Gassee, naming Microsoft's premier product
-- a product over which Apple sued Microsoft five years ago. Not
-the right answer - it's "The Obfuscated C Contest [sic]" - but
-it brought down the house of Apple partisans...
+ "Windows," shot back Gassee, naming Microsoft's premier product
+ - a product over which Apple sued Microsoft five years ago. Not
+ the right answer - it's "The Obfuscated C Contest [sic]" - but
+ it brought down the house of Apple partisans...
```
[The expression on Bill Gates' face was a sight to behold, as reported
diff --git a/1993/cmills/index.html b/1993/cmills/index.html
index 153dfe6a9..af19d1b30 100644
--- a/1993/cmills/index.html
+++ b/1993/cmills/index.html
@@ -132,8 +132,7 @@
Author:
Name: Christopher Mills
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -145,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.
DISPLAY="your_X_server_display"
-exportDISPLAY
-./cmills.alt[speed]# must be run on an X11 server
+
DISPLAY="your_X_server_display"
+exportDISPLAY
+./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.
@@ -167,20 +166,20 @@ 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:
From the San Jose Mercury News (May 15, 1993 page 20A “West Hackers
trounce East in computer quiz game”):
-
"Since 1984, a contest has been held on Usenet for the most
-unreadable, creative, bizarre but working C program", Gates
-said. "What is the name of this contest"
+
"Since 1984, a contest has been held on Usenet for the most
+ unreadable, creative, bizarre but working C program", Gates
+ said. "What is the name of this contest"
-"Windows," shot back Gassee, naming Microsoft's premier product
-- a product over which Apple sued Microsoft five years ago. Not
-the right answer - it's "The Obfuscated C Contest [sic]" - but
-it brought down the house of Apple partisans...
+ "Windows," shot back Gassee, naming Microsoft's premier product
+ - a product over which Apple sued Microsoft five years ago. Not
+ the right answer - it's "The Obfuscated C Contest [sic]" - but
+ it brought down the house of Apple partisans...
[The expression on Bill Gates’ face was a sight to behold, as reported
to us by several who were there].
You must set $DISPLAY in your environment or the program will
diff --git a/1993/dgibson/README.md b/1993/dgibson/README.md
index 036453228..d32666ba5 100644
--- a/1993/dgibson/README.md
+++ b/1993/dgibson/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./dgibson.sh [datafile]
+ ./dgibson.sh [datafile]
```
where:
@@ -19,7 +19,7 @@ where:
## Try:
```sh
-./try.sh
+ ./try.sh
```
diff --git a/1993/dgibson/index.html b/1993/dgibson/index.html
index 1141efad8..8f7707583 100644
--- a/1993/dgibson/index.html
+++ b/1993/dgibson/index.html
@@ -132,8 +132,7 @@
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 1a6e04d46..dc1a48a9d 100644
--- a/1993/ejb/README.md
+++ b/1993/ejb/README.md
@@ -1,27 +1,27 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./ejb level
+ ./ejb level
```
where:
```sh
-level a value from -128 to 127
+ level a value from -128 to 127
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -46,7 +46,7 @@ We note that this also works under macOS just fine.
#### Output solution to Towers of Hanoi for five rings:
```sh
-./ejb 5
+ ./ejb 5
```
The format of the output for the Towers of Hanoi case is simply a
@@ -55,7 +55,7 @@ text description of how to solve the puzzle.
#### Output solution to the Patience puzzle for six rings:
```sh
-./ejb -6
+ ./ejb -6
```
diff --git a/1993/ejb/index.html b/1993/ejb/index.html
index 8faced175..8a38327cf 100644
--- a/1993/ejb/index.html
+++ b/1993/ejb/index.html
@@ -132,8 +132,7 @@
A negative argument plays the patience puzzle. An argument
greater than 0 plays the Tower of Hanoi puzzle. In either case
@@ -161,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/ejb/patience.html b/1993/ejb/patience.html
index b139f5a54..40c7735fb 100644
--- a/1993/ejb/patience.html
+++ b/1993/ejb/patience.html
@@ -171,10 +171,7 @@ then be blocked by the first ring in its new position
outside of the U.
Here is an illustration of the three-ring case. The bottom
of the puzzle is on the left-hand side of the page.
-
-
-
- //==\\
+
//==\\
|| ||
|| ||
*****||** ||
diff --git a/1993/ejb/patience.md b/1993/ejb/patience.md
index eee068182..0821aa6b5 100644
--- a/1993/ejb/patience.md
+++ b/1993/ejb/patience.md
@@ -54,9 +54,6 @@ Here is an illustration of the three-ring case. The bottom
of the puzzle is on the left-hand side of the page.
```
-
-
-
//==\\
|| ||
|| ||
diff --git a/1993/index.html b/1993/index.html
index dc88f9b37..846f37931 100644
--- a/1993/index.html
+++ b/1993/index.html
@@ -155,8 +155,8 @@ errors.
Please send us comments and suggestions what we have expressed above.
Also include anything else that you would like to see in future contests.
Send such email to:
If you use, distribute or publish these entries in some way, please drop
us a line. We enjoy seeing who, where and how the contest is used.
Final Comments
diff --git a/1993/jonth/README.md b/1993/jonth/README.md
index 59e6a5259..2537681cc 100644
--- a/1993/jonth/README.md
+++ b/1993/jonth/README.md
@@ -6,14 +6,14 @@ install [XQuartz](https://www.xquartz.org) in order to compile and run this
entry.
```sh
-make all
+ make all
```
## To use:
```sh
-./jonth # must be run on an X11 server
+ ./jonth # must be run on an X11 server
```
diff --git a/1993/jonth/index.html b/1993/jonth/index.html
index eea59ac41..8f7be10a1 100644
--- a/1993/jonth/index.html
+++ b/1993/jonth/index.html
@@ -132,8 +132,7 @@
Author:
Name: Jon Thingvold
-Location: NO - Kingdom of Norway (Norway)
-
@@ -146,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 72de26a4d..c16564900 100644
--- a/1993/leo/README.md
+++ b/1993/leo/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -10,13 +10,13 @@ make all
To have the computer guess:
```sh
-./leo [colors]
+ ./leo [colors]
```
To guess the computer's number:
```sh
-./mind [colors]
+ ./mind [colors]
```
where:
@@ -72,35 +72,35 @@ Please don't type ^D at the prompt!!
##### EXAMPLE: Suppose we think of 1234
```
-$ ./leo
-(1296): 6433
-?? 12 # one 3 is a bull, another is a cow, and 4 is a cow
-(160): 5363
-?? 02 # both 3's are cows
-(21): 4231
-?? 22 # 2 and 3 are bulls, 4 and 1 are cows
-(2): 4132
-?? 13 # 3 is a bull; 1, 2 and 4 are cows
-(1): 1234
-?? 40 # you may enter everything there
+ $ ./leo
+ (1296): 6433
+ ?? 12 # one 3 is a bull, another is a cow, and 4 is a cow
+ (160): 5363
+ ?? 02 # both 3's are cows
+ (21): 4231
+ ?? 22 # 2 and 3 are bulls, 4 and 1 are cows
+ (2): 4132
+ ?? 13 # 3 is a bull; 1, 2 and 4 are cows
+ (1): 1234
+ ?? 40 # you may enter everything there
```
##### EXAMPLE: Guess the computer's number
```
-$ ./mind
-(1296): ???? 1122 # my strategy isn't the best, just as example
-00
-(256): ???? 3344
-20
-(18): ???? 5566
-02
-(6): ???? 3654
-11
-(2): ???? 3355
-00
-(1): ???? 6444
-40 # we have guessed the number
+ $ ./mind
+ (1296): ???? 1122 # my strategy isn't the best, just as example
+ 00
+ (256): ???? 3344
+ 20
+ (18): ???? 5566
+ 02
+ (6): ???? 3654
+ 11
+ (2): ???? 3355
+ 00
+ (1): ???? 6444
+ 40 # we have guessed the number
```
diff --git a/1993/leo/index.html b/1993/leo/index.html
index d57b73999..c18fa4724 100644
--- a/1993/leo/index.html
+++ b/1993/leo/index.html
@@ -132,8 +132,7 @@
Author:
Name: Leonid A. Broukhis
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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:
@@ -181,31 +180,31 @@ backspaces. Do “disable scrolling” on cmdtool or similar emulators.
Bugs
Please don’t type ^D at the prompt!!
EXAMPLE: Suppose we think of 1234
-
$ ./leo
-(1296): 6433
-?? 12 # one 3 is a bull, another is a cow, and 4 is a cow
-(160): 5363
-?? 02 # both 3's are cows
-(21): 4231
-?? 22 # 2 and 3 are bulls, 4 and 1 are cows
-(2): 4132
-?? 13 # 3 is a bull; 1, 2 and 4 are cows
-(1): 1234
-?? 40 # you may enter everything there
+
$ ./leo
+ (1296): 6433
+ ?? 12 # one 3 is a bull, another is a cow, and 4 is a cow
+ (160): 5363
+ ?? 02 # both 3's are cows
+ (21): 4231
+ ?? 22 # 2 and 3 are bulls, 4 and 1 are cows
+ (2): 4132
+ ?? 13 # 3 is a bull; 1, 2 and 4 are cows
+ (1): 1234
+ ?? 40 # you may enter everything there
EXAMPLE: Guess the computer’s number
-
$ ./mind
-(1296): ???? 1122 # my strategy isn't the best, just as example
-00
-(256): ???? 3344
-20
-(18): ???? 5566
-02
-(6): ???? 3654
-11
-(2): ???? 3355
-00
-(1): ???? 6444
-40 # we have guessed the number
+
$ ./mind
+ (1296): ???? 1122 # my strategy isn't the best, just as example
+ 00
+ (256): ???? 3344
+ 20
+ (18): ???? 5566
+ 02
+ (6): ???? 3654
+ 11
+ (2): ???? 3355
+ 00
+ (1): ???? 6444
+ 40 # we have guessed the number
@@ -143,9 +142,9 @@ 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
+
";main(){puts("Hello World!");}char*C=".c
When that file is compiled, it will greet the world in the
traditional fashion of C.
For an explanation of why and how this works see the author’s remarks. The gist
@@ -163,18 +162,18 @@ with gcc >= 2.3.3 or using clang. See Alternate cod
section below for more details.
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
@@ -190,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
@@ -201,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 8ba8c7420..af15d25ee 100644
--- a/1993/plummer/README.md
+++ b/1993/plummer/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make alt
+ make alt
```
We recommend that you try the alternate version first to get a better idea of
@@ -13,21 +13,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
+ 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
+ make clobber SLEEP=1500 alt
```
## To use:
```sh
-./plummer.alt number arg
+ ./plummer.alt number arg
```
where:
@@ -43,21 +43,21 @@ bypass](https://hitchhikers.fandom.com/wiki/Bypass).
## Try:
```sh
-./try.alt.sh
+ ./try.alt.sh
-./try.alt.sh 21701
+ ./try.alt.sh 21701
-SLEEP=500 ./try.alt.sh
+ SLEEP=500 ./try.alt.sh
-SLEEP=900 ./try.alt.sh 789789789789789
+ SLEEP=900 ./try.alt.sh 789789789789789
-./try.alt.sh 789789789
+ ./try.alt.sh 789789789
-SLEEP=400 ./try.alt.sh 42424242424242
+ SLEEP=400 ./try.alt.sh 42424242424242
-SLEEP=1000 ./try.alt.sh xyzzyzzyx
+ SLEEP=1000 ./try.alt.sh xyzzyzzyx
-SLEEP=1200 ./try.alt.sh xyzzyzzyx 5555
+ SLEEP=1200 ./try.alt.sh xyzzyzzyx 5555
```
@@ -71,7 +71,7 @@ course).
### Original build:
```sh
-make all
+ make all
```
@@ -83,19 +83,19 @@ Use `plummer` as you would `plummer.alt` above.
### Original try:
```sh
-./try.sh
+ ./try.sh
-./try.sh 21701
+ ./try.sh 21701
-./try.sh 789789789789789
+ ./try.sh 789789789789789
-./try.sh 789789789
+ ./try.sh 789789789
-./try.sh 42424242424242
+ ./try.sh 42424242424242
-./try.sh xyzzyzzyx
+ ./try.sh xyzzyzzyx
-./try.sh xyzzyzzyx 5555
+ ./try.sh xyzzyzzyx 5555
```
diff --git a/1993/plummer/index.html b/1993/plummer/index.html
index bd9c837d7..5bec962f0 100644
--- a/1993/plummer/index.html
+++ b/1993/plummer/index.html
@@ -132,8 +132,7 @@
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:
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).
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 2de1292e7..d339f141e 100644
--- a/1993/rince/README.md
+++ b/1993/rince/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
NOTE: there are two alternate versions of this program, both allowing one to
@@ -14,7 +14,7 @@ See the [Alternate code](#alternate-code) section below.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [bugs report with 1993/rince](../../bugs.html#1993_rince).
@@ -23,7 +23,7 @@ For more detailed information see [bugs report with 1993/rince](../../bugs.html#
## To use:
```sh
-./rince [cabbage]
+ ./rince [cabbage]
```
where:
@@ -38,13 +38,13 @@ value 17 in the lines:
```c
-struct timeval v= {0,1<<17} ;
+ struct timeval v= {0,1<<17} ;
```
and
```c
-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.
@@ -58,7 +58,7 @@ changed).
### Alternate build:
```sh
-make SLEEP=18 clobber alt
+ make SLEEP=18 clobber alt
```
Replace 18 with whatever number you wish.
@@ -108,7 +108,7 @@ 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
+ gcc -fno-builtin -I/usr/include -o rince rince.c -lcurses -ltermcap
```
@@ -145,13 +145,13 @@ The proper definition for usage would be: `./rince [data_filename]`
I have compiled in on the following systems:
```
-System OS Compiler (and flags)
-DECstation 5000/240 Ultrix 4.2A c89 -std
-SPARCstation 1+ SunOS 4.1 gcc -ansi -pedantic
-SPARCstation 10/31 Solaris 2.1 gcc -ansi -pedantic (*)
-DECAlpha 3000/500 OSF/1 V1.2 c89 -std
-SGI Indigo (R4000) IRIX 4.0.5F cc -ansi
-Alliant FX2800 Conentrix 3.0.0 fxc
+ System OS Compiler (and flags)
+ DECstation 5000/240 Ultrix 4.2A c89 -std
+ SPARCstation 1+ SunOS 4.1 gcc -ansi -pedantic
+ SPARCstation 10/31 Solaris 2.1 gcc -ansi -pedantic (*)
+ DECAlpha 3000/500 OSF/1 V1.2 c89 -std
+ SGI Indigo (R4000) IRIX 4.0.5F cc -ansi
+ Alliant FX2800 Conentrix 3.0.0 fxc
```
\* I never said it worked! The guidelines state that you dislike programs that
diff --git a/1993/rince/design.html b/1993/rince/design.html
index 1db988153..cf436bf45 100644
--- a/1993/rince/design.html
+++ b/1993/rince/design.html
@@ -130,24 +130,23 @@ slightly cheaty, cellular automata system, with some of the transitions
bound to key presses.
For instance, assume you wish to make a boulder o roll off a hill /
A standard automata would have 2 rules something like this:
-
- o.. ...
- \.. --> 'o' .o. --> '.'
- ... .\.
+
o.. ...
+ \.. --> 'o' .o. --> '.'
+ ... .\.
However, the system I devised, in order to keep things small and neat(!),
was to define a 3x3 to 3x3 map (instead of the 3x3 to 1x1 shown above).
Hence:
-
.o. ...
- .\. --> .\o
- ... ...
+
.o. ...
+ .\. --> .\o
+ ... ...
This does of course have the odd problem with clashes. What if we want to roll
two boulders down simultaneously towards the same square. I perform no
buffering, and so this situation is just a ‘fight it out’ and let which ever
transition has priority win. Such a case may produce the following change of
maps (depending on which ‘roll’ transition is used first).
-
o.o ..o o..
- \./ changes to \o/ or to \o/
- ... ... ...
+
o.o ..o o..
+ \./ changes to \o/ or to \o/
+ ... ... ...
Here I also use wildcards. On the match side (left) of the transition, an
asterisk will match against any character. On the update side (right), an
asterisk means ‘keep whatever was here before’. So the above example
simply means to swap the @ and . around when l is pressed. For the
purposes of space saving, this transition is shrunk to a single line.
Key: K
-
a b c 1 2 3
- d e f 4 5 6
- g h i 7 8 9
+
a b c 1 2 3
+ d e f 4 5 6
+ g h i 7 8 9
is written as: eabcdfghi512346789K.
If there are no keys needed for this transition, the character *1 should
be used instead. Now the format of the game description file is now
the following (angle brackets denote an ‘entity’ to be defined):
The <X size> should take into account the newline at the end of each line
of map, and hence should also be one larger than expected.
'o' .o. --> '.'
- ... .\.
+ o.. ...
+ \.. --> 'o' .o. --> '.'
+ ... .\.
```
However, the system I devised, in order to keep things small and neat(!),
@@ -21,9 +20,9 @@ was to define a 3x3 to 3x3 map (instead of the 3x3 to 1x1 shown above).
Hence:
```
- .o. ...
- .\. --> .\o
- ... ...
+ .o. ...
+ .\. --> .\o
+ ... ...
```
This does of course have the odd problem with clashes. What if we want to roll
@@ -33,9 +32,9 @@ transition has priority win. Such a case may produce the following change of
maps (depending on which 'roll' transition is used first).
```
- o.o ..o o..
- \./ changes to \o/ or to \o/
- ... ... ...
+ o.o ..o o..
+ \./ changes to \o/ or to \o/
+ ... ... ...
```
I claim that it is possible to perform all of the 3x3 to 1x1 transitions in a
@@ -60,9 +59,9 @@ is hit we have a transition like:
## Key: l
```
- * * * * * *
- * @ . * . @
- * * * * * *
+ * * * * * *
+ * @ . * . @
+ * * * * * *
```
Here I also use wildcards. On the match side (left) of the transition, an
@@ -74,9 +73,9 @@ purposes of space saving, this transition is shrunk to a single line.
## Key: K
```
- a b c 1 2 3
- d e f 4 5 6
- g h i 7 8 9
+ a b c 1 2 3
+ d e f 4 5 6
+ g h i 7 8 9
```
is written as: `eabcdfghi512346789K`.
@@ -87,8 +86,8 @@ the following (angle brackets denote an 'entity' to be defined):
```
- *\n*\n[ \t]+\n
- . Since it is far more obscure
this way, I hope you’ll forgive me.
The outline of the program is roughly as follows
-
while (more lines) {
- if (line is in morse) {
- while (more characters) {
- skip next sequence
- if (' ')
- putchar(' ');
- else
- decode_sequence; /* backwards */
- }
- } else {
- while (more characters) {
- if (isalnum)
- encode_character;
- putchar(' ');
- }
- }
+
while (more lines) {
+ if (line is in morse) {
+ while (more characters) {
+ skip next sequence
+ if (' ')
+ putchar(' ');
+ else
+ decode_sequence; /* backwards */
+ }
+ } else {
+ while (more characters) {
+ if (isalnum)
+ encode_character;
+ putchar(' ');
+ }
+ }
Because of the twowhile(more characters) loops are the same, I’ve
exchanged the if(line is in morse) and the two while loops (so there
is singlewhile loop). However, we must now store the if(line is in morse) test for efficiency (it would be stupid to test the entire line
@@ -246,13 +246,13 @@ as the temporary l[0] will remain != 0.
I’ve put the ifs in the above layout into a single switch. Hope you don’t
mind ;-)
Summary of the use of l[999]:
-
l[0] result of "is this line in morse" test
-l[0] temporary shift during encoding
-l[0] - l[33] Morse codings (letters and digits, plus garbage)
-l[11] - l[14] strspn argument
-l[12] - l[14] strspn argument
-l[34] terminator for backward decoding
-l[35] - l[998] input line
+
l[0] result of "is this line in morse" test
+ l[0] temporary shift during encoding
+ l[0] - l[33] Morse codings (letters and digits, plus garbage)
+ l[11] - l[14] strspn argument
+ l[12] - l[14] strspn argument
+ l[34] terminator for backward decoding
+ l[35] - l[998] input line
Selected notes:
- We don’t need to declare isalnum(3) (or include ctype.h) as its implicit
diff --git a/1998/dorssel/dorssel.md b/1998/dorssel/dorssel.md
index c1c13144d..202f74b6c 100644
--- a/1998/dorssel/dorssel.md
+++ b/1998/dorssel/dorssel.md
@@ -4,9 +4,9 @@ Morse codes for letters and digits use sequences of 1 to 5 (inclusive)
Morse symbols (denoted as `.` or `-`), e.g.
```
-E .
-Z --..
-3 ...--
+ E .
+ Z --..
+ 3 ...--
```
(BTW: digits always have 5 symbols, letters 1 to 4. I didn't use this fact.)
@@ -23,9 +23,9 @@ The least significant bit contains the first symbol of a Morse code, so
we have
```
-E > 0......1
-Z > 0...1100
-3 > 0..00111
+ E > 0......1
+ Z > 0...1100
+ 3 > 0..00111
```
The dots still have to be determined. But we also need to encode the
@@ -33,9 +33,9 @@ length of the sequence. Since there are only 4 different kind of lengths,
two bits would suffice, e.g.
```
-E > 000....1
-Z > 010.1100
-3 > 01100111
+ E > 000....1
+ Z > 010.1100
+ 3 > 01100111
```
That means bits 6 and 5 set to 00 is length 1, set to 01 is length 2, etc.
@@ -43,30 +43,30 @@ 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 ? '-' : '.');
- 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
-length 3: 000.1xxx
-length 4: 00.1xxxx Z > 00.11100
-length 5: 0.1xxxxx 3 > 0.100111
+ length 1: 00000.1x E > 00000.11
+ length 2: 0000.1xx
+ length 3: 000.1xxx
+ 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
```c
-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
@@ -76,11 +76,11 @@ the initializing (encoding) string awkward. Hence I came up with the
following
```
-length 1: 0010010x E > 00100101 (= '%')
-length 2: 001010xx
-length 3: 00110xxx
-length 4: 0100xxxx Z > 01001100 (= 'L')
-length 5: 011xxxxx 3 > 01100111 (= 'g')
+ length 1: 0010010x E > 00100101 (= '%')
+ length 2: 001010xx
+ length 3: 00110xxx
+ length 4: 0100xxxx Z > 01001100 (= 'L')
+ length 5: 011xxxxx 3 > 01100111 (= 'g')
```
Notice these encodings in the initialization string. Only the coding for
@@ -88,10 +88,10 @@ Notice these encodings in the initialization string. Only the coding for
is encoded still allows the encoding to be its own counter:
```c
-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`.
@@ -102,7 +102,7 @@ The character `'-'` (ASCII 45) and `'.'` (ASCII 46) are conveniently in
sequence, so the putchar can simply be
```c
-putchar(45 + encoding % 2);
+ putchar(45 + encoding % 2);
```
I used the modulo operator this time, because `+` takes precedence over `&`.
@@ -111,7 +111,7 @@ The assignment can be incorporated into the `while` control test, and a
as a `while` loop with a comma operator in the test:
```c
-while(putchar(45 + encoding % 2), encoding = encoding + 32 >> 1);
+ while(putchar(45 + encoding % 2), encoding = encoding + 32 >> 1);
```
Voila.
@@ -144,22 +144,22 @@ this way, I hope you'll forgive me.
The outline of the program is roughly as follows
```
-while (more lines) {
- if (line is in morse) {
- while (more characters) {
- skip next sequence
- if (' ')
- putchar(' ');
- else
- decode_sequence; /* backwards */
- }
- } else {
- while (more characters) {
- if (isalnum)
- encode_character;
- putchar(' ');
- }
- }
+ while (more lines) {
+ if (line is in morse) {
+ while (more characters) {
+ skip next sequence
+ if (' ')
+ putchar(' ');
+ else
+ decode_sequence; /* backwards */
+ }
+ } else {
+ while (more characters) {
+ if (isalnum)
+ encode_character;
+ putchar(' ');
+ }
+ }
```
Because of the *two* `while(more characters)` loops are the same, I've
@@ -179,13 +179,13 @@ mind ;-)
Summary of the use of l[999]:
```
-l[0] result of "is this line in morse" test
-l[0] temporary shift during encoding
-l[0] - l[33] Morse codings (letters and digits, plus garbage)
-l[11] - l[14] strspn argument
-l[12] - l[14] strspn argument
-l[34] terminator for backward decoding
-l[35] - l[998] input line
+ l[0] result of "is this line in morse" test
+ l[0] temporary shift during encoding
+ l[0] - l[33] Morse codings (letters and digits, plus garbage)
+ l[11] - l[14] strspn argument
+ l[12] - l[14] strspn argument
+ l[34] terminator for backward decoding
+ l[35] - l[998] input line
```
---
diff --git a/1998/dorssel/index.html b/1998/dorssel/index.html
index e5c337213..717e14647 100644
--- a/1998/dorssel/index.html
+++ b/1998/dorssel/index.html
@@ -132,8 +132,7 @@
The file dorssel.md contains all the information needed to
understand this program. For an obfuscated spoiler, try
-
./dorssel< dorssel.md
+
./dorssel< dorssel.md
(trans \x(+ x x)) (trans 3)
--> (abs x (trans + x x)) 3
--> (abs x + x x) 3
--> S (abs x + x) (abs x x) 3
--> S (S (abs x +) (abs x x)) I 3
--> S (S (K +) I) I 3
--> S (S (K +) I) I 3
+ trans \x(+ x x) 3
+ -> (trans \x(+ x x)) (trans 3)
+ -> (abs x (trans + x x)) 3
+ -> (abs x + x x) 3
+ -> S (abs x + x) (abs x x) 3
+ -> S (S (abs x +) (abs x x)) I 3
+ -> S (S (K +) I) I 3
+ -> S (S (K +) I) I 3
```
We can then check that this evaluates to the expected result:
```
- S (S (K +) I) I 3
--> S (K +) I 3 (I 3)
--> K + 3 (I 3) (I 3)
--> + (I 3) (I 3)
--> + 3 3
+ S (S (K +) I) I 3
+ -> S (K +) I 3 (I 3)
+ -> K + 3 (I 3) (I 3)
+ -> + (I 3) (I 3)
+ -> + 3 3
```
It is possible to perform a slightly more compact translation with a
@@ -166,24 +166,24 @@ couple of simple optimisations. For example, note that `K (a b)` is the
same as `S (K a) (K b)`, because
```
- K (a b) x
--> a b
+ K (a b) x
+ -> a b
```
and
```
- S (K a) (K b) x
--> K a x (K b x)
--> a b
+ S (K a) (K b) x
+ -> K a x (K b x)
+ -> a b
```
Also, `S (K a) I` is the same as just `a` because
```
- S (K a) I x
--> K a x (I x)
--> a x
+ S (K a) I x
+ -> K a x (I x)
+ -> a x
```
The program simply reads a lambda expression from the standard input,
@@ -245,7 +245,7 @@ writes that character on `stdout`, and finally it calls its second
argument as a function with the argument `I`, i.e.
```
-P x f -> f I
+ P x f -> f I
```
with a side-effect.
@@ -255,7 +255,7 @@ argument as a function with the appropriate `E` combinator as an
argument, i.e.
```
-G f -> f E(c)
+ G f -> f E(c)
```
with a side-effect.
@@ -274,7 +274,7 @@ The `Y` combinator is used for implementing recursive functions. It has
the evaluation rule
```
-Y f -> f (Y f)
+ Y f -> f (Y f)
```
so that it can be used to call a function with itself as an argument.
@@ -282,7 +282,7 @@ For example, if I had the appropriate arithmetic operators defined, I
could write a factorial function in the lambda calculus like this:
```
-Y \f\n((= n 0) 1 (* n (f (- n 1))))
+ Y \f\n((= n 0) 1 (* n (f (- n 1))))
```
`OFL` provides a facility for naming expressions so that they can be used
@@ -302,11 +302,11 @@ when translating an expression from the lambda calculus to combinators,
and therefore more compact programs. Their evaluation rules are:
```
-B f g x -> f (g x)
-C f g x -> (f x) g
-BB c f g x -> c (f (g x))
-CC c f g x -> c (f x) g
-SS c f g x -> c (f x) (g x)
+ B f g x -> f (g x)
+ C f g x -> (f x) g
+ BB c f g x -> c (f (g x))
+ CC c f g x -> c (f x) g
+ SS c f g x -> c (f x) (g x)
```
I used them to help fit my program into the required space; unfortunately
@@ -315,14 +315,14 @@ it reads into the required space. The complete optimisation rules
including the ones it doesn't use are:
```
-S (K p) I -> p
-S (K p) (K r) -> K ( p r )
-S (K p) (B r s) -> BB p r s
-S (K p) r -> B p r
-S (B p q) (K r) -> CC p q r
-S p (K r) -> C p r
-S (B p q) r -> SS p q r
-S p r -> S p r
+ S (K p) I -> p
+ S (K p) (K r) -> K ( p r )
+ S (K p) (B r s) -> BB p r s
+ S (K p) r -> B p r
+ S (B p q) (K r) -> CC p q r
+ S p (K r) -> C p r
+ S (B p q) r -> SS p q r
+ S p r -> S p r
```
### The implementation of `OFL`
diff --git a/1998/fanf/index.html b/1998/fanf/index.html
index 0afb9a707..343ca2462 100644
--- a/1998/fanf/index.html
+++ b/1998/fanf/index.html
@@ -132,8 +132,7 @@
Author:
Name: Tony Finch
-Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
-
+Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
@@ -142,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
@@ -166,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
@@ -218,44 +217,44 @@ since it is equivalent to S K K:
The algorithm for translating lambda expressions into combinator
expressions works as follows. There are three forms of lambda expression
to consider: variables, applications, and abstractions.
-
trans v -> v (variable)
-trans a b -> (trans a) (trans b ) (application)
-trans \ab -> abs a (trans b) (abstraction)
+
trans v -> v (variable)
+ trans a b -> (trans a) (trans b ) (application)
+ trans \ab -> abs a (trans b) (abstraction)
There are a further three cases to consider for the body of lambda
expressions, where we need to do the magic that transforms away the
variables.
-
abs a f x -> S (abs a f) (abs a x)
-abs a b -> K b (b != a)
-abs a a -> I
+
abs a f x -> S (abs a f) (abs a x)
+ abs a b -> K b (b != a)
+ abs a a -> I
E.g. suppose we had combinator expressions for + and 3 and we wanted
to see what the combinator expression for doubling 3 looked like:
-
trans \x(+ x x) 3
--> (trans \x(+ x x)) (trans 3)
--> (abs x (trans + x x)) 3
--> (abs x + x x) 3
--> S (abs x + x) (abs x x) 3
--> S (S (abs x +) (abs x x)) I 3
--> S (S (K +) I) I 3
--> S (S (K +) I) I 3
+
trans \x(+ x x) 3
+ -> (trans \x(+ x x)) (trans 3)
+ -> (abs x (trans + x x)) 3
+ -> (abs x + x x) 3
+ -> S (abs x + x) (abs x x) 3
+ -> S (S (abs x +) (abs x x)) I 3
+ -> S (S (K +) I) I 3
+ -> S (S (K +) I) I 3
We can then check that this evaluates to the expected result:
-
S (S (K +) I) I 3
--> S (K +) I 3 (I 3)
--> K + 3 (I 3) (I 3)
--> + (I 3) (I 3)
--> + 3 3
+
S (S (K +) I) I 3
+ -> S (K +) I 3 (I 3)
+ -> K + 3 (I 3) (I 3)
+ -> + (I 3) (I 3)
+ -> + 3 3
It is possible to perform a slightly more compact translation with a
couple of simple optimisations. For example, note that K (a b) is the
same as S (K a) (K b), because
-
K (a b) x
--> a b
+
K (a b) x
+ -> a b
and
-
S (K a) (K b) x
--> K a x (K b x)
--> a b
+
S (K a) (K b) x
+ -> K a x (K b x)
+ -> a b
Also, S (K a) I is the same as just a because
-
S (K a) I x
--> K a x (I x)
--> a x
+
S (K a) I x
+ -> K a x (I x)
+ -> a x
The program simply reads a lambda expression from the standard input,
translates it into a combinator expression using the transformation and
optimisations described above, and prints out the result.
@@ -305,12 +304,12 @@ obfuscated form E('a') char then else.
its first argument and checking that it is some form of E. It then
writes that character on stdout, and finally it calls its second
argument as a function with the argument I, i.e.
-
P x f -> f I
+
P x f -> f I
with a side-effect.
The G combinator just reads a character from stdin then calls its
argument as a function with the appropriate E combinator as an
argument, i.e.
-
G f -> f E(c)
+
G f -> f E(c)
with a side-effect.
One of the problems with non-strict languages is that it is hard to
predict in advance in which order side-effects will occur. In my program
@@ -323,11 +322,11 @@ CPS form of the I/O monad from page 6 of “Imperative Functional
Programming”.)
The Y combinator is used for implementing recursive functions. It has
the evaluation rule
-
Y f -> f (Y f)
+
Y f -> f (Y f)
so that it can be used to call a function with itself as an argument.
For example, if I had the appropriate arithmetic operators defined, I
could write a factorial function in the lambda calculus like this:
-
Y \f\n((= n 0) 1 (* n (f (- n 1))))
+
Y \f\n((= n 0) 1 (* n (f (- n 1))))
OFL provides a facility for naming expressions so that they can be used
more than once without writing them in full. A definition must be written
on one line in the form l name b expression where l is short for
@@ -342,23 +341,23 @@ expression must be surrounded by brackets.
basic eight. These combinators provide greater scope for optimisation
when translating an expression from the lambda calculus to combinators,
and therefore more compact programs. Their evaluation rules are:
-
B f g x -> f (g x)
-C f g x -> (f x) g
-BB c f g x -> c (f (g x))
-CC c f g x -> c (f x) g
-SS c f g x -> c (f x) (g x)
+
B f g x -> f (g x)
+ C f g x -> (f x) g
+ BB c f g x -> c (f (g x))
+ CC c f g x -> c (f x) g
+ SS c f g x -> c (f x) (g x)
I used them to help fit my program into the required space; unfortunately
I couldn’t fit the version that fully optimises the lambda expressions
it reads into the required space. The complete optimisation rules
including the ones it doesn’t use are:
-
S (K p) I -> p
-S (K p) (K r) -> K ( p r )
-S (K p) (B r s) -> BB p r s
-S (K p) r -> B p r
-S (B p q) (K r) -> CC p q r
-S p (K r) -> C p r
-S (B p q) r -> SS p q r
-S p r -> S p r
+
S (K p) I -> p
+ S (K p) (K r) -> K ( p r )
+ S (K p) (B r s) -> BB p r s
+ S (K p) r -> B p r
+ S (B p q) (K r) -> CC p q r
+ S p (K r) -> C p r
+ S (B p q) r -> SS p q r
+ S p r -> S p r
The implementation of OFL
Although OFL has completely different syntax and semantics to C, all you
need to compile OFL programs is a C compiler and a header file (which in
diff --git a/1998/index.html b/1998/index.html
index 3b4578965..3c24c900b 100644
--- a/1998/index.html
+++ b/1998/index.html
@@ -207,7 +207,7 @@ skipped over 1997.
Please send us comments and suggestions what we have expressed above.
Also include anything else that you would like to see in future contests.
Send such email to:
-
questions@ioccc.org
+
questions@ioccc.org
IMPORTANT NOTE: The email addresses found above are for historical
purposes only, and should not be used today. See
contact.html for up to date contact details
diff --git a/1998/schnitzi/README.md b/1998/schnitzi/README.md
index d571e800d..f088cdb61 100644
--- a/1998/schnitzi/README.md
+++ b/1998/schnitzi/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -10,7 +10,7 @@ make all
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [1998 schnitzi bugs](../../bugs.html#1998_schnitzi).
@@ -19,12 +19,12 @@ For more detailed information see [1998 schnitzi bugs](../../bugs.html#1998_schn
## To use:
```sh
-./schnitzi n > sort.c
-make sort
-./sort
-# enter three numbers, space separated
+ ./schnitzi n > sort.c
+ make sort
+ ./sort
+ # enter three numbers, space separated
-echo x y z | ./sort
+ echo x y z | ./sort
```
where `n` and `x`, `y` and `z` are numbers.
@@ -33,18 +33,18 @@ where `n` and `x`, `y` and `z` are numbers.
## Try:
```sh
-./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
+ ./schnitzi 5 > sort.c
+ make sort
-# try running the next command four or five times:
-echo 2 5 3 1 | ./sort
+ # try running the next command four or five times:
+ echo 2 5 3 1 | ./sort
```
Why does this happen?
@@ -100,7 +100,7 @@ So what does it do? Give it an integer `(1 < n < 27)` on the command
line, such as
```sh
-./schnitzi 5
+ ./schnitzi 5
```
The output will itself be a lipographic program, one which expects input of
@@ -110,7 +110,7 @@ looping. To see the resulting program run, redirect the output from
`schnitzi` into another file, like this
```sh
-./schnitzi 4 > sort.c
+ ./schnitzi 4 > sort.c
```
and then compile it.
diff --git a/1998/schnitzi/index.html b/1998/schnitzi/index.html
index a0325fcaa..a4c1b34a3 100644
--- a/1998/schnitzi/index.html
+++ b/1998/schnitzi/index.html
@@ -132,8 +132,7 @@
./schnitzi n > sort.c
-make sort
-./sort
-# enter three numbers, space separated
+
./schnitzi n > sort.c
+make sort
+./sort
+# enter three numbers, space separated
-echo x y z |./sort
+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
+
./schnitzi 5 > sort.c
+make sort
-# try running the next command four or five times:
-echo 2 5 3 1 |./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
@@ -202,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 e94dfda77..6497f2aae 100644
--- a/1998/schweikh1/README.md
+++ b/1998/schweikh1/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
There is an alternate version of this entry that will work with macOS. See the
@@ -13,7 +13,7 @@ includes some interesting details about the entry.
## To use:
```sh
-./schweikh1
+ ./schweikh1
```
@@ -31,7 +31,7 @@ if you don't have a Mac as it has some interesting details about the entry.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -88,15 +88,15 @@ the most likely result is no output and/or an exit status of 1.
If Amendment One headers are missing you will see something like:
```
-:
-gcc: /usr/include/iso646.h: No such file or directory
-gcc: No input files specified
-:
-gcc: /usr/include/wctype.h: No such file or directory
-gcc: No input files specified
-:
-gcc: /usr/include/wchar.h: No such file or directory
-gcc: No input files specified
+ :
+ gcc: /usr/include/iso646.h: No such file or directory
+ gcc: No input files specified
+ :
+ gcc: /usr/include/wctype.h: No such file or directory
+ gcc: No input files specified
+ :
+ gcc: /usr/include/wchar.h: No such file or directory
+ gcc: No input files specified
```
Bug your vendor for an upgrade.
@@ -127,17 +127,17 @@ 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
-#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
+ #include /* <- or where the bogus macro is defined */
+ #include
+ #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
@@ -155,18 +155,18 @@ 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
- ```
+```c
+ #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.
```c
-#define H(x)
-#include H(dio) /* expands to */
+ #define H(x)
+ #include H(dio) /* expands to */
```
is rejected by tcc version 4.1.2, the TenDRA compiler:
@@ -188,19 +188,19 @@ C compilers.
which may include octal escape sequences. Let's look at
```c
-#include
-#line 42 "foo\0bar"
-int main (void) {
- printf ("%s %d\n", __FILE__, (int)sizeof __FILE__);
- return 0;
-}
+ #include
+ #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!
+ foo 4 gcc 2.7.2.1, lcc
+ foo\0bar 9 tcc 4.1.2, Sunsoft cc turn "\0" into "\\0", ugh!
```
(I have written a bug report for gcc. Newer versions and egcs are ok.)
@@ -215,8 +215,8 @@ foo\0bar 9 tcc 4.1.2, Sunsoft cc turn "\0" into "\\0", ugh!
no chance to use Standardese weasel words as an escape: can I have
```c
- case :
- case :
+ case :
+ case :
```
in the same switch? (Note that you need the [invisible] newline. You
@@ -256,19 +256,18 @@ The advantages of an independent clean room approach...
```perl
-#!/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:
```sh
-perl ./charcount.pl schweikh1.c
+ perl ./charcount.pl schweikh1.c
```
diff --git a/1998/schweikh1/index.html b/1998/schweikh1/index.html
index 2e1e93461..98548f7c8 100644
--- a/1998/schweikh1/index.html
+++ b/1998/schweikh1/index.html
@@ -132,8 +132,7 @@
Author:
Name: Jens Schweikhardt
-Location: DE - Federal Republic of Germany (Germany)
-
+Location: DE - Federal Republic of Germany (Germany)
@@ -142,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.
@@ -193,15 +192,15 @@ When run, it is likely to uncover bugs in your system headers.
The program is run without arguments. If your compiler is buggy,
the most likely result is no output and/or an exit status of 1.
If Amendment One headers are missing you will see something like:
-
<iso646.h>:
-gcc: /usr/include/iso646.h: No such file or directory
-gcc: No input files specified
-<wctype.h>:
-gcc: /usr/include/wctype.h: No such file or directory
-gcc: No input files specified
-<wchar.h>:
-gcc: /usr/include/wchar.h: No such file or directory
-gcc: No input files specified
+
<iso646.h>:
+ gcc: /usr/include/iso646.h: No such file or directory
+ gcc: No input files specified
+ <wctype.h>:
+ gcc: /usr/include/wctype.h: No such file or directory
+ gcc: No input files specified
+ <wchar.h>:
+ gcc: /usr/include/wchar.h: No such file or directory
+ gcc: No input files specified
Bug your vendor for an upgrade.
The format of the info file is straightforward and described in the file
itself. Just load it in your favorite editor.
@@ -221,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);
-return0;
-}
+
#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);
+return0;
+}
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
@@ -244,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
@@ -265,15 +264,15 @@ 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
-
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!
+
foo 4 gcc 2.7.2.1, lcc
+ foo\0bar 9 tcc 4.1.2, Sunsoft cc turn "\0" into "\\0", ugh!
(I have written a bug report for gcc. Newer versions and egcs are ok.)
The %: and %:%: digraphs test for conformance to Amendment One.
@@ -284,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.)
@@ -316,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…
-
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 3234a38a5..cb10eee28 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.
@@ -150,13 +150,13 @@ string and the other a couple lines further below.
In the original the numbers are, respectively, 44 and 46, but with the gcc
limitation removed the numbers now are 43 and 45. But how does this work? Well
the command is:
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 aa022537e..ef18d9c0c 100644
--- a/1998/schweikh1/macos.md
+++ b/1998/schweikh1/macos.md
@@ -20,7 +20,7 @@ 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
+ sudo xcode-select --install
```
An important point is that the original version hard-coded `gcc` but just like
@@ -39,7 +39,7 @@ limitation removed the numbers now are `43` and `45`. But how does this work? We
the command is:
```
-"0gcc -ansi -E -dM -undef %s /usr/include/%s>r\0 ("
+ "0gcc -ansi -E -dM -undef %s /usr/include/%s>r\0 ("
```
which has been changed to be:
@@ -51,9 +51,9 @@ 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;
+ 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
diff --git a/1998/schweikh2/README.md b/1998/schweikh2/README.md
index 67bed9b95..2f7ed9b0e 100644
--- a/1998/schweikh2/README.md
+++ b/1998/schweikh2/README.md
@@ -1,30 +1,30 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./yarng
+ ./yarng
```
or
```sh
-./yarng integer_number
+ ./yarng integer_number
```
## Try:
```sh
-./try.sh
+ ./try.sh
-./yarng
-# watch what it does
+ ./yarng
+ # watch what it does
```
What is the difference between what is in the script and running `yarng` without
@@ -43,38 +43,37 @@ 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
+ 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
- "
-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:
```c
-#line 10 ONE(O(1,1,2,6,0,6))
+ #line 10 ONE(O(1,1,2,6,0,6))
```
turned into the line:
```c
-# 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:
```asm
-.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.
@@ -82,7 +81,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
+ make schweikh2 CFLAGS=-g
```
to trigger this error.
@@ -107,7 +106,7 @@ still can :-) ).
Because of this bug, the code was changed to be instead:
```c
-#line 10 "01\015"
+ #line 10 "01\015"
```
However in 2023 it was observed that _it is gcc_ (at least some versions?) that
@@ -115,22 +114,22 @@ has a problem with the compilation of the _modified_ program, giving an internal
compiler error:
```
-:10:16: warning: type defaults to 'int' in declaration of 'zero' [-Wimplicit-int]
-: In function 'main':
-:12:1: warning: missing terminating " character
-:12:19: internal compiler error: invalid built-in macro "__FILE__"
+ :10:16: warning: type defaults to 'int' in declaration of 'zero' [-Wimplicit-int]
+ : In function 'main':
+ :12:1: warning: missing terminating " character
+ :12:19: internal compiler error: invalid built-in macro "__FILE__"
```
so the line:
```c
-#line 10 "01\015"
+ #line 10 "01\015"
```
was changed to:
```c
-#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.
@@ -160,10 +159,10 @@ different values? How long would you need for an empirical test?
For example:
```sh
-$ ./yarng 32
-10111001010101110110010101001111
-$ ./yarng 5
-10011
+ $ ./yarng 32
+ 10111001010101110110010101001111
+ $ ./yarng 5
+ 10011
```
### Why I think this is obfuscated
diff --git a/1998/schweikh2/index.html b/1998/schweikh2/index.html
index 2534c80b0..f89d07d45 100644
--- a/1998/schweikh2/index.html
+++ b/1998/schweikh2/index.html
@@ -132,8 +132,7 @@
Author:
Name: Jens Schweikhardt
-Location: DE - Federal Republic of Germany (Germany)
-
+Location: DE - Federal Republic of Germany (Germany)
@@ -142,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
+
./try.sh
-./yarng
-# watch what it does
+./yarng
+# watch what it does
What is the difference between what is in the script and running yarng without
an arg?
Judges’ remarks:
@@ -161,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. :-)
@@ -192,18 +191,18 @@ 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:
-
:10:16: warning: type defaults to 'int' in declaration of 'zero' [-Wimplicit-int]
-: In function 'main':
-:12:1: warning: missing terminating " character
-:12:19: internal compiler error: invalid built-in macro "__FILE__"
+
:10:16: warning: type defaults to 'int' in declaration of 'zero' [-Wimplicit-int]
+ : In function 'main':
+ :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
@@ -224,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?
diff --git a/1998/schweikh3/README.md b/1998/schweikh3/README.md
index 73aacb211..5b9f48e6e 100644
--- a/1998/schweikh3/README.md
+++ b/1998/schweikh3/README.md
@@ -1,16 +1,16 @@
## To build:
```sh
-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
-`sizeof (char *) == 8`), increase the manifest constant 32767 on line
-31.
+ 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
+ `sizeof (char *) == 8`), increase the manifest constant 32767 on line
+ 31.
```
An alternate version allows one to fix this; see [alternate
@@ -24,7 +24,7 @@ all your favorite pictures off the Internet or from
`alt.binaries.pictures.*`, do
```sh
-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. :-)
@@ -35,7 +35,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
+ ./try.sh
```
Notice that the tool finds some files that are duplicates.
@@ -54,7 +54,7 @@ If you wish to change the size to say, 55555:
```sh
-make clobber SIZE=55555 alt
+ make clobber SIZE=55555 alt
```
or whatever you wish to redefine it to.
@@ -84,7 +84,7 @@ 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
+ `man ./samefile.1
```
Otherwise:
@@ -101,7 +101,7 @@ Otherwise:
#### SYNOPSIS
```sh
-./samefile
+ ./samefile
```
#### DESCRIPTION
@@ -142,13 +142,13 @@ 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
- 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
@@ -178,7 +178,7 @@ For everybody:
What are the duplicates under my home directory?
```sh
-find $HOME | ./samefile
+ find $HOME | ./samefile
```
For the sysadmin folks:
@@ -186,14 +186,14 @@ For the sysadmin folks:
Report all duplicate files under /usr larger than 16k:
```sh
-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?
```sh
-find /pub -type f | samefile | awk '{sum += $1} END {print sum}'
+ find /pub -type f | samefile | awk '{sum += $1} END {print sum}'
```
diff --git a/1998/schweikh3/index.html b/1998/schweikh3/index.html
index 790d3bec6..f4b75609c 100644
--- a/1998/schweikh3/index.html
+++ b/1998/schweikh3/index.html
@@ -132,8 +132,7 @@
Author:
Name: Jens Schweikhardt
-Location: DE - Federal Republic of Germany (Germany)
-
+Location: DE - Federal Republic of Germany (Germany)
@@ -142,23 +141,23 @@ 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
-`sizeof (char *) == 8`), increase the manifest constant 32767 on line
-31.
+
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
+ `sizeof (char *) == 8`), increase the manifest constant 32767 on line
+ 31.
An alternate version allows one to fix this; see alternate
code below.
To use:
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
@@ -166,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
@@ -182,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
@@ -220,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:
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
@@ -246,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 805912687..088fb7f15 100644
--- a/1998/tomtorfs/README.md
+++ b/1998/tomtorfs/README.md
@@ -1,32 +1,32 @@
## To build:
```sh
-make all
+ make all
```
## To use:
```sh
-./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)
-polynom : polynomial used for the CRC (hexadecimal)
-reflected : 0 if the CRC is not reflected, 1 if it is
-init : initial value for the CRC (hexadecimal)
-xor : value to xor the final CRC with (hexadecimal)
+ filename : file to calculate the CRC of
+ bitwidth : width of the CRC in bits (decimal)
+ polynom : polynomial used for the CRC (hexadecimal)
+ reflected : 0 if the CRC is not reflected, 1 if it is
+ init : initial value for the CRC (hexadecimal)
+ xor : value to xor the final CRC with (hexadecimal)
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -40,15 +40,15 @@ archiver that uses the CRC-32 algorithm.
## Author's remarks:
```
-Usage:
-./tomtorfs filename bitwidth polynom reflected init xor
+ Usage:
+ ./tomtorfs filename bitwidth polynom reflected init xor
-filename : file to calculate the CRC of
-bitwidth : width of the CRC in bits (decimal)
-polynom : polynomial used for the CRC (hexadecimal)
-reflected : 0 if the CRC is not reflected, 1 if it is
-init : initial value for the CRC (hexadecimal)
-xor : value to xor the final CRC with (hexadecimal)
+ filename : file to calculate the CRC of
+ bitwidth : width of the CRC in bits (decimal)
+ polynom : polynomial used for the CRC (hexadecimal)
+ reflected : 0 if the CRC is not reflected, 1 if it is
+ init : initial value for the CRC (hexadecimal)
+ xor : value to xor the final CRC with (hexadecimal)
```
### Examples
@@ -57,7 +57,7 @@ xor : value to xor the final CRC with (hexadecimal)
#### CRC-16:
```sh
-./tomtorfs filename 16 1021 0 FFFF 0000
+ ./tomtorfs filename 16 1021 0 FFFF 0000
```
@@ -65,22 +65,21 @@ xor : value to xor the final CRC with (hexadecimal)
```sh
-./tomtorfs filename 32 04C11DB7 1 FFFFFFFF FFFFFFFF
+ ./tomtorfs filename 32 04C11DB7 1 FFFFFFFF FFFFFFFF
```
#### XMODEM:
```sh
-./tomtorfs filename 16 8408 1 0000 0000
-
+ ./tomtorfs filename 16 8408 1 0000 0000
```
#### ARC:
```sh
-./tomtorfs filename 16 8005 1 0000 0000
+ ./tomtorfs filename 16 8005 1 0000 0000
```
@@ -110,22 +109,22 @@ The variable names are not very descriptive. They have the
following meanings:
```
-a = argc
-A = argv
+ a = argc
+ A = argv
-b = array of unsigned long variables
- b[0] = bit-width of the CRC (argv[2])
- b[1] = CRC polynomial (argv[3])
- b[2] = nonzero if CRC is reflected (argv[4])
- b[3] = initial value of CRC (argv[5])
- b[4] = value final CRC is XORed with (argv[6])
- b[5] = CRC value
- b[6] = byte from file
- b[7] = counter
+ b = array of unsigned long variables
+ b[0] = bit-width of the CRC (argv[2])
+ b[1] = CRC polynomial (argv[3])
+ b[2] = nonzero if CRC is reflected (argv[4])
+ b[3] = initial value of CRC (argv[5])
+ b[4] = value final CRC is XORed with (argv[6])
+ b[5] = CRC value
+ b[6] = byte from file
+ b[7] = counter
-B = FILE * through which the file argv[1] is opened
+ B = FILE * through which the file argv[1] is opened
-C = typedef for unsigned long
+ C = typedef for unsigned long
```
The first `for` loop simply reads the command-line arguments
diff --git a/1998/tomtorfs/index.html b/1998/tomtorfs/index.html
index 39d4bdccc..a66769e53 100644
--- a/1998/tomtorfs/index.html
+++ b/1998/tomtorfs/index.html
@@ -132,8 +132,7 @@
Author:
Name: Tom Torfs
-Location: ZZ - Unknown location
-
filename : file to calculate the CRC of
-bitwidth : width of the CRC in bits (decimal)
-polynom : polynomial used for the CRC (hexadecimal)
-reflected : 0 if the CRC is not reflected, 1 if it is
-init : initial value for the CRC (hexadecimal)
-xor : value to xor the final CRC with (hexadecimal)
+
filename : file to calculate the CRC of
+ bitwidth : width of the CRC in bits (decimal)
+ polynom : polynomial used for the CRC (hexadecimal)
+ reflected : 0 if the CRC is not reflected, 1 if it is
+ init : initial value for the CRC (hexadecimal)
+ xor : value to xor the final CRC with (hexadecimal)
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
archiver that uses the CRC-32 algorithm.
Usage:
+ ./tomtorfs filename bitwidth polynom reflected init xor
-filename : file to calculate the CRC of
-bitwidth : width of the CRC in bits (decimal)
-polynom : polynomial used for the CRC (hexadecimal)
-reflected : 0 if the CRC is not reflected, 1 if it is
-init : initial value for the CRC (hexadecimal)
-xor : value to xor the final CRC with (hexadecimal)
+ filename : file to calculate the CRC of
+ bitwidth : width of the CRC in bits (decimal)
+ polynom : polynomial used for the CRC (hexadecimal)
+ reflected : 0 if the CRC is not reflected, 1 if it is
+ init : initial value for the CRC (hexadecimal)
+ xor : value to xor the final CRC with (hexadecimal)
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.
@@ -191,22 +190,22 @@ the nice code shape I worked so hard on ;-) ) the code will become a bit more
readable.
The variable names are not very descriptive. They have the
following meanings:
-
a = argc
-A = argv
+
a = argc
+ A = argv
-b = array of unsigned long variables
- b[0] = bit-width of the CRC (argv[2])
- b[1] = CRC polynomial (argv[3])
- b[2] = nonzero if CRC is reflected (argv[4])
- b[3] = initial value of CRC (argv[5])
- b[4] = value final CRC is XORed with (argv[6])
- b[5] = CRC value
- b[6] = byte from file
- b[7] = counter
+ b = array of unsigned long variables
+ b[0] = bit-width of the CRC (argv[2])
+ b[1] = CRC polynomial (argv[3])
+ b[2] = nonzero if CRC is reflected (argv[4])
+ b[3] = initial value of CRC (argv[5])
+ b[4] = value final CRC is XORed with (argv[6])
+ b[5] = CRC value
+ b[6] = byte from file
+ b[7] = counter
-B = FILE * through which the file argv[1] is opened
+ B = FILE * through which the file argv[1] is opened
-C = typedef for unsigned long
+ C = typedef for unsigned long
The first for loop simply reads the command-line arguments
in the b[] array. The third parameter to strtoul(3) causes
all arguments to be in base-16 (hex) except the first one,
diff --git a/2000/README.md b/2000/README.md
index 6ba3f12cd..94895be1e 100644
--- a/2000/README.md
+++ b/2000/README.md
@@ -84,7 +84,7 @@ Also include anything else that you would like to see in future contests.
Send such email to:
```
-questions@ioccc.org
+ questions@ioccc.org
```
**IMPORTANT NOTE**: The email addresses found above are for historical
diff --git a/2000/anderson/README.md b/2000/anderson/README.md
index 65833ca62..f215bbee9 100644
--- a/2000/anderson/README.md
+++ b/2000/anderson/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-echo something | ./anderson
+ echo something | ./anderson
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -53,17 +53,16 @@ characters (semaphore smileys, if you will). For example, given the
input "Hello, world!", the output will be:
```
- <> <> <> <> <> <>
- _() ()/ ()/ ()/ _\) () (/_ _\)
-[] /^ |^^ /^^ /^^ [] ^^ |^^| ^^ [] [] ^^
- <>[ [][ <>][ <>][ ][ [][] ][ ][
+ <> <> <> <> <> <>
+ _() ()/ ()/ ()/ _\) () (/_ _\)
+ [] /^ |^^ /^^ /^^ [] ^^ |^^| ^^ [] [] ^^
+ <>[ [][ <>][ <>][ ][ [][] ][ ][
- <> []
- _()_ ()/ |() ()
-[] ^^ [] /^^ ^^| |^^|
- ][ <>][ ][] [][]
-
+ <> []
+ _()_ ()/ |() ()
+ [] ^^ [] /^^ ^^| |^^|
+ ][ <>][ ][] [][]
```
The program is obfuscated without the use of the preprocessor or any
diff --git a/2000/anderson/index.html b/2000/anderson/index.html
index 8b0302949..b3f21a1e7 100644
--- a/2000/anderson/index.html
+++ b/2000/anderson/index.html
@@ -132,8 +132,7 @@
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
@@ -172,17 +171,16 @@ characters are ignored. The codes themselves are written to standard
output as a depiction of a person holding two flags, using only ASCII
characters (semaphore smileys, if you will). For example, given the
input “Hello, world!”, the output will be:
The program is obfuscated without the use of the preprocessor or any
special compilation parameters. In fact, the program doesn’t even
bother using any keywords, save the single char at the beginning.
diff --git a/2000/bellard/README.md b/2000/bellard/README.md
index b6983df80..91e212529 100644
--- a/2000/bellard/README.md
+++ b/2000/bellard/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./bellard
+ ./bellard
```
@@ -23,6 +23,7 @@ Can you modify this code to produce primes such as `23523*2^70000-1`,
NOTE: as bigger primes are found as time goes by this program no longer prints
the biggest prime once noted by the author below.
+
## Author's comments:
This program prints the biggest known prime number (`2^6972593-1`)
diff --git a/2000/bellard/index.html b/2000/bellard/index.html
index 0470a8511..7e5fde649 100644
--- a/2000/bellard/index.html
+++ b/2000/bellard/index.html
@@ -132,8 +132,7 @@
@@ -142,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 939d7aeb0..8f122944b 100644
--- a/2000/bmeyer/README.md
+++ b/2000/bmeyer/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./bmeyer
+ ./bmeyer
```
@@ -17,7 +17,7 @@ make
In a video window (white text on black background):
```sh
-./try.sh
+ ./try.sh
```
The script will suggest you compare the output of the program with images,
@@ -32,8 +32,8 @@ 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
+ bmeyer: bmeyer.c
+ CC -DY="__setfpucw(0x127f)" -O6 $? -o $@ -lm
```
However many compilers use `-O3` as the maximum level for `-O` optimization.
@@ -41,8 +41,8 @@ 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
+ bmeyer: bmeyer.c
+ gcc -DY='int x=0x127f; __asm__ ("fldcw %0" : : "m" (*&x))' $? -o $@ -lm
```
Compile with the maximum possible optimization on your system.
@@ -81,13 +81,13 @@ ASCII .PGM, depending on what format it was compressed from. For
example:
```sh
-./glicbawls < michael.pgm > michael.glic
+ ./glicbawls < michael.pgm > michael.glic
```
and then
```sh
-./glicbawls < michael.glic > michael.decoded.pgm
+ ./glicbawls < michael.glic > michael.decoded.pgm
```
As it turns out, `glicbawls` compresses greyscale images (or, more
@@ -105,7 +105,7 @@ 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
+ ./glicbawls 260 lavabus.glic
```
will allow `glicbawls` to use up to 260 columns, which makes things
@@ -123,21 +123,21 @@ give the maximum allowed error as an argument, with a dash (`-`)
before it. For example:
```sh
-./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.:
```sh
-./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:
```sh
-./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.
diff --git a/2000/bmeyer/index.html b/2000/bmeyer/index.html
index da750752e..115e8dee0 100644
--- a/2000/bmeyer/index.html
+++ b/2000/bmeyer/index.html
@@ -132,8 +132,7 @@
Author:
Name: Bernd Meyer
-Location: AU - Commonwealth of Australia (Australia)
-
+Location: AU - Commonwealth of Australia (Australia)
@@ -142,24 +141,24 @@ 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
- CC -DY="__setfpucw(0x127f)" -O6 $? -o $@ -lm
+
bmeyer: bmeyer.c
+ CC -DY="__setfpucw(0x127f)" -O6 $? -o $@ -lm
However many compilers use -O3 as the maximum level for -O optimization.
Compile with the maximum possible optimization on your system.
If your system has 80-bit internal representation of floating
point values (x86, some Motorola processors) and you want the
@@ -185,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
@@ -200,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
@@ -213,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:
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 064d8f99e..e6e1b94b9 100644
--- a/2000/briddlebane/README.md
+++ b/2000/briddlebane/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./briddlebane
+ ./briddlebane
```
@@ -20,9 +20,9 @@ equivalent file!
You might also like to try:
```sh
-./try.sh
+ ./try.sh
-INSULTS=15 ./try.sh
+ INSULTS=15 ./try.sh
```
diff --git a/2000/briddlebane/index.html b/2000/briddlebane/index.html
index 2c6ef42f3..d5d9338c3 100644
--- a/2000/briddlebane/index.html
+++ b/2000/briddlebane/index.html
@@ -135,8 +135,7 @@
Location: ZZ - Unknown location
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
+
./try.sh
-INSULTS=15 ./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 ff7d0f705..fe19210fb 100644
--- a/2000/dhyang/README.md
+++ b/2000/dhyang/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./dhyang
+ ./dhyang
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
diff --git a/2000/dhyang/index.html b/2000/dhyang/index.html
index f0a776df9..f37919cb9 100644
--- a/2000/dhyang/index.html
+++ b/2000/dhyang/index.html
@@ -132,8 +132,7 @@
Author:
Name: Don Yang
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 0b7a3d170..9ab5e8da9 100644
--- a/2000/dlowe/README.md
+++ b/2000/dlowe/README.md
@@ -1,13 +1,13 @@
## To build:
```sh
-make
+ make
```
The following bit of perl may help determine the values you need:
```sh
-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.
@@ -18,8 +18,8 @@ perl -MConfig -e 'print "$Config{archlibexp}/CORE\n"'
The current status of this entry is:
```
-STATUS: known bug - please help us fix
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: known bug - please help us fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2000 dlowe bugs](../../bugs.html#2000_dlowe).
@@ -28,14 +28,14 @@ For more detailed information see [2000 dlowe bugs](../../bugs.html#2000_dlowe).
## To use:
```sh
-./dlowe [file ...]
+ ./dlowe [file ...]
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -60,7 +60,7 @@ of the submitters hidden until all winning entries have been selected.
### Usage
```
-./dlowe [file ...]
+ ./dlowe [file ...]
```
### Synopsis
@@ -74,29 +74,29 @@ based on the `dc(1)` unix calculator.
This program understands the following `dc(1)` commands:
```
-p prints the top stack value without altering the stack.
-P prints the top stack value, removing it from the stack, and
- doesn't print a trailing newline.
-f prints the contents of the stack, one number per line,
- without modifying it.
-c clears the stack.
-d pushes a copy of the top stack value onto the stack.
-r reverses the order of the top two stack values.
+ p prints the top stack value without altering the stack.
+ P prints the top stack value, removing it from the stack, and
+ doesn't print a trailing newline.
+ f prints the contents of the stack, one number per line,
+ without modifying it.
+ c clears the stack.
+ d pushes a copy of the top stack value onto the stack.
+ r reverses the order of the top two stack values.
```
And the following arithmetic operators are supported:
```
- + Pops 2 values and pushes their sum.
- - Pops 2 values and pushes the result of subtracting the first
- from the second.
- * Pops 2 values and pushes their product.
- / Pops 2 values and pushes the result of dividing the second
- by the first.
- ^ Pops 2 values and pushes the result of raising the second
- to the power of the first.
- % Pops 2 values and pushes the remainder of the division that
- / would do.
+ + Pops 2 values and pushes their sum.
+ - Pops 2 values and pushes the result of subtracting the first
+ from the second.
+ * Pops 2 values and pushes their product.
+ / Pops 2 values and pushes the result of dividing the second
+ by the first.
+ ^ Pops 2 values and pushes the result of raising the second
+ to the power of the first.
+ % Pops 2 values and pushes the remainder of the division that
+ / would do.
```
The precision and range are double, like it or not, except that the
@@ -113,34 +113,34 @@ or EOF is encountered.
### Diagnostics:
```
-"stack empty" Not enough on the stack for the requested command
-"divide by zero" Attempt to divide by zero
-"unimplemented" Invalid input
-Floating point exception (core dumped) (or something to that effect)
- Bug in Perl_sv_upgrade causes this in some cases when
- the results of an operation are really huge (> 10^308)
- This bug appears to be fixed in perl5.6.0
+ "stack empty" Not enough on the stack for the requested command
+ "divide by zero" Attempt to divide by zero
+ "unimplemented" Invalid input
+ Floating point exception (core dumped) (or something to that effect)
+ Bug in Perl_sv_upgrade causes this in some cases when
+ the results of an operation are really huge (> 10^308)
+ This bug appears to be fixed in perl5.6.0
```
### Examples:
```sh
-$ 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:
diff --git a/2000/dlowe/index.html b/2000/dlowe/index.html
index b21d04df9..c07dd7df3 100644
--- a/2000/dlowe/index.html
+++ b/2000/dlowe/index.html
@@ -132,8 +132,7 @@
Author:
Name: J. David Lowe
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,19 +141,19 @@ Location: US - United States of America
To build:
-
make
+
make
The following bit of perl may help determine the values you need:
When this entry was submitted the rules of the IOCCC did not prohibit
the use of embedded language interpreters. The judges considered
@@ -170,32 +169,32 @@ of the submitters hidden until all winning entries have been selected.
This program understands the following dc(1) commands:
-
p prints the top stack value without altering the stack.
-P prints the top stack value, removing it from the stack, and
- doesn't print a trailing newline.
-f prints the contents of the stack, one number per line,
- without modifying it.
-c clears the stack.
-d pushes a copy of the top stack value onto the stack.
-r reverses the order of the top two stack values.
+
p prints the top stack value without altering the stack.
+ P prints the top stack value, removing it from the stack, and
+ doesn't print a trailing newline.
+ f prints the contents of the stack, one number per line,
+ without modifying it.
+ c clears the stack.
+ d pushes a copy of the top stack value onto the stack.
+ r reverses the order of the top two stack values.
And the following arithmetic operators are supported:
-
+ Pops 2 values and pushes their sum.
- - Pops 2 values and pushes the result of subtracting the first
- from the second.
- * Pops 2 values and pushes their product.
- / Pops 2 values and pushes the result of dividing the second
- by the first.
- ^ Pops 2 values and pushes the result of raising the second
- to the power of the first.
- % Pops 2 values and pushes the remainder of the division that
- / would do.
+
+ Pops 2 values and pushes their sum.
+ - Pops 2 values and pushes the result of subtracting the first
+ from the second.
+ * Pops 2 values and pushes their product.
+ / Pops 2 values and pushes the result of dividing the second
+ by the first.
+ ^ Pops 2 values and pushes the result of raising the second
+ to the power of the first.
+ % Pops 2 values and pushes the remainder of the division that
+ / would do.
The precision and range are double, like it or not, except that the
modulus operator actually returns (p1 - (p2 * (p1 / p2))), but with
the innermost division calculated at integer precision. This is
@@ -205,29 +204,29 @@ the command line. Unlike dc(1), multiple commands on the same line
must be space separated. Commands are only executed when a newline
or EOF is encountered.
Diagnostics:
-
"stack empty" Not enough on the stack for the requested command
-"divide by zero" Attempt to divide by zero
-"unimplemented" Invalid input
-Floating point exception (core dumped) (or something to that effect)
- Bug in Perl_sv_upgrade causes this in some cases when
- the results of an operation are really huge (> 10^308)
- This bug appears to be fixed in perl5.6.0
-
+
"stack empty" Not enough on the stack for the requested command
+ "divide by zero" Attempt to divide by zero
+ "unimplemented" Invalid input
+
+ Floating point exception (core dumped) (or something to that effect)
+ Bug in Perl_sv_upgrade causes this in some cases when
+ the results of an operation are really huge (> 10^308)
+ This bug appears to be fixed in perl5.6.0
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/index.html b/2000/index.html
index a8cc488e4..9338be892 100644
--- a/2000/index.html
+++ b/2000/index.html
@@ -184,7 +184,7 @@ REVERSAL ...
Please send us comments and suggestions what we have expressed above.
Also include anything else that you would like to see in future contests.
Send such email to:
-
questions@ioccc.org
+
questions@ioccc.org
IMPORTANT NOTE: The email addresses found above are for historical
purposes only, and should not be used today. See
contact.html for up to date contact details
diff --git a/2000/jarijyrki/README.md b/2000/jarijyrki/README.md
index c39e9fdce..a7a0a6861 100644
--- a/2000/jarijyrki/README.md
+++ b/2000/jarijyrki/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
You will need X11 header files and libraries installed to build this program.
@@ -10,7 +10,7 @@ You will need X11 header files and libraries installed to build this program.
## To use:
```sh
-./jarijyrki < infile.info > outfile.info
+ ./jarijyrki < infile.info > outfile.info
```
You will need a system capable of displaying the results of X Window programs.
@@ -19,19 +19,19 @@ You will need a system capable of displaying the results of X Window programs.
## Try:
```sh
-./jarijyrki < finance.sheet > myedits.info
+ ./jarijyrki < finance.sheet > myedits.info
```
Then click on cell `C3` and type in the following:
```
-C5 C6 C7 @
+ C5 C6 C7 @
```
Click on cell `D4` and type in the following:
```
-C5 C6 C7 !
+ C5 C6 C7 !
```
Hit `ESC`.
@@ -39,7 +39,7 @@ Hit `ESC`.
Now try running:
```
-./jarijyrki < myedits.info
+ ./jarijyrki < myedits.info
```
And observe that it matches what you had in the previous run!
@@ -89,7 +89,7 @@ supports are:
##### Starting
```sh
-./jarijyrki < finance.sheet > myedits.info
+ ./jarijyrki < finance.sheet > myedits.info
```
@@ -112,18 +112,18 @@ character at the end of the formula; press backspace to delete the last one.
##### Formulas
```
-123.45
-A1 A2 +
-B1 B2 -
-C1 C2 *
-D1 D2 /
+ 123.45
+ A1 A2 +
+ B1 B2 -
+ C1 C2 *
+ D1 D2 /
```
##### Pie charts
```
-A1 A2 A3 ...
+ A1 A2 A3 ...
```
Finish the formula with `@` to create the pie chart.
@@ -132,7 +132,7 @@ Finish the formula with `@` to create the pie chart.
##### Histograms
```
-A1 A2 A3 ...
+ A1 A2 A3 ...
```
Finish the formula with `!` to create the histogram.
@@ -145,7 +145,7 @@ spreadsheet, for instance [finance.sheet](finance.sheet), use the following
command line:
```sh
-./jarijyrki < finance.sheet
+ ./jarijyrki < finance.sheet
```
The file [finance.sheet](finance.sheet) has been provided as an example. This
@@ -157,7 +157,7 @@ supported by the program.
To start the program with an empty sheet, use
```sh
-./jarijyrki < /dev/null
+ ./jarijyrki < /dev/null
```
Alternatively, `/dev/zero` could be used but that may not exist on all systems.
@@ -172,7 +172,7 @@ 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
+ ./jarijyrki < finance.sheet > myedits.info
```
@@ -217,29 +217,29 @@ Otherwise, the formula is interpreted as a string and shown as it is.
An example of a simple formula, simply specifying a number is
```
-123.50
+ 123.50
```
Another simple formula refers to a cell:
```
-A1
+ A1
```
This particular example formula referred to the first cell of the first row in
the spreadsheet. Arithmetic operations require both arguments:
```
-A1 A2 +
-B1 B2 *
-C1 C2 -
-D1 D2 /
+ A1 A2 +
+ B1 B2 *
+ C1 C2 -
+ D1 D2 /
```
More complex formulae can be constructed by combining these simple ones:
```
-A1 A2 + 2 *
+ A1 A2 + 2 *
```
This example calculates the sum of the cells `A1` and `A2`, and then multiplies
@@ -260,7 +260,7 @@ slices, and is constructed by putting the pie amounts in stack and using the `@`
operator. The program automatically computes the relative size of the slices.
```
-A1 A2 A3 A4 @
+ A1 A2 A3 A4 @
```
This example would draw a pie chart of four cells, `A1` to `A4`.
@@ -269,7 +269,7 @@ The pie formula is shown above the pie for reference.
The histograms are drawn in a similar manner, by using the `!` operator:
```
-A1 A2 A3 A3 !
+ A1 A2 A3 A3 !
```
@@ -296,12 +296,12 @@ compile time parameters:
---
```
--DC=XK_Up
--DL=XK_Down
--DO=XK_Left
--DV=XK_Right
--DR=XK_Escape
--D_=XK_BackSpace
+ -DC=XK_Up
+ -DL=XK_Down
+ -DO=XK_Left
+ -DV=XK_Right
+ -DR=XK_Escape
+ -D_=XK_BackSpace
```
These definitions can be used to change the user interface of the program with
@@ -314,7 +314,7 @@ for the arrow keys.
```
--DU=40
+ -DU=40
```
This parameter defines the maximum dimensions of the stored and handled
@@ -323,7 +323,7 @@ thinking about the consequences!).
```
--DT=98
+ -DT=98
```
This parameter defines the maximum length of a formula in one cell. Note the
@@ -331,7 +331,7 @@ warning in section 4.4.
```
--Dz="(T+1)*U*U"
+ -Dz="(T+1)*U*U"
```
Defines the number of bytes in a spreadsheet file. The number is automatically
@@ -340,8 +340,8 @@ section 4.4.
```
--DQ=80
--DS=20
+ -DQ=80
+ -DS=20
```
These two parameters define the visual dimensions of a cell. Changing these may
@@ -351,7 +351,7 @@ systems we've tested the program with. `S` also defines the size of the left
```
--DN=10
+ -DN=10
```
This is the x-indentation of text inside a cell. Changing this may be necessary
@@ -359,7 +359,7 @@ to suit other font sizes and different X environments.
```
--DB=5
+ -DB=5
```
This is the y-indentation of text inside a cell. Changing this may be necessary
@@ -367,14 +367,14 @@ to suit other font sizes and different X environments.
```
--DG=23
+ -DG=23
```
This parameter is the number of cell rows visible at one time.
```
--Dp=7
+ -Dp=7
```
This parameter is one smaller than the number of cells columns visible at one
@@ -383,8 +383,8 @@ time.
```
--DM="((p+1)*Q)+S"
--DH="(G*S)+S+S"
+ -DM="((p+1)*Q)+S"
+ -DH="(G*S)+S+S"
```
These parameters are the window x and y sizes of the spreadsheet program window.
diff --git a/2000/jarijyrki/index.html b/2000/jarijyrki/index.html
index fb029680b..14a9194e7 100644
--- a/2000/jarijyrki/index.html
+++ b/2000/jarijyrki/index.html
@@ -135,8 +135,7 @@
Location: SE - Kingdom of Sweden (Sweden)
+Location: FI - Republic of Finland (Finland)
@@ -145,20 +144,20 @@ 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 @
+
C5 C6 C7 @
Click on cell D4 and type in the following:
-
C5 C6 C7 !
+
C5 C6 C7 !
Hit ESC.
Now try running:
-
./jarijyrki < myedits.info
+
./jarijyrki < myedits.info
And observe that it matches what you had in the previous run!
NOTE: changing the dimension parameters (see the authors’ remarks) renders
existing spreadsheet files unusable.
@@ -191,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
@@ -200,29 +199,29 @@ supports are:
The currently selected cell is always in the edit state. Press any key to add a
character at the end of the formula; press backspace to delete the last one.
Formulas
-
123.45
-A1 A2 +
-B1 B2 -
-C1 C2 *
-D1 D2 /
+
123.45
+ A1 A2 +
+ B1 B2 -
+ C1 C2 *
+ D1 D2 /
Pie charts
-
A1 A2 A3 ...
+
A1 A2 A3 ...
Finish the formula with @ to create the pie chart.
Histograms
-
A1 A2 A3 ...
+
A1 A2 A3 ...
Finish the formula with ! to create the histogram.
2.2. Starting and Loading Spreadsheets
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
@@ -230,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.
@@ -259,17 +258,17 @@ plus) are first pushed to the stack and then the operation is performed. If a
formula on a cell produces exactly one result then that is shown in the cell.
Otherwise, the formula is interpreted as a string and shown as it is.
An example of a simple formula, simply specifying a number is
-
123.50
+
123.50
Another simple formula refers to a cell:
-
A1
+
A1
This particular example formula referred to the first cell of the first row in
the spreadsheet. Arithmetic operations require both arguments:
-
A1 A2 +
-B1 B2 *
-C1 C2 -
-D1 D2 /
+
A1 A2 +
+ B1 B2 *
+ C1 C2 -
+ D1 D2 /
More complex formulae can be constructed by combining these simple ones:
-
A1 A2 + 2 *
+
A1 A2 + 2 *
This example calculates the sum of the cells A1 and A2, and then multiplies
the result by two.
The currently selected cell is always in a state where it can be edited. Press
@@ -282,11 +281,11 @@ of certain commercial spreadsheet programs.)
cells: pie charts and histograms. The pie chart can consist of any number of
slices, and is constructed by putting the pie amounts in stack and using the @
operator. The program automatically computes the relative size of the slices.
-
A1 A2 A3 A4 @
+
A1 A2 A3 A4 @
This example would draw a pie chart of four cells, A1 to A4.
The pie formula is shown above the pie for reference.
The histograms are drawn in a similar manner, by using the ! operator:
-
A1 A2 A3 A3 !
+
A1 A2 A3 A3 !
2.8. Errors in Formulas
The program detects recursive reference attempts, references cells not
containing a numerical value, attempts to define formulas with zero, two, or
@@ -301,12 +300,12 @@ value supposedly returned by it.
This section explains the meaning and rationale for the
compile time parameters:
These definitions can be used to change the user interface of the program with
respect to special keys. The first four define the movement operations and
the latter two define the program termination and character deletion keys.
@@ -314,36 +313,36 @@ Typical modifications to these parameters include changing character deletion to
the key the user is most familiar with, which could also be XK_Delete.
XK_Escape might be better in some cases as one of the function keys. Likewise
for the arrow keys.
-
-DU=40
+
-DU=40
This parameter defines the maximum dimensions of the stored and handled
spreadsheet (but see section 4.4 for a warning about changing this without
thinking about the consequences!).
-
-DT=98
+
-DT=98
This parameter defines the maximum length of a formula in one cell. Note the
warning in section 4.4.
-
-Dz="(T+1)*U*U"
+
-Dz="(T+1)*U*U"
Defines the number of bytes in a spreadsheet file. The number is automatically
adjusted when the spreadsheet size parameters are changed. Note the warning in
section 4.4.
-
-DQ=80
--DS=20
+
-DQ=80
+ -DS=20
These two parameters define the visual dimensions of a cell. Changing these may
be necessary on your system if the default font sizes differ from those in the
systems we’ve tested the program with. S also defines the size of the left
(x1) and top margins (x2).
-
-DN=10
+
-DN=10
This is the x-indentation of text inside a cell. Changing this may be necessary
to suit other font sizes and different X environments.
-
-DB=5
+
-DB=5
This is the y-indentation of text inside a cell. Changing this may be necessary
to suit other font sizes and different X environments.
-
-DG=23
+
-DG=23
This parameter is the number of cell rows visible at one time.
-
-Dp=7
+
-Dp=7
This parameter is one smaller than the number of cells columns visible at one
time.
-
-DM="((p+1)*Q)+S"
--DH="(G*S)+S+S"
+
-DM="((p+1)*Q)+S"
+ -DH="(G*S)+S+S"
These parameters are the window x and y sizes of the spreadsheet program window.
With these definitions, they are automatically reflecting the
at-one-time-visible cell row/column amounts. Hence, we recommend changing the
diff --git a/2000/natori/README.md b/2000/natori/README.md
index 72c2aa3e1..8f7ec2f46 100644
--- a/2000/natori/README.md
+++ b/2000/natori/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
An alt version exists for those in the southern hemisphere (or those who want to
@@ -12,14 +12,14 @@ version](#alternate-code) below.
## To use:
```sh
-./natori
+ ./natori
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
Try running this on different days, say a few days apart (even better if the
@@ -43,14 +43,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
+ make alt
```
### Alternate use:
```sh
-./natori.alt
+ ./natori.alt
```
Try running this on different days, say a few days apart, and each time run it
@@ -66,7 +66,7 @@ versions? Or are there any?
### Alternate try:
```sh
-./try.alt.sh
+ ./try.alt.sh
```
Like with [try.sh](try.sh), try using this multiple times in a row or throughout
diff --git a/2000/natori/index.html b/2000/natori/index.html
index 1d37a1ca2..40b6e06bd 100644
--- a/2000/natori/index.html
+++ b/2000/natori/index.html
@@ -132,8 +132,7 @@
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).
@@ -161,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
@@ -171,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 3b313a9e9..ddec251f7 100644
--- a/2000/primenum/README.md
+++ b/2000/primenum/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2000 primenum bugs](../../bugs.html#2000_primenum).
@@ -19,8 +19,7 @@ For more detailed information see [2000 primenum bugs](../../bugs.html#2000_prim
## To use:
```sh
-echo n | ./primenum n
-
+ echo n | ./primenum n
```
NOTE: `n` is an integer.
@@ -29,7 +28,7 @@ NOTE: `n` is an integer.
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -66,8 +65,8 @@ Instead, the program reads input from `stdin` and returns garbled text on
running the program a second time. Try:
```sh
-./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
diff --git a/2000/primenum/index.html b/2000/primenum/index.html
index c63df63cb..d89b97a47 100644
--- a/2000/primenum/index.html
+++ b/2000/primenum/index.html
@@ -132,8 +132,7 @@
Author:
Name: Raymond Cheong
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,16 +141,16 @@ Location: US - United States of America
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
@@ -175,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 28b5af7ad..d4df7d496 100644
--- a/2000/rince/README.md
+++ b/2000/rince/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -10,7 +10,7 @@ make all
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2000 rince bugs](../../bugs.html#2000_rince).
@@ -19,7 +19,7 @@ For more detailed information see [2000 rince bugs](../../bugs.html#2000_rince).
## To use:
```sh
-./rince number number2
+ ./rince number number2
```
If `DISPLAY` is not set the program will very likely crash or do something
@@ -29,7 +29,7 @@ different.
## Try:
```sh
-./try.sh
+ ./try.sh
```
This will run the program several times with different parameters to show
@@ -52,7 +52,7 @@ observation.
The simplest way to run it is with no arguments. Just type:
```sh
-./rince
+ ./rince
```
You will need to have access to X windows, although it doesn't require
@@ -66,7 +66,7 @@ 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
+ ./rince 0.01
```
To display the output (still guessing?) for a given date, specify two
@@ -74,8 +74,8 @@ 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
+ ./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
@@ -98,10 +98,10 @@ The moons are labelled with Roman numerals from `I` to `IV`, `I` being the
closest to the planet and `IV` being the furthest. They are:
```
-I Io
-II Europa
-III Ganymede
-IV Callisto
+ I Io
+ II Europa
+ III Ganymede
+ IV Callisto
```
Amazingly, all it takes is a pair of binoculars to see the Galilean moons,
@@ -134,46 +134,46 @@ Galileo discovered the moons in January 1610.
states the following:
```
-By early 1610, Galileo had further improved his telescope by
-double its power, so it now enlarged objects a thousand
-times. He began looking at the stars and couldn't believe how
-many more he could now see! The number seemed infinite. He was
-beginning to realize the fixed stars weren't a flat distant
-wall on a globe, but a three-dimensional expanse bigger than
-anyone had ever thought!
+ By early 1610, Galileo had further improved his telescope by
+ double its power, so it now enlarged objects a thousand
+ times. He began looking at the stars and couldn't believe how
+ many more he could now see! The number seemed infinite. He was
+ beginning to realize the fixed stars weren't a flat distant
+ wall on a globe, but a three-dimensional expanse bigger than
+ anyone had ever thought!
-Then, on January 7, about an hour after sunset, Jupiter rose
-in the east, and Galileo happened to turn his powerful scope
-on its bright disk. It wasn't the first time he had looked at
-Jupiter, but before it was with one of his lesser-powered
-telescopes. This time, though, he noticed three small but
-bright stars near the planet, two to one side and one to the
-other. He wondered at how bright the small stars were and how
-they were arranged in what seemed like a straight line. The
-next night he decided to look at Jupiter again, and to his
-surprise, the stars had moved. But not in such a way as he
-would expect. If Jupiter was moving as it normally should, the
-stars would be east of Jupiter. But all three were to the
-west! The next night was cloudy, but on January 10, Galileo
-was able to observe the planet again. One of the stars was
-gone, and the other two were now on the east side. As the
-stars moved around Jupiter on each succeeding night, and were
-finally joined by a fourth star, it dawned on Galileo that
-what he had found were moons orbiting Jupiter! Almost at once
-he realized that this was proof that not all objects orbited
-the Earth. Here were four bodies that were orbiting
-Jupiter. One argument against the sun-centered theory was, if
-the Earth orbited the sun, wouldn't the moon get left behind?
-Here he could see for himself that somehow, a planet could
-orbit the sun, and not leave a moon behind!
+ Then, on January 7, about an hour after sunset, Jupiter rose
+ in the east, and Galileo happened to turn his powerful scope
+ on its bright disk. It wasn't the first time he had looked at
+ Jupiter, but before it was with one of his lesser-powered
+ telescopes. This time, though, he noticed three small but
+ bright stars near the planet, two to one side and one to the
+ other. He wondered at how bright the small stars were and how
+ they were arranged in what seemed like a straight line. The
+ next night he decided to look at Jupiter again, and to his
+ surprise, the stars had moved. But not in such a way as he
+ would expect. If Jupiter was moving as it normally should, the
+ stars would be east of Jupiter. But all three were to the
+ west! The next night was cloudy, but on January 10, Galileo
+ was able to observe the planet again. One of the stars was
+ gone, and the other two were now on the east side. As the
+ stars moved around Jupiter on each succeeding night, and were
+ finally joined by a fourth star, it dawned on Galileo that
+ what he had found were moons orbiting Jupiter! Almost at once
+ he realized that this was proof that not all objects orbited
+ the Earth. Here were four bodies that were orbiting
+ Jupiter. One argument against the sun-centered theory was, if
+ the Earth orbited the sun, wouldn't the moon get left behind?
+ 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:
```sh
-./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
@@ -181,7 +181,7 @@ wasn't cloudy on the 9th. Try:
```sh
-./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!
diff --git a/2000/rince/index.html b/2000/rince/index.html
index 5923770b0..e00633062 100644
--- a/2000/rince/index.html
+++ b/2000/rince/index.html
@@ -132,8 +132,7 @@
Author:
Name: James Bonfield
-Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
-
+Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
@@ -142,17 +141,17 @@ Location: GB - United Kingdom of Great
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:
@@ -163,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.
@@ -172,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:
@@ -192,10 +191,10 @@ location on Earth, but I assure you that the
parallax is minimal!
The moons are labelled with Roman numerals from I to IV, I being the
closest to the planet and IV being the furthest. They are:
-
I Io
-II Europa
-III Ganymede
-IV Callisto
+
I Io
+ II Europa
+ III Ganymede
+ IV Callisto
Amazingly, all it takes is a pair of binoculars to see the Galilean moons,
so the results can be experimentally checked. (Note that at present, the
best views of Jupiter are over the autumn/winter.)
@@ -216,45 +215,45 @@ confusion, please consult the following chart (*):
By early 1610, Galileo had further improved his telescope by
-double its power, so it now enlarged objects a thousand
-times. He began looking at the stars and couldn't believe how
-many more he could now see! The number seemed infinite. He was
-beginning to realize the fixed stars weren't a flat distant
-wall on a globe, but a three-dimensional expanse bigger than
-anyone had ever thought!
+
By early 1610, Galileo had further improved his telescope by
+ double its power, so it now enlarged objects a thousand
+ times. He began looking at the stars and couldn't believe how
+ many more he could now see! The number seemed infinite. He was
+ beginning to realize the fixed stars weren't a flat distant
+ wall on a globe, but a three-dimensional expanse bigger than
+ anyone had ever thought!
-Then, on January 7, about an hour after sunset, Jupiter rose
-in the east, and Galileo happened to turn his powerful scope
-on its bright disk. It wasn't the first time he had looked at
-Jupiter, but before it was with one of his lesser-powered
-telescopes. This time, though, he noticed three small but
-bright stars near the planet, two to one side and one to the
-other. He wondered at how bright the small stars were and how
-they were arranged in what seemed like a straight line. The
-next night he decided to look at Jupiter again, and to his
-surprise, the stars had moved. But not in such a way as he
-would expect. If Jupiter was moving as it normally should, the
-stars would be east of Jupiter. But all three were to the
-west! The next night was cloudy, but on January 10, Galileo
-was able to observe the planet again. One of the stars was
-gone, and the other two were now on the east side. As the
-stars moved around Jupiter on each succeeding night, and were
-finally joined by a fourth star, it dawned on Galileo that
-what he had found were moons orbiting Jupiter! Almost at once
-he realized that this was proof that not all objects orbited
-the Earth. Here were four bodies that were orbiting
-Jupiter. One argument against the sun-centered theory was, if
-the Earth orbited the sun, wouldn't the moon get left behind?
-Here he could see for himself that somehow, a planet could
-orbit the sun, and not leave a moon behind!
+ Then, on January 7, about an hour after sunset, Jupiter rose
+ in the east, and Galileo happened to turn his powerful scope
+ on its bright disk. It wasn't the first time he had looked at
+ Jupiter, but before it was with one of his lesser-powered
+ telescopes. This time, though, he noticed three small but
+ bright stars near the planet, two to one side and one to the
+ other. He wondered at how bright the small stars were and how
+ they were arranged in what seemed like a straight line. The
+ next night he decided to look at Jupiter again, and to his
+ surprise, the stars had moved. But not in such a way as he
+ would expect. If Jupiter was moving as it normally should, the
+ stars would be east of Jupiter. But all three were to the
+ west! The next night was cloudy, but on January 10, Galileo
+ was able to observe the planet again. One of the stars was
+ gone, and the other two were now on the east side. As the
+ stars moved around Jupiter on each succeeding night, and were
+ finally joined by a fourth star, it dawned on Galileo that
+ what he had found were moons orbiting Jupiter! Almost at once
+ he realized that this was proof that not all objects orbited
+ the Earth. Here were four bodies that were orbiting
+ Jupiter. One argument against the sun-centered theory was, if
+ the Earth orbited the sun, wouldn't the moon get left behind?
+ 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:
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 8966afda5..269ca16df 100644
--- a/2000/robison/README.md
+++ b/2000/robison/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./robison
+ ./robison
```
diff --git a/2000/robison/index.html b/2000/robison/index.html
index 934b3f1d7..e711ca1c5 100644
--- a/2000/robison/index.html
+++ b/2000/robison/index.html
@@ -132,8 +132,7 @@
Author:
Name: Arch D. Robison
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 0f99d766c..d6329887a 100644
--- a/2000/schneiderwent/README.md
+++ b/2000/schneiderwent/README.md
@@ -1,22 +1,22 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./schneiderwent
+ ./schneiderwent
```
## Try:
```sh
-./schneiderwent schneiderwent.data
-./schneiderwent
+ ./schneiderwent schneiderwent.data
+ ./schneiderwent
```
What's the difference?
@@ -25,7 +25,7 @@ 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
+ ./try.sh
```
Alternatively, you can check on it later on, to see all the entry does. Or if
@@ -34,7 +34,7 @@ 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
+ SLEEP=30 ITERATIONS=2 ./try.sh
```
diff --git a/2000/schneiderwent/index.html b/2000/schneiderwent/index.html
index c70f291e6..8b50fcc8a 100644
--- a/2000/schneiderwent/index.html
+++ b/2000/schneiderwent/index.html
@@ -132,8 +132,7 @@
Author:
Name: Craig Schneiderwent
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,21 +141,21 @@ Location: US - United States of America
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 01805f3fb..5dcdf024c 100644
--- a/2000/thadgavin/README.md
+++ b/2000/thadgavin/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make alt
+ make alt
```
NOTE: if you don't have curses or SDL1 installed both modes will fail to compile. In
@@ -17,7 +17,7 @@ looked like back in 2000 (with a configurable speed). See the
## To use:
```sh
-./thadgavin.alt
+ ./thadgavin.alt
```
You can press 'q' at any time to exit.
@@ -28,7 +28,7 @@ You can press 'q' at any time to exit.
If you have SDL1 installed:
```sh
-./thadgavin_sdl
+ ./thadgavin_sdl
```
Whereas the curses version has an early exit the SDL version does not. You will
@@ -44,13 +44,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
+ make SDL_SLEEP=15000 clobber alt
```
and to change the curses one to `40`:
```sh
-make SLEEP=40 clobber alt
+ make SLEEP=40 clobber alt
```
Then use the program(s) in the same way.
@@ -76,14 +76,14 @@ is not a problem there.
### Original build:
```sh
-make all
+ make all
```
### Original use:
```sh
-./thadgavin
+ ./thadgavin
```
@@ -92,7 +92,7 @@ make all
If you have SDL1 installed:
```sh
-./thadgavin_sdl
+ ./thadgavin_sdl
```
@@ -111,14 +111,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
+ 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
+ gcc -O6 -lpthread -g -o thadgavin thadgavin.c -lSDL -DSDL -lm
```
@@ -126,7 +126,7 @@ gcc -O6 -lpthread -g -o thadgavin thadgavin.c -lSDL -DSDL -lm
```sh
-gcc -O6 -lpthread -g -o thadgavin thadgavin.c -lncurses -lm
+ gcc -O6 -lpthread -g -o thadgavin thadgavin.c -lncurses -lm
```
@@ -135,18 +135,17 @@ gcc -O6 -lpthread -g -o thadgavin thadgavin.c -lncurses -lm
In gcc you might get the following warning:
```
-thadgavin.c.c:46: warning: passing arg 2 of `SDL_SetColors' from incompatible pointer type
+ thadgavin.c.c:46: warning: passing arg 2 of `SDL_SetColors' from incompatible pointer type
```
In Microsoft Visual Studio you may get warnings as follows:
```
-thadgavin.c(46) : warning C4133: 'function' : incompatible types - from 'unsigned
-char *' to 'struct SDL_Color *'
-thadgavin.c(63) : warning C4026: function declared with formal parameter list
-thadgavin.c(77) : warning C4244: '=' : conversion from 'double ' to 'unsigned
-char ', possible loss of data
-
+ thadgavin.c(46) : warning C4133: 'function' : incompatible types - from 'unsigned
+ char *' to 'struct SDL_Color *'
+ thadgavin.c(63) : warning C4026: function declared with formal parameter list
+ thadgavin.c(77) : warning C4244: '=' : conversion from 'double ' to 'unsigned
+ char ', possible loss of data
```
But don't worry, this is completely normal.
diff --git a/2000/thadgavin/index.html b/2000/thadgavin/index.html
index 1f2bc3480..0f378f8cb 100644
--- a/2000/thadgavin/index.html
+++ b/2000/thadgavin/index.html
@@ -135,8 +135,7 @@
Location: ZZ - Unknown location
Name: Thaddaeus Frogley
-Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
-
+Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
@@ -145,7 +144,7 @@ Location: GB - United Kingdom of Great
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
@@ -168,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
@@ -185,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,
@@ -199,21 +198,20 @@ less than dazzling. We could not test this entry in DOS mode.
thadgavin.c.c:46: warning: passing arg 2 of `SDL_SetColors' from incompatible pointer type
+
thadgavin.c.c:46: warning: passing arg 2 of `SDL_SetColors' from incompatible pointer type
In Microsoft Visual Studio you may get warnings as follows:
-
thadgavin.c(46) : warning C4133: 'function' : incompatible types - from 'unsigned
-char *' to 'struct SDL_Color *'
-thadgavin.c(63) : warning C4026: function declared with formal parameter list
-thadgavin.c(77) : warning C4244: '=' : conversion from 'double ' to 'unsigned
-char ', possible loss of data
-
+
thadgavin.c(46) : warning C4133: 'function' : incompatible types - from 'unsigned
+ char *' to 'struct SDL_Color *'
+ thadgavin.c(63) : warning C4026: function declared with formal parameter list
+ thadgavin.c(77) : warning C4244: '=' : conversion from 'double ' to 'unsigned
+ char ', possible loss of data
But don’t worry, this is completely normal.
Recommended dosage:
At least 3 minutes taken 3 times a day when tired.
diff --git a/2000/tomx/README.md b/2000/tomx/README.md
index 631ff78e5..3520da688 100644
--- a/2000/tomx/README.md
+++ b/2000/tomx/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version that compiles [mkentry.c](mkentry.c). See
@@ -11,14 +11,14 @@ There is an alternate version that compiles [mkentry.c](mkentry.c). See
## To use:
```sh
-./tomx
+ ./tomx
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -33,14 +33,14 @@ using it as a Makefile and running the code ends up running `mkentry`.
### Alternate build:
```sh
-make alt
+ make alt
```
### Alternate try:
```sh
-./try.alt.sh
+ ./try.alt.sh
```
@@ -101,9 +101,9 @@ source still acceptable to `make` and `sh`. The following modification to the
last few lines will compile the IOCCC's famous [mkentry.c](mkentry.c).
```
-.PHONY: /* true clean */
-#undef true
-#include "mkentry.c"
+ .PHONY: /* true clean */
+ #undef true
+ #include "mkentry.c"
```
Ain't that useful?
diff --git a/2000/tomx/index.html b/2000/tomx/index.html
index e8036e8b3..117db3d4e 100644
--- a/2000/tomx/index.html
+++ b/2000/tomx/index.html
@@ -132,8 +132,7 @@
Author:
Name: Thomas P John
-Location: NL - Kingdom of the Netherlands (Netherlands)
-
+Location: NL - Kingdom of the Netherlands (Netherlands)
@@ -142,22 +141,22 @@ Location: NL - Kingdom of the Netherlan
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
@@ -201,9 +200,9 @@ the main(), leaving the complexities of the C file elsewhere and ma
source still acceptable to make and sh. The following modification to the
last few lines will compile the IOCCC’s famous mkentry.c.
-
By extending this program’s idea, It is possible to do some
diff --git a/2001/README.md b/2001/README.md
index c50bba8d7..08766a44b 100644
--- a/2001/README.md
+++ b/2001/README.md
@@ -66,7 +66,7 @@ Also include anything else that you would like to see in future contests.
Send such email to:
```
-questions@ioccc.org
+ questions@ioccc.org
```
**IMPORTANT NOTE**: The email addresses found above are for historical
diff --git a/2001/anonymous/README.md b/2001/anonymous/README.md
index cc3e2eeec..58f85d5a1 100644
--- a/2001/anonymous/README.md
+++ b/2001/anonymous/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
The programs that this program is supposed to act on,
@@ -19,7 +19,7 @@ whatever your system will compile them as).
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2001 anonymous bugs](../../bugs.html#2001_anonymous).
@@ -28,16 +28,16 @@ For more detailed information see [2001 anonymous bugs](../../bugs.html#2001_ano
## To use:
```sh
-./anonymous x86_program
+ ./anonymous x86_program
```
## Try:
```sh
-./try.sh
+ ./try.sh
-./anonymous anonymous.bed # if able to compile as a 32-bit (-m32) ELF binary
+ ./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
@@ -65,16 +65,16 @@ that :-(
### Alternate build:
```sh
-make alt
+ make alt
```
### Alternate use:
```sh
-./anonymous.ten.alt
+ ./anonymous.ten.alt
-./anonymous.bed.alt
+ ./anonymous.bed.alt
```
diff --git a/2001/anonymous/index.html b/2001/anonymous/index.html
index 82ec8691c..71757b9e2 100644
--- a/2001/anonymous/index.html
+++ b/2001/anonymous/index.html
@@ -132,8 +132,7 @@
Author:
Name: Anonymous 2001
-Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
-
+Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
@@ -142,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
@@ -153,14 +152,14 @@ below for information on how to compile these programs as 64-bit binaries (or
whatever your system will compile them as).
./try.sh
-./anonymous anonymous.bed # if able to compile as a 32-bit (-m32) ELF binary
+./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.
@@ -177,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.ten.alt
-./anonymous.bed.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 ef7d752e1..4f62e47e0 100644
--- a/2001/bellard/README.md
+++ b/2001/bellard/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,8 +10,8 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
-STATUS: doesn't work with some platforms - please help us fix
+ 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](../../bugs.html#2001_bellard).
@@ -20,14 +20,14 @@ For more detailed information see [2001 bellard bugs](../../bugs.html#2001_bella
## To use:
```sh
-./bellard file
+ ./bellard file
```
## Try:
```sh
-./bellard bellard.otccex.c
+ ./bellard bellard.otccex.c
```
@@ -48,7 +48,7 @@ program.
You can use it by typing:
```sh
-./bellard bellard.c [args]...
+ ./bellard bellard.c [args]...
```
or by giving the C source to its standard input.
@@ -62,19 +62,19 @@ or by giving the C source to its standard input.
- Sample compilation and execution:
```sh
-./bellard bellard.otccex.c 10
+ ./bellard bellard.otccex.c 10
```
- Self compilation:
```sh
-./bellard bellard.c bellard.otccex.c 10
+ ./bellard bellard.c bellard.otccex.c 10
```
- Self compilation iterated...
```sh
-./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
diff --git a/2001/bellard/index.html b/2001/bellard/index.html
index d508a4139..91b5aee0d 100644
--- a/2001/bellard/index.html
+++ b/2001/bellard/index.html
@@ -132,8 +132,7 @@
@@ -162,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).
@@ -170,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 a29e6c62c..2535eba4b 100644
--- a/2001/cheong/README.md
+++ b/2001/cheong/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./cheong digits
+ ./cheong digits
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -37,11 +37,11 @@ Program will return the integer part of its square root (n-digits).
For example,
```sh
-$ 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. :-)
@@ -53,8 +53,8 @@ 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 **'
+ gcc -ansi -Wall cheong.c
+ cheong.c:3: warning: third argument of `main' should probably be `char **'
```
### Obfuscation
diff --git a/2001/cheong/index.html b/2001/cheong/index.html
index 50a7f6f5c..7c9c9a176 100644
--- a/2001/cheong/index.html
+++ b/2001/cheong/index.html
@@ -132,8 +132,7 @@
Author:
Name: Raymond Cheong
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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.
@@ -157,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,
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 13743112a..5ea683a84 100644
--- a/2001/coupard/README.md
+++ b/2001/coupard/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./coupard
+ ./coupard
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -53,7 +53,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
+ ./coupard > /dev/audio
```
The program then speaks out something like
@@ -69,7 +69,7 @@ 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
+ ./coupard | sox -c1 -r8000 -tub - -c2 -r44100 -twav test.wav
```
converts the output of the program into a 44.1KHz stereo .WAV
diff --git a/2001/coupard/index.html b/2001/coupard/index.html
index 2c3118504..62d61f609 100644
--- a/2001/coupard/index.html
+++ b/2001/coupard/index.html
@@ -132,8 +132,7 @@
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,
@@ -171,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
@@ -182,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:
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 36731d8ad..939235595 100644
--- a/2001/ctk/README.md
+++ b/2001/ctk/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version with vi(m) key movements. See [alternate
@@ -11,7 +11,7 @@ code](#alternate code) below.
## To use:
```sh
-./ctk
+ ./ctk
```
@@ -24,14 +24,14 @@ This alternate version adds to the movement keys `l` for right, `h` for left and
### Alternate build:
```sh
-make alt
+ make alt
```
### Alternate use:
```sh
-./ctk.alt
+ ./ctk.alt
```
diff --git a/2001/ctk/index.html b/2001/ctk/index.html
index d4119404d..359db2b43 100644
--- a/2001/ctk/index.html
+++ b/2001/ctk/index.html
@@ -132,8 +132,7 @@
Author:
Name: Chris King
-Location: ZZ - Unknown location
-
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 50ca2bb4b..576fdbc44 100644
--- a/2001/dgbeards/README.md
+++ b/2001/dgbeards/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version based on the author's remarks. See [alternate
@@ -13,7 +13,7 @@ code](#alternate-code) below for more details.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2001 dgbeards bugs](../../bugs.html#2001_dgbeards).
@@ -22,7 +22,7 @@ For more detailed information see [2001 dgbeards bugs](../../bugs.html#2001_dgbe
## To use:
```sh
-./dgbeards
+ ./dgbeards
```
@@ -37,14 +37,14 @@ this you can look at the author's remarks and make the change.
### Alternate build:
```sh
-make alt
+ make alt
```
### Alternate use:
```sh
-./dgbeards.alt
+ ./dgbeards.alt
```
@@ -224,11 +224,11 @@ A: When compiled with `gcc -Wall`, the compiler generated the following
warnings:
```
-suggest parentheses around + or - in operand of &
-array subscript has type 'char'
-return type defaults to 'int'
-control reaches end of non-void function
-value computed is not used
+ suggest parentheses around + or - in operand of &
+ array subscript has type 'char'
+ return type defaults to 'int'
+ control reaches end of non-void function
+ value computed is not used
```
The `value computed is not used` warning happens because I use the `&&`
diff --git a/2001/dgbeards/index.html b/2001/dgbeards/index.html
index 786467bb0..1957e4c97 100644
--- a/2001/dgbeards/index.html
+++ b/2001/dgbeards/index.html
@@ -132,8 +132,7 @@
Author:
Name: Doug Beardsley
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,24 +141,24 @@ 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.
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.
@@ -292,11 +291,11 @@ this is not so.
Q: What about the compiler warnings?
A: When compiled with gcc -Wall, the compiler generated the following
warnings:
-
suggest parentheses around + or - in operand of &
-array subscript has type 'char'
-return type defaults to 'int'
-control reaches end of non-void function
-value computed is not used
+
suggest parentheses around + or - in operand of &
+ array subscript has type 'char'
+ return type defaults to 'int'
+ control reaches end of non-void function
+ value computed is not used
The value computed is not used warning happens because I use the &&
operator and take advantage of short circuit evaluation instead of using
an if() statement.
diff --git a/2001/herrmann1/README.md b/2001/herrmann1/README.md
index 148cf6021..78cced7e4 100644
--- a/2001/herrmann1/README.md
+++ b/2001/herrmann1/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,8 +10,8 @@ make
The current status of this entry is:
```
-STATUS: missing files - please provide them
-STATUS: known bug - please help us fix
+ STATUS: missing files - please provide them
+ STATUS: known bug - please help us fix
```
For more detailed information see [2001 herrmann1 bugs](../../bugs.html#2001_herrmann1).
@@ -20,7 +20,7 @@ For more detailed information see [2001 herrmann1 bugs](../../bugs.html#2001_her
## To use:
```sh
-./herrmann1.sh 'prg=file'
+ ./herrmann1.sh 'prg=file'
```
NOTE: this entry seems to rely on older versions of gcc for the compilation
@@ -31,7 +31,7 @@ need an older compiler perhaps gcc 2.95.
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -87,23 +87,23 @@ 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'
+ ./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:
```
-/*
-*
-* State: st2.
-*
-* _ _ _ _ _ * _ _ _ _ _ _ _ _ _ _ _ _ _
-* ... O O I I I I I O I I I I I O O ...
-* ~ ~ ~ ~ ~ * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
-*
-*
-*/
+ /*
+ *
+ * State: st2.
+ *
+ * _ _ _ _ _ * _ _ _ _ _ _ _ _ _ _ _ _ _
+ * ... O O I I I I I O I I I I I O O ...
+ * ~ ~ ~ ~ ~ * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+ *
+ *
+ */
```
(As on real videos, you'll see a bit of "white noise" at the
@@ -113,9 +113,9 @@ type `./herrmann1` to see the final result. The output will be
Final tape:
```
- *
-..OOIIIIIIIIIIIIIIIIOOOO..
- *
+ *
+ ..OOIIIIIIIIIIIIIIIIOOOO..
+ *
```
(Note that the last frame of the animation is _not_ the final
@@ -127,8 +127,7 @@ 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"
-
+ ./herrmann1 prg=times2.turing tape="O O O I I I O O O"
```
(The `O`s and `I`s are letters, not digits.) You might prefer to
@@ -138,7 +137,7 @@ this case, the remainder of the tape is filled with `O`s. ;-)
If you just type:
```
-./herrmann1
+ ./herrmann1
```
and run the program, you'll get a usage message (and the return
@@ -157,12 +156,12 @@ 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. */
-#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:
@@ -179,7 +178,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"'
+ ./herrmann1.sh 'prg=plus1.turing' 'tape="I I I"'
```
But what happens if no tape is provided? Up to now, the Turing
@@ -189,7 +188,7 @@ 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
+ #define tape O O O O O I I I I
```
to your program.
@@ -202,13 +201,13 @@ to define a state or to misspell one. Let's assume you forgot the
line
```c
-#define start_I I, left, st2
+ #define start_I I, left, st2
```
Remove it and type
```sh
-./herrmann1 'prg=plus1.turing'
+ ./herrmann1 'prg=plus1.turing'
```
The output will be
@@ -218,9 +217,9 @@ Undefined state start.
Tape:
```
- *
-..OOOOOOOOIIIIOO..
- *
+ *
+ ..OOOOOOOOIIIIOO..
+ *
```
and the return code will be 1. As you can see, the Turing machine
diff --git a/2001/herrmann1/index.html b/2001/herrmann1/index.html
index 4e8eabe64..a12818c8f 100644
--- a/2001/herrmann1/index.html
+++ b/2001/herrmann1/index.html
@@ -132,8 +132,7 @@
Author:
Name: Immanuel Herrmann
-Location: DE - Federal Republic of Germany (Germany)
-
+Location: DE - Federal Republic of Germany (Germany)
@@ -142,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
+
STATUS: missing files - please provide them
+ STATUS: known bug - please help us fix
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
@@ -193,37 +192,37 @@ 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:
-
/*
-*
-* State: st2.
-*
-* _ _ _ _ _ * _ _ _ _ _ _ _ _ _ _ _ _ _
-* ... O O I I I I I O I I I I I O O ...
-* ~ ~ ~ ~ ~ * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
-*
-*
-*/
+
/*
+ *
+ * State: st2.
+ *
+ * _ _ _ _ _ * _ _ _ _ _ _ _ _ _ _ _ _ _
+ * ... O O I I I I I O I I I I I O O ...
+ * ~ ~ ~ ~ ~ * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+ *
+ *
+ */
(As on real videos, you’ll see a bit of “white noise” at the
beginning and at the end.;-) After compilation has terminated,
type ./herrmann1 to see the final result. The output will be
Final tape:
-
*
-..OOIIIIIIIIIIIIIIIIOOOO..
- *
+
*
+ ..OOIIIIIIIIIIIIIIIIOOOO..
+ *
(Note that the last frame of the animation is not the final
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. ;-)
If you just type:
-
./herrmann1
+
./herrmann1
and run the program, you’ll get a usage message (and the return
code will be 2).
Note: To get a really nice animation, you’ll need a terminal which
@@ -235,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
@@ -252,27 +251,27 @@ 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:
-
*
-..OOOOOOOOIIIIOO..
- *
+
*
+ ..OOOOOOOOIIIIOO..
+ *
and the return code will be 1. As you can see, the Turing machine
moved over the Os, but when it arrived at the I (still in state
start), the error occurred.
diff --git a/2001/herrmann2/README.md b/2001/herrmann2/README.md
index af261b5f9..250f7c74a 100644
--- a/2001/herrmann2/README.md
+++ b/2001/herrmann2/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./herrmann2
+ ./herrmann2
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
If you use vi(m) you can see a pattern in [herrmann2.cup](herrmann2.cup) and
@@ -23,27 +23,27 @@ If you use vi(m) you can see a pattern in [herrmann2.cup](herrmann2.cup) and
```
-/[pon]\
+ /[pon]\
```
and
```
-/l
+ /l
```
For additional fun in [herrmann2.cup](herrmann2.cup) try:
```
-/[po]
-/q
+ /[po]
+ /q
```
and in [herrmann2.ioccc](herrmann2.ioccc) try:
```
-/n
+ /n
```
@@ -76,7 +76,7 @@ to about 9k.
32 and 126). For example, type
```sh
-./herrmann2 < herrmann2.ioccc
+ ./herrmann2 < herrmann2.ioccc
```
3. If you want to control the characters used in the output (for
@@ -87,9 +87,9 @@ 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
+ ./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
@@ -123,15 +123,15 @@ 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,'\
-'!( 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
@@ -184,7 +184,7 @@ works.)
- When still in doubt about how to judge this program, type
```sh
-./herrmann2 < herrmann2.cup
+ ./herrmann2 < herrmann2.cup
```
and let the result inspire you. ;-)
diff --git a/2001/herrmann2/index.html b/2001/herrmann2/index.html
index ebb1dcf6a..590c127b4 100644
--- a/2001/herrmann2/index.html
+++ b/2001/herrmann2/index.html
@@ -132,8 +132,7 @@
Author:
Name: Immanuel Herrmann
-Location: DE - Federal Republic of Germany (Germany)
-
+Location: DE - Federal Republic of Germany (Germany)
@@ -142,21 +141,21 @@ 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:
Be careful when staring at the source code - your eyes might cross, but
if you concentrate on your focus you will find illumination!
@@ -178,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
If you want to control the characters used in the output (for
example if your picture is to consist only of digits), pass them
@@ -187,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:
Due to the way these 3D pictures work, the left part of the
@@ -217,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:
If I had submitted the program last year, I would have said that
it has exactly the maximum allowed length: 1536 characters. Now
@@ -268,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/index.html b/2001/index.html
index 60a431c92..7cb103173 100644
--- a/2001/index.html
+++ b/2001/index.html
@@ -172,7 +172,7 @@ we do look at and work out what every entry does.
Please send us comments and suggestions what we have expressed above.
Also include anything else that you would like to see in future contests.
Send such email to:
-
questions@ioccc.org
+
questions@ioccc.org
IMPORTANT NOTE: The email addresses found above are for historical
purposes only, and should not be used today. See
contact.html for up to date contact details
diff --git a/2001/jason/README.md b/2001/jason/README.md
index aac51dfa6..fdc8a4c6d 100644
--- a/2001/jason/README.md
+++ b/2001/jason/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./jason
+ ./jason
```
@@ -38,13 +38,13 @@ 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
-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
@@ -117,14 +117,6 @@ the game entertaining, see if you can find
in the source code.)
-
-
-
-
-
-
-
-
### GAME STRATEGY SPOILER
The trick, of course, is to drop items in empty rooms to mark them. That way
diff --git a/2001/jason/index.html b/2001/jason/index.html
index 448c7f691..827a54176 100644
--- a/2001/jason/index.html
+++ b/2001/jason/index.html
@@ -132,8 +132,7 @@
Author:
Name: Jason Orendorff
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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
@@ -161,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 f7c337e93..23555bd96 100644
--- a/2001/kev/README.md
+++ b/2001/kev/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is another version which lets you use the arrow keys rather than the more
@@ -13,7 +13,7 @@ awkward `,` and `.` keys. See [alternate code](#alternate-code) below.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2001 kev bugs](../../bugs.html#2001_kev).
@@ -22,9 +22,9 @@ For more detailed information see [2001 kev bugs](../../bugs.html#2001_kev).
## To use:
```sh
-./kev # in one terminal
+ ./kev # in one terminal
-./kev hostname # in another terminal
+ ./kev hostname # in another terminal
```
NOTE: each player's paddle is at the bottom and the opponent at the top.
@@ -33,22 +33,22 @@ NOTE: each player's paddle is at the bottom and the opponent at the top.
## Try:
```sh
-./kev # in one terminal
+ ./kev # in one terminal
-./kev localhost # in another terminal on the same host
+ ./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):
```sh
-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:
```sh
-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.
@@ -59,19 +59,19 @@ 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
+ 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 &
+ 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&
+ xterm -geometry 80x40 -fg green -bg black -fn 9x15bold -e ./kev localhost&
```
This might look nicer than just the terminal itself.
@@ -86,7 +86,7 @@ awkward `,` and `.` keys to move your paddle.
### Alternate build:
```sh
-make alt
+ make alt
```
You can reconfigure the macros described above in the same way.
@@ -106,13 +106,13 @@ terminal?
If you have `xterm` try on one system:
```sh
-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:
```sh
-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&
```
@@ -152,14 +152,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
+ ./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
+ ./kev localhost
```
Make sure that the terminals on both ends are the same size. Also, the TCP port
@@ -170,8 +170,8 @@ 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&
+ 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 3d5f670f7..0646ec5de 100644
--- a/2001/kev/index.html
+++ b/2001/kev/index.html
@@ -132,8 +132,7 @@
Author:
Name: Kevin Pulo
-Location: AU - Commonwealth of Australia (Australia)
-
+Location: AU - Commonwealth of Australia (Australia)
@@ -142,43 +141,43 @@ 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.
./kev# in one terminal
-./kev hostname # in another 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# in one terminal
-./kev localhost # in another terminal on the same host
+./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.
@@ -186,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.
@@ -213,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 a08584036..2e1f80115 100644
--- a/2001/ollinger/README.md
+++ b/2001/ollinger/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./ollinger integer
+ ./ollinger integer
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
Try the above command in a large window, say 200 chars wide and 100
@@ -56,34 +56,34 @@ A: Yes, there are types of entries that show up over and over again.
The guidelines say:
```
-We tend to dislike programs that:
-are similar to previous winning entries
+ We tend to dislike programs that:
+ are similar to previous winning entries
-We like variety. However too often we see (please look at the winning
-examples given to be aware of the level of the competition):
+ We like variety. However too often we see (please look at the winning
+ examples given to be aware of the level of the competition):
-(snip)
+ (snip)
-generating small primes (below is the list of all prime related entries)
+ generating small primes (below is the list of all prime related entries)
- 1985/august
- 1988/applin
- 1994/weisberg
- 1995/makarios
- 1996/dalbec
- 2000/bellard
+ 1985/august
+ 1988/applin
+ 1994/weisberg
+ 1995/makarios
+ 1996/dalbec
+ 2000/bellard
-As you can see, just a list of primes (let alone small primes)
-does not cut it anymore.
+ As you can see, just a list of primes (let alone small primes)
+ does not cut it anymore.
-(snip)
+ (snip)
-entries that use some complex state machine/table to print something
+ entries that use some complex state machine/table to print something
- 1988/isaak
- 1988/phillipps
+ 1988/isaak
+ 1988/phillipps
-Unbeaten for 12 years and counting...
+ Unbeaten for 12 years and counting...
```
I think this is enough motivation for trying to submit a program which uses
diff --git a/2001/ollinger/index.html b/2001/ollinger/index.html
index a0fc2b654..5471516bc 100644
--- a/2001/ollinger/index.html
+++ b/2001/ollinger/index.html
@@ -132,8 +132,7 @@
@@ -142,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:
@@ -169,34 +168,34 @@ character printed on the screen.
judges get tired of them?
A: Yes, there are types of entries that show up over and over again.
The guidelines say:
-
We tend to dislike programs that:
-are similar to previous winning entries
+
We tend to dislike programs that:
+ are similar to previous winning entries
-We like variety. However too often we see (please look at the winning
-examples given to be aware of the level of the competition):
+ We like variety. However too often we see (please look at the winning
+ examples given to be aware of the level of the competition):
-(snip)
+ (snip)
-generating small primes (below is the list of all prime related entries)
+ generating small primes (below is the list of all prime related entries)
- 1985/august
- 1988/applin
- 1994/weisberg
- 1995/makarios
- 1996/dalbec
- 2000/bellard
+ 1985/august
+ 1988/applin
+ 1994/weisberg
+ 1995/makarios
+ 1996/dalbec
+ 2000/bellard
-As you can see, just a list of primes (let alone small primes)
-does not cut it anymore.
+ As you can see, just a list of primes (let alone small primes)
+ does not cut it anymore.
-(snip)
+ (snip)
-entries that use some complex state machine/table to print something
+ entries that use some complex state machine/table to print something
- 1988/isaak
- 1988/phillipps
+ 1988/isaak
+ 1988/phillipps
-Unbeaten for 12 years and counting...
+ Unbeaten for 12 years and counting...
I think this is enough motivation for trying to submit a program which uses
some complex state machine/table to generate small primes and print them.
The way it works
diff --git a/2001/rosten/README.md b/2001/rosten/README.md
index ec106460e..4850b0412 100644
--- a/2001/rosten/README.md
+++ b/2001/rosten/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: missing files - please provide them
+ STATUS: missing files - please provide them
```
For more detailed information see [2001 rosten bugs](../../bugs.html#2001_rosten).
@@ -19,7 +19,7 @@ For more detailed information see [2001 rosten bugs](../../bugs.html#2001_rosten
## To use:
```sh
-./rosten [number]
+ ./rosten [number]
```
WARNING: this will mess with your mouse and can make it hard to quit the
@@ -31,14 +31,14 @@ NOTE: number is floating point.
## Try:
```sh
-./rosten 1.03
-./rosten 1.00
+ ./rosten 1.03
+ ./rosten 1.00
```
For some abuse, try:
```sh
-./rosten 0.99
+ ./rosten 0.99
```
@@ -58,7 +58,7 @@ cursor) in the wrong way. :-)
### SYNOPSIS
```sh
-./rosten [greasiness]
+ ./rosten [greasiness]
```
@@ -95,15 +95,15 @@ 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
-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](https://en.wikipedia.org/wiki/Tab_stop) every 8 spaces.
@@ -143,7 +143,7 @@ The MIPS compiler suggests an `==` instead of an `=` in expressions
such as:
```c
-&&(a=b)
+ &&(a=b)
```
but its suggestions would break my program. It also reckons
diff --git a/2001/rosten/index.html b/2001/rosten/index.html
index 36b72e4f6..2d97bd752 100644
--- a/2001/rosten/index.html
+++ b/2001/rosten/index.html
@@ -132,8 +132,7 @@
Author:
Name: Edward Rosten
-Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
-
+Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
@@ -142,21 +141,21 @@ Location: GB - United Kingdom of Great
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. :-)
@@ -164,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
@@ -184,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
@@ -214,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 69074f039..6f0b4c42c 100644
--- a/2001/schweikh/README.md
+++ b/2001/schweikh/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2001 schweikh bugs](../../bugs.html#2001_schweikh).
@@ -19,7 +19,7 @@ For more detailed information see [2001 schweikh bugs](../../bugs.html#2001_schw
## To use:
```sh
-./schweikh string string2
+ ./schweikh string string2
```
This program will very likely crash or do something else if you do not give it
@@ -34,14 +34,14 @@ This is supposed to happen. As is written in the
[The Jargon File](http://catb.org/jargon/html/F/feature.html):
```
-That's not a bug, that's a feature.
+ That's not a bug, that's a feature.
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -65,11 +65,11 @@ 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
- echo no match
-fi
+ if prog "${VARIABLE}" ''; then
+ echo VARIABLE matches
+ else
+ echo no match
+ fi
```
### Bugs
diff --git a/2001/schweikh/index.html b/2001/schweikh/index.html
index e47b9e3f8..6d3c239a5 100644
--- a/2001/schweikh/index.html
+++ b/2001/schweikh/index.html
@@ -132,8 +132,7 @@
Author:
Name: Jens Schweikhardt
-Location: DE - Federal Republic of Germany (Germany)
-
+Location: DE - Federal Republic of Germany (Germany)
@@ -142,13 +141,13 @@ Location: DE - Federal Republic of Germ
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
@@ -156,9 +155,9 @@ comments for details and a workaround.
There’s also no way to escape meta characters.
This is supposed to happen. As is written in the
The Jargon File:
-
That's not a bug, that's a feature.
+
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:
@@ -171,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):
-
ifprog"${VARIABLE}"'<glob>';then
-echo VARIABLE matches
-else
-echo no match
-fi
+
ifprog"${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 b79df66a4..130a6d2e1 100644
--- a/2001/westley/README.md
+++ b/2001/westley/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There are two additional programs based on the author's remarks and the original
@@ -15,9 +15,9 @@ code](#alternate-code) below.
The current status of this entry is:
```
-STATUS: uses gets() - change to fgets() if possible
-STATUS: missing files - please provide them
-STATUS: main() has only one arg - try and make it have 2 or 3
+ STATUS: uses gets() - change to fgets() if possible
+ STATUS: missing files - please provide them
+ STATUS: main() has only one arg - try and make it have 2 or 3
```
For more detailed information see [2001 westley bugs](../../bugs.html#2001_westley).
@@ -26,19 +26,19 @@ 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
+ ./westley 2>/dev/null
+ # enter some input, terminate with EOF
-echo foo | ./westley 2>/dev/null
+ echo foo | ./westley 2>/dev/null
-./westley < westley.c 2>/dev/null
+ ./westley < westley.c 2>/dev/null
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -61,7 +61,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
+ echo 'Brian Westley does it again!' | ./westley.punch 2>/dev/null
```
@@ -74,7 +74,7 @@ This alternate code might be less portable.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -109,10 +109,10 @@ 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");}
-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
@@ -123,8 +123,8 @@ 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);}
+ char *greet = "Hello, world!";
+ char *greet; main(){puts(greet);}
```
It would be trivial to write an entire C program that is
@@ -133,9 +133,9 @@ 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");}
+ 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
@@ -145,13 +145,13 @@ 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;}
-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
@@ -200,7 +200,7 @@ by looking at `card.gif`.)
For a nice test pattern, try
```
-&-0123456789ABCDEFGHIJKLMNOPQR/STUVWXYZ:#@'=".<(+|!$*);,%_>?abcmnoxyz^[]{}\
+ &-0123456789ABCDEFGHIJKLMNOPQR/STUVWXYZ:#@'=".<(+|!$*);,%_>?abcmnoxyz^[]{}\
```
If you want to analyze the program, sorting the lines while
@@ -226,9 +226,9 @@ comment), there are technically `28!` different programs, or
all legal C.
```
-* except in Florida voting machines
+ * except in Florida voting machines
-** all cards must be face down, nine-edge first, of course.
+ ** all cards must be face down, nine-edge first, of course.
```
diff --git a/2001/westley/index.html b/2001/westley/index.html
index 72b7afa2f..a94053795 100644
--- a/2001/westley/index.html
+++ b/2001/westley/index.html
@@ -132,8 +132,7 @@
Author:
Name: Brian Westley
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,26 +141,26 @@ 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
code below.
Bugs and (Mis)features:
The current status of this entry is:
-
STATUS: uses gets() - change to fgets() if possible
-STATUS: missing files - please provide them
-STATUS: main() has only one arg - try and make it have 2 or 3
+
STATUS: uses gets() - change to fgets() if possible
+ STATUS: missing files - please provide them
+ STATUS: main() has only one arg - try and make it have 2 or 3
./westley2>/dev/null
-# enter some input, terminate with EOF
+
./westley2>/dev/null
+# enter some input, terminate with EOF
-echo foo |./westley2>/dev/null
+echo foo |./westley2>/dev/null
-./westley< westley.c 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.
@@ -172,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.punch2>/dev/null
+
echo'Brian Westley does it again!'|./westley.punch2>/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:
@@ -196,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”.
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.
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:
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:
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
@@ -265,7 +264,7 @@ Unrecognized characters are punched as a lace column.
(You can see an ASCII simulation of the code as punch cards
by looking at card.gif.)
If you want to analyze the program, sorting the lines while
ignoring leading blanks works best (sort -b). This will
produce the version that just reverses the line order, and
@@ -284,9 +283,9 @@ actually shorter than the trigraph version of a??(b??).
comment), there are technically 28! different programs, or
304,888,344,611,713,860,501,504,000,000 different versions,
all legal C.
-
* except in Florida voting machines
+
* except in Florida voting machines
-** all cards must be face down, nine-edge first, of course.
+ ** all cards must be face down, nine-edge first, of course.
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 8d0bd2581..84ff70b52 100644
--- a/2004/anonymous/README.md
+++ b/2004/anonymous/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./anonymous 'foo' > bar.pgm
+ ./anonymous 'foo' > bar.pgm
```
Now open the output using your favourite
@@ -22,7 +22,7 @@ images.
## Try:
```sh
-./try.sh
+ ./try.sh
```
NOTE: technically the text is supposed to be in all lower case but the script
@@ -108,8 +108,8 @@ 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
+ ./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
diff --git a/2004/anonymous/index.html b/2004/anonymous/index.html
index 80fb4cfe8..0dea0b6a3 100644
--- a/2004/anonymous/index.html
+++ b/2004/anonymous/index.html
@@ -132,8 +132,7 @@
@@ -142,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
@@ -152,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:
@@ -221,8 +220,8 @@ in lower case.
The following command thus writes a rendering of the Ring
inscription to
the file 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 f92604132..21fd5b2a3 100644
--- a/2004/arachnid/README.md
+++ b/2004/arachnid/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alt version for rogue players, vi(m) users and Dvorak typist (i.e.
@@ -12,20 +12,20 @@ code](#alternate-code) below.
## To use:
```sh
-./arachnid [mazefile]
+ ./arachnid [mazefile]
```
## Try:
```sh
-./arachnid arachnid.txt
+ ./arachnid arachnid.txt
```
and then try:
```sh
-./arachnid arachnid.c
+ ./arachnid arachnid.c
```
Navigation is through the use of the `wasd` inverted-T formation on
@@ -42,7 +42,7 @@ instead.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -81,7 +81,7 @@ explorers out there.
### Usage
```sh
-./arachnid [mazefile]
+ ./arachnid [mazefile]
```
You can explore the maze using the `w`,`a`,`s`, and `d` keys.
diff --git a/2004/arachnid/index.html b/2004/arachnid/index.html
index 2bc13e50d..dc1def705 100644
--- a/2004/arachnid/index.html
+++ b/2004/arachnid/index.html
@@ -132,8 +132,7 @@
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)!
@@ -159,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:
@@ -182,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.
@@ -142,35 +141,35 @@ 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:
This is a draw poker program. You
start with $100. Input alternates between your bet and which cards to keep.
Example:
-
5 <== you enter a bet of $5 (defaults to $1)
-J Q J 9 5 <== your hand is Jack of Clubs, Queen of Hearts,
-C H D S C Jack of Diamonds, 9 of Spades, 5 of Clubs
-123 <== you enter which cards you want to keep
+
5 <== you enter a bet of $5 (defaults to $1)
+ J Q J 9 5 <== your hand is Jack of Clubs, Queen of Hearts,
+ C H D S C Jack of Diamonds, 9 of Spades, 5 of Clubs
+ 123 <== you enter which cards you want to keep
(enter 0 to 5 digits between 1 and 5)
-J Q J J Q <== your new hand is Jack of Clubs, Queen of Hearts,
-C H D S C Jack of Diamonds, Jack of Spaces, Queen of clubs
-$145 (45) <== Your new balance is now $145. You had a Full House
+ J Q J J Q <== your new hand is Jack of Clubs, Queen of Hearts,
+ C H D S C Jack of Diamonds, Jack of Spaces, Queen of clubs
+ $145 (45) <== Your new balance is now $145. You had a Full House
so your payoff is 9 times your bet == 45
The payout is according to “Vegas rules”:
-
Straight Flush 50 times your bet
-Four of a Kind 25 times your bet
-Full House 9 times your bet
-Flush 6 times your bet
-Straight 4 times your bet
-3 of a Kind 3 times your bet
-2 Pair 2 times your bet
-Jacks or Better 1 times your bet
+
Straight Flush 50 times your bet
+ Four of a Kind 25 times your bet
+ Full House 9 times your bet
+ Flush 6 times your bet
+ Straight 4 times your bet
+ 3 of a Kind 3 times your bet
+ 2 Pair 2 times your bet
+ Jacks or Better 1 times your bet
The program allows you to go into debt. However I’m sure you would never
control-C to kill the program just because you got behind, right? On the other
hand the program never willingly exits, so you have to leave even when you are
diff --git a/2004/gavare/README.md b/2004/gavare/README.md
index 10e0d6e92..473563536 100644
--- a/2004/gavare/README.md
+++ b/2004/gavare/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There are three alternate versions; see [alternate code](#alternate-code) below
@@ -11,14 +11,14 @@ for more details.
## To use:
```sh
-./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:
```sh
-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.
@@ -29,7 +29,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 -
+ ./gavare | xv -
```
to not worry about writing it to a file and just viewing the image it creates.
@@ -54,19 +54,19 @@ on `stdout` which theoretically should work in Windows.
To build the configurable and unobfuscated versions:
```sh
-make alt
+ make alt
```
To change the default size from 1024x768 try:
```sh
-make clobber XX=640 YY=480 alt
+ make clobber XX=640 YY=480 alt
```
You might also wish to change the anti-alias setting:
```sh
-make clobber AA=2 alt
+ make clobber AA=2 alt
```
You may of course combine the above two commands and give any combination you
@@ -79,7 +79,7 @@ As the Windows version will not compile on most viewers' systems we do not build
it with `make alt`; instead try:
```sh
-make alt2
+ make alt2
```
diff --git a/2004/gavare/index.html b/2004/gavare/index.html
index 5c8ad9518..8cadf4c3c 100644
--- a/2004/gavare/index.html
+++ b/2004/gavare/index.html
@@ -132,8 +132,7 @@
Author:
Name: Anders Gavare
-Location: SE - Kingdom of Sweden (Sweden)
-
@@ -142,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
@@ -166,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 d6b246317..9365781b0 100644
--- a/2004/gavin/README.md
+++ b/2004/gavin/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -15,9 +15,9 @@ to reboot and rely on having a floppy drive (if you even remember what those are
The current status of this entry is:
```
-STATUS: compiled executable crashes - please help us fix
-STATUS: doesn't work with some platforms - please help us fix
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: compiled executable crashes - please help us fix
+ STATUS: doesn't work with some platforms - please help us fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2004 gavin bugs](../../bugs.html#2004_gavin).
@@ -26,7 +26,7 @@ For more detailed information see [2004 gavin bugs](../../bugs.html#2004_gavin).
## To use:
```sh
-./gavin
+ ./gavin
```
@@ -37,14 +37,14 @@ those? We do!):
```sh
-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:
```sh
-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.
@@ -52,27 +52,27 @@ 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
+ 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
+ vi gavin.c
```
Scroll up and down the file with up-arrow and down-arrow.
```sh
-sh
+ sh
```
You can have several shell windows:
```sh
-vi README.md
-./prim
+ vi README.md
+ ./prim
```
Press and hold any key.
@@ -87,7 +87,7 @@ you can use it with `QEMU`.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -198,7 +198,7 @@ so these may need updating as appropriate (`0x90200` is the address
at which a Linux bootloader loads an x86 kernel image).
```
-\* ;-)
+ \* ;-)
```
diff --git a/2004/gavin/gavin.html b/2004/gavin/gavin.html
index 97fe35b0e..11d960092 100644
--- a/2004/gavin/gavin.html
+++ b/2004/gavin/gavin.html
@@ -136,24 +136,28 @@ should do no damage to your existing setup, BUT I ACCEPT NO LIABILITY FOR ANY
DAMAGE DONE BY THIS PROGRAM. Run it at your own risk. The OS has been tested
on half a dozen machines or so, and worked on all but one. The failure came in
the form of the machine rebooting itself midway through loading the OS, with no
-nasty side-effects.
-
Hardware requirements - i386 or better processor, but the GUI is
-surprisingly power-hungry, so I would recommend a fast P3 or P4 processor
-(has been tested on P3/P4/Athlon machines). Minimum RAM is something like
-32MB. PS/2 mouse & keyboard required - no USB I’m afraid, and the keyboard
-map is for a UK keyboard. Uses VESA VBE 3.0, so should work on any modern
-graphics card (has been tested on NVIDIA, Matrox, and SiS cards).
-
Now you need to setup a bootloader to load the OS. If you have a system
+nasty side-effects.
+
+
Hardware requirements - i386 or better processor, but the GUI is
+ surprisingly power-hungry, so I would recommend a fast P3 or P4 processor
+ (has been tested on P3/P4/Athlon machines). Minimum RAM is something like
+ 32MB. PS/2 mouse & keyboard required - no USB I'm afraid, and the keyboard
+ map is for a UK keyboard. Uses VESA VBE 3.0, so should work on any modern
+ graphics card (has been tested on NVIDIA, Matrox, and SiS cards).
+
+
Now you need to setup a bootloader to load the OS. If you have a system
using a lilo bootloader you can simply add the OS to your boot menu. Just add
appropriate image= and initrd= lines to your /etc/lilo.conf, pointing at
kernel and fs.tar respectively (as built by make earlier), then run lilo.
If you do not wish modify your lilo setup, one easy option is to get yourself a
GRUB boot disk image, and follow the instructions for GRUB below - Debian users
-can simply runapt-get install grub-disk to get themselves a GRUB boot disk.
-
If you run GRUB, then at the boot menu simply hit c to get a console, then
-type kernel=(hd0,0)/<PATH>/kernel (substituting appropriate hard
-drive/partition numbers & path, or using (fd0) to load a kernel on the
-floppy), then initrd=(hd0,0)/<PATH>/fs.tar, and finally boot.
+can simply runapt-get install grub-disk to get themselves a GRUB boot disk.
+
+
If you run GRUB, then at the boot menu simply hit `c` to get a console, then
+ type `kernel=(hd0,0)/<PATH>/kernel` (substituting appropriate hard
+ drive/partition numbers & path, or using `(fd0)` to load a kernel on the
+ floppy), then `initrd=(hd0,0)/<PATH>/fs.tar`, and finally `boot`.
+
Assuming the OS has booted, what can you do now? Well, start by trying sh,
to open another shell. Then, try vi gavin.c to open up the OS source in a
text file viewer (up/down or PgUp/PgDn to scroll). Note that the provided
diff --git a/2004/gavin/gavin.md b/2004/gavin/gavin.md
index e8bed892e..d516f1761 100644
--- a/2004/gavin/gavin.md
+++ b/2004/gavin/gavin.md
@@ -15,12 +15,14 @@ on half a dozen machines or so, and worked on all but one. The failure came in
the form of the machine rebooting itself midway through loading the OS, with no
nasty side-effects.
+```
Hardware requirements - i386 or better processor, but the GUI is
surprisingly power-hungry, so I would recommend a fast P3 or P4 processor
(has been tested on P3/P4/Athlon machines). Minimum RAM is something like
32MB. PS/2 mouse & keyboard required - no USB I'm afraid, and the keyboard
map is for a UK keyboard. Uses VESA VBE 3.0, so should work on any modern
graphics card (has been tested on NVIDIA, Matrox, and SiS cards).
+```
3. Now you need to setup a bootloader to load the OS. If you have a system
using a lilo bootloader you can simply add the OS to your boot menu. Just add
@@ -30,10 +32,12 @@ If you do not wish modify your lilo setup, one easy option is to get yourself a
GRUB boot disk image, and follow the instructions for GRUB below - Debian users
can simply run`apt-get install grub-disk` to get themselves a GRUB boot disk.
+```
If you run GRUB, then at the boot menu simply hit `c` to get a console, then
type `kernel=(hd0,0)//kernel` (substituting appropriate hard
drive/partition numbers & path, or using `(fd0)` to load a kernel on the
floppy), then `initrd=(hd0,0)//fs.tar`, and finally `boot`.
+```
4. Assuming the OS has booted, what can you do now? Well, start by trying `sh`,
to open another shell. Then, try `vi gavin.c` to open up the OS source in a
diff --git a/2004/gavin/index.html b/2004/gavin/index.html
index 60cacdf37..98602f50c 100644
--- a/2004/gavin/index.html
+++ b/2004/gavin/index.html
@@ -132,8 +132,7 @@
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.
Bugs and (Mis)features:
The current status of this entry is:
-
STATUS: compiled executable crashes - please help us fix
-STATUS: doesn't work with some platforms - please help us fix
-STATUS: INABIAF - please **DO NOT** fix
+
STATUS: compiled executable crashes - please help us fix
+ STATUS: doesn't work with some platforms - please help us fix
+ STATUS: INABIAF - please **DO NOT** fix
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
@@ -257,7 +256,7 @@ data & code suitable for the new target platform.
Accesses to data in the string are made relative to the define V,
so these may need updating as appropriate (0x90200 is the address
at which a Linux bootloader loads an x86 kernel image).
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
@@ -164,34 +163,34 @@ 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:
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 autoconfconfigure script has been
provided to figure out the necessary link libraries, to verify all the necessary
headers and functions are present, and setup the #! paths for the CGI
examples. In which case the preferred build commands are:
-
./configure [--enable-port=number]
-make
+
./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 2cfe31613..ce72288ba 100644
--- a/2004/hoyle/README.md
+++ b/2004/hoyle/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./hoyle point ...
+ ./hoyle point ...
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -48,13 +48,13 @@ passed in.
For example, to graph `y = x^2`:
```sh
-./hoyle 0 0 1
+ ./hoyle 0 0 1
```
Note that:
```sh
-./hoyle 0 0 2
+ ./hoyle 0 0 2
```
will produce the same graph, since the `y-axis` is auto scaling.
diff --git a/2004/hoyle/index.html b/2004/hoyle/index.html
index 62c4d7c7b..3460a4d6f 100644
--- a/2004/hoyle/index.html
+++ b/2004/hoyle/index.html
@@ -132,8 +132,7 @@
Author:
Name: Jonathan Hoyle
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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,
@@ -168,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.
@@ -142,35 +141,35 @@ 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.
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 ff4a86bb4..ede111eab 100644
--- a/2004/kopczynski/README.md
+++ b/2004/kopczynski/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
NOTE: We FORCE the use of -O0 even if someone overrides it because this entry
@@ -11,14 +11,14 @@ will not work with it enabled.
## To use:
```sh
-./kopczynski < input_file
+ ./kopczynski < input_file
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
What happens if you feed the program source to the program? Can you figure out
@@ -35,15 +35,15 @@ does.
### Alternate build:
```sh
-make alt
+ make alt
```
### Alternate try:
```sh
-./kopczynski.alt < kopczynski-10
-echo $?
+ ./kopczynski.alt < kopczynski-10
+ echo $?
```
@@ -182,12 +182,12 @@ not the top left one.) The following messages will also work instead of `has
dirtiest IF`:
```
-HighlandYachter
-TestDirtiestTen
-has lintiest IF
-TighterLaughter
-HustlerDaughter
-TighterDemoThen
+ HighlandYachter
+ TestDirtiestTen
+ has lintiest IF
+ TighterLaughter
+ HustlerDaughter
+ TighterDemoThen
```
They can be mixed, of course!
diff --git a/2004/kopczynski/index.html b/2004/kopczynski/index.html
index c9c839e55..919c8fd53 100644
--- a/2004/kopczynski/index.html
+++ b/2004/kopczynski/index.html
@@ -132,8 +132,7 @@
@@ -142,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:
@@ -156,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
@@ -256,12 +255,12 @@ we use 15-character string.)
until it did. (The # character to find vertexes is in the top right corner,
not the top left one.) The following messages will also work instead of has dirtiest IF:
-
HighlandYachter
-TestDirtiestTen
-has lintiest IF
-TighterLaughter
-HustlerDaughter
-TighterDemoThen
+
HighlandYachter
+ TestDirtiestTen
+ has lintiest IF
+ TighterLaughter
+ HustlerDaughter
+ TighterDemoThen
They can be mixed, of course!
NOTE: item 8 was removed by the judges so as to not spoil the challenge of
diff --git a/2004/newbern/README.md b/2004/newbern/README.md
index 3743c7376..7c2de3fd5 100644
--- a/2004/newbern/README.md
+++ b/2004/newbern/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./newbern [file.dat arg]
+ ./newbern [file.dat arg]
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -35,14 +35,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
+ ./newbern char < some_nicely_shaped_text >> data_file
```
- To print a string using glyphs from a data file:
```sh
-./newbern data_file a_string
+ ./newbern data_file a_string
```
diff --git a/2004/newbern/index.html b/2004/newbern/index.html
index d234a31f0..707c56f2a 100644
--- a/2004/newbern/index.html
+++ b/2004/newbern/index.html
@@ -132,8 +132,7 @@
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 3d853cd02..a56689061 100644
--- a/2004/omoikane/README.md
+++ b/2004/omoikane/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./omoikane infile layout outfile
+ ./omoikane infile layout outfile
```
## Try:
```
-./try.sh
+ ./try.sh
```
@@ -44,7 +44,7 @@ insert a human-readable checksum string in the text itself! `^_^`
### Usage
```sh
-./omoikane
+ ./omoikane
```
All three arguments may reference the same file. All files is
@@ -82,18 +82,18 @@ layout.
Example file/layout:
```
-file: layout:
- crc = ######## ... . XXXXXXXX
- patch = ###### ..... . XXXXXX
- other text here ..... .... ....
+ file: layout:
+ crc = ######## ... . XXXXXXXX
+ patch = ###### ..... . XXXXXX
+ other text here ..... .... ....
```
And `Rinia` may generate a file similar to this:
```
-crc = 1bad73cf
-patch = #FR-QQ
-other text here
+ crc = 1bad73cf
+ patch = #FR-QQ
+ other text here
```
Note that the original file by itself is a valid layout file, since
@@ -116,9 +116,8 @@ runs faster if the checksum is placed before the other marker
characters rather than after, e.g.:
```
- a: X X XXX b: XXXXXXXX c: XXXXXXXX
- XXXXXXXX X X XXX XXXXX
-
+ a: X X XXX b: XXXXXXXX c: XXXXXXXX
+ XXXXXXXX X X XXX XXXXX
```
`a` usually takes the longest time, while `c` usually is the
diff --git a/2004/omoikane/index.html b/2004/omoikane/index.html
index 5b7a146fb..34cf5d461 100644
--- a/2004/omoikane/index.html
+++ b/2004/omoikane/index.html
@@ -132,8 +132,7 @@
Author:
Name: Don Yang
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,11 +141,11 @@ Location: US - United States of America
To build:
-
make
+
make
To use:
-
./omoikane infile layout outfile
+
./omoikane infile layout outfile
Try:
-
./try.sh
+
./try.sh
Judges’ remarks:
For extra credit, spot the checksum in the source file itself.
What makes this one particularly interesting is that the checksum,
@@ -162,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
@@ -188,14 +187,14 @@ then replace the remaining ones with space. Often it’s possible to
write the original file in such a way that it can be used as a
layout.
Example file/layout:
-
file: layout:
- crc = ######## ... . XXXXXXXX
- patch = ###### ..... . XXXXXX
- other text here ..... .... ....
+
file: layout:
+ crc = ######## ... . XXXXXXXX
+ patch = ###### ..... . XXXXXX
+ other text here ..... .... ....
And Rinia may generate a file similar to this:
-
crc = 1bad73cf
-patch = #FR-QQ
-other text here
+
crc = 1bad73cf
+ patch = #FR-QQ
+ other text here
Note that the original file by itself is a valid layout file, since
Rinia will recognize that only # marks enough space to hold the
checksum, and has the lowest frequency.
@@ -209,9 +208,8 @@ and nothing is written.
completely dominated by the layout file design. In general, Rinia
runs faster if the checksum is placed before the other marker
characters rather than after, e.g.:
-
a: X X XXX b: XXXXXXXX c: XXXXXXXX
- XXXXXXXX X X XXX XXXXX
-
+
a: X X XXX b: XXXXXXXX c: XXXXXXXX
+ XXXXXXXX X X XXX XXXXX
a usually takes the longest time, while c usually is the
fastest.
That said, each run is randomized with respect to system time, so
diff --git a/2004/schnitzi/README.md b/2004/schnitzi/README.md
index eaddbc54c..feace3a2c 100644
--- a/2004/schnitzi/README.md
+++ b/2004/schnitzi/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./schnitzi output.dat
+ ./schnitzi < input.dat > output.dat
```
Then, open the output file, select the text, and copy it
diff --git a/2004/schnitzi/index.html b/2004/schnitzi/index.html
index 5603284ab..7860a6a97 100644
--- a/2004/schnitzi/index.html
+++ b/2004/schnitzi/index.html
@@ -132,8 +132,7 @@
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:
@@ -186,7 +185,7 @@ it.)
to stdin when running the program. What follows is a detailed
description of the input file format.
The first line is specified thusly:
-
[duration] [timefactor]
+
[duration] [timefactor]
The first parameter, duration, defines how long the animation will run. The
second, timefactor, is used as sort of a fudge factor for machines that run
too fast to see the animation. A timefactor of 0 means, “run the animation as
@@ -199,7 +198,7 @@ different sprites, each up 50 by 50 in size, and with up to four
different ‘views’ of that object, which are cycled through with
each successive frame. Each sprite begins with a line of parameters
of the following form:
start is the time at which this sprite first appears.
@@ -222,11 +221,11 @@ scene, the other a bit of scrolling text.
Redirect the output directly to vi, like this:
-
./schnitzi< input.dat |vi
+
./schnitzi< input.dat |vi
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 ea21a54c3..d55ecce7a 100644
--- a/2004/sds/README.md
+++ b/2004/sds/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2004 sds bugs](../../bugs.html#2004_sds).
@@ -19,14 +19,14 @@ For more detailed information see [2004 sds bugs](../../bugs.html#2004_sds).
## To use:
```sh
-./sds
+ ./sds
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -64,13 +64,13 @@ decoder.
Try it out. Compile the program, then type
```sh
-./sds < sds.c
+ ./sds < sds.c
```
You should see the encoder program displayed. Now save it, like:
```sh
-./sds < sds.c > encoder.c
+ ./sds < sds.c > encoder.c
```
Then compile `encoder.c`. You now have the complete system ready.
@@ -83,15 +83,15 @@ 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
+ echo 'Hello, World!' > message
+ ./encoder message < remarks > remarks_msg
```
Then to decode:
```sh
-./sds < remarks_msg
-Hello, World!
+ ./sds < remarks_msg
+ Hello, World!
```
C programs are mostly unaffected by adding steganographic content,
diff --git a/2004/sds/index.html b/2004/sds/index.html
index a6bc8f45c..0348d1ce7 100644
--- a/2004/sds/index.html
+++ b/2004/sds/index.html
@@ -132,8 +132,7 @@
Author:
Name: Stephen Sykes
-Location: FI - Republic of Finland (Finland)
-
Why not use the program to hide another program in the program? It
must have seemed reasonable at the time.
@@ -175,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):
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 c7ade93b3..fe79826bc 100644
--- a/2004/vik1/README.md
+++ b/2004/vik1/README.md
@@ -1,27 +1,27 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./vik1 [arg]
+ ./vik1 [arg]
```
## Try:
```sh
-./vik1
+ ./vik1
-./vik1 a
+ ./vik1 a
-./vik1 d2
+ ./vik1 d2
-./vik1 ad3
+ ./vik1 ad3
```
@@ -83,24 +83,24 @@ The program takes three options which have to be typed in a specific
order as described below.
```sh
-Usage: ./vik1 ['a']['d'][#]
+ Usage: ./vik1 ['a']['d'][#]
-a - Advanced racing in a winter landscape
-d - Racing in at night in the dark
+ 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:
+ Command line: Description:
-$ ./vik1 Run track 1 at daytime in the summer
-$ ./vik1 a Run track 1 at daytime in the winter
-$ ./vik1 d Run track 1 at night in the summer
-$ ./vik1 3 Run track 3 at daytime in the summer
-$ ./vik1 d3 Run track 3 at night in the summer
-$ ./vik1 ad2 Run track 2 at night in the winter
+ $ ./vik1 Run track 1 at daytime in the summer
+ $ ./vik1 a Run track 1 at daytime in the winter
+ $ ./vik1 d Run track 1 at night in the summer
+ $ ./vik1 3 Run track 3 at daytime in the summer
+ $ ./vik1 d3 Run track 3 at night in the summer
+ $ ./vik1 ad2 Run track 2 at night in the winter
```
Note that the order in which the argument characters are entered is
diff --git a/2004/vik1/index.html b/2004/vik1/index.html
index 00c22e6eb..efd9cad3d 100644
--- a/2004/vik1/index.html
+++ b/2004/vik1/index.html
@@ -132,8 +132,7 @@
Author:
Name: Daniel Vik
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,17 +141,17 @@ Location: US - United States of America
To build:
-
make
+
make
To use:
-
./vik1[arg]
+
./vik1[arg]
Try:
-
./vik1
+
./vik1
-./vik1 a
+./vik1 a
-./vik1 d2
+./vik1 d2
-./vik1 ad3
+./vik1 ad3
Can you figure out how to cheat?
Also see the author’s remarks below for more details on the different
modes/options.
@@ -185,20 +184,20 @@ 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'][#]
+
Usage: ./vik1 ['a']['d'][#]
-a- Advanced racing in a winter landscape
-d- Racing in at night in the dark
+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:
+
Command line: Description:
-$ ./vik1 Run track 1 at daytime in the summer
-$ ./vik1 a Run track 1 at daytime in the winter
-$ ./vik1 d Run track 1 at night in the summer
-$ ./vik1 3 Run track 3 at daytime in the summer
-$ ./vik1 d3 Run track 3 at night in the summer
-$ ./vik1 ad2 Run track 2 at night in the winter
+ $ ./vik1 Run track 1 at daytime in the summer
+ $ ./vik1 a Run track 1 at daytime in the winter
+ $ ./vik1 d Run track 1 at night in the summer
+ $ ./vik1 3 Run track 3 at daytime in the summer
+ $ ./vik1 d3 Run track 3 at night in the summer
+ $ ./vik1 ad2 Run track 2 at night in the winter
Note that the order in which the argument characters are entered is
important. It is for example not possible to type ./vik1 da. (Well it is
possible, but the result will not be as expected.)
diff --git a/2004/vik2/README.md b/2004/vik2/README.md
index 97564cb2e..a4b81a5b4 100644
--- a/2004/vik2/README.md
+++ b/2004/vik2/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./vik2
+ ./vik2
```
@@ -128,7 +128,7 @@ speed up the compilation, define the `STOP` symbol to anything from `_3` to
time.) Prime numbers up to `2^STOP` will be calculated.
```sh
-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
@@ -136,20 +136,20 @@ Then use `cpp` or any other
work. This will take some time....
```sh
-cpp tmp1.c > tmp2.c
+ cpp tmp1.c > tmp2.c
```
Finally compile the pre-processed file
```sh
-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):
```sh
-./vik2
+ ./vik2
```
diff --git a/2004/vik2/index.html b/2004/vik2/index.html
index c7db3368a..decc85989 100644
--- a/2004/vik2/index.html
+++ b/2004/vik2/index.html
@@ -132,8 +132,7 @@
Author:
Name: Daniel Vik
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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
@@ -235,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 dba0a1daa..76e94a799 100644
--- a/2005/aidan/README.md
+++ b/2005/aidan/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version based on the author's remarks. See [alternate
@@ -11,10 +11,9 @@ code](#alternate-code).
## To use:
```sh
-./aidan < puzzle
-
-./aidan seed
+ ./aidan < puzzle
+ ./aidan seed
```
where `seed` is a number.
@@ -23,7 +22,7 @@ where `seed` is a number.
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -36,7 +35,7 @@ which is slower, inelegant and not as obscure, as the author put it.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -48,7 +47,7 @@ Use `aidan.alt` as you would `aidan` above.
### Alternate try:
```sh
-./try.alt.sh
+ ./try.alt.sh
```
@@ -141,14 +140,14 @@ 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<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 /* 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<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](aidan.alt.c).
@@ -163,18 +162,18 @@ Oh, and if you think that example sudoku is too easy, try this one (which my
program generated):
```
---- insane1.sudoku --
-. . 4 | . . . | . 5 6
-5 . . | . 7 2 | . . .
-. . 1 | . . . | 8 . .
-------+-------+------
-. . . | . . . | . . .
-. . . | 6 9 3 | . . 5
-. . . | . . . | 7 3 4
-------+-------+------
-. 5 . | 2 . 1 | 4 . 8
-3 . . | . . . | . . .
-. . . | . . . | . 6 1
+ --- insane1.sudoku --
+ . . 4 | . . . | . 5 6
+ 5 . . | . 7 2 | . . .
+ . . 1 | . . . | 8 . .
+ ------+-------+------
+ . . . | . . . | . . .
+ . . . | 6 9 3 | . . 5
+ . . . | . . . | 7 3 4
+ ------+-------+------
+ . 5 . | 2 . 1 | 4 . 8
+ 3 . . | . . . | . . .
+ . . . | . . . | . 6 1
```
Be warned - it's evil! (I certainly haven't been able to solve it by hand. The
@@ -188,20 +187,20 @@ reasons. That's the worst performance I've had from brute-force so far!)
#### Building
```sh
-cc -o sudoku-sf sudoku-sf.c
+ 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
+ gcc -O2 -Wall -Wextra -ansi -pedantic-errors -o sudoku-sf sudoku-sf.c
```
#### Testing (optional)
```sh
-perl ./test-su.perl
+ perl ./test-su.perl
```
Note that this requires Perl 5 (I use 5.8.5, earlier versions untested) and is
@@ -213,7 +212,7 @@ really.
#### Solving
```sh
-./aidan < somefile.txt
+ ./aidan < somefile.txt
```
Input should be the numbers of each row in turn. Empty spaces can be
@@ -234,7 +233,7 @@ though slightly slower. See if you can figure out what it does.)
#### Generating
```sh
-./sudoku
+ ./sudoku
```
Output is a blank grid, then the solution, then the problem. There's no
@@ -294,8 +293,8 @@ 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,)
+ #define foo(x,y) x y
+ foo(bar,)
```
Apparently, a few can't (ANSI C specifically doesn't require that this works,
diff --git a/2005/aidan/index.html b/2005/aidan/index.html
index 07fc501d1..b8205ee06 100644
--- a/2005/aidan/index.html
+++ b/2005/aidan/index.html
@@ -132,8 +132,7 @@
Author:
Name: Aidan Thornton
-Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
-
+Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
@@ -142,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< puzzle
-./aidan seed
+./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!
@@ -224,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.:
Be warned - it’s evil! (I certainly haven’t been able to solve it by hand. The
brute-force program given above, sudoku-bfi.c (aidan.alt.c),
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!)
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
@@ -283,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.
@@ -322,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 f30bd78da..c77a47391 100644
--- a/2005/anon/README.md
+++ b/2005/anon/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
NOTE: there is an alternate version for vi(m) like movements. See [alternate
@@ -9,7 +9,7 @@ version](#alternate-code) below. If your terminal has problems with the
`stty(1)` commands try:
```sh
-make anon-no_stty
+ make anon-no_stty
```
This will compile [anon.c](anon.c) as `anon` to not use `stty(1)`.
@@ -20,7 +20,7 @@ This will compile [anon.c](anon.c) as `anon` to not use `stty(1)`.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2005 anon bugs](../../bugs.html#2005_anon).
@@ -29,16 +29,16 @@ For more detailed information see [2005 anon bugs](../../bugs.html#2005_anon).
## To use:
```sh
-./anon x y [z]
+ ./anon x y [z]
```
## Try:
```sh
-./anon 4 4
+ ./anon 4 4
-./anon 3 3 3
+ ./anon 3 3 3
```
After a very large number of moves this program will deliberately force itself
@@ -49,13 +49,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
+ 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
+ yes 'please crash on me :-)' | ./anon 10 10 10
```
If you specify more than three args the program might also crash or do
@@ -71,13 +71,13 @@ The alternate version uses `vi(m)` like movement keys.
### Alternate build:
```sh
-make alt
+ make alt
```
To compile the version without `stty(1)`:
```sh
-make alt-no_stty
+ make alt-no_stty
```
@@ -86,12 +86,12 @@ make alt-no_stty
Use `anon.alt` as you would `anon` with the change in movements:
```
-k | Move empty spot up
-h | Move empty spot left
-j | Move empty spot down
-l | Move empty spot right
-J | Move empty spot forwards
-K | Move empty spot backwards
+ k | Move empty spot up
+ h | Move empty spot left
+ j | Move empty spot down
+ l | Move empty spot right
+ J | Move empty spot forwards
+ K | Move empty spot backwards
```
@@ -122,13 +122,13 @@ 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
+ ./anon 4 4
```
To play with a 3D board, do something like this:
```sh
-./anon 3 3 3
+ ./anon 3 3 3
```
**WARNING: do NOT run the program with more than 3 command-line arguments.
@@ -145,18 +145,18 @@ characters instead of digits. To slide the tiles around, use the following
keys:
```
-i | Slide the tile above the current empty space downwards.
-j | Slide the tile to the left of the current empty space to the right.
-k | Slide the tile below the current empty space upwards.
-l | Slide the tile to the right of the current empty space to the left.
-o | Slide the tile behind the current empty space forwards.
-n | Slide the tile in front of the current empty space backwards.
+ i | Slide the tile above the current empty space downwards.
+ j | Slide the tile to the left of the current empty space to the right.
+ k | Slide the tile below the current empty space upwards.
+ l | Slide the tile to the right of the current empty space to the left.
+ o | Slide the tile behind the current empty space forwards.
+ n | Slide the tile in front of the current empty space backwards.
```
To quit the game:
```
-q | Quit the game.
+ q | Quit the game.
```
Note that, for example, sliding the tile above the current empty spot
@@ -165,12 +165,12 @@ the current empty spot was. Hence, you could think of the movement keys in
terms of how they effectively "move" the empty spot:
```
-i | Move empty spot up
-j | Move empty spot left
-k | Move empty spot down
-l | Move empty spot right
-n | Move empty spot forwards
-o | Move empty spot backwards
+ i | Move empty spot up
+ j | Move empty spot left
+ k | Move empty spot down
+ l | Move empty spot right
+ n | Move empty spot forwards
+ o | Move empty spot backwards
```
**NOTE:** as a measure of alleviating counter-productivity due to addiction to
@@ -378,7 +378,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}
+ if (p) { q; r } else {s}
```
Why are `q` and `r` split up? Because it's cleaner (in whatever twisted sense of
@@ -405,18 +405,18 @@ 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)
+ for(s,i, 0, 10,
+ some_code ,
+ other_code)
```
is equivalent to:
```c
-for (i=0; i<10; i++) {
- some_code;
-}
-other_code;
+ for (i=0; i<10; i++) {
+ some_code;
+ }
+ other_code;
```
Note the "wrong" indentation in the former: the author prefers to write it
@@ -444,25 +444,25 @@ program, and what the various state numbers are meant to do:
#### MASS usage map
```
-0 | Function return value
-1 | Function argument 1
-2 | Function argument 2
-3 | Function argument 3
-4 | Scratch register 1
-5 | Scratch register 2
-6 | Scratch register 3
-7 | Scratch register 4
-8 | Value of original argv :-)
-9 | Value of original argc :-)
-11 | Zero register (always set to 0)
-12 | Width of board
-13 | Length of board
-14 | Height of board
-15 | Current position of hole
-16 | Random seed for rand_r(3)
-18 | Scratch register used by state 18 :-)
-31 | field width for printing tiles
-32 | Start of board data
+ 0 | Function return value
+ 1 | Function argument 1
+ 2 | Function argument 2
+ 3 | Function argument 3
+ 4 | Scratch register 1
+ 5 | Scratch register 2
+ 6 | Scratch register 3
+ 7 | Scratch register 4
+ 8 | Value of original argv :-)
+ 9 | Value of original argc :-)
+ 11 | Zero register (always set to 0)
+ 12 | Width of board
+ 13 | Length of board
+ 14 | Height of board
+ 15 | Current position of hole
+ 16 | Random seed for rand_r(3)
+ 18 | Scratch register used by state 18 :-)
+ 31 | field width for printing tiles
+ 32 | Start of board data
```
(**CAVEAT:** not all of these mappings ended up in the final version of the
@@ -478,22 +478,22 @@ to be on all tested architectures.)
#### State number assignments
```
-1 | showhelp
-2 | showhelp
-3 | is 2D: start init
-4 | is 3D: start init
-5 | find allocation type
-6 | MASS init, bottom-up
-7 | MASS init, top-down
-8 | main program
-9 | generate() outer loop
-13 | render()
-14 | render() loop
-15 | exit(0)
-16 | pick a tile that hasn't occurred yet
-17 | inner loop of 16.
-18 | main loop
-19 | checkwin() loop
+ 1 | showhelp
+ 2 | showhelp
+ 3 | is 2D: start init
+ 4 | is 3D: start init
+ 5 | find allocation type
+ 6 | MASS init, bottom-up
+ 7 | MASS init, top-down
+ 8 | main program
+ 9 | generate() outer loop
+ 13 | render()
+ 14 | render() loop
+ 15 | exit(0)
+ 16 | pick a tile that hasn't occurred yet
+ 17 | inner loop of 16.
+ 18 | main loop
+ 19 | checkwin() loop
```
Note that some of the manually-implemented states (those not implemented by
diff --git a/2005/anon/index.html b/2005/anon/index.html
index 1cf84b6af..1bd2b5830 100644
--- a/2005/anon/index.html
+++ b/2005/anon/index.html
@@ -132,8 +132,7 @@
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).
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
-h | Move empty spot left
-j | Move empty spot down
-l | Move empty spot right
-J | Move empty spot forwards
-K | Move empty spot backwards
+
k | Move empty spot up
+ h | Move empty spot left
+ j | Move empty spot down
+ l | Move empty spot right
+ J | Move empty spot forwards
+ K | Move empty spot backwards
Judges’ remarks:
Taking the 4x4 board with 15 tiles to a whole new level, this entry takes this
puzzle to a whole new dimension! While you puzzle out this puzzle, we invite
@@ -201,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.
:-)
@@ -214,24 +213,24 @@ dimensions. :-) (10x10x10 is considered a safe upper limit.)
The empty space on the board is represented by a space filled with #
characters instead of digits. To slide the tiles around, use the following
keys:
-
i | Slide the tile above the current empty space downwards.
-j | Slide the tile to the left of the current empty space to the right.
-k | Slide the tile below the current empty space upwards.
-l | Slide the tile to the right of the current empty space to the left.
-o | Slide the tile behind the current empty space forwards.
-n | Slide the tile in front of the current empty space backwards.
+
i | Slide the tile above the current empty space downwards.
+ j | Slide the tile to the left of the current empty space to the right.
+ k | Slide the tile below the current empty space upwards.
+ l | Slide the tile to the right of the current empty space to the left.
+ o | Slide the tile behind the current empty space forwards.
+ n | Slide the tile in front of the current empty space backwards.
To quit the game:
-
q | Quit the game.
+
q | Quit the game.
Note that, for example, sliding the tile above the current empty spot
downwards will fill up the empty spot, and create a new empty spot above where
the current empty spot was. Hence, you could think of the movement keys in
terms of how they effectively “move” the empty spot:
-
i | Move empty spot up
-j | Move empty spot left
-k | Move empty spot down
-l | Move empty spot right
-n | Move empty spot forwards
-o | Move empty spot backwards
+
i | Move empty spot up
+ j | Move empty spot left
+ k | Move empty spot down
+ l | Move empty spot right
+ n | Move empty spot forwards
+ o | Move empty spot backwards
NOTE: as a measure of alleviating counter-productivity due to addiction to
this game, particularly for those hardcore gamers who insist on solving a
10x10x10 puzzle during work hours, and also to give an upper bound to user
@@ -395,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
@@ -416,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:
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
@@ -444,25 +443,25 @@ key press. What could be more fun than to define such a case in terms of a
are the mappings of various locations of the MASS to their usage in the
program, and what the various state numbers are meant to do:
MASS usage map
-
0 | Function return value
-1 | Function argument 1
-2 | Function argument 2
-3 | Function argument 3
-4 | Scratch register 1
-5 | Scratch register 2
-6 | Scratch register 3
-7 | Scratch register 4
-8 | Value of original argv :-)
-9 | Value of original argc :-)
-11 | Zero register (always set to 0)
-12 | Width of board
-13 | Length of board
-14 | Height of board
-15 | Current position of hole
-16 | Random seed for rand_r(3)
-18 | Scratch register used by state 18 :-)
-31 | field width for printing tiles
-32 | Start of board data
+
0 | Function return value
+ 1 | Function argument 1
+ 2 | Function argument 2
+ 3 | Function argument 3
+ 4 | Scratch register 1
+ 5 | Scratch register 2
+ 6 | Scratch register 3
+ 7 | Scratch register 4
+ 8 | Value of original argv :-)
+ 9 | Value of original argc :-)
+ 11 | Zero register (always set to 0)
+ 12 | Width of board
+ 13 | Length of board
+ 14 | Height of board
+ 15 | Current position of hole
+ 16 | Random seed for rand_r(3)
+ 18 | Scratch register used by state 18 :-)
+ 31 | field width for printing tiles
+ 32 | Start of board data
(CAVEAT: not all of these mappings ended up in the final version of the
program, mainly due to size limitations which entailed the trimming off of a
lot of neat features in the game. It is left as an exercise for the reader to
@@ -472,22 +471,22 @@ the MASS, because otherwise they may overwrite their original value
memory allocation code saves them. Index 8 is deemed “safe enough”. (It seems
to be on all tested architectures.)
State number assignments
-
1 | showhelp
-2 | showhelp
-3 | is 2D: start init
-4 | is 3D: start init
-5 | find allocation type
-6 | MASS init, bottom-up
-7 | MASS init, top-down
-8 | main program
-9 | generate() outer loop
-13 | render()
-14 | render() loop
-15 | exit(0)
-16 | pick a tile that hasn't occurred yet
-17 | inner loop of 16.
-18 | main loop
-19 | checkwin() loop
+
1 | showhelp
+ 2 | showhelp
+ 3 | is 2D: start init
+ 4 | is 3D: start init
+ 5 | find allocation type
+ 6 | MASS init, bottom-up
+ 7 | MASS init, top-down
+ 8 | main program
+ 9 | generate() outer loop
+ 13 | render()
+ 14 | render() loop
+ 15 | exit(0)
+ 16 | pick a tile that hasn't occurred yet
+ 17 | inner loop of 16.
+ 18 | main loop
+ 19 | checkwin() loop
Note that some of the manually-implemented states (those not implemented by
do()) respond to multiple state numbers. Also note that states 1-4
conveniently correspond to what the program should do when 1-4 arguments are
diff --git a/2005/boutines/README.md b/2005/boutines/README.md
index f2dc02287..33e34fb0f 100644
--- a/2005/boutines/README.md
+++ b/2005/boutines/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -16,20 +16,20 @@ Look here to find some [SVG Viewer
Implementations](https://www.w3.org/Graphics/SVG/WG/wiki/Implementations).
```sh
-./boutines < input > output.svg
+ ./boutines < input > output.svg
```
## Try:
```sh
-./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
+ ruby -e '20.times{puts "#{rand} #{rand}"}' | ./boutines > test.svg
```
It will also create an SVG file with the file [input.txt](input.txt).
@@ -76,7 +76,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
+ ./boutines | gzip > result.svg.gz
```
Input consists of a list of floating points values separated by whitespaces
@@ -85,11 +85,11 @@ whitespace then the other coordinate (pointing downwards in the resulting
graph) and a newline will just go fine:
```
-0 0
-0 1
-1 0
-1 1
-.5 .5
+ 0 0
+ 0 1
+ 1 0
+ 1 1
+ .5 .5
```
Strictly speaking, you have to provide a **set** of points. If there are
diff --git a/2005/boutines/index.html b/2005/boutines/index.html
index a4c2445a9..d9d1a30a1 100644
--- a/2005/boutines/index.html
+++ b/2005/boutines/index.html
@@ -132,8 +132,7 @@
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
@@ -179,16 +178,16 @@ square.
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
graph) and a newline will just go fine:
@@ -142,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 0e2e5415b..d46c0f8a3 100644
--- a/2005/giljade/README.md
+++ b/2005/giljade/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
NOTE: We FORCE the use of -O0 even if someone overrides it because this entry
@@ -13,7 +13,7 @@ will not work with it enabled.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2005 giljade bugs](../../bugs.html#2005_giljade).
@@ -22,22 +22,22 @@ For more detailed information see [2005 giljade bugs](../../bugs.html#2005_gilja
## To use:
```sh
-./giljade
+ ./giljade
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
### Self-test feature to try:
```sh
-./giljade > out
-./giljade out
+ ./giljade > out
+ ./giljade out
```
NOTE: [try.sh](try.sh) will ask you if you wish to do this.
@@ -53,7 +53,7 @@ Control-F.
If you really understand expressions, then understand this:
```c
-s=s^(b=s&s-1^s)
+ s=s^(b=s&s-1^s)
```
... and understand why it is found in the source code.
diff --git a/2005/giljade/index.html b/2005/giljade/index.html
index b3322c540..4e4ec12a3 100644
--- a/2005/giljade/index.html
+++ b/2005/giljade/index.html
@@ -132,8 +132,7 @@
Author:
Name: Gil Dogon
-Location: IL - State of Israel (Israel)
-
@@ -146,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 e2408d7bf..4a0d22772 100644
--- a/2005/klausler/README.md
+++ b/2005/klausler/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./klausler arg1 arg2 | head
+ ./klausler arg1 arg2 | head
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
diff --git a/2005/klausler/index.html b/2005/klausler/index.html
index acaaefa84..3c3b17bdc 100644
--- a/2005/klausler/index.html
+++ b/2005/klausler/index.html
@@ -132,8 +132,7 @@
Author:
Name: Peter Klausler
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 fc5e00bb3..aa183e382 100644
--- a/2005/mikeash/README.md
+++ b/2005/mikeash/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2005 mikeash bugs](../../bugs.html#2005_mikeash).
@@ -19,7 +19,7 @@ For more detailed information see [2005 mikeash bugs](../../bugs.html#2005_mikea
## To use:
```sh
-./mikeash
+ ./mikeash
```
NOTE: the author stated that they tested this under i386 machines but this works
@@ -29,7 +29,7 @@ under 64-bit (x86_64, arm64) machines too.
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -68,7 +68,7 @@ functions.
Try:
```sh
-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
@@ -77,7 +77,7 @@ the format function. More sophisticated arithmetic expressions may be
used:
```sh
-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,
@@ -131,8 +131,8 @@ 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
+ ./mikeash < mikeash.c > mikeash2.c
+ diff mikeash.c mikeash2.c
```
The program can also be run from an implementation of [common
@@ -140,7 +140,7 @@ lisp](https://en.wikipedia.org/wiki/Common_Lisp). To do
this, run the common lisp compiler and then type the following command:
```
-(load "mikeash.c")
+ (load "mikeash.c")
```
The source code of [mikeash.c](mikeash.c) will be printed.
diff --git a/2005/mikeash/index.html b/2005/mikeash/index.html
index 03594d72a..65544d691 100644
--- a/2005/mikeash/index.html
+++ b/2005/mikeash/index.html
@@ -132,8 +132,7 @@
Author:
Name: Michael Ash
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,17 +141,17 @@ Location: US - United States of America
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
@@ -176,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:
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
@@ -220,12 +219,12 @@ nowhere near
Basically, the LISP interpreter is good for some basic math operations, and
for running itself. To do the latter, try this:
Lispob is obfuscated in several ways. First, it’s actually two programs
diff --git a/2005/mynx/README.md b/2005/mynx/README.md
index b33344d9f..176f16747 100644
--- a/2005/mynx/README.md
+++ b/2005/mynx/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version that scans for (_ONLY_ scans) the string `https`
@@ -13,7 +13,7 @@ as a starting point. See [alternate code](#alternate-code) below.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2005 mynx bugs](../../bugs.html#2005_mynx).
@@ -22,7 +22,7 @@ For more detailed information see [2005 mynx bugs](../../bugs.html#2005_mynx).
## To use:
```sh
-./mynx http://
+ ./mynx http://
```
You can specify a port by appending to the domain `:port`. See notes below on
@@ -32,9 +32,9 @@ the issue of https.
## Try:
```sh
-./mynx http://www.textfiles.com
+ ./mynx http://www.textfiles.com
-./mynx manual.html
+ ./mynx manual.html
```
@@ -59,7 +59,7 @@ must just appreciate the entry for what it once was.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -69,7 +69,7 @@ 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
+ ./mynx.alt https://www.ioccc.org:443
```
but again unless you have a clever workaround or hack to the problem, this sadly
@@ -93,13 +93,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
+ cc -o mynx mynx.c
```
While some others like to be a little different:
```sh
-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
@@ -108,13 +108,13 @@ all the network functions in a variety of places. So a simpler build
command sequence would be:
```sh
-cd source ; ./configure ; make
+ cd source ; ./configure ; make
```
After which, the rest of the documentation can be read by saying:
```sh
-./mynx ../manual.html
+ ./mynx ../manual.html
```
diff --git a/2005/mynx/index.html b/2005/mynx/index.html
index c9cc70d79..3cb72131c 100644
--- a/2005/mynx/index.html
+++ b/2005/mynx/index.html
@@ -132,8 +132,7 @@
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
@@ -172,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:
@@ -189,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
@@ -142,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
@@ -159,11 +158,11 @@ generated by the entry).
functions _setmode() and _fileno(3) to set binary mode on stdout which should
let it work with Windows.
Alternate build:
-
make alt
+
make alt
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:
@@ -180,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
@@ -191,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 3070a721d..ffe3e7576 100644
--- a/2005/sykes/README.md
+++ b/2005/sykes/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2005 sykes bugs](../../bugs.html#2005_sykes).
@@ -19,14 +19,14 @@ For more detailed information see [2005 sykes bugs](../../bugs.html#2005_sykes).
## To use:
```sh
-./sykes binary_file
+ ./sykes binary_file
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -45,16 +45,16 @@ 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
-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:
```sh
-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.
@@ -80,7 +80,7 @@ Compile the program, then test the
[emulation](https://en.wikipedia.org/wiki/Emulator) like this:
```sh
-./sykes 6502test
+ ./sykes 6502test
```
A basic test is done for each instruction and addressing mode, all tests
@@ -106,27 +106,27 @@ window](https://en.wikipedia.org/wiki/Terminal_emulator) of 40x25 chars or
bigger, and then run the emulator like this:
```sh
-./sykes pet.rom
+ ./sykes pet.rom
```
You should see the startup message. Try typing in some
[BASIC](https://en.wikipedia.org/wiki/BASIC) - for instance:
```
-PRINT "HELLO, WORLD"
+ PRINT "HELLO, WORLD"
```
There is an optional numeric parameter, which controls the speed. For a
slower cursor blink, try
```sh
-./sykes pet.rom 6
+ ./sykes pet.rom 6
```
and for faster
```sh
-./sykes pet.rom 2
+ ./sykes pet.rom 2
```
The default is 4.
@@ -134,23 +134,23 @@ The default is 4.
The control keys are as follows:
```
-^A HOME
-^L CLR
-^R RVS
-^E OFF
-^Y INST
-^X STOP (break)
-^F cursor forward
-^B cursor back
-^N cursor down
+ ^A HOME
+ ^L CLR
+ ^R RVS
+ ^E OFF
+ ^Y INST
+ ^X STOP (break)
+ ^F cursor forward
+ ^B cursor back
+ ^N cursor down
```
Supplied also is a short demo program written in
[BASIC](https://en.wikipedia.org/wiki/BASIC). Try typing
```
-LOAD "DEMO"
-RUN
+ LOAD "DEMO"
+ RUN
```
Many other old programs will run in this emulator too. Files with a `.PRG`
@@ -162,19 +162,19 @@ The filenames must be upper case in order to be loaded by the emulator.
You can save programs too - try
```
-10 PRINT "HELLO!"
-SAVE "HELLO"
-NEW
+ 10 PRINT "HELLO!"
+ SAVE "HELLO"
+ NEW
-LOAD "HELLO"
-RUN
+ LOAD "HELLO"
+ RUN
```
You also might try typing this to see an ancient [Easter egg][]:
```
-WAIT 6502,12
+ WAIT 6502,12
```
[Easter egg]: https://en.wikipedia.org/wiki/Easter_egg_(media)#Software
@@ -192,7 +192,7 @@ compiled-for-[6502](https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_
version a chess program (heh, I found a use for a previous losing entry :) ). Try:
```sh
-./sykes chess
+ ./sykes chess
```
It works as you would expect (it plays very badly). There's no castling
@@ -307,7 +307,7 @@ from the Internet. This is to avoid directly infringing any copyright.
What does this do?
```sh
-./sykes pet.rom -1
+ ./sykes pet.rom -1
```
Have fun!
diff --git a/2005/sykes/index.html b/2005/sykes/index.html
index e99ae2697..fd7caecff 100644
--- a/2005/sykes/index.html
+++ b/2005/sykes/index.html
@@ -132,8 +132,7 @@
Author:
Name: Stephen Sykes
-Location: FI - Republic of Finland (Finland)
-
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:
@@ -181,7 +180,7 @@ to not infringe the rules.
Compile the program, then test the
6502emulation 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.
@@ -197,44 +196,44 @@ 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"
+
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
-^L CLR
-^R RVS
-^E OFF
-^Y INST
-^X STOP (break)
-^F cursor forward
-^B cursor back
-^N cursor down
+
^A HOME
+ ^L CLR
+ ^R RVS
+ ^E OFF
+ ^Y INST
+ ^X STOP (break)
+ ^F cursor forward
+ ^B cursor back
+ ^N cursor down
Supplied also is a short demo program written in
BASIC. Try typing
@@ -142,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 a42867f10..590089412 100644
--- a/2005/toledo/README.md
+++ b/2005/toledo/README.md
@@ -1,22 +1,22 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./toledo [a ...]
+ ./toledo [a ...]
```
## Try:
```sh
-./toledo a
-./toledo a b
+ ./toledo a
+ ./toledo a b
```
@@ -31,7 +31,7 @@ Two alternate versions of this entry, [toledo2.c](toledo2.c) and
To compile the alternate versions:
```sh
-make alt
+ make alt
```
@@ -64,7 +64,7 @@ two modes: two-players, and one player (always white) against the machine. To
get the first mode, run the program without arguments:
```sh
-./toledo
+ ./toledo
```
The other mode is accessible running the program with one argument
@@ -72,14 +72,14 @@ The other mode is accessible running the program with one argument
analysis):
```sh
-./toledo a
+ ./toledo a
```
Two arguments for 6-[ply](https://en.wikipedia.org/wiki/Ply_(game_theory))
analysis:
```sh
-./toledo a b
+ ./toledo a b
```
And each successive argument will analyze one
diff --git a/2005/toledo/index.html b/2005/toledo/index.html
index f7e2cf16b..2230a9bdb 100644
--- a/2005/toledo/index.html
+++ b/2005/toledo/index.html
@@ -132,8 +132,7 @@
Author:
Name: Oscar Toledo G.
-Location: MX - United Mexican States (Mexico)
-
@@ -142,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:
@@ -171,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):
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 765675e20..95b6acf58 100644
--- a/2005/vik/README.md
+++ b/2005/vik/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./vik [file.map]
+ ./vik [file.map]
```
## Try:
```sh
-./vik maze.map
+ ./vik maze.map
```
@@ -61,14 +61,14 @@ 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]
+ ./vik [-w ] [mapfile]
```
where:
```
-width - Specifies the width of the window
-mapfile - Filename containing a map
+ width - Specifies the width of the window
+ mapfile - Filename containing a map
```
#### Examples
@@ -76,20 +76,20 @@ mapfile - Filename containing a map
Start the engine using a built in labyrinth and texture bitmaps:
```sh
-./vik
+ ./vik
```
Start the engine and loads the labyrinth defined in the file
[maze.map](maze.map):
```sh
-./vik maze.map
+ ./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
+ ./vik -w 400 maze.map
```
Note that the `mapfile` has to be the last argument and the `-w` option if present
@@ -107,12 +107,12 @@ engine what bitmap texture file to use. The `*` character lets the engine know
where to position the user. The example below shows how a map file can look:
```
-aaaaaaaaaaaaa
-a a
-a * a
-a bbbb cccccccc
-c c
-cccccccccccccccccccc
+ aaaaaaaaaaaaa
+ a a
+ a * a
+ a bbbb cccccccc
+ c c
+ cccccccccccccccccccc
```
The engine loads the map, and creates walls. When a character in the range `a-z`
diff --git a/2005/vik/index.html b/2005/vik/index.html
index 0e9409811..18d77889f 100644
--- a/2005/vik/index.html
+++ b/2005/vik/index.html
@@ -132,8 +132,7 @@
Author:
Name: Daniel Vik
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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
@@ -178,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
+
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.
@@ -199,12 +198,12 @@ located in the current directory.
ASCII text file where lower case letters represent walls. The letter tells the
engine what bitmap texture file to use. The * character lets the engine know
where to position the user. The example below shows how a map file can look:
-
aaaaaaaaaaaaa
-a a
-a * a
-a bbbb cccccccc
-c c
-cccccccccccccccccccc
+
aaaaaaaaaaaaa
+ a a
+ a * a
+ a bbbb cccccccc
+ c c
+ cccccccccccccccccccc
The engine loads the map, and creates walls. When a character in the range a-z
is found, the engine will load the corresponding texture bitmap. The bitmap file
must be named *.bmp where * is substituted with the letter of the wall in
diff --git a/2005/vince/README.md b/2005/vince/README.md
index 14976158c..cfd3975be 100644
--- a/2005/vince/README.md
+++ b/2005/vince/README.md
@@ -4,14 +4,14 @@ Before building, make sure that you have the OpenGL development libraries
installed.
```sh
-make
+ make
```
## To use:
```sh
-./vince
+ ./vince
```
@@ -32,7 +32,7 @@ also has the recursive `CPP` macro (which sneaked in accidentally) removed.
To compile this alternate version:
```sh
-make alt
+ make alt
```
diff --git a/2005/vince/index.html b/2005/vince/index.html
index a938a640e..b7d8e34f2 100644
--- a/2005/vince/index.html
+++ b/2005/vince/index.html
@@ -132,8 +132,7 @@
Author:
Name: Vincent Weaver
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -144,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!
@@ -155,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 b1b96d761..22445ac14 100644
--- a/2006/birken/README.md
+++ b/2006/birken/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: uses gets() - change to fgets() if possible
+ STATUS: uses gets() - change to fgets() if possible
```
For more detailed information see [2006 birken bugs](../../bugs.html#2006_birken).
@@ -19,14 +19,14 @@ For more detailed information see [2006 birken bugs](../../bugs.html#2006_birken
## To use:
```sh
-./birken < file.tofu
+ ./birken < file.tofu
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
etc.
diff --git a/2006/birken/index.html b/2006/birken/index.html
index c6b41cf99..ef786662f 100644
--- a/2006/birken/index.html
+++ b/2006/birken/index.html
@@ -132,8 +132,7 @@
Author:
Name: Michael Birken
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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
+
STATUS: uses gets() - change to fgets() if possible
diff --git a/2006/borsanyi/README.md b/2006/borsanyi/README.md
index b2fc78c2a..e49720212 100644
--- a/2006/borsanyi/README.md
+++ b/2006/borsanyi/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2006 borsanyi bugs](../../bugs.html#2006_borsanyi).
@@ -19,14 +19,14 @@ For more detailed information see [2006 borsanyi bugs](../../bugs.html#2006_bors
## To use:
```sh
-./borsanyi string > file.gif
+ ./borsanyi string > file.gif
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
We recommend you input for the filename `example.gif` and for the string
@@ -69,9 +69,9 @@ 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
+ 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
diff --git a/2006/borsanyi/index.html b/2006/borsanyi/index.html
index 028562644..020d2cfce 100644
--- a/2006/borsanyi/index.html
+++ b/2006/borsanyi/index.html
@@ -132,8 +132,7 @@
Author:
Name: Szabolcs Borsanyi
-Location: DE - Federal Republic of Germany (Germany)
-
+Location: DE - Federal Republic of Germany (Germany)
@@ -142,15 +141,15 @@ Location: DE - Federal Republic of Germ
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.
@@ -176,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 65ce72eeb..0ef56dd95 100644
--- a/2006/grothe/README.md
+++ b/2006/grothe/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./grothe carrier_freq pixelclock horizontal_total < some_input.txt
+ ./grothe carrier_freq pixelclock horizontal_total < some_input.txt
```
@@ -17,7 +17,7 @@ make
Put on your "electronic ears" and then try:
```sh
-./try.sh
+ ./try.sh
```
You may find using
@@ -42,22 +42,22 @@ To be able to run the program you need to determine the following
parameters:
```
-carrier_freq - base frequency used to host music
-pixelclock - refresh rate of the monitor
-horizontal_total - total scan along the horizontal axis
+ carrier_freq - base frequency used to host music
+ pixelclock - refresh rate of the monitor
+ 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
```sh
-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:
```sh
-./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
@@ -74,19 +74,19 @@ and [Timex Sinclair ZX-81](https://en.wikipedia.org/wiki/ZX81)s.
Olympics Fanfare - from `antang@phakt.usc.edu` - Tony:
```
-4-9-91231,2222-321123123-9-91231,2222-32112321
+ 4-9-91231,2222-321123123-9-91231,2222-32112321
```
Twinkle Twinkle Little Star - from `fsufunkyb@aol.com` - Ben Schmidt:
```
-1199##9-6633221-9966332-9966332-1199#9-6633221-
+ 1199##9-6633221-9966332-9966332-1199#9-6633221-
```
Generic Arabian Tune - from `rdippold@qualcomm.com` - Ron "Asbestos" Dippold:
```
-453,54,4569564459,9#95458,8987453 54
+ 453,54,4569564459,9#95458,8987453 54
```
Others can be found by doing a search for "touch tone phone songs".
diff --git a/2006/grothe/index.html b/2006/grothe/index.html
index 000b0e188..f575407ae 100644
--- a/2006/grothe/index.html
+++ b/2006/grothe/index.html
@@ -132,8 +132,7 @@
Author:
Name: Aaron Grothe
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,12 +141,12 @@ Location: US - United States of America
Olympics Fanfare - from antang@phakt.usc.edu - Tony:
-
4-9-91231,2222-321123123-9-91231,2222-32112321
+
4-9-91231,2222-321123123-9-91231,2222-32112321
Twinkle Twinkle Little Star - from fsufunkyb@aol.com - Ben Schmidt:
-
1199##9-6633221-9966332-9966332-1199#9-6633221-
+
1199##9-6633221-9966332-9966332-1199#9-6633221-
Generic Arabian Tune - from rdippold@qualcomm.com - Ron “Asbestos” Dippold:
-
453,54,4569564459,9#95458,8987453 54
+
453,54,4569564459,9#95458,8987453 54
Others can be found by doing a search for “touch tone phone songs”.
Obfuscations
diff --git a/2006/hamre/README.md b/2006/hamre/README.md
index 0332ddd74..87d012e3a 100644
--- a/2006/hamre/README.md
+++ b/2006/hamre/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./hamre math_expression_string
+ ./hamre math_expression_string
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -43,8 +43,8 @@ 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
+ ./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
diff --git a/2006/hamre/index.html b/2006/hamre/index.html
index 728fbac82..c108e650d 100644
--- a/2006/hamre/index.html
+++ b/2006/hamre/index.html
@@ -132,8 +132,7 @@
Author:
Name: Steinar Hamre
-Location: NO - Kingdom of Norway (Norway)
-
@@ -142,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
@@ -163,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 7185e941f..93831e729 100644
--- a/2006/meyer/README.md
+++ b/2006/meyer/README.md
@@ -1,27 +1,27 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./meyer [SEED]
+ ./meyer [SEED]
```
## Try:
```sh
-./meyer [SEED]
+ ./meyer [SEED]
```
For your first input try:
```
-a 0 1
+ a 0 1
```
where `a` is the row (`a`-`i`), `0` is the column (`0`-`8`) and `1` is the
@@ -70,13 +70,13 @@ it is obvious, that object-oriented code isn't '`WYWIWID`' ('what
you write is what it does'). It may be tempting to think that
```
-Object o;
+ Object o;
```
might do something similar as
```c
-struct not_an_object o;
+ struct not_an_object o;
```
But this program reveals that it doesn't. Even worse, this program only
@@ -101,7 +101,7 @@ implementation in a popular object-oriented programming language.
### Starting the game
```sh
-./meyer [SEED]
+ ./meyer [SEED]
```
### Gameplay
@@ -119,15 +119,15 @@ breaking the following rule. Any number must be unique in its:
Expected input for your move:
```
-row column number
+ row column number
```
where
```
-row: [a-i]
-column: [0-8]
-number: [1-9].
+ row: [a-i]
+ column: [0-8]
+ number: [1-9].
```
The game can be aborted with `q`.
diff --git a/2006/meyer/index.html b/2006/meyer/index.html
index 2a25d35bd..e57f9884e 100644
--- a/2006/meyer/index.html
+++ b/2006/meyer/index.html
@@ -132,8 +132,7 @@
Author:
Name: Raphael Meyer
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,13 +141,13 @@ 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
+
a 0 1
where a is the row (a-i), 0 is the column (0-8) and 1 is the
number (1-9).
NOTE: if you do not input three different ‘words’ it will block. You can input
@@ -182,9 +181,9 @@ disoriented program.
Comparing this program to a potential object-oriented implementation,
it is obvious, that object-oriented code isn’t ‘WYWIWID’ (‘what
you write is what it does’). It may be tempting to think that
-
Object o;
+
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.
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.
@@ -177,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
@@ -194,11 +193,11 @@ effort to work on both i386 and x86_64. Portable it is
Keep clicking with left or right button to zoom in or out.
Use the number pad + and - to increase/decrease the iteration count when
@@ -222,54 +221,54 @@ expression must be an assignment ([variable] = [expr]) or a compari
< or > ([expr1] < [expr2] or [expr1] > [expr2]), and you can add spaces
as you like (as understood by the C function isspace()).
Supported operations and functions are:
-
Operation | Description
-:-------- | :----------
- +,-,*,/ | Arithmetic operations, priority of * , / over +,- is
- | respected.
- |
- <,> | Compares the real parts of two complex numbers (the imaginary part
- | is ignored). Any number of conditions is allowed, the iteration
- | will just stop as soon as one of them fails.
- Abs2 | Calculates the squared norm, i.e.: Abs2(a+b*i) is (a*a+b*b)+0*i.
- Re | Extract the real part, i.e.: Re(a+b*i) is a+0*i.
- Im | Extract the imaginary part, i.e.: Im(a+b*i) is b+0*i.
- Exp | Calculates the complex exponential, i.e. Exp(a+b*i) is
- | e^a*(cos(b)+sin(b)*i).
- Ln | Calculates the principal value of the natural logarithm, i.e.
- Ln(a+b*i) is ln(a*a+b*b)/2 + atan(b/a)*i.
+
Operation | Description
+ :-------- | :----------
+ +,-,*,/ | Arithmetic operations, priority of * , / over +,- is
+ | respected.
+ |
+ <,> | Compares the real parts of two complex numbers (the imaginary part
+ | is ignored). Any number of conditions is allowed, the iteration
+ | will just stop as soon as one of them fails.
+ Abs2 | Calculates the squared norm, i.e.: Abs2(a+b*i) is (a*a+b*b)+0*i.
+ Re | Extract the real part, i.e.: Re(a+b*i) is a+0*i.
+ Im | Extract the imaginary part, i.e.: Im(a+b*i) is b+0*i.
+ Exp | Calculates the complex exponential, i.e. Exp(a+b*i) is
+ | e^a*(cos(b)+sin(b)*i).
+ Ln | Calculates the principal value of the natural logarithm, i.e.
+ Ln(a+b*i) is ln(a*a+b*b)/2 + atan(b/a)*i.
@@ -142,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 28acd4296..f7c787689 100644
--- a/2006/stewart/README.md
+++ b/2006/stewart/README.md
@@ -1,25 +1,25 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./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
-fern gasket gasket_mod gasket_mod2 ioccc maze octagon
-pentagon pentagons rings rings2 spirals spirals2 spirals3
-spirals4 squares stars stars2 tree tree2 tree3 tree4 triangle
+ altar box box2 box3 build carpet circles cross cross2 cross3
+ crystal curve diamonds diamonds2 dragon dragon2 dragon3
+ fern gasket gasket_mod gasket_mod2 ioccc maze octagon
+ pentagon pentagons rings rings2 spirals spirals2 spirals3
+ spirals4 squares stars stars2 tree tree2 tree3 tree4 triangle
```
NOTE: you cannot specify a different width from height; it's one number.
@@ -30,7 +30,7 @@ NOTE: `convert(1)` belongs to [ImageMagick](https://imagemagick.org/index.php).
## Try:
```sh
-./try.sh
+ ./try.sh
```
After running the program on a few files it will ask you if you wish to run it
@@ -59,16 +59,16 @@ a reasonably experienced user who can parse formats in their mind. :-)
The program should be run with the following
```sh
-./stewart
+ ./stewart
```
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
- clearer picture).
-ifs = The file to use as input.
+ 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
+ clearer picture).
+ ifs = The file to use as input.
```
The program will spit out an [XBM image](https://en.wikipedia.org/wiki/X_BitMap)
@@ -78,7 +78,7 @@ are 3. Wrong arguments will cause the program to bomb out.
#### Example:
```sh
-./stewart 1024 1000000 gasket > gasket.xbm
+ ./stewart 1024 1000000 gasket > gasket.xbm
```
### Compilation/Testing
@@ -109,13 +109,13 @@ another kind of fractal, those from the [Iterated Function System
The format of the input file is as follows:
```
-
-
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
@@ -172,17 +171,17 @@ 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
- clearer picture).
-ifs = The file to use as input.
+
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
+ clearer picture).
+ ifs = The file to use as input.
The program will spit out an XBM image
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.
@@ -200,25 +199,25 @@ another kind of fractal, those from the Input File
Included in my submission will be a tarball of some IFS files,
including one that attempts (not very well) to mimic the IOCCC logo
@@ -231,8 +230,8 @@ enough to condense it down to something that is coherent.
in the XBM image file.
The a b c d e f are used to iterative find points that lie in the IFS
from the algorithm
-
x = a * prevx + b * prevy + e;
-y = c * prevx + d * prevy + f;
+
x = a * prevx + b * prevy + e;
+ y = c * prevx + d * prevy + f;
The p is for the probability that the equation will run.
Obfuscations
The main obfuscation is using a void * as my only variable (aside from
diff --git a/2006/sykes1/README.md b/2006/sykes1/README.md
index 883cf5e51..0f04c6c3c 100644
--- a/2006/sykes1/README.md
+++ b/2006/sykes1/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alt version based on the author's remarks. The [try.sh](try.sh)
@@ -14,7 +14,7 @@ specifically see the [Alternate code](#alternate-code) section below.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2006 sykes1 bugs](../../bugs.html#2006_sykes1).
@@ -23,7 +23,7 @@ For more detailed information see [2006 sykes1 bugs](../../bugs.html#2006_sykes1
## To use:
```sh
-./sykes1
+ ./sykes1
```
Next point your browser to the file: `sykes1.html`.
@@ -32,7 +32,7 @@ Next point your browser to the file: `sykes1.html`.
## Try:
```sh
-./sykes1 10
+ ./sykes1 10
```
Refresh your browser.
@@ -40,7 +40,7 @@ Refresh your browser.
You might also try:
```sh
-./try.sh
+ ./try.sh
```
This will run both the original entry and the alt code to show some differences.
@@ -53,24 +53,24 @@ maximum:
```sh
-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
-sys 0m0.002s
+ real 6m35.524s
+ user 6m35.159s
+ sys 0m0.002s
```
and done with macOS Sonoma with the Max M1 chip:
```
-real 7m10.786s
-user 7m8.322s
-sys 0m0.110s
+ real 7m10.786s
+ user 7m8.322s
+ sys 0m0.110s
```
@@ -82,7 +82,7 @@ This alternate code is based on the author's remarks.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -97,7 +97,7 @@ The [try.sh](try.sh) script will use both versions to show some differences. You
can do so like:
```sh
-./try.sh
+ ./try.sh
```
@@ -107,7 +107,7 @@ 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
+ diff -s sykes1.c sykes1.html
```
For extra credit, understand what happens when you give this entry
@@ -139,7 +139,7 @@ need to be very lucky indeed to stumble across a solution.
Compile the program, then test that it works:
```sh
-./sykes1
+ ./sykes1
```
Shortly you should see the first solution pop out on your screen. It
@@ -155,7 +155,7 @@ cube. Rendered in glorious 3D color.
Want to see another solution? Try:
```sh
-./sykes1 some_number
+ ./sykes1 some_number
```
The program will discard solutions up to the number, and output numbered
@@ -166,7 +166,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
+ ./sykes1 19186
```
On my machine this takes about half an hour to run.
@@ -179,9 +179,9 @@ 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 } ;
+ 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.
@@ -190,38 +190,38 @@ 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:
```
-010
-111
-010
+ 010
+ 111
+ 010
```
The other pieces are defined similarly. Most of the rest require more
than one layer, such as piece 3 (`1426`):
```
-000
-000
-010
+ 000
+ 000
+ 010
-110
-010
-010
+ 110
+ 010
+ 010
```
Imagine the two layers on top of each other, and you should see this
shape:
```
- +---------+
- / +----+ /|
- +-/ /| / |
- |+----+ |/ +
- || | + /
- +| | /
- | | /
- | | /
- | |/
- +----+
+ +---------+
+ / +----+ /|
+ +-/ /| / |
+ |+----+ |/ +
+ || | + /
+ +| | /
+ | | /
+ | | /
+ | |/
+ +----+
```
@@ -234,7 +234,7 @@ 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
+ int s[ ] = { 187, 94, 402, 3098
```
And of course you can make your own.
diff --git a/2006/sykes1/index.html b/2006/sykes1/index.html
index 6ac736b01..1464395d8 100644
--- a/2006/sykes1/index.html
+++ b/2006/sykes1/index.html
@@ -132,8 +132,7 @@
Author:
Name: Stephen Sykes
-Location: FI - Republic of Finland (Finland)
-
@@ -142,49 +141,49 @@ 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.
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
-sys 0m0.002s
+
real 6m35.524s
+ user 6m35.159s
+ sys 0m0.002s
and done with macOS Sonoma with the Max M1 chip:
-
real 7m10.786s
-user 7m8.322s
-sys 0m0.110s
+
real 7m10.786s
+ user 7m8.322s
+ sys 0m0.110s
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.
@@ -201,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.
@@ -211,53 +210,53 @@ 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:
-
010
-111
-010
+
010
+ 111
+ 010
The other pieces are defined similarly. Most of the rest require more
than one layer, such as piece 3 (1426):
-
000
-000
-010
+
000
+ 000
+ 010
-110
-010
-010
+ 110
+ 010
+ 010
Imagine the two layers on top of each other, and you should see this
shape:
The program is in fact a general solver - you can change the shape of
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 385ffe42d..0ca475207 100644
--- a/2006/sykes2/README.md
+++ b/2006/sykes2/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./sykes2
+ ./sykes2
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
This will repeatedly remake the program and run it then sleep for one second for
diff --git a/2006/sykes2/index.html b/2006/sykes2/index.html
index d168a41cd..c72553191 100644
--- a/2006/sykes2/index.html
+++ b/2006/sykes2/index.html
@@ -132,8 +132,7 @@
Author:
Name: Stephen Sykes
-Location: FI - Republic of Finland (Finland)
-
@@ -142,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 c4bfa6aec..14eaa3579 100644
--- a/2006/toledo1/README.md
+++ b/2006/toledo1/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./toledo1 [0-9][0-9]
+ ./toledo1 [0-9][0-9]
```
where `[0-9][0-9]` is a two digit number.
@@ -17,7 +17,7 @@ where `[0-9][0-9]` is a two digit number.
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -39,11 +39,11 @@ 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
-./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
diff --git a/2006/toledo1/index.html b/2006/toledo1/index.html
index beb4bdd77..76abcfbf4 100644
--- a/2006/toledo1/index.html
+++ b/2006/toledo1/index.html
@@ -132,8 +132,7 @@
Author:
Name: Oscar Toledo G.
-Location: MX - United Mexican States (Mexico)
-
@@ -142,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.
@@ -158,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 c445e3af7..7e9d6e67d 100644
--- a/2006/toledo2/README.md
+++ b/2006/toledo2/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is [alternate code](#alternate-code) that is based on the author's notes
@@ -14,7 +14,7 @@ that it should be fine, after the proper header files were added.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2006 toledo2 bugs](../../bugs.html#2006_toledo2).
@@ -23,7 +23,7 @@ For more detailed information see [2006 toledo2 bugs](../../bugs.html#2006_toled
## To use:
```sh
-./toledo2
+ ./toledo2
```
To end execution press `ctrl-z`. As mentioned in the author's remarks and in the
@@ -34,16 +34,15 @@ does not seem to happen in macOS or linux in 2023.
## Try:
```sh
-./toledo2
-
+ ./toledo2
```
and then type in the following:
```
-10 PRINT "HELLO WORLD!"
-LIST
-RUN
+ 10 PRINT "HELLO WORLD!"
+ LIST
+ RUN
```
To end the program hit ctrl-z.
@@ -58,7 +57,7 @@ functions in place of `read(2)` and `write(2)`.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -114,21 +113,21 @@ Type using uppercase letters. Here are three example programs. Press Enter after
each line:
```basic
-10 PRINT "Hello, world!"
-LIST
-RUN
+ 10 PRINT "Hello, world!"
+ LIST
+ RUN
-10 FOR A=1 TO 10
-20 PRINT A\
-30 NEXT A\
-LIST\
-RUN
+ 10 FOR A=1 TO 10
+ 20 PRINT A\
+ 30 NEXT A\
+ LIST\
+ RUN
-10 INPUT A
-20 INPUT B
-30 PRINT A+B
-LIST
-RUN
+ 10 INPUT A
+ 20 INPUT B
+ 30 PRINT A+B
+ LIST
+ RUN
```
Press Ctrl+Z to quit. By the way, the segmentation fault is
@@ -157,13 +156,13 @@ To import them, you must run the emulator with an argument, by
example:
```sh
-./toledo2 DDT.COM
+ ./toledo2 DDT.COM
```
When the `>` prompt appears, do:
```
-IMPORT DDT.COM
+ IMPORT DDT.COM
```
When it ends, do `HALT`, so the file is closed, and you can start
@@ -197,9 +196,9 @@ It is easy if your platform has `getch()`/`kbhit()` and
ANSI terminal:
```
-read --> Z=kbhit()?getch():0
-write --> putchar(7[o])
-system --> nothing
+ read --> Z=kbhit()?getch():0
+ write --> putchar(7[o])
+ system --> nothing
```
@@ -232,33 +231,33 @@ separates them in one of three common forms. A lot of ternary operators selects
the instruction.
```
-o[0] = B register o[1] = C register
-o[2] = D register o[3] = E register
-o[4] = H register o[5] = L register
-o[6] = Flags o[7] = A or accumulator
+ o[0] = B register o[1] = C register
+ o[2] = D register o[3] = E register
+ o[4] = H register o[5] = L register
+ o[6] = Flags o[7] = A or accumulator
```
The following instructions do peripheral operation:
```
-76 Quits emulator
-DB 00 Reads key pressed status
-DB 01 Reads key
-DB 02 Reads byte from file (Carry=EOF)
-D3 xx Writes byte from acc. to console
-ED ED 02 Reads sector
-ED ED 03 Writes sector
+ 76 Quits emulator
+ DB 00 Reads key pressed status
+ DB 01 Reads key
+ DB 02 Reads byte from file (Carry=EOF)
+ D3 xx Writes byte from acc. to console
+ ED ED 02 Reads sector
+ ED ED 03 Writes sector
```
Memory addresses:
```
-FBFA = Low source/target direction
-FBFB - High source/target direction
-FBFC - Sector
-FBFD - Low cylinder
-FBFE - High cylinder
-FBFF - Drive.
+ FBFA = Low source/target direction
+ FBFB - High source/target direction
+ FBFC - Sector
+ FBFD - Low cylinder
+ FBFE - High cylinder
+ FBFF - Drive.
```
The BIOS is tailor made for this emulator, and helps to simplify it.
diff --git a/2006/toledo2/index.html b/2006/toledo2/index.html
index ed49b5ffa..b109fe00f 100644
--- a/2006/toledo2/index.html
+++ b/2006/toledo2/index.html
@@ -132,8 +132,7 @@
Author:
Name: Oscar Toledo G.
-Location: MX - United Mexican States (Mexico)
-
@@ -142,31 +141,31 @@ 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.
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
-RUN
+
10 PRINT "HELLO WORLD!"
+ LIST
+ RUN
To end the program hit ctrl-z.
Alternate code:
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.
Notice that you’ll have to do #include <conio.h> as well.
Also add the following to trap Ctrl-C:
#include <signal.h>
@@ -282,25 +281,25 @@ counter
is the c pointer and
main loop reads every opcode and
separates them in one of three common forms. A lot of ternary operators selects
the instruction.
-
o[0] = B register o[1] = C register
-o[2] = D register o[3] = E register
-o[4] = H register o[5] = L register
-o[6] = Flags o[7] = A or accumulator
+
o[0] = B register o[1] = C register
+ o[2] = D register o[3] = E register
+ o[4] = H register o[5] = L register
+ o[6] = Flags o[7] = A or accumulator
The following instructions do peripheral operation:
-
76 Quits emulator
-DB 00 Reads key pressed status
-DB 01 Reads key
-DB 02 Reads byte from file (Carry=EOF)
-D3 xx Writes byte from acc. to console
-ED ED 02 Reads sector
-ED ED 03 Writes sector
+
76 Quits emulator
+ DB 00 Reads key pressed status
+ DB 01 Reads key
+ DB 02 Reads byte from file (Carry=EOF)
+ D3 xx Writes byte from acc. to console
+ ED ED 02 Reads sector
+ ED ED 03 Writes sector
Memory addresses:
-
FBFA = Low source/target direction
-FBFB - High source/target direction
-FBFC - Sector
-FBFD - Low cylinder
-FBFE - High cylinder
-FBFF - Drive.
+
FBFA = Low source/target direction
+ FBFB - High source/target direction
+ FBFC - Sector
+ FBFD - Low cylinder
+ FBFE - High cylinder
+ FBFF - Drive.
The BIOS is tailor made for this emulator, and helps to simplify it.
Other notes
diff --git a/2006/toledo3/README.md b/2006/toledo3/README.md
index 20aedd2ff..9a1a0bab4 100644
--- a/2006/toledo3/README.md
+++ b/2006/toledo3/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
The author provided two alternate versions, one which adds a status bar and
@@ -12,14 +12,14 @@ tested with Windows. See [alternate code](#alternate-code) below.
## To use:
```sh
-./toledo3 [1 | 2 | 3 [b]]
+ ./toledo3 [1 | 2 | 3 [b]]
```
## Try:
```sh
-./toledo3 1
+ ./toledo3 1
```
@@ -63,13 +63,13 @@ 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)
-./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
@@ -98,7 +98,7 @@ 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
+ gcc -O3 -fexpensive-optimizations prog.c -o prog -lX11
```
### KNOWN "FEATURES"
diff --git a/2006/toledo3/index.html b/2006/toledo3/index.html
index 2bf1df718..e0282106f 100644
--- a/2006/toledo3/index.html
+++ b/2006/toledo3/index.html
@@ -132,8 +132,7 @@
Author:
Name: Oscar Toledo G.
-Location: MX - United Mexican States (Mexico)
-
@@ -142,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
@@ -173,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
@@ -197,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:
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.
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 949c79d84..b100c2ab1 100644
--- a/2011/blakely/README.md
+++ b/2011/blakely/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,20 +10,20 @@ make
Zoom out and make your terminal window 53 or more lines deep.
```sh
-./blakely < blakely.c | head -300
+ ./blakely < blakely.c | head -300
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
For those who have a lot of time, try:
```sh
-./blakely < t0_3.dat
+ ./blakely < t0_3.dat
```
though one might or might not need to kill it, depending on your boredom
@@ -41,7 +41,7 @@ If you have enough time to spare, put the plan of your garden in a text file,
and run:
```sh
-./blakely - < garden.txt
+ ./blakely - < garden.txt
```
@@ -55,7 +55,7 @@ over tabs.
In order to see the main feature of the code, type:
```sh
-./blakely < blakely.c
+ ./blakely < blakely.c
```
and wait for about four seconds before using Ctrl-C (or whatever) to end the program. The
@@ -73,7 +73,7 @@ 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
+ ./blakely - < 3.dat
```
The program will first display the grid given in [3.dat](3.dat), and then three
@@ -82,7 +82,7 @@ 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
+ ./blakely < evolve_to_3.dat
```
then the 3 will reappear after three time steps.
@@ -213,9 +213,9 @@ without expanding to collide with the digits' evolution.
Groups of cells such as singletons, pairs, and larger groups like
```
-* * * * * * * * * *
- *****************
-* * * * * * * * * *
+ * * * * * * * * * *
+ *****************
+ * * * * * * * * * *
```
were useful in this regard.
diff --git a/2011/blakely/index.html b/2011/blakely/index.html
index c1fb6a56a..2110056ac 100644
--- a/2011/blakely/index.html
+++ b/2011/blakely/index.html
@@ -132,8 +132,7 @@
Author:
Name: Philip Blakely
-Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
-
+Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
@@ -142,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:
@@ -159,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
@@ -177,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
@@ -282,9 +281,9 @@ will not collide when evolving.
into. Therefore it was necessary to add some regions that would quickly die off
without expanding to collide with the digits’ evolution.
Groups of cells such as singletons, pairs, and larger groups like
-
Other problems were keywords which need to be all in one
string, keywords requiring space after them, and
diff --git a/2011/borsanyi/README.md b/2011/borsanyi/README.md
index 2842c544a..f932b7a1f 100644
--- a/2011/borsanyi/README.md
+++ b/2011/borsanyi/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2011 borsanyi bugs](../../bugs.html#2011_borsanyi).
@@ -19,14 +19,14 @@ For more detailed information see [2011 borsanyi bugs](../../bugs.html#2011_bors
## To use:
```sh
-./borsanyi < some_data_file
+ ./borsanyi < some_data_file
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
diff --git a/2011/borsanyi/index.html b/2011/borsanyi/index.html
index 6f4cbb956..cd9a6dbcb 100644
--- a/2011/borsanyi/index.html
+++ b/2011/borsanyi/index.html
@@ -132,8 +132,7 @@
Author:
Name: Szabolcs Borsanyi
-Location: DE - Federal Republic of Germany (Germany)
-
+Location: DE - Federal Republic of Germany (Germany)
@@ -142,15 +141,15 @@ Location: DE - Federal Republic of Germ
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 640258e78..f228ed7d8 100644
--- a/2011/dlowe/README.md
+++ b/2011/dlowe/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,8 +10,8 @@ make
The current status of this entry is:
```
-STATUS: missing or dead link - please provide them
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: missing or dead link - please provide them
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2011 dlowe bugs](../../bugs.html#2011_dlowe).
@@ -20,7 +20,7 @@ For more detailed information see [2011 dlowe bugs](../../bugs.html#2011_dlowe).
## To use:
```sh
-./dlowe - corpus1/ [...] corpus0/ < start.net > trained.net
+ ./dlowe - corpus1/ [...] corpus0/ < start.net > trained.net
```
NOTE: In the above command, the directory args MUST end in a `/`.
@@ -28,7 +28,7 @@ NOTE: In the above command, the directory args MUST end in a `/`.
Then to use `trained.net`:
```sh
-./dlowe file [file ...] < trained.net
+ ./dlowe file [file ...] < trained.net
```
@@ -37,7 +37,7 @@ Then to use `trained.net`:
Try these pre-trained networks:
```sh
-./try.sh
+ ./try.sh
```
NOTE: The `dlowe-aux-data/` directory, which [try.sh](try.sh) refers to, was
@@ -45,7 +45,7 @@ created by:
```sh
-tar -jxf dlowe-aux-data.tar.bz2
+ tar -jxf dlowe-aux-data.tar.bz2
```
@@ -64,8 +64,8 @@ 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/
+ 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:
@@ -90,9 +90,9 @@ that did not win were flushed to `/dev/null`.
The [earlystop.pl](earlystop.pl) tool wrote:
```
-training 1 to 1001...
-training 1001 to 2001...
-prior error = 56.746974766043; current error = 58.095691135305
+ training 1 to 1001...
+ training 1001 to 2001...
+ prior error = 56.746974766043; current error = 58.095691135305
```
The resulting `ioccc-winlose-trained.net` file was included in the
@@ -102,7 +102,7 @@ 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
+ ./dlowe dlowe.c < dlowe-aux-data/ioccc-winlose-trained.net
```
NOTE: this is done in [try.sh](try.sh).
@@ -111,7 +111,7 @@ NOTE: this is done in [try.sh](try.sh).
The match of [dlowe.c](dlowe.c) to the lose/win trailed network was:
```
-dlowe.c 0.125108
+ dlowe.c 0.125108
```
NOTE: The non-artificially intelligent decisions of the IOCCC judges include random
@@ -128,7 +128,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
+ ./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/](dlowe-aux-data/english-0/)
@@ -140,7 +140,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
+ ./dlowe -8000 png-1/ png-0/ < /dev/null > dlowe-aux-data/png-trained.net
```
- [dlowe-aux-data/png-0/](dlowe-aux-data/png-0/)
@@ -152,7 +152,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
+ ./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](dlowe-aux-data/xor-0/)
@@ -190,7 +190,7 @@ The neurons' activation function is the logistic function `1 / (1 + e ^ -x)`.
### Classifying
```sh
-./dlowe file [file ...] < trained.net
+ ./dlowe file [file ...] < trained.net
```
To classify files, one specifies a trained network (on `stdin`) and one or more
@@ -205,9 +205,8 @@ trained, but it's geared toward interpretation as a *probability* or a
### Training
-
```sh
-./dlowe - corpus1/ [...] corpus0/ < start.net > end.net
+ ./dlowe - corpus1/ [...] corpus0/ < start.net > end.net
```
**NOTE**: The directory args **must end in a** `/` for them to work.
diff --git a/2011/dlowe/index.html b/2011/dlowe/index.html
index 909d6ab2f..7edb919fa 100644
--- a/2011/dlowe/index.html
+++ b/2011/dlowe/index.html
@@ -132,8 +132,7 @@
Author:
Name: J. David Lowe
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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
+
STATUS: missing or dead link - please provide them
+ STATUS: INABIAF - please **DO NOT** fix
The match of dlowe.c to the lose/win trailed network was:
-
dlowe.c 0.125108
+
dlowe.c 0.125108
NOTE: The non-artificially intelligent decisions of the IOCCC judges include random
quirks and their non-linear judgment calls not found in the ioccc trained network.
Just because C code is or isn’t scored highly by this network does not
@@ -204,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:
@@ -243,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
@@ -252,7 +251,7 @@ and 1.
trained, but it’s geared toward interpretation as a probability or a
confidence.
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 3e5716ab4..986f6994a 100644
--- a/2011/eastman/README.md
+++ b/2011/eastman/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./eastman
+ ./eastman
```
NOTE: to restore your cursor in your shell, try `reset`.
@@ -20,7 +20,7 @@ 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
+ ./eastman
```
NOTE: to restore your cursor in your shell, try `reset`.
@@ -61,7 +61,7 @@ program is running, though. It only checks the size once, when it starts up.
To compile:
```sh
-cc -lm eastman.c
+ cc -lm eastman.c
```
diff --git a/2011/eastman/index.html b/2011/eastman/index.html
index 84fec2a0e..d37b07e6f 100644
--- a/2011/eastman/index.html
+++ b/2011/eastman/index.html
@@ -132,8 +132,7 @@
Author:
Name: Peter Eastman
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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!
@@ -174,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 d646565ea..d244e27d3 100644
--- a/2011/fredriksson/README.md
+++ b/2011/fredriksson/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2011 fredriksson bugs](../../bugs.html#2011_fredriksson).
@@ -19,14 +19,14 @@ For more detailed information see [2011 fredriksson bugs](../../bugs.html#2011_f
## To use:
```sh
-./fredriksson [-icvtnk#] regexp < file
+ ./fredriksson [-icvtnk#] regexp < file
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
NOTE: you need to be allowed to change your stack size or else the last command
@@ -56,7 +56,7 @@ Implements a variant of `grep`.
To search regexp from file, do:
```sh
-./fredriksson [-icvtnk#] regexp < file
+ ./fredriksson [-icvtnk#] regexp < file
```
Pipes might not work, see the section Limitations.
@@ -79,8 +79,8 @@ This version of `grep` recognizes two more options, not present in normal
[edit-distance](https://en.wikipedia.org/wiki/Edit_distance)). E.g.
"`obfuscated`" matches "`obfuscation`"
with one deletion and two mismatches. Likewise, "`obfuscate`" and
- "`oversimplify`" match with 7 [edit
- operations](https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties).
+ "`oversimplify`" match with 7
+ [edit operations](https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties).
The default is `-k0` (i.e. exact match).
* `-t` Add local transpositions to the set of allowed
@@ -124,13 +124,13 @@ Just say
```sh
-./fredriksson -k3 cat < file
+ ./fredriksson -k3 cat < file
```
* Like with `cat`, you can append line numbers too:
```sh
-./fredriksson -nk3 cat < file
+ ./fredriksson -nk3 cat < file
```
@@ -173,7 +173,9 @@ Just say
* Depending on the file, it might require a lot of stack space. If the
program segfaults (because of this), say
- ulimit -s unlimited
+```sh
+ ulimit -s unlimited
+```
cross your fingers, hope it is enough, and try again.
@@ -185,14 +187,14 @@ Just say
to be 'gcc', but any compiler would work, provided that it supports
C99, or long lines as an extension. This code has been tested on:
- - GNU/Linux FC4, i386, gcc
- - GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0
- - GNU/Linux FC9, x86_64, gcc 4.?.?
- - GNU/Linux CentOS 5, gcc 4.1.2
- - GNU/Linux Ubuntu 11.04, gcc 4.5.2
- - SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2
- - SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC
- - AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6
+- GNU/Linux FC4, i386, gcc
+- GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0
+- GNU/Linux FC9, x86_64, gcc 4.?.?
+- GNU/Linux CentOS 5, gcc 4.1.2
+- GNU/Linux Ubuntu 11.04, gcc 4.5.2
+- SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2
+- SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC
+- AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6
(Btw, tcc has its roots in IOCCC...)
@@ -205,7 +207,9 @@ Just say
extracts and builds that, and then calls it. More precisely, the command
to build is
- gcc -O3 ag.c -o ag
+```sh
+ 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'*' '-'-'`.
@@ -216,29 +220,29 @@ Just say
from the submitted entry.)
* The code demonstrates several useful programming paradigms, such as:
- - recursion to remove all loops
- - subroutines (`main()` contains several logical subroutines,
- selected by the first argument)
- - function pointers
+ - recursion to remove all loops
+ - subroutines (`main()` contains several logical subroutines,
+ selected by the first argument)
+ - function pointers
* Algorithmically, it incorporates the following:
- - (inverse) Burrows-Wheeler transform (used also e.g. in `bzip2(1)`)
- - data compression (really expansion :-), run-length-encoding,
- unary coding (this is why it is expansion rather than compression)
- - approximate string matching
- - dynamic programming to compute the edit distance
- - parallel computation in sequential computers (by packing
- several objects into a single `long`, to speed up the dynamic
- programming)
- - self extracting, compiling and running code
+ - (inverse) Burrows-Wheeler transform (used also e.g. in `bzip2(1)`)
+ - data compression (really expansion :-), run-length-encoding,
+ unary coding (this is why it is expansion rather than compression)
+ - approximate string matching
+ - dynamic programming to compute the edit distance
+ - parallel computation in sequential computers (by packing
+ several objects into a single `long`, to speed up the dynamic
+ programming)
+ - self extracting, compiling and running code
* As a C program, it demonstrates that
- - a C subset without reserved words is complete enough,
- excluding data type specific things (`int`, `char`, `void` ...)
- - only letters are needed (i.e. the digits `0-9` are not)
- - only one statement is enough to code any program (plus
- variable definitions)
- - white space has other uses than just indenting the code
+ - a C subset without reserved words is complete enough,
+ excluding data type specific things (`int`, `char`, `void` ...)
+ - only letters are needed (i.e. the digits `0-9` are not)
+ - only one statement is enough to code any program (plus
+ variable definitions)
+ - white space has other uses than just indenting the code
* It also shows the power of boolean logic and bitwise arithmetic.
@@ -256,12 +260,16 @@ Just say
* No numerical values, other than in the initialized char array, try
- ./fredriksson -ck0 [0-9] < fredriksson.c
+```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
- ./fredriksson -ck0 [0-9] < ag.c
+```sh
+ ./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/fredriksson/index.html b/2011/fredriksson/index.html
index a46a6bc69..f93f25ed1 100644
--- a/2011/fredriksson/index.html
+++ b/2011/fredriksson/index.html
@@ -132,8 +132,7 @@
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.
@@ -166,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:
@@ -184,8 +183,8 @@ matches (aka
edit-distance). E.g.
“obfuscated” matches “obfuscation”
with one deletion and two mismatches. Likewise, “obfuscate” and
-“oversimplify” match with 7 edit
-operations.
+“oversimplify” match with 7
+edit operations.
The default is -k0 (i.e. exact match).
-t Add local transpositions to the set of allowed
edit-operations.
@@ -221,11 +220,11 @@ expressions by putting ] as the first character, and putting
It is assumed that the user knows how to feed correct input to the
@@ -255,42 +254,44 @@ input has this limit, as using the edit operations can make the string
longer. However, no assumptions are made for sizeof(long). In fact,
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
-
cross your fingers, hope it is enough, and try again.
+program segfaults (because of this), say
+
+
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
handle this just fine even in C89 mode, though.
The code should be reasonably portable, it assumes standard ASCII codes
for each char, and that a C compiler is on $PATH; the latter is hard coded
to be ‘gcc’, but any compiler would work, provided that it supports
-C99, or long lines as an extension. This code has been tested on:
-
-
GNU/Linux FC4, i386, gcc
-
GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0
-
GNU/Linux FC9, x86_64, gcc 4.?.?
-
GNU/Linux CentOS 5, gcc 4.1.2
-
GNU/Linux Ubuntu 11.04, gcc 4.5.2
-
SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2
-
SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC
-
AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6
-
+C99, or long lines as an extension. This code has been tested on:
+
GNU/Linux FC4, i386, gcc
+
GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0
+
GNU/Linux FC9, x86_64, gcc 4.?.?
+
GNU/Linux CentOS 5, gcc 4.1.2
+
GNU/Linux Ubuntu 11.04, gcc 4.5.2
+
SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2
+
SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC
+
AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6
(Btw, tcc has its roots in IOCCC…)
Obfuscations (a.k.a. spoilers…)
-
The initialized char array includes the source code of the real program,
+
The initialized char array includes the source code of the real program,
as well as its name and commands to build and run it, all
Burrows-Wheeler
-transformed, then run-length-encoded with unary coding. The main program
extracts and builds that, and then calls it. More precisely, the command
-to build is
-
gcc -O3 ag.c -o ag
+to build is
+
+
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.
(The original version also deleted the generated source and the
corresponding binary after running it, but this feature was removed
-from the submitted entry.)
+from the submitted entry.)
+
The code demonstrates several useful programming paradigms, such as:
recursion to remove all loops
@@ -330,13 +331,15 @@ complexity.
if-then-else constructs (also, no ternary ?: constructs are present).
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
+
No numerical values, other than in the initialized char array, try
+
+
./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.
+ag.c file), and this should print 0.
+
The source code is best viewed with cat (or using the program itself),
instead of some editor. (This is a somewhat system dependent thing.)
One reason for this is that the code builds (some of the) constant
diff --git a/2011/goren/README.md b/2011/goren/README.md
index 577457c24..cd1afbbd9 100644
--- a/2011/goren/README.md
+++ b/2011/goren/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-echo "some text" | ./goren
+ echo "some text" | ./goren
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -28,13 +28,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
+ 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
+ echo '| is just a representation of a pipe because I say so! So stuff it!' | ./goren
```
something happens! Why?
@@ -56,8 +56,8 @@ a pipe. But what IS a pipe? This program tries to provide an answer.
Magritte's [test for pipes](http://en.wikipedia.org/wiki/The_Treachery_of_Images) is:
```
-The famous pipe. How people reproached me for it! And yet, could
-you stuff my pipe? No, it's just a representation, is it not?
+ The famous pipe. How people reproached me for it! And yet, could
+ you stuff my pipe? No, it's just a representation, is it not?
```
Accordingly, this program only approves pipes which can be used for
diff --git a/2011/goren/index.html b/2011/goren/index.html
index d02a4d1fd..2e1dd2c39 100644
--- a/2011/goren/index.html
+++ b/2011/goren/index.html
@@ -132,8 +132,7 @@
Author:
Name: Uri Goren
-Location: IL - State of Israel (Israel)
-
The famous pipe. How people reproached me for it! And yet, could
-you stuff my pipe? No, it's just a representation, is it not?
+
The famous pipe. How people reproached me for it! And yet, could
+ you stuff my pipe? No, it's just a representation, is it not?
Accordingly, this program only approves pipes which can be used for
stuffing data.
One thing I tried to achieve is condition free programming. Many
diff --git a/2011/hamaji/README.md b/2011/hamaji/README.md
index d47a86c6e..e6eafe694 100644
--- a/2011/hamaji/README.md
+++ b/2011/hamaji/README.md
@@ -1,28 +1,28 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./hamaji < a_nonogram_file
+ ./hamaji < a_nonogram_file
```
## Try:
```sh
-./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
+ perl c2nono.pl hamaji.c | ./hamaji
```
@@ -52,26 +52,25 @@ For example, for a simple problem which shows a glider of [Conway's
Game of Life](http://en.wikipedia.org/wiki/Conway's_Game_of_Life):
```
- 1
- .
- 112
-
-1 X
-1 X
-3 XXX
+ 1
+ .
+ 112
+ 1 X
+ 1 X
+ 3 XXX
```
the input should be
```
-1
-1
-3
--
-1
-1.1
-2
+ 1
+ 1
+ 3
+ -
+ 1
+ 1.1
+ 2
```
The width and the height of an input puzzle should be less than or
@@ -82,9 +81,9 @@ This means the problem is indeed broken. For example, this happens for
an input like
```
-2
--
-2
+ 2
+ -
+ 2
```
When this solver cannot find a solution, it prints "`failed`". This
@@ -93,29 +92,29 @@ solver cannot solve the input problem. Here is an example input of the
former:
```
-1
-1
--
-1
-1
+ 1
+ 1
+ -
+ 1
+ 1
```
There are two solutions:
```
- 11
+ 11
-1 X
-1 X
+ 1 X
+ 1 X
```
and
```
- 11
+ 11
-1 X
-1 X
+ 1 X
+ 1 X
```
### Detail
@@ -183,7 +182,7 @@ 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
+ 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
@@ -198,7 +197,7 @@ 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/*/*
+ grep LONG_LONG_TYPE_SIZE gcc/config/*/*
```
I found long long may be 32bit integers only on AVR.
@@ -226,7 +225,7 @@ You can reproduce [dragon.nono](dragon.nono) from [hamaji.c](hamaji.c) using
[c2nono.pl](c2nono.pl):
```sh
-perl c2nono.pl hamaji.c | ./hamaji
+ perl c2nono.pl hamaji.c | ./hamaji
```
diff --git a/2011/hamaji/index.html b/2011/hamaji/index.html
index fc65e4bb5..e7c0dd93f 100644
--- a/2011/hamaji/index.html
+++ b/2011/hamaji/index.html
@@ -135,8 +135,7 @@
Location: JP - Japan
The width and the height of an input puzzle should be less than or
equal to 60.
When this solver finds the problem has no solution, it prints “invalid”.
This means the problem is indeed broken. For example, this happens for
an input like
-
2
--
-2
+
2
+ -
+ 2
When this solver cannot find a solution, it prints “failed”. This
failure can happen when the problem has more than one solution or the
solver cannot solve the input problem. Here is an example input of the
former:
-
1
-1
--
-1
-1
+
1
+ 1
+ -
+ 1
+ 1
There are two solutions:
-
11
+
11
-1 X
-1 X
+ 1 X
+ 1 X
and
-
11
+
11
-1 X
-1 X
+ 1 X
+ 1 X
Detail
Solving Nonogram is
NP-complete, so we cannot make
@@ -262,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
@@ -271,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.
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 b6ba3af02..37fabfe56 100644
--- a/2011/richards/README.md
+++ b/2011/richards/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: doesn't work with some platforms - please help us fix
+ STATUS: doesn't work with some platforms - please help us fix
```
For more detailed information see [2011 richards bugs](../../bugs.html#2011_richards).
@@ -19,14 +19,14 @@ For more detailed information see [2011 richards bugs](../../bugs.html#2011_rich
## To use:
```sh
-echo expression | ./richards
+ echo expression | ./richards
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
diff --git a/2011/richards/index.html b/2011/richards/index.html
index 2d499070c..caad3fa9d 100644
--- a/2011/richards/index.html
+++ b/2011/richards/index.html
@@ -132,8 +132,7 @@
Author:
Name: Gregor Richards
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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
+
STATUS: doesn't work with some platforms - please help us fix
Oh no, yet another
dc-style calculator? (see
diff --git a/2011/toledo/README.md b/2011/toledo/README.md
index d90e1fa5d..03a441569 100644
--- a/2011/toledo/README.md
+++ b/2011/toledo/README.md
@@ -3,7 +3,7 @@
If you have X11 installed:
```sh
-make
+ make
```
There are two alternate versions, [one that lets you reconfigure the
@@ -14,7 +14,7 @@ Windows](toledo.alt2.c). See [Alternate code](#alternate-code) below.
## To use:
```sh
-./toledo
+ ./toledo
```
@@ -36,13 +36,13 @@ have the right names you can define the macros `FIRE`, `FORWARD`, `BACKWARD`,
`LEFT`, `RIGHT`, `WIDTH` and `HEIGHT`. Here are the defaults:
```
-FIRE= XK_BackSpace:XK_Tab
-FORWARD= XK_Up:XK_w
-BACKWARD= XK_Down:XK_s
-LEFT= XK_Left:XK_a
-RIGHT= XK_Right:XK_d
-WIDTH= 512
-HEIGHT= 288
+ FIRE= XK_BackSpace:XK_Tab
+ FORWARD= XK_Up:XK_w
+ BACKWARD= XK_Down:XK_s
+ LEFT= XK_Left:XK_a
+ RIGHT= XK_Right:XK_d
+ WIDTH= 512
+ HEIGHT= 288
```
but you can change them about however you like, even with other keys. For
@@ -50,7 +50,7 @@ instance to swap `LEFT` and `RIGHT`:
```sh
-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
@@ -76,7 +76,7 @@ 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"
+ #include "layer.c"
```
you ought to be able to compile and run this program on Windows.
diff --git a/2011/toledo/index.html b/2011/toledo/index.html
index 1efb35b77..f793cdca8 100644
--- a/2011/toledo/index.html
+++ b/2011/toledo/index.html
@@ -132,8 +132,7 @@
Author:
Name: Oscar Toledo G.
-Location: MX - United Mexican States (Mexico)
-
The first alt version, toledo.alt.c, allows you to reconfigure
the controls and the dimensions more easily.
@@ -160,16 +159,16 @@ cannot be tested by us.
included header file, keysym.h, to find the correct macros. Once you
have the right names you can define the macros FIRE, FORWARD, BACKWARD,
LEFT, RIGHT, WIDTH and HEIGHT. Here are the defaults:
-
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
@@ -185,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 38bea4536..34d0add56 100644
--- a/2011/vik/README.md
+++ b/2011/vik/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version that should work for Windows. See [alternate
@@ -13,7 +13,7 @@ code](#alternate-code) below.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2011 vik bugs](../../bugs.html#2011_vik).
@@ -22,20 +22,20 @@ For more detailed information see [2011 vik bugs](../../bugs.html#2011_vik).
## To use:
```sh
-./vik file.mod > audio_file.raw
+ ./vik file.mod > audio_file.raw
```
If you have `mplayer(1)`:
```sh
-./vik file.mod | mplayer -demuxer rawaudio -
+ ./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
+ ./vik file.mod > file.raw; ./raw2wav file.raw > file.wav
```
and then play `file.wav` with a program that can play WAV files.
@@ -44,7 +44,7 @@ and then play `file.wav` with a program that can play WAV files.
## Try:
```sh
-./try.sh
+ ./try.sh
```
The script checks that you have `mplayer(1)` installed and if it is it will pipe
@@ -67,7 +67,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
+ make alt
```
@@ -88,7 +88,7 @@ initialization for?
Does it take your system a long time to compile? You may want to do:
```sh
-cc -S vik.c
+ cc -S vik.c
```
and examine the resulting assembly file `vik.s`. On some platforms
@@ -154,7 +154,7 @@ Bertilsson, also known as Deelite:
Compiling for Unix systems (including cygwin) is straight forward:
```sh
-gcc -o vik vik.c
+ gcc -o vik vik.c
```
### Usage
@@ -163,13 +163,13 @@ gcc -o vik vik.c
#### Convert MOD file to raw 44.1kHz stereo audio file
```sh
-./vik mad_world.mod > audio_file.raw
+ ./vik mad_world.mod > audio_file.raw
```
#### Listen to the MOD file (streaming to mplayer)
```sh
-./vik randowan.mod | mplayer -demuxer rawaudio -
+ ./vik randowan.mod | mplayer -demuxer rawaudio -
```
(Don't forget the last `-` as it makes mplayer read from `stdin`.)
@@ -211,7 +211,7 @@ 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);
+ _setmode(_fileno(stdout), 0x8000);
```
NOTE: this is what the [alternate version](#alternate-code) is for.
diff --git a/2011/vik/index.html b/2011/vik/index.html
index 3ffc05768..db3ec9ef8 100644
--- a/2011/vik/index.html
+++ b/2011/vik/index.html
@@ -132,8 +132,7 @@
Author:
Name: Daniel Vik
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,22 +141,22 @@ Location: US - United States of America
To build:
-
make
+
make
There is an alternate version that should work for Windows. See alternate
code below.
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
@@ -169,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:
@@ -179,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
@@ -226,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,
@@ -257,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:
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 5de67d02b..50d371113 100644
--- a/2011/zucker/README.md
+++ b/2011/zucker/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version which should work for Windows which distinguishes
@@ -11,7 +11,7 @@ binary mode from text mode. See [alternate code](#alternate-code) below.
## To use:
```sh
-./zucker > image.ppm
+ ./zucker > image.ppm
```
Now open `image.ppm` with your image viewer of choice.
@@ -20,7 +20,7 @@ Now open `image.ppm` with your image viewer of choice.
## Try:
```sh
-./try.sh
+ ./try.sh
```
After running `try.sh`, open the PPM images `ioccc.ppm`, `hello.ppm` and
@@ -37,7 +37,7 @@ that distinguish binary and text.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -69,7 +69,7 @@ This program makes pretty pictures. To see the default output, try
running
```sh
-./zucker > ioccc2011.ppm
+ ./zucker > ioccc2011.ppm
```
On the author's 2.5 GHz MacBook Pro, this command takes approximately 1 minute
@@ -83,7 +83,7 @@ Netpbm files, and are available on multiple platforms.
With macOS you can type at the command line:
```sh
-open ioccc2021.ppm
+ open ioccc2021.ppm
```
and it will open image in the default application Preview.app.
@@ -91,7 +91,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
+ convert ioccc2011.ppm ioccc2011.png
```
and then open `ioccc2011.png` in your viewer of choice.
@@ -99,7 +99,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
+ gm convert ioccc2011.ppm ioccc2011.png
```
and then open `ioccc2011.png` in your viewer of choice.
@@ -108,14 +108,14 @@ Aside from the default image, you may create your own by running the
program as follows:
```sh
-./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:
```sh
-./zucker faster\! -preview > image.ppm
+ ./zucker faster\! -preview > image.ppm
```
If your platform distinguishes between binary and text streams, you may need to
diff --git a/2011/zucker/index.html b/2011/zucker/index.html
index 2eae071a8..2adca8c1b 100644
--- a/2011/zucker/index.html
+++ b/2011/zucker/index.html
@@ -132,8 +132,7 @@
Author:
Name: Matt Zucker
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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:
@@ -157,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:
@@ -171,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
@@ -180,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 38a8498d9..ab4f26ecc 100644
--- a/2012/blakely/README.md
+++ b/2012/blakely/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2012 blakely bugs](../../bugs.html#2012_blakely).
@@ -19,14 +19,14 @@ For more detailed information see [2012 blakely bugs](../../bugs.html#2012_blake
## To use:
```sh
-./blakely "RPN formula" resolution > output.gif
+ ./blakely "RPN formula" resolution > output.gif
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -60,7 +60,7 @@ output to `stdout`.
The program should be run as:
```sh
-./blakely xy* 32 > pic.gif
+ ./blakely xy* 32 > pic.gif
```
where the first parameter is a
@@ -73,15 +73,15 @@ Notation](https://en.wikipedia.org/wiki/Reverse_Polish_notation) with the
following characters recognised:
```
-+, -, *, / - usual arithmetic operations
-^ - Exponentiation; valid for constant exponent only
-s - sin
-c - cos
-0-9 - single digit integers
-d - duplicate number on stack
-t - transpose top two elements on stack
-x - x coordinate value
-y - y coordinate value
+ +, -, *, / - usual arithmetic operations
+ ^ - Exponentiation; valid for constant exponent only
+ s - sin
+ c - cos
+ 0-9 - single digit integers
+ d - duplicate number on stack
+ t - transpose top two elements on stack
+ x - x coordinate value
+ y - y coordinate value
```
NB: all arithmetic is done in double precision, so `23/` is two-thirds, rather
@@ -106,9 +106,9 @@ 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 xy* 32 > saddle.gif
-./blakely xx*yy*1++d5*ct/ 64 > ripple.gif
+ ./blakely xx*yy*1++d5*ct/ 64 > ripple.gif
```
diff --git a/2012/blakely/index.html b/2012/blakely/index.html
index 965e8c257..350ebca77 100644
--- a/2012/blakely/index.html
+++ b/2012/blakely/index.html
@@ -132,8 +132,7 @@
Author:
Name: Philip Blakely
-Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
-
+Location: GB - United Kingdom of Great Britain and Northern Ireland (United Kingdom)
@@ -142,15 +141,15 @@ Location: GB - United Kingdom of Great
Several IOCCC themes (RPN
calculator, animated
@@ -170,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
@@ -178,15 +177,15 @@ to a maximum of 250.
The expressions are written in Reverse Polish
Notation with the
following characters recognised:
-
+, -, *, / - usual arithmetic operations
-^ - Exponentiation; valid for constant exponent only
-s - sin
-c - cos
-0-9 - single digit integers
-d - duplicate number on stack
-t - transpose top two elements on stack
-x - x coordinate value
-y - y coordinate value
+
+, -, *, / - usual arithmetic operations
+ ^ - Exponentiation; valid for constant exponent only
+ s - sin
+ c - cos
+ 0-9 - single digit integers
+ d - duplicate number on stack
+ t - transpose top two elements on stack
+ x - x coordinate value
+ y - y coordinate value
NB: all arithmetic is done in double precision, so 23/ is two-thirds, rather
than 0.
The surface plotted corresponds to -1 <= x,y <= 1 and for best results, the
@@ -202,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.
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 36a477d2c..ca689c5c1 100644
--- a/2012/deckmyn/README.md
+++ b/2012/deckmyn/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2012 deckmyn bugs](../../bugs.html#2012_deckmyn).
@@ -19,14 +19,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
+ ./deckmyn "$(cat deckmyn.c)" "$(cat musicfile.txt)" > sheetmusic.pbm
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -60,13 +60,13 @@ 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
+ ./deckmyn "`cat deckmyn.c`" "`cat example_greensleeves`" > greensleeves.pbm
```
If you have macOS you can open the image like:
```sh
-open greensleeves.pbm
+ open greensleeves.pbm
```
... otherwise, you'll have to open it in your viewer of choice how you would
@@ -74,13 +74,13 @@ normally open an image.
```sh
-./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:
```sh
-open short_bass.pbm
+ open short_bass.pbm
```
... otherwise, you'll have to open it in your viewer of choice how you would
diff --git a/2012/deckmyn/deckmyn.html b/2012/deckmyn/deckmyn.html
index 3d12ab4b2..dec702532 100644
--- a/2012/deckmyn/deckmyn.html
+++ b/2012/deckmyn/deckmyn.html
@@ -124,7 +124,7 @@
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,9 +186,9 @@ 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
+
./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.
Some files with well-known melodies are included as examples.
@@ -142,15 +141,15 @@ Location: BE - Kingdom of Belgium
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.
@@ -169,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.
… 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 a8079e18d..11db8ad08 100644
--- a/2012/dlowe/README.md
+++ b/2012/dlowe/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2012 dlowe bugs](../../bugs.html#2012_dlowe).
@@ -19,14 +19,14 @@ For more detailed information see [2012 dlowe bugs](../../bugs.html#2012_dlowe).
## To use:
```sh
-./dlowe
+ ./dlowe
```
## Try:
```sh
-./dlowe
+ ./dlowe
```
Watch for a while if you like, then press a key within the window.
diff --git a/2012/dlowe/index.html b/2012/dlowe/index.html
index fc570ce3e..5acb40183 100644
--- a/2012/dlowe/index.html
+++ b/2012/dlowe/index.html
@@ -132,8 +132,7 @@
Author:
Name: J. David Lowe
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,15 +141,15 @@ Location: US - United States of America
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 b2bc4e52a..e04f7c43b 100644
--- a/2012/endoh1/README.md
+++ b/2012/endoh1/README.md
@@ -1,6 +1,6 @@
```sh
-make
+ make
```
There are two alt versions that let you control the compile time variables that
@@ -15,7 +15,7 @@ section below for more details.
## To use:
```sh
-./endoh1 < file
+ ./endoh1 < file
```
WARNING: if you're sensitive to/don't like flashing colours/text or just want to
@@ -26,14 +26,14 @@ 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
+ ./try.bw.sh endoh1.c
+ ./try.sh endoh1.c
-./try.bw.sh pour-out.txt
-./try.sh pour-out.txt
+ ./try.bw.sh pour-out.txt
+ ./try.sh pour-out.txt
-./try.bw.sh fountain.txt
-./try.sh fountain.txt
+ ./try.bw.sh fountain.txt
+ ./try.sh fountain.txt
```
@@ -51,7 +51,7 @@ the fluid and change the behaviour of the fluid. The file
For the default values, try:
```sh
-make alt
+ make alt
```
In the `alt` versions a default time of 10 seconds is set as an alarm so that
@@ -60,13 +60,13 @@ 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
+ make clobber TIMER=5 alt
```
If you want to disable the alarm time, set it to 0:
```sh
-make clobber TIMER=0 alt
+ make clobber TIMER=0 alt
```
It cannot be < 0 or > 60 (arbitrarily selected).
@@ -77,7 +77,7 @@ 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
+ make clobber SLEEP=50000 alt
```
@@ -85,7 +85,7 @@ If you wish to speed it up you might decrease the sleep time from `12321` to
`9999`:
```sh
-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
@@ -98,7 +98,7 @@ viscosity factor, you should redefine the values `GRAVITY`, `PRESSURE` and/or
viscosity and pressure factors but leave the other values alone:
```sh
-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
@@ -112,21 +112,21 @@ instance:
```sh
-make clobber GRAVITY=5 PRESSURE=5 VISCOSITY=5 alt
+ make clobber GRAVITY=5 PRESSURE=5 VISCOSITY=5 alt
```
You might try even:
```sh
-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
-V = VISCOSITY
+ G = GRAVITY
+ P = PRESSURE
+ V = VISCOSITY
```
@@ -142,7 +142,7 @@ To see two different ways run on the source file and each of the text files,
try:
```sh
-./try.alt.sh
+ ./try.alt.sh
```
The second run of each will be with the gravity factor set to `I`.
@@ -150,7 +150,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
+ ./try.alt.bw.sh
```
@@ -179,12 +179,12 @@ entry](https://web.archive.org/web/20230711134609/https://whatif.xkcd.com/6/).
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
-./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
@@ -247,9 +247,9 @@ 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
+ 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
+ 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
diff --git a/2012/endoh1/index.html b/2012/endoh1/index.html
index d2ad820a7..593e4ac9e 100644
--- a/2012/endoh1/index.html
+++ b/2012/endoh1/index.html
@@ -132,8 +132,7 @@
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
@@ -150,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.
The files endoh1.alt.c and
endoh1_color.alt.c correspond to endoh1.c and
@@ -171,53 +170,53 @@ 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
-V = VISCOSITY
+
G = GRAVITY
+ P = PRESSURE
+ V = VISCOSITY
Alternate use:
Use endoh1.alt, endoh1_color.alt and endoh1.alt2 as you would endoh1
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:
,___. ,. ,. ,. ,___. ,. ,. ,.
|/--' || `' || |/--' `' || |\_.
@@ -285,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.
-
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.
-
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 ad628b8c1..2c570f5f3 100644
--- a/2012/grothe/README.md
+++ b/2012/grothe/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,22 +10,22 @@ make
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
+ ./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):
```sh
-./grothe I-sharedI J-sharedJ K-sharedK ... +reconstructed
+ ./grothe I-sharedI J-sharedJ K-sharedK ... +reconstructed
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -76,18 +76,18 @@ 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\
- 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:
```sh
-./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
```
diff --git a/2012/grothe/index.html b/2012/grothe/index.html
index ba3486715..25c9864fb 100644
--- a/2012/grothe/index.html
+++ b/2012/grothe/index.html
@@ -135,8 +135,7 @@
Location: US - United States of America (United States)
Name: David Madore
-Location: FR - French Republic (France)
-
+Location: FR - French Republic (France)
@@ -145,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:
Also known as ‘Best abuse of the judging process’.
The IOCCC 2012 submission page didn’t enforce the 2048 meaningful character
@@ -185,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:
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 6054dc7ac..eb2504327 100644
--- a/2012/hamano/README.md
+++ b/2012/hamano/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./hamano < textfile > output.pdf
+ ./hamano < textfile > output.pdf
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
The script will generate a number of PDF files and it will suggest you look at
@@ -31,9 +31,9 @@ README.md!
That procedure looks like:
```sh
-./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
@@ -41,11 +41,11 @@ 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
+ 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
+ ./hello2
```
although the `CFLAGS` will be what is in the Makefile as it uses the helper
diff --git a/2012/hamano/index.html b/2012/hamano/index.html
index 8fe0b4178..2f24a4c77 100644
--- a/2012/hamano/index.html
+++ b/2012/hamano/index.html
@@ -132,8 +132,7 @@
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
@@ -156,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:
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 b9ad81a6a..4e6394a86 100644
--- a/2012/hou/README.md
+++ b/2012/hou/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./hou syntax-file file-to-process
+ ./hou syntax-file file-to-process
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
View the `remarks.htm` file in your web browser.
@@ -26,9 +26,9 @@ The result is best viewed in a 80x25 console with ANSI colors.
## Try (Windows):
```
-copy header.htm hou.htm /y
-hou html.txt hou.c >> hou.htm
-start hou.htm
+ copy header.htm hou.htm /y
+ hou html.txt hou.c >> hou.htm
+ start hou.htm
```
@@ -74,15 +74,15 @@ 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](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_ ]*\]))?[ ]*)*;
-```
+ "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](ansi.txt) contains a pathological expression [^2] that guarantees a
@@ -90,8 +90,8 @@ 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
+ ./hou ansi.txt ansi.txt
+ perl patho.pl < ansi.txt
```
diff --git a/2012/hou/hint.html b/2012/hou/hint.html
index 1d355f887..55e16949f 100644
--- a/2012/hou/hint.html
+++ b/2012/hou/hint.html
@@ -124,20 +124,23 @@
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.
What a versatile entry! It can be used to check the size of IOCCC entries and to publish them as HTML.
For extra credit: what is the meaning of the number 2321237?
@@ -165,14 +168,14 @@ original text in the format string using “%s”. Other “%” characters in t
format string must be escaped with another “%”. The space character can be used
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:
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 abf4bb1dd..7fb416b18 100644
--- a/2012/hou/hint.md
+++ b/2012/hou/hint.md
@@ -2,16 +2,21 @@
### To build:
+```sh
make hou
+```
### To run:
+```sh
./hou syntax-file file-to-process
+```
### Try (Unix):
The results are best viewed in a 80x25 console with ANSI colors.
+```
less hou.c
./hou ansi.txt hou.c | less -r
@@ -20,12 +25,15 @@ The results are best viewed in a 80x25 console with ANSI colors.
./hou markdown.txt remarks.markdown > remarks.htm
your-browser remarks.htm
+```
### Try (Windows):
+```
copy header.htm hou.htm /y
hou html.txt hou.c >> hou.htm
start hou.htm
+```
### Selected Judges Remarks:
@@ -67,18 +75,24 @@ 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:
+```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_ ]*\]))?[ ]*)*;
+```
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
+```
Finally, there are a few limitations...
diff --git a/2012/hou/index.html b/2012/hou/index.html
index 653451a98..00ba9ac2c 100644
--- a/2012/hou/index.html
+++ b/2012/hou/index.html
@@ -132,8 +132,7 @@
Author:
Name: Qiming HOU
-Location: CN - People’s Republic of China (China)
-
+Location: CN - People’s Republic of China (China)
@@ -142,17 +141,17 @@ 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.
What a versatile entry! It can be used to check the size of IOCCC entries and
to publish them as HTML.
@@ -181,16 +180,16 @@ original text in the format string using %s. Other % c
format string must be escaped with another %. The space character can be used
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:
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 c6ddd22fd..44bf535ce 100644
--- a/2012/kang/README.md
+++ b/2012/kang/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is alternate code which fixes some German at the expense of other German.
@@ -11,18 +11,18 @@ 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
+ echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang
```
## Try:
```sh
-./try.sh # try various languages
+ ./try.sh # try various languages
-./en.sh # English 0 through 13
+ ./en.sh # English 0 through 13
-./de.sh # German 0 through 13 with both umlauts and without (additional 'e')
+ ./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
@@ -44,29 +44,29 @@ subtlety of this entry even more.
### Alternate build:
```sh
-make alt
+ make alt
```
### Alternate use:
```sh
-echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang.alt
+ echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang.alt
-echo vier | ./kang.alt
+ echo vier | ./kang.alt
-echo uno | ./kang.alt
+ echo uno | ./kang.alt
```
### Alternate try:
```sh
-./try.alt.sh # try various languages
+ ./try.alt.sh # try various languages
-./en.alt.sh # English 0 through 13
+ ./en.alt.sh # English 0 through 13
-./de.alt.sh # German 0 through 13 with both umlauts and without (additional 'e')
+ ./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
@@ -89,13 +89,13 @@ We've added a linefeed to the print format for convenience.
Can you explain why:
```sh
-echo f hundr|./kang
+ echo f hundr|./kang
```
correctly reports 500 but:
```sh
-echo hundr|./kang
+ echo hundr|./kang
```
does not report 100, instead printing 0?
@@ -184,19 +184,19 @@ But the most important obfuscation is the clever construction of lookup table.
The program uses 11 different characters required for recognizing 22 lexemes:
```
-zero one tw- th(i)r- fo(u)r- fi- six-
-seven- eigh- nin- ten eleven twelve
-hundred(s) thousand(s) million(s) billion(s) trillion(s)
-a and -teen -ty
+ zero one tw- th(i)r- fo(u)r- fi- six-
+ seven- eigh- nin- ten eleven twelve
+ hundred(s) thousand(s) million(s) billion(s) trillion(s)
+ a and -teen -ty
```
So that they are internally represented as like:
```
-r n tw- tr- fr- f- s-
-sn- g- nn- tn ln twl
-nr(s) tsan(s) lln(s) blln(s) trlln(s)
-a an -tn -ty
+ r n tw- tr- fr- f- s-
+ sn- g- nn- tn ln twl
+ nr(s) tsan(s) lln(s) blln(s) trlln(s)
+ a an -tn -ty
```
The stemmer recognizes the longest matching prefix, so every lexeme can be
diff --git a/2012/kang/index.html b/2012/kang/index.html
index db25d69ee..67dbb256f 100644
--- a/2012/kang/index.html
+++ b/2012/kang/index.html
@@ -132,8 +132,7 @@
Author:
Name: Seonghoon Kang
-Location: KR - Republic of Korea (South Korea)
-
@@ -142,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
+
./try.sh# try various languages
-./en.sh# English 0 through 13
+./en.sh# English 0 through 13
-./de.sh# German 0 through 13 with both umlauts and without (additional 'e')
+./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:
@@ -165,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"full spelling of an English cardinal numeral less than a quadrillion"|./kang.alt
-echo vier |./kang.alt
+echo vier |./kang.alt
-echo uno |./kang.alt
+echo uno |./kang.alt
Alternate try:
-
./try.alt.sh# try various languages
+
./try.alt.sh# try various languages
-./en.alt.sh# English 0 through 13
+./en.alt.sh# English 0 through 13
-./de.alt.sh# German 0 through 13 with both umlauts and without (additional 'e')
+./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?
@@ -189,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
@@ -261,15 +260,15 @@ including the final NUL character are used.
But the most important obfuscation is the clever construction of lookup table.
The program uses 11 different characters required for recognizing 22 lexemes:
-
zero one tw- th(i)r- fo(u)r- fi- six-
-seven- eigh- nin- ten eleven twelve
-hundred(s) thousand(s) million(s) billion(s) trillion(s)
-a and -teen -ty
+
zero one tw- th(i)r- fo(u)r- fi- six-
+ seven- eigh- nin- ten eleven twelve
+ hundred(s) thousand(s) million(s) billion(s) trillion(s)
+ a and -teen -ty
So that they are internally represented as like:
-
r n tw- tr- fr- f- s-
-sn- g- nn- tn ln twl
-nr(s) tsan(s) lln(s) blln(s) trlln(s)
-a an -tn -ty
+
r n tw- tr- fr- f- s-
+ sn- g- nn- tn ln twl
+ nr(s) tsan(s) lln(s) blln(s) trlln(s)
+ a an -tn -ty
The stemmer recognizes the longest matching prefix, so every lexeme can be
recognized by at most three characters (e.g. trl instead of trlln). This is
also handy for ignoring plurals. But that would make it so that the table does not fit
diff --git a/2012/konno/README.md b/2012/konno/README.md
index 9bf28eb0d..26e23b138 100644
--- a/2012/konno/README.md
+++ b/2012/konno/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an unobfuscated version of this entry. See [Alternate
@@ -11,17 +11,17 @@ code](#alternate-code) below.
## To use:
```sh
-./konno N
+ ./konno N
```
## Try:
```sh
-./try.sh
+ ./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
+ # 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](try.sh) a number of times as the first part randomly
@@ -37,7 +37,7 @@ This alternate code is an unobfuscated version of the winning code.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -65,11 +65,11 @@ patterns.
Try:
```sh
-./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.
@@ -80,13 +80,13 @@ There are 256 (from 0 through 255) possible rules.
This program uses bit operations. I think
```c
-7&O<>!o+29
+ 7&O<>!o+29
```
is an interesting operation. This isn't equal to
```c
-7&O>>29
+ 7&O>>29
```
operation. What is the operation doing?
diff --git a/2012/konno/index.html b/2012/konno/index.html
index 13088191a..a99b7b092 100644
--- a/2012/konno/index.html
+++ b/2012/konno/index.html
@@ -132,8 +132,7 @@
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 c8f9fc086..c1c427f9a 100644
--- a/2012/omoikane/README.md
+++ b/2012/omoikane/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version that will read from the compiled file itself, in
@@ -13,14 +13,14 @@ 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
+ ./nyaruko [seed.txt] < original.bin > output.c
+ bash output.c > key.c
+ perl output.c > data.c
-cat key.c data.c > output.c
+ cat key.c data.c > output.c
-cc output.c -o output
-./output > regenerated.bin
+ cc output.c -o output
+ ./output > regenerated.bin
```
NOTE: if your OS does not have `/dev/urandom` then you should specify a seed
@@ -31,7 +31,7 @@ binary itself.
## Try:
```sh
-./try.sh
+ ./try.sh
```
The script [try.sh](try.sh) will check if you have perl before trying to use the
@@ -54,13 +54,13 @@ For the first version:
```sh
-make alt
+ make alt
```
For the second version:
```sh
-make alt2
+ make alt2
```
@@ -74,7 +74,7 @@ Use `nyaruko.alt` or `nyaruko.alt2` as you would `nyaruko` above.
For the first alternate version:
```sh
-./try.alt.sh
+ ./try.alt.sh
```
We have no way to test the second version, sorry (tm Canada :-) )!
@@ -94,17 +94,17 @@ The judges have nothing to add that has not already been written about in the
`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
+ ./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:
```sh
-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
@@ -115,8 +115,8 @@ 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
+ 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,
@@ -124,7 +124,7 @@ 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
+ ./nyaruko seed.txt < input.bin > output.c
```
This makes the output key deterministic, allowing the same key to be shared
diff --git a/2012/omoikane/index.html b/2012/omoikane/index.html
index 2915e8ccc..09df3b63e 100644
--- a/2012/omoikane/index.html
+++ b/2012/omoikane/index.html
@@ -132,8 +132,7 @@
Author:
Name: Don Yang
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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.
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:
@@ -172,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
@@ -188,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:
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:
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 07f5866f7..56362ffbe 100644
--- a/2012/tromp/README.md
+++ b/2012/tromp/README.md
@@ -1,9 +1,9 @@
## To build:
```sh
-make all # On a 64-bit machine (default)
+ make all # On a 64-bit machine (default)
-make tromp32 # On a 32-bit machine
+ make tromp32 # On a 32-bit machine
```
@@ -12,7 +12,7 @@ make tromp32 # On a 32-bit machine
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2012 tromp bugs](../../bugs.html#2012_tromp).
@@ -21,7 +21,7 @@ For more detailed information see [2012 tromp bugs](../../bugs.html#2012_tromp).
## To use:
```sh
-./tromp [-b]
+ ./tromp [-b]
```
Use `./tromp32` as you would `./tromp` if on a 32-bit machine.
@@ -30,15 +30,15 @@ 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
+ cat ascii-prog.blc data | ./tromp -b
+ cat binary-prog.Blc data | ./tromp
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -96,10 +96,10 @@ bit of input, and using characters `0` and `1` for output.
The program uses the following exit codes:
```
-0: OK; result is a finite list
-5: Out of term space
-6: Out of memory
-1,2,3,4,8,9: result not in list form
+ 0: OK; result is a finite list
+ 5: Out of term space
+ 6: Out of memory
+ 1,2,3,4,8,9: result not in list form
```
The size of the term space is fixed at compile time with `-DA`.
@@ -114,8 +114,8 @@ 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
+ $ echo " Hello, world" | ./tromp
+ Hello, world
```
Since the least significant 4 bits of the first byte are just arbitrary padding
@@ -123,8 +123,8 @@ 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
+ $ echo "*Hello, world" | ./tromp
+ Hello, world
```
@@ -135,7 +135,7 @@ 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
+ echo -n "U" | ./tromp
```
Furthermore, the interpreter requires the initial encoded lambda term to be
@@ -144,7 +144,7 @@ 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
+ echo ">Hello, world" | ./tromp
```
will likely dump core.
@@ -201,8 +201,8 @@ The byte oriented BLC8 version weighs in at 43 bytes (shown in hexadecimal).
```
```sh
-$ (cat uni8.Blc; echo " Ni hao") | ./tromp
-Ni hao
+ $ (cat uni8.Blc; echo " Ni hao") | ./tromp
+ Ni hao
```
### A prime number sieve
@@ -226,8 +226,8 @@ 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
+ $ cat primes.blc | ./tromp -b | head -c 70
+ 0011010100010100010100010000010100000100010100010000010000010100000100
```
For those who prefer to digest their primes in decimal, there is `oddindices.Blc`,
@@ -236,8 +236,8 @@ which will print the indices of all odd characters (with
separated by a given character:
```
-$ (cat oddindices.Blc; echo -n " "; cat primes.blc | ./tromp -b) | ./tromp | head -c 70
-2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
+ $ (cat oddindices.Blc; echo -n " "; cat primes.blc | ./tromp -b) | ./tromp | head -c 70
+ 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
```
### A Space filling program
@@ -266,44 +266,43 @@ 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
- _
-| |
+ $ (cat hilbert.Blc; echo -n "1") | ./tromp
+ _
+ | |
-$ (cat hilbert.Blc; echo -n "12") | ./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 "123") | ./tromp
+ _ _ _ _
+ | |_| | | |_| |
+ |_ _| |_ _|
+ _| |_____| |_
+ | ___ ___ |
+ |_| _| |_ |_|
+ _ |_ _| _
+ | |___| |___| |
+ $ (cat hilbert.Blc; echo -n "1234") | ./tromp
+ _ _ _ _ _ _ _ _
+ | |_| | | |_| | | |_| | | |_| |
+ |_ _| |_ _| |_ _| |_ _|
+ _| |_____| |_ _| |_____| |_
+ | ___ ___ | | ___ ___ |
+ |_| _| |_ |_| |_| _| |_ |_|
+ _ |_ _| _ _ |_ _| _
+ | |___| |___| |_| |___| |___| |
+ |_ ___ ___ ___ ___ _|
+ _| |_ |_| _| |_ |_| _| |_
+ | _ | _ |_ _| _ | _ |
+ |_| |_| | |___| |___| | |_| |_|
+ _ _ | ___ ___ | _ _
+ | |_| | |_| _| |_ |_| | |_| |
+ |_ _| _ |_ _| _ |_ _|
+ _| |___| |___| |___| |___| |_
```
### A [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) interpreter
@@ -313,15 +312,15 @@ The smallest known BF interpreter is written in... you guessed it,
coming in at 112 bytes (including 3 bits of padding):
```
-$ od -t x4 bf.Blc
-0000000 01a15144 02d55584 223070b7 00f032ff
-0000020 7f85f9bf 956fe15e c0ee7d7f 006854e5
-0000040 fbfd5558 fd5745e0 b6f0fbeb 07d62ff0
-0000060 d7736fe1 c0bc14f1 1f2eff0b 17666fa1
-0000100 2fef5be8 ff13ffcf 2034cae1 0bd0c80a
-0000120 e51fee99 6a5a7fff ff0fff1f d0049d87
-0000140 db0500ab 3bb74023 b0c0cc28 10740e6c
-0000160
+ $ od -t x4 bf.Blc
+ 0000000 01a15144 02d55584 223070b7 00f032ff
+ 0000020 7f85f9bf 956fe15e c0ee7d7f 006854e5
+ 0000040 fbfd5558 fd5745e0 b6f0fbeb 07d62ff0
+ 0000060 d7736fe1 c0bc14f1 1f2eff0b 17666fa1
+ 0000100 2fef5be8 ff13ffcf 2034cae1 0bd0c80a
+ 0000120 e51fee99 6a5a7fff ff0fff1f d0049d87
+ 0000140 db0500ab 3bb74023 b0c0cc28 10740e6c
+ 0000160
```
It expects its input to consist of a
@@ -330,10 +329,10 @@ It expects its input to consist of a
followed by a `]`, followed by the input for the Brainfuck program.
```
-$ more hw.bf
-++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.]
-$ cat bf.Blc hw.bf | ./tromp
-Hello World!
+ $ more hw.bf
+ ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.]
+ $ cat bf.Blc hw.bf | ./tromp
+ Hello World!
```
Curiously, the interpreter `bf.Blc` is the exact same size as `hw.bf`.
@@ -346,10 +345,9 @@ translates single-letter-variable lambda calculus into BLC:
```sh
-$ 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
@@ -361,24 +359,24 @@ 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
+ 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
+ $ 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
-!dlrow ,olleH
+ $ cat rev.Blc - | ./tromp
+ Hello, world!
+ ^D
+ !dlrow ,olleH
```
### Symbolic Lambda Calculus reduction
@@ -387,24 +385,24 @@ BLC8 program `symbolic.Blc` shows individual reduction steps on symbolic lambda
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
-(\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
@@ -415,8 +413,8 @@ 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)
+ $ 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...
@@ -424,13 +422,13 @@ Hardly any less obfuscated...
The last line of
```sh
-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
+ \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
@@ -462,16 +460,16 @@ 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
-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
@@ -495,15 +493,15 @@ The program freely (without casting) converts between `int` and `int *`, causing
many warnings;
```
- note: expected 'int *' but argument is of type 'int'
- warning: assignment from incompatible pointer type
- warning: assignment makes integer from pointer without a cast
- warning: assignment makes pointer from integer without a cast
- warning: incompatible implicit declaration of built-in function 'calloc'
- warning: incompatible implicit declaration of built-in function 'exit'
- warning: passing argument 1 of 'd' makes pointer from integer without a cast
- warning: passing argument 1 of 'p' makes pointer from integer without a cast
- warning: pointer/integer type mismatch in conditional expression
+ note: expected 'int *' but argument is of type 'int'
+ warning: assignment from incompatible pointer type
+ warning: assignment makes integer from pointer without a cast
+ warning: assignment makes pointer from integer without a cast
+ warning: incompatible implicit declaration of built-in function 'calloc'
+ warning: incompatible implicit declaration of built-in function 'exit'
+ warning: passing argument 1 of 'd' makes pointer from integer without a cast
+ warning: passing argument 1 of 'p' makes pointer from integer without a cast
+ warning: pointer/integer type mismatch in conditional expression
```
Avoiding these would make the program substantially longer,
diff --git a/2012/tromp/how.html b/2012/tromp/how.html
index 7551a90e6..e98ace5cd 100644
--- a/2012/tromp/how.html
+++ b/2012/tromp/how.html
@@ -133,10 +133,10 @@ continuations (see the 3rd reference for details).
The term space holds lambda
calculus terms in the following
format. 0 denotes some form of I/O; the only four occurrences are at:
-
C=13: recognizes end of a byte
- C=20: recognize output of 0 bit
- C=21: recognize output of 1 bit
- C=end: input list, expanded lazily
+
C=13: recognizes end of a byte
+ C=20: recognize output of 0 bit
+ C=21: recognize output of 1 bit
+ C=end: input list, expanded lazily
1 denotes a variable, with the next entry its de Bruijn
index.
2 denotes application with the next entry the size of the term being applied.
@@ -150,26 +150,26 @@ free list.
lambda term (index in term space).
Here’s what each variable does:
-
L Lambda term space
-m mode: 0 for bits and 7 for bytes
-b bits remaining unread in I, -1 on EOF
-D Desirable temporary
-c continuation context
-a active environment pointer
-C Current term index
-U Ultimate term pointer
-u utility entry
-B Born to be free-list of closures
-I Input character
-O Output character
-e entry of current term
+
L Lambda term space
+ m mode: 0 for bits and 7 for bytes
+ b bits remaining unread in I, -1 on EOF
+ D Desirable temporary
+ c continuation context
+ a active environment pointer
+ C Current term index
+ U Ultimate term pointer
+ u utility entry
+ B Born to be free-list of closures
+ I Input character
+ O Output character
+ e entry of current term
Here’s what each of the 6 auxiliary functions do:
-
s variable lookup in active environment with de Bruijn index u
-S gets one bit of input, setting b to -1 on EOF or to remaining number of bits in current byte
-k copy fragment from string literal holding lambda terms xor 46 into current end of term space
-x expand input, adding 11 (resp. 99) entries to term space for bit (resp. byte) mode
-p parses BLC-encoded lambda term using S(), stores results in term space and returns length
-d decrease reference counter, add record to free list on reaching zero
+
s variable lookup in active environment with de Bruijn index u
+ S gets one bit of input, setting b to -1 on EOF or to remaining number of bits in current byte
+ k copy fragment from string literal holding lambda terms xor 46 into current end of term space
+ x expand input, adding 11 (resp. 99) entries to term space for bit (resp. byte) mode
+ p parses BLC-encoded lambda term using S(), stores results in term space and returns length
+ d decrease reference counter, add record to free list on reaching zero
@@ -142,21 +141,21 @@ Location: US - United States of America
To build:
-
make all # On a 64-bit machine (default)
+
make all # On a 64-bit machine (default)
-make tromp32 # On a 32-bit machine
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.
@@ -196,10 +195,10 @@ under 6K in size.
With one (arbitrary) argument, it runs in bit mode, using only the least significant
bit of input, and using characters 0 and 1 for output.
The program uses the following exit codes:
-
0: OK; result is a finite list
-5: Out of term space
-6: Out of memory
-1,2,3,4,8,9: result not in list form
+
0: OK; result is a finite list
+ 5: Out of term space
+ 6: Out of memory
+ 1,2,3,4,8,9: result not in list form
The size of the term space is fixed at compile time with -DA.
A half byte cat
The shortest (closed) lambda calculus term is \x x (\ 1 in De Bruijn
@@ -207,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,
@@ -266,8 +265,8 @@ as a self interpreter in BLC it is downright minuscule at 232 bits (29 bytes):
0b7fb 00cf6
7bb03 91a1a
-
$(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):
@@ -282,14 +281,14 @@ as a self interpreter in BLC it is downright minuscule at 232 bits (29 bytes):
0000110110
The nth bit in the output indicates whether n is prime:
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)
separated by a given character:
It expects its input to consist of a
Brainfuck program
(looking only at bits 0, 1 and 4 to distinguish among ,-.+<>][)
followed by a ], followed by the input for the Brainfuck program.
Curiously, the interpreter bf.Blc is the exact same size as hw.bf.
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
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
+
\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
applies the decoded lambda term). The \b b (..) (...) is the list constructor,
usually called cons, applied to a head (a list element) and a tail (another list).
@@ -445,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:
Obfuscation is due entirely to conciseness. Some questions to ponder:
Which of the term space codes 0, 1, 2, 3 serve multiple purposes?
@@ -465,15 +464,15 @@ under the interpreter perform much worse than that same program written in Haske
Portability
The program freely (without casting) converts between int and int *, causing
many warnings;
-
note: expected 'int *' but argument is of type 'int'
- warning: assignment from incompatible pointer type
- warning: assignment makes integer from pointer without a cast
- warning: assignment makes pointer from integer without a cast
- warning: incompatible implicit declaration of built-in function 'calloc'
- warning: incompatible implicit declaration of built-in function 'exit'
- warning: passing argument 1 of 'd' makes pointer from integer without a cast
- warning: passing argument 1 of 'p' makes pointer from integer without a cast
- warning: pointer/integer type mismatch in conditional expression
+
note: expected 'int *' but argument is of type 'int'
+ warning: assignment from incompatible pointer type
+ warning: assignment makes integer from pointer without a cast
+ warning: assignment makes pointer from integer without a cast
+ warning: incompatible implicit declaration of built-in function 'calloc'
+ warning: incompatible implicit declaration of built-in function 'exit'
+ warning: passing argument 1 of 'd' makes pointer from integer without a cast
+ warning: passing argument 1 of 'p' makes pointer from integer without a cast
+ warning: pointer/integer type mismatch in conditional expression
Avoiding these would make the program substantially longer,
and detract from its single minded focus on conciseness.
It implicitly declares functions read(2), write(2), exit(3) and
diff --git a/2012/vik/README.md b/2012/vik/README.md
index ee85b31be..bf71396a2 100644
--- a/2012/vik/README.md
+++ b/2012/vik/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
This entry requires [Zlib](https://www.zlib.net).
@@ -15,7 +15,7 @@ code](#alternate-code) section below.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2012 vik bugs](../../bugs.html#2012_vik).
@@ -26,38 +26,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
+ ./vik e base.png filename > encodedimg.png
```
or
```sh
-./vik e base.png SomeRandomText > encodedimg.png
+ ./vik e base.png SomeRandomText > encodedimg.png
```
To extract the embedded text:
```sh
-./vik d encodedimg.png
+ ./vik d encodedimg.png
```
To embed a PNG into another:
```sh
-./vik e base.png source.png > encodedimg.png
+ ./vik e base.png source.png > encodedimg.png
```
To extract the embedded PNG:
```sh
-./vik d encodedimg.png > restored.png
+ ./vik d encodedimg.png > restored.png
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -69,7 +69,7 @@ For those few who might use Windows this alternate code might work.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -117,8 +117,8 @@ 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
+ ./vik e ioccc.png chocolate.png > encodedimg.png
+ ./vik b encodedimg.png
```
It is of course also possible to embed a
@@ -126,8 +126,8 @@ It is of course also possible to embed a
(as explained above) and decode it, e.g.:
```sh
-./vik e ioccc.png .+[.+] > encodedimg.png
-./vik b encodedimg.png
+ ./vik e ioccc.png .+[.+] > encodedimg.png
+ ./vik b encodedimg.png
```
### Obfuscation
@@ -155,7 +155,7 @@ the variable declarations in the main declaration in order to run
correctly:
```c
-_setmode(_fileno(stdout), 0x8000);
+ _setmode(_fileno(stdout), 0x8000);
```
NOTE: this is what the [Alternate code](#alternate-code) does.
diff --git a/2012/vik/index.html b/2012/vik/index.html
index d6bafb359..2db153246 100644
--- a/2012/vik/index.html
+++ b/2012/vik/index.html
@@ -132,8 +132,7 @@
Author:
Name: Daniel Vik
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,31 +141,31 @@ Location: US - United States of America
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:
@@ -197,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
@@ -222,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:
-
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 e915091cd..09c2eaef3 100644
--- a/2012/zeitak/README.md
+++ b/2012/zeitak/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version that is slightly deobfuscated. See [alternate
@@ -11,7 +11,7 @@ code](#alternate-code) below.
## To use:
```sh
-./zeitak < file
+ ./zeitak < file
```
where `file` is the file to be checked for nesting errors. For example, you may
@@ -22,7 +22,7 @@ text files that are not code.
## Try:
```sh
-make test
+ make test
```
NOTE: the program prints an error and exits on the first nesting error so it
@@ -39,7 +39,7 @@ understand this extremely subtle entry.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -61,7 +61,7 @@ just to understand _18 key **characters**_ of this code.
NOTE: if you use vim to view the code, make sure to do:
```
-:set tabstop=4
+ :set tabstop=4
```
in command mode, before looking at the code, to see the correct layout.
@@ -93,7 +93,7 @@ around it's position.
will be detected in the following line:
```c
-printf(")");
+ printf(")");
```
* Doesn't get confused by the [1984/anonymous](../../1984/anonymous/index.html) entry!
@@ -105,7 +105,7 @@ printf(")");
an error:
```c
-printf("\"");
+ printf("\"");
```
#### Obfuscation
diff --git a/2012/zeitak/index.html b/2012/zeitak/index.html
index 104ea2c0d..8e61349b1 100644
--- a/2012/zeitak/index.html
+++ b/2012/zeitak/index.html
@@ -132,8 +132,7 @@
Author:
Name: Adar Zeitak
-Location: IL - State of Israel (Israel)
-
@@ -142,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:
@@ -159,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:
@@ -170,7 +169,7 @@ At one point we spent
minutes
just to understand 18 key characters of this code.
NOTE: if you use vim to view the code, make sure to do:
-
:set tabstop=4
+
:set tabstop=4
in command mode, before looking at the code, to see the correct layout.
Author’s remarks:
Nesting Errors Detector
@@ -189,7 +188,7 @@ around it’s position.
Ignores parenthesis inside strings or character constants, so no errors
will be detected in the following line:
@@ -198,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 5c7a75963..7b830f0cc 100644
--- a/2013/README.md
+++ b/2013/README.md
@@ -58,9 +58,9 @@ 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
-by the IOCCC size tool source code is preferred by the judges.
+ In cases where the above summary and the algorithm implemented by
+ the IOCCC size tool source code conflict, the algorithm implemented
+ by the IOCCC size tool source code is preferred by the judges.
```
so this abuse was allowed (and encouraged). The judges hope that
diff --git a/2013/birken/README.md b/2013/birken/README.md
index 816c18fc4..c0f903d53 100644
--- a/2013/birken/README.md
+++ b/2013/birken/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make alt
+ make alt
```
We recommend that you use the alt version first to see what this entry looked
@@ -12,7 +12,7 @@ version see the [original code](#original-code) section below.
## To use:
```sh
-./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
@@ -31,7 +31,7 @@ it should you wish (see below).
To see the program run on each text file, try:
```sh
-./try.alt.sh
+ ./try.alt.sh
```
If you have perl installed it will also try a random run.
@@ -45,7 +45,7 @@ compile time. If you wish to speed it up by 100% you can instead do:
```sh
-make clobber SLEEP=7500 alt
+ make clobber SLEEP=7500 alt
```
and then try `birken.alt` as above.
@@ -56,7 +56,7 @@ ctrl-c to terminate the program early but note that the terminal is likely to be
messed up. In that case try:
```sh
-reset
+ reset
```
to make it sane again (running to completion will do that for you).
@@ -71,7 +71,7 @@ hard to see the art of the entry but you may do so if you wish.
### Original build:
```sh
-make all
+ make all
```
@@ -85,7 +85,7 @@ Use `birken` as you would `birken.alt` above.
To use the demo script with the original code, try:
```sh
-./try.sh
+ ./try.sh
```
PLEASE be careful if you are sensitive to flashing colours!
@@ -320,16 +320,16 @@ 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
+ $ ./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.
```sh
-$ ./iocccsize -i < birken.c
-2048
+ $ ./iocccsize -i < birken.c
+ 2048
```
Although this bug provides an easy means of circumventing contest rule 2, as
@@ -358,7 +358,7 @@ Carefully selected variable names also yielded wonderful expressions like `l=0`,
sorts:
```c
-[T][e][t]--; while(R+i) { s
+ [T][e][t]--; while(R+i) { s
```
The source is formatted to resemble the
diff --git a/2013/birken/index.html b/2013/birken/index.html
index f4312de68..d02aeee5c 100644
--- a/2013/birken/index.html
+++ b/2013/birken/index.html
@@ -132,8 +132,7 @@
Author:
Name: Michael Birken
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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.
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.
@@ -158,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
@@ -166,24 +165,24 @@ 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;
@@ -347,12 +346,12 @@ call to fflush(3) (N.B: see birken.alt.c2013-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.
@@ -372,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 6d64956b1..235235141 100644
--- a/2013/cable1/README.md
+++ b/2013/cable1/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./cable1 name group1 group2
+ ./cable1 name group1 group2
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -27,39 +27,39 @@ We need not limit ourselves to the two major political parties in the US today.
Let us consider:
```sh
-./cable1 Cooper Mac PC
+ ./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
+ ./cable1 Noll Mac PC
```
That works too! Now Leo brings PCs to the IOCCC judging for cross-platform
testing:
```sh
-./cable1 Broukhis Mac PC
+ ./cable1 Broukhis Mac PC
```
We can test other people. The late Steve Jobs:
```sh
-./cable1 Jobs Mac PC
+ ./cable1 Jobs Mac PC
```
That works! How about Bill?
```sh
-./cable1 Gates Mac PC
+ ./cable1 Gates Mac PC
```
A PC guy as expected. What about that other Steve?
```sh
-./cable1 Ballmer Mac PC
+ ./cable1 Ballmer Mac PC
```
Humm .. maybe there is a hidden reason he is leaving the late Micro$oft? :-)
diff --git a/2013/cable1/index.html b/2013/cable1/index.html
index 6a9f1e27f..c8628621a 100644
--- a/2013/cable1/index.html
+++ b/2013/cable1/index.html
@@ -132,8 +132,7 @@
Author:
Name: Adrian Cable
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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 4bd1fd31c..2c90d9ac5 100644
--- a/2013/cable2/README.md
+++ b/2013/cable2/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2013 cable2 bugs](../../bugs.html#2013_cable2).
@@ -19,7 +19,7 @@ For more detailed information see [2013 cable2 bugs](../../bugs.html#2013_cable2
## To use:
```sh
-./cable2 file.bmp [color]
+ ./cable2 file.bmp [color]
```
@@ -28,7 +28,7 @@ For more detailed information see [2013 cable2 bugs](../../bugs.html#2013_cable2
For different OCR examples:
```sh
-./try.sh
+ ./try.sh
```
diff --git a/2013/cable2/index.html b/2013/cable2/index.html
index 072aa7d6d..23f3e1b2d 100644
--- a/2013/cable2/index.html
+++ b/2013/cable2/index.html
@@ -132,8 +132,7 @@
Author:
Name: Adrian Cable
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,16 +141,16 @@ Location: US - United States of America
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 33d982e20..dc211d824 100644
--- a/2013/cable3/README.md
+++ b/2013/cable3/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
An alternate version that should compile in Windows/MS Visual Studio is
@@ -11,14 +11,14 @@ available. See the [Alternate code](#alternate-code) section below.
## To use:
```sh
-./cable3 bios-image-file floppy-image-file [harddisk-image-file]
+ ./cable3 bios-image-file floppy-image-file [harddisk-image-file]
```
## Try:
```sh
-./cable3.sh
+ ./cable3.sh
```
NOTE: to quit the program type `QUITEMU`. You might have to be at the top level
@@ -47,7 +47,7 @@ Assuming `make` is available and will function:
```sh
-make alt
+ make alt
```
@@ -174,7 +174,7 @@ 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))
+ KB=(kb=H(8),kbhit())&&(r[1190]=getch(),H(7))
```
NOTE: this is done in the [Alternate code](#alternate-code).
@@ -190,7 +190,7 @@ will need to explicitly declare these functions by adding the appropriate
include to the top of the source:
```c
-#include
+ #include
```
NOTE: this has been done in [cable3.c](cable3.c).
@@ -198,7 +198,7 @@ NOTE: this has been done in [cable3.c](cable3.c).
### Usage
```sh
-./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
@@ -206,9 +206,9 @@ 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
+ stty cbreak raw -echo min 0
+ ./cable3 bios floppy.img harddisk.img
+ stty cooked echo
```
See the [cable3.sh](cable3.sh) script.
@@ -224,9 +224,9 @@ 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
+ stty cbreak raw -echo min 0
+ ./cable3 bios fd.img
+ stty cooked echo
```
## To use the emulator - floppy + HD mode
@@ -238,9 +238,9 @@ 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
+ 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.
diff --git a/2013/cable3/index.html b/2013/cable3/index.html
index 2a7f7941e..4609a6b90 100644
--- a/2013/cable3/index.html
+++ b/2013/cable3/index.html
@@ -132,8 +132,7 @@
Author:
Name: Adrian Cable
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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.
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
@@ -163,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:
@@ -265,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:
The code as supplied uses implicit function declarations for POSIX file I/O and
@@ -274,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:
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
The simplest use of the emulator is with a single floppy boot disk image, like
@@ -292,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 58ce9bbd6..ca89a1feb 100644
--- a/2013/dlowe/README.md
+++ b/2013/dlowe/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2013 dlowe bugs](../../bugs.html#2013_dlowe).
@@ -19,7 +19,7 @@ For more detailed information see [2013 dlowe bugs](../../bugs.html#2013_dlowe).
## To use:
```sh
-./dlowe [number...]
+ ./dlowe [number...]
```
where `[number...]` is one or more number, space separated.
@@ -28,15 +28,15 @@ where `[number...]` is one or more number, space separated.
## Try:
```sh
-./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
+ echo 'IOCCC winning entry 2013/dlowe' > ioccc.txt
+ ./try.sh
+ rm -f ioccc.txt
```
?
@@ -44,7 +44,7 @@ rm -f ioccc.txt
To make it simpler to see try showing just the different line like:
```sh
-./diff.sh
+ ./diff.sh
```
@@ -59,10 +59,10 @@ 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));
-}
+ #include
+ 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.
@@ -71,19 +71,19 @@ with gcc and clang.
With GCC (4.7.2), we get
```
--2147483648 -2147483648 -2147483648
+ -2147483648 -2147483648 -2147483648
```
and with clang (3.3), we get
```
--2147483648 0 2147483647
+ -2147483648 0 2147483647
```
and with Apple clang version 15.0.0 (clang-1500.0.40.1) in 2023, we get:
```
-1840985120 -2033041452 35979112
+ 1840985120 -2033041452 35979112
```
Which one is correct? :)
@@ -92,7 +92,7 @@ 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
+ make CC=clang fun
```
@@ -106,17 +106,17 @@ A tiny implementation of command-line
### Synopsis
```sh
-$ ./sparkl 0 1 2 3 4 5 6 7
-▁▂▃▄▅▆▇▉
+ $ ./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: ▁▁▁▃▃▂▁▂▁▁▉
+ $ echo "sparkline of file lengths: $(wc -c * | awk '{print $1}' | xargs ./sparkl)"
+ sparkline of file sizes: ▁▁▁▃▃▂▁▂▁▁▉
```
NOTE: this has been provided in [slflen.sh](slflen.sh) so you can try:
```sh
-./slflen.sh
+ ./slflen.sh
```
instead (which [try.sh](try.sh) also uses).
diff --git a/2013/dlowe/index.html b/2013/dlowe/index.html
index e55863c29..f6206ae06 100644
--- a/2013/dlowe/index.html
+++ b/2013/dlowe/index.html
@@ -132,8 +132,7 @@
Author:
Name: J. David Lowe
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,56 +141,56 @@ Location: US - United States of America
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 b0b216809..ea5c9b256 100644
--- a/2013/endoh1/README.md
+++ b/2013/endoh1/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2013 endoh1 bugs](../../bugs.html#2013_endoh1).
@@ -19,20 +19,20 @@ For more detailed information see [2013 endoh1 bugs](../../bugs.html#2013_endoh1
## To use:
```sh
-./endoh1 [file.lazy]
+ ./endoh1 [file.lazy]
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
You might also enjoy running:
```sh
-cc -E endoh1.c | less
+ cc -E endoh1.c | less
```
@@ -51,9 +51,9 @@ 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
+ less endoh1.c
+ gcc -o endoh1 endoh1.c
+ ./endoh1
```
... Isn't there any more to it?
@@ -67,8 +67,8 @@ 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!
+ $ lazy hello.lazy
+ Hello, world!
```
where `lazy` is [a reference implementation of Lazy K][3]. At the same time,
@@ -76,9 +76,9 @@ where `lazy` is [a reference implementation of Lazy K][3]. At the same time,
as a library.
```sh
-$ 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][4].
@@ -137,9 +137,9 @@ 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
+ 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:
@@ -174,7 +174,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)...
+ s(x)(x)(x)(x)...
```
What type should `s` have? Unfortunately, C does *not* provide a "recursive
@@ -183,7 +183,7 @@ type", such as `typedef f (*f)();`.
So, I used a heavily nested function pointer type:
```c
-typedef void *(*(*(*...(*(f))()...)())())
+ typedef void *(*(*(*...(*(f))()...)())())
```
This limits how many arguments one function can be consecutively applied to.
@@ -208,11 +208,11 @@ 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); }
-...
-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.
diff --git a/2013/endoh1/index.html b/2013/endoh1/index.html
index 412fb4a71..505ac2017 100644
--- a/2013/endoh1/index.html
+++ b/2013/endoh1/index.html
@@ -132,8 +132,7 @@
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
@@ -161,23 +160,23 @@ the program itself.
4x longer to compile it with -O3 than without, compared to clang’s 2x.
I think it will work on almost all platforms. I confirmed:
Ubuntu Linux
@@ -236,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:
-
typedefvoid*(*(*(*...(*(f))()...)())())
+
typedefvoid*(*(*(*...(*(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
@@ -256,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:
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 (SKI) one program can use.
diff --git a/2013/endoh2/README.md b/2013/endoh2/README.md
index 3ec3c7050..c50d13277 100644
--- a/2013/endoh2/README.md
+++ b/2013/endoh2/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-make check
+ make check
```
You'll need to have both [Ruby](https://www.ruby-lang.org) and
@@ -24,7 +24,7 @@ download one or both before exiting.
## Try:
```sh
-less jpeg.c
+ less jpeg.c
```
Next look at `jpeg.jpg` in an image viewer program.
@@ -74,25 +74,25 @@ This program uses (a part of) Proggy Tiny Fonts
which is distributed in MIT License:
```
-Copyright (c) 2004, 2005 Tristan Grimmer
+ Copyright (c) 2004, 2005 Tristan Grimmer
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
```
diff --git a/2013/endoh2/index.html b/2013/endoh2/index.html
index 0d7ba0385..010651feb 100644
--- a/2013/endoh2/index.html
+++ b/2013/endoh2/index.html
@@ -132,8 +132,7 @@
You’ll need to have both Ruby and
ImageMagick installed to run all the automated
checks.
@@ -153,7 +152,7 @@ section to enjoy the entry. The Makefilecheck
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
@@ -187,25 +186,25 @@ year.
Legal
This program uses (a part of) Proggy Tiny Fonts
which is distributed in MIT License:
-
Copyright (c) 2004, 2005 Tristan Grimmer
+
Copyright (c) 2004, 2005 Tristan Grimmer
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
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.
@@ -181,21 +180,21 @@ will remain the same for historical purposes.
Note that the tone numbers simply enumerate the semi-tone steps. So we can
calculate the frequency easily: pow(2, n / 12.0). Then, how can we calculate
pow without math.h? pow(2, 1.0 / 12.0) is approximated by 89/84.. (I
@@ -288,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 3b54a7830..7931913a8 100644
--- a/2013/endoh4/README.md
+++ b/2013/endoh4/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
If you wish to change the size (see the [Author's remarks](#authors-remarks)
@@ -9,7 +9,7 @@ below) you can do so with the `SIZE` variable. For instance you can do:
```sh
-make clobber SIZE=50,50 all
+ make clobber SIZE=50,50 all
```
but you can also do this directly with the [endoh4.sh](endoh4.sh) script as
@@ -21,7 +21,7 @@ described below.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2013 endoh4 bugs](../../bugs.html#2013_endoh4).
@@ -30,8 +30,8 @@ For more detailed information see [2013 endoh4 bugs](../../bugs.html#2013_endoh4
## To use:
```sh
-./endoh4 < file
-./endoh4.sh file
+ ./endoh4 < file
+ ./endoh4.sh file
```
The second form is preferable as it will temporarily make the cursor invisible
@@ -42,7 +42,7 @@ line it will feed to the program [endoh4.c](endoh4.c).
## Try:
```sh
-./endoh4.sh cube.txt
+ ./endoh4.sh cube.txt
```
Hit ctrl-c to end the program.
@@ -52,13 +52,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
+ ./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
+ ./endoh4.sh solids/archimedian-solid/a11-truncated-icosahedron.txt cube.txt
```
Hit ctrl-c/intr to go to the next file.
@@ -67,7 +67,7 @@ If you wish to change the size to `50,50` without passing any arg:
```sh
-SIZE=50,50 ./endoh4.sh
+ SIZE=50,50 ./endoh4.sh
```
Not specifying a file feeds [endoh4.c](endoh4.c) to the program.
@@ -116,15 +116,15 @@ 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
+ tput civis
+ ./endoh4 < cube.txt
+ tput cnorm
```
or
```sh
-./endoh4.sh cube.txt
+ ./endoh4.sh cube.txt
```
### Bonuses
@@ -132,14 +132,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
+ 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
+ ./endoh4 < endoh4.c # or ./endoh4.sh
```
The [solids/](solids/) directory includes various solid data:
diff --git a/2013/endoh4/index.html b/2013/endoh4/index.html
index f76b7ce6d..8c2d04e2b 100644
--- a/2013/endoh4/index.html
+++ b/2013/endoh4/index.html
@@ -132,8 +132,7 @@
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:
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
@@ -204,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:
diff --git a/2013/hou/README.md b/2013/hou/README.md
index 9c5a756ac..750552e6e 100644
--- a/2013/hou/README.md
+++ b/2013/hou/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make all
+ make all
```
@@ -10,7 +10,7 @@ make all
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2013 hou bugs](../../bugs.html#2013_hou).
@@ -19,7 +19,7 @@ For more detailed information see [2013 hou bugs](../../bugs.html#2013_hou).
## To use:
```sh
-./hou [scene-file-name] [options]
+ ./hou [scene-file-name] [options]
```
Follow the instructions in `stdout`, preferably with an auto-refreshing PPM
@@ -30,7 +30,7 @@ effects should be more or less recognizable when you see 16.
## Try:
```sh
-./try.sh
+ ./try.sh
```
Try opening the file noted by the program then let the program run a while and
@@ -63,8 +63,8 @@ NOTE: the author refers to [a.c](a.c), placed in a gzipped file `a.c.gz`. We do
include it but it can be generated like:
```sh
-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
@@ -79,7 +79,7 @@ This program is a programmable rendering engine with a built-in default scene.
The standard command line is:
```sh
-./hou [scene-file-name] [options]
+ ./hou [scene-file-name] [options]
```
As `hou` runs, it writes a progressively refining image to a ppm file specified
@@ -182,11 +182,11 @@ doesn't copy saved sessions across different endianness.
### Spoiler
```
- 3225 3225 3225 9 9 3225 3225
- 1 1 1 1 1 1 1 1 1 1
- 4225 1226 1 1 1 1 1222 1226
- 1 1 1 1 1 1 1 1 1
- 4226 1 4226 8 4222 4226 1 1
+ 3225 3225 3225 9 9 3225 3225
+ 1 1 1 1 1 1 1 1 1 1
+ 4225 1226 1 1 1 1 1222 1226
+ 1 1 1 1 1 1 1 1 1
+ 4226 1 4226 8 4222 4226 1 1
```
The program consists of a recursive-descent interpreter, a `3DDDA` (3D Discrete
diff --git a/2013/hou/doc/example.html b/2013/hou/doc/example.html
index 141cda07e..08d953866 100644
--- a/2013/hou/doc/example.html
+++ b/2013/hou/doc/example.html
@@ -125,38 +125,38 @@
Scene format documentation
The file must be encoded in UTF-8 as the BOF marker indicates.
You can directly feed it to the renderer. If you’re wondering about what the following code block does, that’s why:)
A scene file begins with arbitrary binary data, followed by several shader
functions.
@@ -164,33 +164,33 @@ functions.
character. There are some special function names, which will be explained below.
The language used to write shader functions is very simple. Basically, you write
a sequence of assignment statements like this:
-
A=A+D
-B=B+E
+
A=A+D
+ B=B+E
Namely, you write a one-character variable name, an equal sign (=), followed
by an expression (made of operators and one-character variable names, of
course).
Expressions
The shader language supports seven operators, listed highest priority first:
-
*/+-<#:
+
*/+-<#:
*/+-< each mean what they mean in C, but the priority part is a bit different.
Basically, * has higher priority than /, so A/4*4 actually computes
A/(4*4). And you can’t write (A/4)*4 – brackets are not supported. As an
advice, keep your expressions simple :) If you really needs to write something
like C=(A/4)*4, write instead:
-
B=A/4+
-C=B*4
+
B=A/4+
+ C=B*4
The # operator acts somewhat like the C ?:. It returns one of its two
operands based on, what else, the value of variable #. When # is true, #
returns its second operand.
The : operator calls built-in functions. The first operand is the function id and the second is the parameter. Here is a list of functions:
-
0:x = the x-th byte of the scene file
-1:x = sin(x*PI)
-2:x = atan2(x,#)/PI
-3:x = sqrt(max(x,0))
-4:x = floor(x)
-5:x = the next number in the (allegedly random) number sequence, can't be called in volume shaders
-6:x = value of the variable (char)(120+x)
-7:x = write #'s value to the variable (char)(120+x)
+
0:x = the x-th byte of the scene file
+ 1:x = sin(x*PI)
+ 2:x = atan2(x,#)/PI
+ 3:x = sqrt(max(x,0))
+ 4:x = floor(x)
+ 5:x = the next number in the (allegedly random) number sequence, can't be called in volume shaders
+ 6:x = value of the variable (char)(120+x)
+ 7:x = write #'s value to the variable (char)(120+x)
Contrary to popular belief, the language itself doesn’t support numerical
constants. Any character sitting between operators is a variable. When you see
1/2, it’s in fact dividing the variable 1’s value by the variable 2’s value. For
@@ -208,7 +208,7 @@ the Windows \r\n), and it terminates your function. Also, the first
must begin immediately after ].
When a function terminates, the interpreter calls the next function specified by
variable R. If you want to call function n, just write somewhere:
-
R=n
+
R=n
providing you have left n at its initial value. If you want to actually return
to the renderer, put in R=0.
As you may have noticed, you can put in all kinds of stuff between functions,
@@ -224,28 +224,28 @@ material shaders.
-
//As an (optional) assignment, figure out what function 'n' does. And why there is a plus sign at every EOL except the last.
-n]#=1+
-x=X+1/2+
-d=0:U;d=d-n;U=U+1;A=d<x;#=#*A+
-d=0:U;d=d-n;U=U+1;A=x<d+1;#=#*A+
-x=Y+1/2+
-d=0:U;d=d-n;U=U+1;A=d<x;#=#*A+
-d=0:U;d=d-n;U=U+1;A=x<d+1;#=#*A+
-x=Z+1/2+
-d=0:U;d=d-n;U=U+1;A=d<x;#=#*A+
-d=0:U;d=d-n;U=U+1;A=x<d+1;#=#*A+
-d=0:U;d=d-n;U=U+1+
-U=U+2+
-C=C#d+3*9+
-#=d+
-R=0#n
+
//As an (optional) assignment, figure out what function 'n' does. And why there is a plus sign at every EOL except the last.
+ n]#=1+
+ x=X+1/2+
+ d=0:U;d=d-n;U=U+1;A=d<x;#=#*A+
+ d=0:U;d=d-n;U=U+1;A=x<d+1;#=#*A+
+ x=Y+1/2+
+ d=0:U;d=d-n;U=U+1;A=d<x;#=#*A+
+ d=0:U;d=d-n;U=U+1;A=x<d+1;#=#*A+
+ x=Z+1/2+
+ d=0:U;d=d-n;U=U+1;A=d<x;#=#*A+
+ d=0:U;d=d-n;U=U+1;A=x<d+1;#=#*A+
+ d=0:U;d=d-n;U=U+1+
+ U=U+2+
+ C=C#d+3*9+
+ #=d+
+ R=0#n
The function A initializes global settings:
-
G -- Image width, in pixels
-H -- Image height, in pixels
-I -- Perturbation probability
-J -- Camera ray stratification probability
+
G -- Image width, in pixels
+ H -- Image height, in pixels
+ I -- Perturbation probability
+ J -- Camera ray stratification probability
If you have used a MLT renderer before, you probably know what I and J does.
If you don’t, well, use the same value as the default scene. Everything
converges just fine under suboptimal settings, just a little slower. Generally,
@@ -280,17 +280,17 @@ the one facing my bed, to thank me for the effort.
-
//As a bonus, find out what the first line does
-A]#=#-#;"=7:0-p+^;#="+
-R=n+
-G=p*:+
-#=0<B+
-G=G*2#G+
-H=G*3/4+
-I=4/5+
-J=1/2+
-C=p+1+
-U=w+w+w
+
//As a bonus, find out what the first line does
+ A]#=#-#;"=7:0-p+^;#="+
+ R=n+
+ G=p*:+
+ #=0<B+
+ G=G*2#G+
+ H=G*3/4+
+ I=4/5+
+ J=1/2+
+ C=p+1+
+ U=w+w+w
The function a is the camera shader, which, well, generates the camera ray.
It’s supposed to return the ray in variables UVWXYZ and ABCDEF (that may
@@ -312,8 +312,8 @@ coordinate space, volume 0 is scaled up 64x here to (0,0,0)-(4096,4096,409
happen. Wall up everything.
Variables ABCDEF control the color returned from the ray. They will be
explained in the material shaders part. For now, just put in:
The numbered functions define materials, i.e., surface reflectance properties.
As the name suggests, the shader simulates ray-surface interaction. It’s done by
@@ -374,32 +374,32 @@ Function) importance sampling. Let’s continue to function o.
Function o defines a diffuse (that is, dull) surface. To define reflectance
properties like this, one needs to sample an outgoing ray direction, based on
@@ -415,9 +415,9 @@ defined as a bunch of cube-shaped cells, there are only 6 possible normals:
(±1,0,0) (0,±1,0) (0,0,±1). Here S is the sign and T is the dimension. If
you get S=-1 and T=1, the normal is (0,-1,0).
If you don’t want to redo all the math yourself… this file provides a few simple shader functions:
-
o -- Diffuse surface. Do the color thing your self and call R=o
-5 -- Perfect mirror.
-f -- Surface with a Fresnel term. Basically, it resembles a polished surface made from a dielectric material.
+
o -- Diffuse surface. Do the color thing your self and call R=o
+ 5 -- Perfect mirror.
+ f -- Surface with a Fresnel term. Basically, it resembles a polished surface made from a dielectric material.
For something more complex like a fluffy carpet, well, you could use a volume to
directly model the
mesoscopic detail. Shader
@@ -430,107 +430,107 @@ appearance.
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
@@ -182,15 +181,15 @@ program.
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
@@ -280,11 +279,11 @@ quite memory consuming, requires IEEE754-compliant double, and assu
doesn’t copy saved sessions across different endianness.
The program consists of a recursive-descent interpreter, a 3DDDA (3D Discrete
Differential Analysis) ray tracer, a PSSMLT (Primary Sample Space Metropolis
Light Transport) light path sampler, all squeezed into the size limit using a
diff --git a/2013/index.html b/2013/index.html
index ca3a0e026..8cb8a403b 100644
--- a/2013/index.html
+++ b/2013/index.html
@@ -160,9 +160,9 @@ certain comments such as:
*\/
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
-by the IOCCC size tool source code is preferred by the judges.
+
In cases where the above summary and the algorithm implemented by
+ the IOCCC size tool source code conflict, the algorithm implemented
+ by the IOCCC size tool source code is preferred by the judges.
so this abuse was allowed (and encouraged). The judges hope that
the IOCCC size tool author will patch the tool to block this kind
of size abuse in future contests.
diff --git a/2013/mills/README.md b/2013/mills/README.md
index 4e3ef0966..074cf671b 100644
--- a/2013/mills/README.md
+++ b/2013/mills/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2013 mills bugs](../../bugs.html#2013_mills).
@@ -19,14 +19,14 @@ For more detailed information see [2013 mills bugs](../../bugs.html#2013_mills).
## To use:
```sh
-./mills
+ ./mills
```
## Try:
```sh
-./mills &
+ ./mills &
```
While that is running, point your favorite browser at:
@@ -62,7 +62,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),
+ 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,
diff --git a/2013/mills/index.html b/2013/mills/index.html
index c3a6f0a9e..a5b12c9cb 100644
--- a/2013/mills/index.html
+++ b/2013/mills/index.html
@@ -132,8 +132,7 @@
Author:
Name: Christopher Mills
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,15 +141,15 @@ Location: US - United States of America
@@ -171,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.
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 51ed40f79..559d9029c 100644
--- a/2013/misaka/README.md
+++ b/2013/misaka/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
This will build a bunch of versions of the code. See the author's details for
@@ -11,8 +11,8 @@ information on all of these builds.
## To use:
```sh
-./horizontal_cat [files...] > [output]
-./vertical_cat [files...] > [output]
+ ./horizontal_cat [files...] > [output]
+ ./vertical_cat [files...] > [output]
```
@@ -21,19 +21,19 @@ information on all of these builds.
To understand the various intermediate source files that are built, try:
```sh
-make understanding
+ make understanding
```
Also try:
```sh
-./try.sh
+ ./try.sh
```
NOTE: Use - for standard input. For example:
```sh
-./vertical_cat - -
+ ./vertical_cat - -
```
@@ -70,12 +70,12 @@ judging this entry.
operation:
```sh
-cc misaka.c -o horizontal_cat
-./horizontal_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]
+ ./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`.
@@ -95,8 +95,8 @@ 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...
+ cc misaka.c -o horizontal_cat
+ ./horizontal_cat files...
```
`horizontal_cat` concatenates files horizontally and write the output to
@@ -110,7 +110,7 @@ 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 -
+ seq -f ' %.0f ' 45 | ./horizontal_cat - misaka.c -
```
@@ -127,16 +127,16 @@ 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...
+ ./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`:
```sh
-./vertical_cat - -
+ ./vertical_cat - -
```
@@ -148,9 +148,9 @@ 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
+ ./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
@@ -158,33 +158,33 @@ 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
+ ./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 > 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 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:
```sh
-./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 - - > 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 - - - > 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:
```sh
-./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](misaka.c) you have stacked
@@ -193,14 +193,14 @@ together, you can feed the source to a
overview of how the programs are stacked. Example:
```sh
-perl bf.pl misaka9.c
+ perl bf.pl misaka9.c
```
This outputs:
```
-MISAKA
-MISAKA MISAKA
+ MISAKA
+ MISAKA MISAKA
```
diff --git a/2013/misaka/index.html b/2013/misaka/index.html
index 885cacc56..8a78e5137 100644
--- a/2013/misaka/index.html
+++ b/2013/misaka/index.html
@@ -132,8 +132,7 @@
Author:
Name: Don Yang
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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.
Where [files...] is a list of text file names. Use - to read from stdin.
Details
Horizontal cat
@@ -193,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.
@@ -203,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
@@ -213,50 +212,50 @@ 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:
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:
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):
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
+
MISAKA
+ MISAKA MISAKA
Return value
horizontal_cat and vertical_cat will exit with zero status on success.
If any input file fails to open, horizontal_cat and vertical_cat will
diff --git a/2013/morgan1/README.md b/2013/morgan1/README.md
index b62ef82f8..769a6fc7a 100644
--- a/2013/morgan1/README.md
+++ b/2013/morgan1/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-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
@@ -24,7 +24,7 @@ follows:
## Try:
```sh
-./try.sh
+ ./try.sh
```
Use the same keys as described above to change the dates each time the program
@@ -107,20 +107,20 @@ degrees sometimes).
With gcc 4.7.2 on Linux Ubuntu 12.10:
```
-morgan1.c:38:3: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
-morgan1.c:40:34: warning: value computed is not used [-Wunused-value]
-morgan1.c:56:6: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
-morgan1.c:58:50: warning: value computed is not used [-Wunused-value]
-morgan1.c:61:5: warning: suggest parentheses around ‘-’ inside ‘>>’ [-Wparentheses]
+ morgan1.c:38:3: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
+ morgan1.c:40:34: warning: value computed is not used [-Wunused-value]
+ morgan1.c:56:6: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
+ morgan1.c:58:50: warning: value computed is not used [-Wunused-value]
+ morgan1.c:61:5: warning: suggest parentheses around ‘-’ inside ‘>>’ [-Wparentheses]
```
With clang 3.1 on Linux Ubuntu 12.10 :
```
-morgan1.c:38:49: warning: '&&' within '||' [-Wlogical-op-parentheses]
-morgan1.c:38:27: warning: '&&' within '||' [-Wlogical-op-parentheses]
-morgan1.c:55:13: warning: '&&' within '||' [-Wlogical-op-parentheses]
-morgan1.c:56:14: warning: '&&' within '||' [-Wlogical-op-parentheses]
+ morgan1.c:38:49: warning: '&&' within '||' [-Wlogical-op-parentheses]
+ morgan1.c:38:27: warning: '&&' within '||' [-Wlogical-op-parentheses]
+ morgan1.c:55:13: warning: '&&' within '||' [-Wlogical-op-parentheses]
+ morgan1.c:56:14: warning: '&&' within '||' [-Wlogical-op-parentheses]
```
This is due to most of the parentheses and braces being removed when
diff --git a/2013/morgan1/index.html b/2013/morgan1/index.html
index 29cecabbb..2cbd8de12 100644
--- a/2013/morgan1/index.html
+++ b/2013/morgan1/index.html
@@ -132,8 +132,7 @@
@@ -142,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:
@@ -155,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:
@@ -218,16 +217,16 @@ degrees sometimes).
Compilation warnings
With gcc 4.7.2 on Linux Ubuntu 12.10:
-
morgan1.c:38:3: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
-morgan1.c:40:34: warning: value computed is not used [-Wunused-value]
-morgan1.c:56:6: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
-morgan1.c:58:50: warning: value computed is not used [-Wunused-value]
-morgan1.c:61:5: warning: suggest parentheses around ‘-’ inside ‘>>’ [-Wparentheses]
+
morgan1.c:38:3: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
+ morgan1.c:40:34: warning: value computed is not used [-Wunused-value]
+ morgan1.c:56:6: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
+ morgan1.c:58:50: warning: value computed is not used [-Wunused-value]
+ morgan1.c:61:5: warning: suggest parentheses around ‘-’ inside ‘>>’ [-Wparentheses]
With clang 3.1 on Linux Ubuntu 12.10 :
-
morgan1.c:38:49: warning: '&&' within '||' [-Wlogical-op-parentheses]
-morgan1.c:38:27: warning: '&&' within '||' [-Wlogical-op-parentheses]
-morgan1.c:55:13: warning: '&&' within '||' [-Wlogical-op-parentheses]
-morgan1.c:56:14: warning: '&&' within '||' [-Wlogical-op-parentheses]
+
morgan1.c:38:49: warning: '&&' within '||' [-Wlogical-op-parentheses]
+ morgan1.c:38:27: warning: '&&' within '||' [-Wlogical-op-parentheses]
+ morgan1.c:55:13: warning: '&&' within '||' [-Wlogical-op-parentheses]
+ morgan1.c:56:14: warning: '&&' within '||' [-Wlogical-op-parentheses]
This is due to most of the parentheses and braces being removed when
unnecessary.
To verify the display, you can look at one of these programs :
diff --git a/2013/morgan2/README.md b/2013/morgan2/README.md
index d7f7a279a..3bb1022b4 100644
--- a/2013/morgan2/README.md
+++ b/2013/morgan2/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,13 +10,13 @@ make
For the console version (ncurses):
```sh
-./morgan2
+ ./morgan2
```
For the graphical version (X11):
```sh
-./morgan2 X
+ ./morgan2 X
```
@@ -133,13 +133,13 @@ simply press `q` when you have finished...
With gcc 4.7.2 on Linux Ubuntu 12.10 :
```
-morgan2.c:46:65: warning: value computed is not used [-Wunused-value]
+ morgan2.c:46:65: warning: value computed is not used [-Wunused-value]
```
With clang 3.1 on Linux Ubuntu 12.10 :
```
-morgan2.c:23:24: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
+ morgan2.c:23:24: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
```
**!!!!! HAVE FUN !!!!!**
diff --git a/2013/morgan2/index.html b/2013/morgan2/index.html
index 6593cca2a..4af053e2d 100644
--- a/2013/morgan2/index.html
+++ b/2013/morgan2/index.html
@@ -132,8 +132,7 @@
@@ -142,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
@@ -228,9 +227,9 @@ use.
Compilation warnings
With gcc 4.7.2 on Linux Ubuntu 12.10 :
-
morgan2.c:46:65: warning: value computed is not used [-Wunused-value]
+
morgan2.c:46:65: warning: value computed is not used [-Wunused-value]
With clang 3.1 on Linux Ubuntu 12.10 :
-
morgan2.c:23:24: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
+
morgan2.c:23:24: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
!!!!! HAVE FUN !!!!!
@@ -142,14 +141,14 @@ Location: US - United States of America
To build:
-
make
+
make
To use:
-
./robison
-# enter an expression
+
./robison
+# enter an expression
-echo expression |./robison
+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 1c87480ca..11443e28b 100644
--- a/2014/birken/README.md
+++ b/2014/birken/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is alternate code that lets you redefine the port to bind to, in case
@@ -12,28 +12,28 @@ there is a firewall issue, and also lets you redefine the timing constant,
## To use:
```sh
-./prog < some_secret_or_something
+ ./prog < some_secret_or_something
-./prog http://host[:port]
+ ./prog http://host[:port]
```
## Try:
```sh
-./prog < README.md
+ ./prog < README.md
```
or maybe:
```sh
-echo "IOCCC 2014!" | ./prog
+ echo "IOCCC 2014!" | ./prog
```
Next, try in another terminal, as the above one is running:
```sh
-./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
@@ -56,13 +56,13 @@ described by the author. See [configuration](#configuration) below.
To specify the port to say, 31337, try:
```sh
-make clobber PORT=31337 alt
+ make clobber PORT=31337 alt
```
To change the timing constant, `STARDATE`, try:
```sh
-make clobber TIME=5000000 alt
+ make clobber TIME=5000000 alt
```
You can combine them both of course.
@@ -102,26 +102,26 @@ the server.
## To use web server
```sh
-./prog < secret_file_to_be_downloaded
+ ./prog < secret_file_to_be_downloaded
```
Try using the program's source code as the secret file:
```sh
-./prog < prog.c
+ ./prog < prog.c
```
## To use client-side downloader
```sh
-./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:
```sh
-./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
@@ -247,15 +247,15 @@ For space considerations, the following include statements were dropped
resulting in compiler warnings:
```c
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
```
It may be necessary to restore some of these under certain environments.
diff --git a/2014/birken/index.html b/2014/birken/index.html
index ae730df06..1a669a18c 100644
--- a/2014/birken/index.html
+++ b/2014/birken/index.html
@@ -135,8 +135,7 @@
Location: US - United States of America (United States)
Name: Michael Birken
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -145,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.
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
@@ -169,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
@@ -195,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
@@ -297,15 +296,15 @@ numerical values.
Compiler warnings
For space considerations, the following include statements were dropped
resulting in compiler warnings:
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:
@@ -158,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.
@@ -187,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:
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 6cb098189..cc5cac99b 100644
--- a/2014/endoh1/README.md
+++ b/2014/endoh1/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./prog > foo.c
+ ./prog > foo.c
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
The script will ask you if you wish to run `make rake` but this is not necessary
@@ -37,16 +37,16 @@ Big terminals with tiny fonts have their uses in certain cases.
One of them is:
```sh
-make treacl
-./treacl
+ make treacl
+ ./treacl
```
which is shorthand for:
```sh
-./prog < prog.c > treacle.c
-make treacle
-./treacle
+ ./prog < prog.c > treacle.c
+ make treacle
+ ./treacle
```
diff --git a/2014/endoh1/index.html b/2014/endoh1/index.html
index cf23f92b5..c681be18c 100644
--- a/2014/endoh1/index.html
+++ b/2014/endoh1/index.html
@@ -132,8 +132,7 @@
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
@@ -160,12 +159,12 @@ build main.c.
Judges’ remarks:
Big terminals with tiny fonts have their uses in certain cases.
One of them is:
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 45914e1e3..4fc3a9559 100644
--- a/2014/maffiodo1/README.md
+++ b/2014/maffiodo1/README.md
@@ -3,9 +3,8 @@
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
+ make
```
@@ -14,7 +13,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2014 maffiodo1 bugs](../../bugs.html#2014_maffiodo1).
@@ -23,7 +22,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
+ cat game.level | ./prog 320 200 800 300 128 144 game.rgba game.wav 10343679
```
The parameters to the program are:
@@ -43,10 +42,9 @@ note on macOS.
## Try:
```sh
-./giana.sh
-
-./mario.sh
+ ./giana.sh
+ ./mario.sh
```
If you end up telnetting to the server (feature of [mario.sh](mario.sh)) you can
@@ -54,19 +52,19 @@ try:
```
-ls # show files including games
-wumpus.bas # play Hunt the Wumpus
-advent.gam # you know what this is! :-)
-starwars # animated Star Wars 'film'
+ ls # show files including games
+ wumpus.bas # play Hunt the Wumpus
+ advent.gam # you know what this is! :-)
+ 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:
```sh
-ROWS=800 COLS=800 ./mario.sh
+ ROWS=800 COLS=800 ./mario.sh
-ROWS=800 COLS=800 ./giana.sh
+ ROWS=800 COLS=800 ./giana.sh
```
@@ -79,7 +77,7 @@ NOTE: the author states to use `tabsize=4` to see the magic of the formatting of
the code. In `vim` you can do:
```
-:set tabstop=4
+ :set tabstop=4
```
in command mode to see this effect. You don't need to modify your `.vimrc` file!
@@ -95,14 +93,14 @@ immediately take effect.
Use `tabsize=4` to see the magic.
```sh
-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:
```sh
-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`
@@ -184,7 +182,7 @@ must be a grid of 8xN sprites. The size of a single sprite must be square. The
program calculates the size in this way:
```
-sprite_size = image_width / 8
+ sprite_size = image_width / 8
```
Each sprite is identified by its position inside the grid, counting line by
@@ -194,27 +192,27 @@ grid, sprite 8 is the first sprite of the second row of the grid etc.).
Some positions of the grid have a predefined purpose:
```
-Position | Description
-:-----------------|:--------------
-0 | Player standing right
-1 | Player walking right frame 0
-2 | Player walking right frame 1
-3 | Player jumping right
-4 | Player standing left
-5 | Player walking left frame 0
-6 | Player walking left frame 1
-7 | Player jumping left
-8 *(second row)* | Super player standing right
-9 | Super player walking right frame 0
-10 | Super player walking right frame 1
-11 | Super player jumping right
-12 | Super player standing left
-13 | Super player walking left frame 0
-14 | Super player walking left frame 1
-15 | Super player jumping left
-24 | Player dead
-32 | Player won
-40 | Super player won
+ Position | Description
+ :-----------------|:--------------
+ 0 | Player standing right
+ 1 | Player walking right frame 0
+ 2 | Player walking right frame 1
+ 3 | Player jumping right
+ 4 | Player standing left
+ 5 | Player walking left frame 0
+ 6 | Player walking left frame 1
+ 7 | Player jumping left
+ 8 *(second row)* | Super player standing right
+ 9 | Super player walking right frame 0
+ 10 | Super player walking right frame 1
+ 11 | Super player jumping right
+ 12 | Super player standing left
+ 13 | Super player walking left frame 0
+ 14 | Super player walking left frame 1
+ 15 | Super player jumping left
+ 24 | Player dead
+ 32 | Player won
+ 40 | Super player won
```
All the others sprites can be used as you want, depending on the game you want
@@ -231,7 +229,7 @@ handled by the program is 333. You can modify this value by editing the source
here:
```c
-C[333*7],d=333;
+ C[333*7],d=333;
```
Each row has six columns:
diff --git a/2014/maffiodo1/index.html b/2014/maffiodo1/index.html
index 2e45968a1..26f81ed02 100644
--- a/2014/maffiodo1/index.html
+++ b/2014/maffiodo1/index.html
@@ -132,8 +132,7 @@
A classic for a particular generation. Like all good programs, being data
driven means you can do fun things in small spaces.
NOTE: the author states to use tabsize=4 to see the magic of the formatting of
the code. In vim you can do:
-
:set tabstop=4
+
:set tabstop=4
in command mode to see this effect. You don’t need to modify your .vimrc file!
You can also use expand as described below by the author if your terminal has
enough rows and you don’t want to move about in the code. The vim command should
@@ -192,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:
This is an engine for platform
game. It can be used to create
@@ -255,32 +254,32 @@ note on macOS.
The program read a single image that contains all the game sprites. The image
must be a grid of 8xN sprites. The size of a single sprite must be square. The
program calculates the size in this way:
-
sprite_size = image_width / 8
+
sprite_size = image_width / 8
Each sprite is identified by its position inside the grid, counting line by
line, from left to right (for example sprite 0 is the top left sprite in the
grid, sprite 8 is the first sprite of the second row of the grid etc.).
Some positions of the grid have a predefined purpose:
-
Position | Description
-:-----------------|:--------------
-0 | Player standing right
-1 | Player walking right frame 0
-2 | Player walking right frame 1
-3 | Player jumping right
-4 | Player standing left
-5 | Player walking left frame 0
-6 | Player walking left frame 1
-7 | Player jumping left
-8 *(second row)* | Super player standing right
-9 | Super player walking right frame 0
-10 | Super player walking right frame 1
-11 | Super player jumping right
-12 | Super player standing left
-13 | Super player walking left frame 0
-14 | Super player walking left frame 1
-15 | Super player jumping left
-24 | Player dead
-32 | Player won
-40 | Super player won
+
Position | Description
+ :-----------------|:--------------
+ 0 | Player standing right
+ 1 | Player walking right frame 0
+ 2 | Player walking right frame 1
+ 3 | Player jumping right
+ 4 | Player standing left
+ 5 | Player walking left frame 0
+ 6 | Player walking left frame 1
+ 7 | Player jumping left
+ 8 *(second row)* | Super player standing right
+ 9 | Super player walking right frame 0
+ 10 | Super player walking right frame 1
+ 11 | Super player jumping right
+ 12 | Super player standing left
+ 13 | Super player walking left frame 0
+ 14 | Super player walking left frame 1
+ 15 | Super player jumping left
+ 24 | Player dead
+ 32 | Player won
+ 40 | Super player won
All the others sprites can be used as you want, depending on the game you want
to create.
Levels
@@ -289,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:
Screen X : x position of the object in the level.
diff --git a/2014/maffiodo2/README.md b/2014/maffiodo2/README.md
index 38c38873a..263750a94 100644
--- a/2014/maffiodo2/README.md
+++ b/2014/maffiodo2/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is a 121 byte version provided by the author. See [Alternate
@@ -13,7 +13,7 @@ code](#alternate-code) below.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2014 maffiodo2 bugs](../../bugs.html#2014_maffiodo2).
@@ -22,14 +22,14 @@ For more detailed information see [2014 maffiodo2 bugs](../../bugs.html#2014_maf
## To use:
```sh
-./prog arg
+ ./prog arg
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -42,14 +42,14 @@ as fun but it's 121 bytes instead of 140.
### Alternate build:
```sh
-make alt
+ make alt
```
### Alternate use:
```sh
-cat image.rgb | ./prog.alt
+ cat image.rgb | ./prog.alt
```
@@ -92,7 +92,7 @@ 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,
+ d=80,
```
### Something to try
@@ -100,14 +100,14 @@ d=80,
Type this:
```sh
-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:
```sh
-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
@@ -117,10 +117,10 @@ 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 " .:-=+*#%@"
-./prog " .,:!-iots&8%#@$"
+ ./prog " :1"
+ ./prog " .:;Y0"
+ ./prog " .:-=+*#%@"
+ ./prog " .,:!-iots&8%#@$"
```
### 121 byte version
@@ -128,7 +128,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("");}}
+ 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...
diff --git a/2014/maffiodo2/index.html b/2014/maffiodo2/index.html
index c156a5939..4db3fb827 100644
--- a/2014/maffiodo2/index.html
+++ b/2014/maffiodo2/index.html
@@ -132,8 +132,7 @@
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
@@ -186,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).
This alternative version has a fixed ramp. It’s smaller but it’s not so fun to use…
@@ -142,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
@@ -191,9 +190,9 @@ It will recursively use itself for sub-make (the MAKE= assignment i
Compilation warnings
With gcc 4.8.2 on Linux Ubuntu 14.04 64-bit :
-
prog.c:22:15: warning: return makes integer from pointer without a cast [enabled by default]
-prog.c:23:72: warning: signed and unsigned type in conditional expression [-Wsign-compare]
-prog.c:12:11: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
+
prog.c:22:15: warning: return makes integer from pointer without a cast [enabled by default]
+ prog.c:23:72: warning: signed and unsigned type in conditional expression [-Wsign-compare]
+ prog.c:12:11: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
@@ -142,13 +141,13 @@ Location: US - United States of America
To build:
-
make
+
make
To use:
-
./hecate.sh
+
./hecate.sh
-./glock.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:
@@ -161,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:
@@ -212,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 5cb550def..e3f6a624d 100644
--- a/2014/skeggs/README.md
+++ b/2014/skeggs/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./prog
+ ./prog
```
HINT: Try pressing the left and right arrow keys as needed.
@@ -220,8 +220,10 @@ I ran out of time to test it on more systems.
* What's the length of this README file according to the
[iocccsize](../iocccsize.c) tool?
- $ ./iocccsize -i < README.md
- 6057
+```
+ $ ./iocccsize -i < README.md
+ 6057
+```
@@ -142,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. :-)
@@ -294,10 +293,10 @@ require a pet fish license.
Station 13. I didn’t, however, look at the minigame at all during the
development of this entry.
What’s the length of this README file according to the
-iocccsize tool?
@@ -142,33 +141,33 @@ 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.
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
@@ -178,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.
@@ -188,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:
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 95ce063a8..12785a580 100644
--- a/2014/wiedijk/README.md
+++ b/2014/wiedijk/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./prog
+ ./prog
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
By default that will use `indent(1)` found by the shell `type -P indent` and
@@ -23,7 +23,7 @@ By default that will use `indent(1)` found by the shell `type -P indent` and
to try a different beautifier, you can do it like:
```sh
-INDENT=bcpp ./try.sh
+ INDENT=bcpp ./try.sh
```
which would change it to use `bcpp(1)` instead of `indent(1)`. Do similar for
@@ -57,8 +57,8 @@ executable C functions.
- The readable implementation of `Y` is on lines 29-30:
```
-W_f = \x.f(xx)
-Y = \f.W_f W_f
+ W_f = \x.f(xx)
+ Y = \f.W_f W_f
```
- A mixture of strict and lazy evaluation, with a `_` force function
diff --git a/2014/wiedijk/index.html b/2014/wiedijk/index.html
index c8e2f2ef9..10b81cb71 100644
--- a/2014/wiedijk/index.html
+++ b/2014/wiedijk/index.html
@@ -132,8 +132,7 @@
Author:
Name: Freek Wiedijk
-Location: NL - Kingdom of the Netherlands (Netherlands)
-
+Location: NL - Kingdom of the Netherlands (Netherlands)
@@ -142,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:
@@ -173,8 +172,8 @@ executable C functions.
Recursion implemented through Curry’s paradoxical combinator Y.
The readable implementation of Y is on lines 29-30:
-
W_f = \x.f(xx)
-Y = \f.W_f W_f
+
W_f = \x.f(xx)
+ Y = \f.W_f W_f
A mixture of strict and lazy evaluation, with a _ force function
(John Tromp notes that if Turing’s fixed-point combinator
diff --git a/2015/README.md b/2015/README.md
index d1d63528e..e9ca371fe 100644
--- a/2015/README.md
+++ b/2015/README.md
@@ -67,14 +67,14 @@ and 22 (one third of 666).
Rule 22, now known as **Catch 22** states:
```
-| 22) Your source code, data files, remarks and program output must NOT
-| identify the authors of your code. The judges STRONGLY prefer to
-| not know who is submitting entries to the IOCCC.
+ | 22) Your source code, data files, remarks and program output must NOT
+ | identify the authors of your code. The judges STRONGLY prefer to
+ | not know who is submitting entries to the IOCCC.
-| The "Peter Honeyman is exempt" guideline also applies to this rule.
-| Identifying yourself, in an obvious way in your code, data, remarks
-| or program output, unless you are Peter Honeyman or pretending
-| to be Peter Honeyman, will be grounds for disqualification of your entry.
+ | The "Peter Honeyman is exempt" guideline also applies to this rule.
+ | Identifying yourself, in an obvious way in your code, data, remarks
+ | or program output, unless you are Peter Honeyman or pretending
+ | to be Peter Honeyman, will be grounds for disqualification of your entry.
```
A number of other entries were based on [iocccsize.c](iocccsize.c), making
@@ -83,7 +83,7 @@ derivative works rather than original works.
Still other entries were too large, violating the first line of rule 2:
```
-2) The size of your program source must be <= 4096 bytes in length.
+ 2) The size of your program source must be <= 4096 bytes in length.
```
While these entries might have passed under the 2053 limit for iocccsize,
diff --git a/2015/burton/README.md b/2015/burton/README.md
index b6be022be..7e336f4d6 100644
--- a/2015/burton/README.md
+++ b/2015/burton/README.md
@@ -1,20 +1,20 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./prog "expression"
+ ./prog "expression"
```
or:
```sh
-./prog
+ ./prog
```
Type in expressions on standard input.
@@ -23,13 +23,13 @@ Type in expressions on standard input.
## Try:
```sh
-./try.sh
+ ./try.sh
```
Notice how the script reads in from a file. If you type just:
```sh
-./prog
+ ./prog
```
it will prompt you in the same way. Send ctrl-c to exit.
@@ -38,7 +38,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
+ man ./calc.1
```
@@ -52,7 +52,7 @@ author's remarks below.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -110,7 +110,7 @@ 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!
+ grep '[0-9]' prog.c || echo no digits!
```
Nor are the digits simply obfuscated. There are no character constants. There
@@ -192,8 +192,8 @@ long`. Changing the two `long long` typedefs to `long`, and compiling with `gcc
shifts mod 32:
```
-1<<48
-65536 0x00010000
+ 1<<48
+ 65536 0x00010000
```
gcc 4.2.1 without arguments compiles cleanly (e.g. `cc prog.c -o prog`).
@@ -203,7 +203,7 @@ clang 3.6.0 lives up to its namesake, resounding on non-problems.
To stifle these complaints:
```
--Wno-return-type -Wno-parentheses -Wno-empty-body
+ -Wno-return-type -Wno-parentheses -Wno-empty-body
```
When invoked with `-ansi -pedantic`, there are two warnings, which can be ignored:
@@ -223,8 +223,8 @@ 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
+ ln -sf prog eprog
+ PATH=. eprog < test.in | diff - test.out
```
### Spoilers:
diff --git a/2015/burton/index.html b/2015/burton/index.html
index db5e7bcdc..1d410a944 100644
--- a/2015/burton/index.html
+++ b/2015/burton/index.html
@@ -132,8 +132,7 @@
Author:
Name: Dave Burton
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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:
@@ -190,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,
@@ -246,13 +245,13 @@ they are to write.
Compiler warnings
calc is C99 compliant, and is ANSI/C90 compliant except for wanting 64-bit long long. Changing the two long long typedefs to long, and compiling with gcc -m32 yields a program that operates on 32-bit values, with wrap-around of
shifts mod 32:
-
1<<48
-65536 0x00010000
+
1<<48
+ 65536 0x00010000
gcc 4.2.1 without arguments compiles cleanly (e.g. cc prog.c -o prog).
This is my workaday compiler. gcc is also clean with -ansi, and -std=c99.
clang 3.6.0 lives up to its namesake, resounding on non-problems.
To stifle these complaints:
-
-Wno-return-type -Wno-parentheses -Wno-empty-body
+
-Wno-return-type -Wno-parentheses -Wno-empty-body
When invoked with -ansi -pedantic, there are two warnings, which can be ignored:
ISO C90 does not support 'long long'
@@ -266,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:
If you do not want to puzzle out how it works, see spoilers.html.
@@ -142,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.
@@ -172,12 +171,12 @@ again.
Alternate code:
The author suggested that one change q to 0x82000820000000 instead of
0x820008202625a0 to see a bug that they avoided, writing:
-
To see this bug in action change the assignment above
-to q=0x82000820000000`, and look towards the negative
-direction of the main tunnel.
+
To see this bug in action change the assignment above
+ to q=0x82000820000000`, and look towards the negative
+ 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:
@@ -247,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 bc014114c..b93c41b44 100644
--- a/2015/duble/README.md
+++ b/2015/duble/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version of this entry, discussed in the author's remarks.
@@ -11,14 +11,14 @@ See [Alternate code](#alternate-code) below.
## To use:
```sh
-echo Some text | ./prog
+ echo Some text | ./prog
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
As the script says if you want to move to the next command at any point
@@ -35,7 +35,7 @@ author in the '[prog.c](prog.c) vs [prog.alt.c](prog.alt.c)' section of their re
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -85,13 +85,13 @@ been shortened in this file.
If you have `clang`:
```sh
-CC=clang make -e
+ CC=clang make -e
```
Otherwise (gcc):
```sh
-make
+ make
```
(You will get a few warnings in this case.)
@@ -117,21 +117,21 @@ needed in this case).
#### Basic mode:
```sh
-$ echo 'I am testing this thing.' | ./prog
-[... rendering ...]
+ $ echo 'I am testing this thing.' | ./prog
+ [... rendering ...]
-$ ./prog < lorem-ipsum.txt
-[... rendering ...]
+ $ ./prog < lorem-ipsum.txt
+ [... rendering ...]
```
#### Interactive mode:
```sh
-$ ./prog
-> hello world!!!
-[... rendering ...]
->
+ $ ./prog
+ > hello world!!!
+ [... rendering ...]
+ >
```
@@ -174,7 +174,7 @@ In order to comply with the size rule, I encoded only a part of the visible ASCI
chars:
```
-a-z, A-Z, '.' ':' ',' ';' '!' and '?'.
+ a-z, A-Z, '.' ':' ',' ';' '!' and '?'.
```
Uppercase and lowercase chars are rendered the same. The program also
@@ -207,7 +207,7 @@ simple text documents.
Thus, if you try for example:
```sh
-$ ./prog < prog.c
+ $ ./prog < prog.c
```
You will not get something that looks like C code. (but you can still try, if
@@ -220,7 +220,7 @@ Defining an environment variable called `DRAFT` will enable the 'draft-mode'.
Try for example:
```sh
-$ 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.
diff --git a/2015/duble/index.html b/2015/duble/index.html
index 696dadd64..d0819b66a 100644
--- a/2015/duble/index.html
+++ b/2015/duble/index.html
@@ -132,8 +132,7 @@
Author:
Name: Etienne Duble
-Location: FR - French Republic (France)
-
@@ -142,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.
@@ -156,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:
@@ -182,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
@@ -197,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 ...]
+
$ echo 'I am testing this thing.'|./prog
+[... rendering ...]
-$ ./prog < lorem-ipsum.txt
-[... rendering ...]
@@ -239,7 +238,7 @@ encoded in macro O_o at the top of the source file.
Charset
In order to comply with the size rule, I encoded only a part of the visible ASCII
chars:
-
a-z, A-Z, '.' ':' ',' ';' '!' and '?'.
+
a-z, A-Z, '.' ':' ',' ';' '!' and '?'.
Uppercase and lowercase chars are rendered the same. The program also
understands space and linefeed (\n). Other chars are simply ignored (most of
the time ;)
@@ -256,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 6e17ff91b..2ad45556a 100644
--- a/2015/endoh1/README.md
+++ b/2015/endoh1/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
NOTE: this program requires the tool `tcpserver` to use. If you do not have this
@@ -12,7 +12,7 @@ require it](../../faq.html#tcpserver).
## To use:
```sh
-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.
@@ -45,13 +45,13 @@ 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)" \
- -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
@@ -60,7 +60,7 @@ Then, run it with the `tcpserver` command in the
[1991/brndstd](../../1991/brnstnd/index.html) "Best of Show".
```sh
-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.
@@ -81,8 +81,8 @@ form non-trivial patterns, such as spots, spiral, dappling, and labyrinths.
The systems are generally formulated as follows:
```
-du/dt = F(u, v) + Du * laplacian(u)
-dv/dt = G(u, v) + Dv * laplacian(v)
+ du/dt = F(u, v) + Du * laplacian(u)
+ dv/dt = G(u, v) + Dv * laplacian(v)
```
The functions `F(u, v)` and `G(u, v)` represent reactions of each substance, and
@@ -113,15 +113,15 @@ model](http://groups.csail.mit.edu/mac/projects/amorphous/GrayScott/) in TeX
notation.
```
-\frac{\partial u}{\partial t} = D_u \Delta u - u v^2 + F (1 - u)
-\frac{\partial v}{\partial t} = D_v \Delta v + u v^2 - v (F + K)
+ \frac{\partial u}{\partial t} = D_u \Delta u - u v^2 + F (1 - u)
+ \frac{\partial v}{\partial t} = D_v \Delta v + u v^2 - v (F + K)
```
You can specify this model as follows:
```
--Delta_u="Du*laplacian(u)-u*v*v+F*(1-u)" \
--Delta_v="Dv*laplacian(v)+u*v*v-v*(F+K)"
+ -Delta_u="Du*laplacian(u)-u*v*v+F*(1-u)" \
+ -Delta_v="Dv*laplacian(v)+u*v*v-v*(F+K)"
```
`Du`, `Dv`, `F`, and `K` are parameters of that model.
@@ -159,15 +159,15 @@ Some interesting parameters are included in `Makefile`. Do one of the following
commands and open `http://127.0.0.1:10333`.
```
-make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 ioccc.txt
-make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 center.txt
-make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 line.txt
-make gray-scott-2 && tcpserver -v 127.0.0.1 10333 ./gray-scott-2 ioccc.txt
-make gray-scott-3 && tcpserver -v 127.0.0.1 10333 ./gray-scott-3 ioccc.txt
-make gray-scott-4 && tcpserver -v 127.0.0.1 10333 ./gray-scott-4 ioccc.txt
-make fitzhugh-nagumo-1 && tcpserver -v 127.0.0.1 10333 ./fitzhugh-nagumo-1 ioccc.txt
-make fitzhugh-nagumo-2 && tcpserver -v 127.0.0.1 10333 ./fitzhugh-nagumo-2 ioccc.txt
-make oregonator && tcpserver -v 127.0.0.1 10333 ./oregonator ioccc.txt
+ make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 ioccc.txt
+ make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 center.txt
+ make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 line.txt
+ make gray-scott-2 && tcpserver -v 127.0.0.1 10333 ./gray-scott-2 ioccc.txt
+ make gray-scott-3 && tcpserver -v 127.0.0.1 10333 ./gray-scott-3 ioccc.txt
+ make gray-scott-4 && tcpserver -v 127.0.0.1 10333 ./gray-scott-4 ioccc.txt
+ make fitzhugh-nagumo-1 && tcpserver -v 127.0.0.1 10333 ./fitzhugh-nagumo-1 ioccc.txt
+ make fitzhugh-nagumo-2 && tcpserver -v 127.0.0.1 10333 ./fitzhugh-nagumo-2 ioccc.txt
+ make oregonator && tcpserver -v 127.0.0.1 10333 ./oregonator ioccc.txt
```
These examples are created by drawing (and modifying) the pattern files of
@@ -204,7 +204,7 @@ I think you may use `inetd` and `xinetd` instead of `tcpserver`. Here is an
example `inetd` configuration.
```
-10333 stream tcp nowait nobody /path/to/prog /path/to/prog /path/to/initial-pattern.txt
+ 10333 stream tcp nowait nobody /path/to/prog /path/to/prog /path/to/initial-pattern.txt
```
But note that I didn't test well.
diff --git a/2015/endoh1/index.html b/2015/endoh1/index.html
index 2df836edc..5c1933b0c 100644
--- a/2015/endoh1/index.html
+++ b/2015/endoh1/index.html
@@ -135,8 +135,7 @@
Location: JP - Japan
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.
@@ -192,8 +191,8 @@ models in which two chemical substances are transformed into each other (loc
chemical reactions) and spread out (diffusion). Their interactions sometimes
form non-trivial patterns, such as spots, spiral, dappling, and labyrinths.
The systems are generally formulated as follows:
-
du/dt = F(u, v) + Du * laplacian(u)
-dv/dt = G(u, v) + Dv * laplacian(v)
+
du/dt = F(u, v) + Du * laplacian(u)
+ dv/dt = G(u, v) + Dv * laplacian(v)
The functions F(u, v) and G(u, v) represent reactions of each substance, and
the parameters Du and Dv are diffusion coefficients. By changing the
functions and parameters, you can see a wide range of behaviors.
@@ -212,11 +211,11 @@ definition.
example, the following is the Gray-Scott
model in TeX
notation.
-
\frac{\partial u}{\partial t} = D_u \Delta u - u v^2 + F (1 - u)
-\frac{\partial v}{\partial t} = D_v \Delta v + u v^2 - v (F + K)
+
\frac{\partial u}{\partial t} = D_u \Delta u - u v^2 + F (1 - u)
+ \frac{\partial v}{\partial t} = D_v \Delta v + u v^2 - v (F + K)
make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 ioccc.txt
+ make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 center.txt
+ make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 line.txt
+ make gray-scott-2 && tcpserver -v 127.0.0.1 10333 ./gray-scott-2 ioccc.txt
+ make gray-scott-3 && tcpserver -v 127.0.0.1 10333 ./gray-scott-3 ioccc.txt
+ make gray-scott-4 && tcpserver -v 127.0.0.1 10333 ./gray-scott-4 ioccc.txt
+ make fitzhugh-nagumo-1 && tcpserver -v 127.0.0.1 10333 ./fitzhugh-nagumo-1 ioccc.txt
+ make fitzhugh-nagumo-2 && tcpserver -v 127.0.0.1 10333 ./fitzhugh-nagumo-2 ioccc.txt
+ make oregonator && tcpserver -v 127.0.0.1 10333 ./oregonator ioccc.txt
These examples are created by drawing (and modifying) the pattern files of
Ready, a cross-platform implementation of
various reaction-diffusion systems 2.
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
@@ -182,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:
You can enjoy the legendary winning entry of the first IOCCC, again.
Internal
This program uses __attribute__((constructor)), which is a GCC extension, to
@@ -218,119 +217,119 @@ destination register. Index addressing mode works well only for R7 (PC
register).
One more thing
Note: this program writes a binary file to stdout:
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:
@@ -164,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?
A good start for understanding this entry might be
rfc1321.txt. How does it compute this using only a
@@ -160,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!
There is an alternate version provided. See Alternate code
below.
To use:
-
./prog file1 file2
+
./prog file1 file2
-./prog-d 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/index.html b/2015/index.html
index 24b1d69a2..95e283ab3 100644
--- a/2015/index.html
+++ b/2015/index.html
@@ -169,18 +169,18 @@ one of the all time best IOCCC entries from 1984.
would have been much higher had some people paid attention to rules 2
and 22 (one third of 666).
Rule 22, now known as Catch 22 states:
-
| 22) Your source code, data files, remarks and program output must NOT
-| identify the authors of your code. The judges STRONGLY prefer to
-| not know who is submitting entries to the IOCCC.
+
| 22) Your source code, data files, remarks and program output must NOT
+ | identify the authors of your code. The judges STRONGLY prefer to
+ | not know who is submitting entries to the IOCCC.
-| The "Peter Honeyman is exempt" guideline also applies to this rule.
-| Identifying yourself, in an obvious way in your code, data, remarks
-| or program output, unless you are Peter Honeyman or pretending
-| to be Peter Honeyman, will be grounds for disqualification of your entry.
+ | The "Peter Honeyman is exempt" guideline also applies to this rule.
+ | Identifying yourself, in an obvious way in your code, data, remarks
+ | or program output, unless you are Peter Honeyman or pretending
+ | to be Peter Honeyman, will be grounds for disqualification of your entry.
A number of other entries were based on iocccsize.c, making
derivative works rather than original works.
Still other entries were too large, violating the first line of rule 2:
-
2) The size of your program source must be <= 4096 bytes in length.
+
2) The size of your program source must be <= 4096 bytes in length.
While these entries might have passed under the 2053 limit for iocccsize,
they were larger than <= 4096 bytes, sometimes by an order or magnitude.
We hope the authors of some of those entries will fix and re-submit
diff --git a/2015/mills1/README.md b/2015/mills1/README.md
index 993bd7410..c9bec2e96 100644
--- a/2015/mills1/README.md
+++ b/2015/mills1/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./prog
+ ./prog
```
## Try:
```sh
-./prog
+ ./prog
```
Press the up arrow and the down arrow at the right time.
@@ -28,52 +28,52 @@ Well you can adjust the Makefile parameters to make life a
bit easier for you:
```sh
-./try.sh
+ ./try.sh
```
which runs:
```sh
-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
-#
-DU=99999 # Time between steps in microseconds.
- # Make it larger if the game is too fast for you.
+ # Game parameters
+ #
+ DU=99999 # Time between steps in microseconds.
+ # Make it larger if the game is too fast for you.
-DW=28 # Pipe-to-pipe spacing, in columns.
- # Farther apart is easier.
+ DW=28 # Pipe-to-pipe spacing, in columns.
+ # Farther apart is easier.
-DD=20 # Space between pipes.
- # The difference between DD and DW is the width of a pipe.
- # Narrow pipes are easier to fly though.
+ DD=20 # Space between pipes.
+ # The difference between DD and DW is the width of a pipe.
+ # Narrow pipes are easier to fly though.
-DH=8 # Height of gap in pipe.
- # Make this larger to make the game easier.
+ DH=8 # Height of gap in pipe.
+ # Make this larger to make the game easier.
-DA=100 # Acceleration due to gravity (scaled by 256).
- # Smaller values make you glide slower.
+ DA=100 # Acceleration due to gravity (scaled by 256).
+ # Smaller values make you glide slower.
-DI=-200 # Impulse velocity of a flap (scaled by 256).
- # Make larger if you want a less intense tapping experience!
+ DI=-200 # Impulse velocity of a flap (scaled by 256).
+ # Make larger if you want a less intense tapping experience!
-DB='"Author:
Name: Christopher Mills
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,61 +141,61 @@ 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
-#
-DU=99999 # Time between steps in microseconds.
- # Make it larger if the game is too fast for you.
+
# Game parameters
+ #
+ DU=99999 # Time between steps in microseconds.
+ # Make it larger if the game is too fast for you.
-DW=28 # Pipe-to-pipe spacing, in columns.
- # Farther apart is easier.
+ DW=28 # Pipe-to-pipe spacing, in columns.
+ # Farther apart is easier.
-DD=20 # Space between pipes.
- # The difference between DD and DW is the width of a pipe.
- # Narrow pipes are easier to fly though.
+ DD=20 # Space between pipes.
+ # The difference between DD and DW is the width of a pipe.
+ # Narrow pipes are easier to fly though.
-DH=8 # Height of gap in pipe.
- # Make this larger to make the game easier.
+ DH=8 # Height of gap in pipe.
+ # Make this larger to make the game easier.
-DA=100 # Acceleration due to gravity (scaled by 256).
- # Smaller values make you glide slower.
+ DA=100 # Acceleration due to gravity (scaled by 256).
+ # Smaller values make you glide slower.
-DI=-200 # Impulse velocity of a flap (scaled by 256).
- # Make larger if you want a less intense tapping experience!
+ DI=-200 # Impulse velocity of a flap (scaled by 256).
+ # Make larger if you want a less intense tapping experience!
-DB='"<o^="' # Sprite for player when gliding.
- # HINT: Try using various emojis.
- # NOTE: The string MUST be enclosed inside double quotes.
+ DB='"<o^="' # Sprite for player when gliding.
+ # HINT: Try using various emojis.
+ # NOTE: The string MUST be enclosed inside double quotes.
-DF='"<ov="' # Sprite for player when flapping.
- # HINT: Try using various emojis.
- # NOTE: The string MUST be enclosed inside double quotes.
+ DF='"<ov="' # Sprite for player when flapping.
+ # HINT: Try using various emojis.
+ # NOTE: The string MUST be enclosed inside double quotes.
-DG='"Tap to Flap!"' # Instruction text.
- # Change to your native tongue.
- # NOTE: The string MUST be enclosed inside double quotes.
+ DG='"Tap to Flap!"' # Instruction text.
+ # Change to your native tongue.
+ # NOTE: The string MUST be enclosed inside double quotes.
WARNING: if you have good eye-hand coordination and too much time on your hands
you might fall asleep while playing as you probably will never die in this mode.
We only stopped when a reminder came through and we tried to mark it complete at
the same time as playing and we almost managed to survive that. At that point we
already scored over 90.
Enjoy!
-
TAP!! TAP!! TAP!!
-FLAP! FLAP! FLAP!
+
TAP!! TAP!! TAP!!
+ FLAP! FLAP! FLAP!
Author’s remarks:
The Program
Better late than never to jump on the bandwagon of 2014’s most successful
@@ -241,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 41330503a..eda7f95de 100644
--- a/2015/mills2/README.md
+++ b/2015/mills2/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2015 mills2 bugs](../../bugs.html#2015_mills2).
@@ -19,14 +19,14 @@ For more detailed information see [2015 mills2 bugs](../../bugs.html#2015_mills2
## To use:
```sh
-./prog compressed_file.Z
+ ./prog compressed_file.Z
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -40,7 +40,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
+ c=0) :( O
```
@@ -67,8 +67,8 @@ 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
+ ./prog ioccc_guidelines.txt.Z
+ ./prog ioccc_rules.txt.Z
```
### The Details
diff --git a/2015/mills2/index.html b/2015/mills2/index.html
index eef3ba2c8..f9f814716 100644
--- a/2015/mills2/index.html
+++ b/2015/mills2/index.html
@@ -132,8 +132,7 @@
Author:
Name: Christopher Mills
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,22 +141,22 @@ Location: US - United States of America
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
@@ -175,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
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 e9cdcf229..2a3a97bf0 100644
--- a/2015/muth/README.md
+++ b/2015/muth/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ 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
+ 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
+ ./try.sh
```
@@ -69,13 +69,13 @@ files for examples.
Every symbol used (except `_`) must be explicitly declared using
```c
-#define sym_SYMBOL(sym, _SYMBOL) sym
+ #define sym_SYMBOL(sym, _SYMBOL) sym
```
Example:
```c
-#define sym_1(sym, _1) sym
+ #define sym_1(sym, _1) sym
```
@@ -85,7 +85,7 @@ 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..., (,))))
+ #define tape ((((,),...l2), l1), c, (r1, (r2..., (,))))
```
- `l1`, `l2`, ... are the symbols to the left
@@ -101,7 +101,7 @@ underscore symbols (`_`). They are expanded on demand.
All transitions are defined in the machine header using the syntax
```
-#define CURRENT_SCANNED (WRITE, MOVEMENT, NEXT)
+ #define CURRENT_SCANNED (WRITE, MOVEMENT, NEXT)
```
where
@@ -120,7 +120,7 @@ machine.
To halt the machine, use the keyword `break` as in
```c
-#define A_1 (2, break)
+ #define A_1 (2, break)
```
@@ -142,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
@@ -180,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:
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:
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!
@@ -227,45 +226,45 @@ you eventually reach 1.
Continuing past one leads to the cycle 1, 4, 2, 1, 4, 2, 1, …
Interesting factoid: if you allow negative start values, there are
a few more cycles, each of different length:
The program computes the sequence for a given positive natural number
and stops at 1. The number n is specified in hexadecimal (without 0x
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):
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:
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:
@@ -350,10 +349,10 @@ acid
):
My own research results complete this list (not yet in Wikipedia due to
the rule “No original
research”):
-
and Androgynine
-xor Xenoricine
-not Notanamine
-tla Triletramine
+
and Androgynine
+ xor Xenoricine
+ not Notanamine
+ tla Triletramine
Interestingly, the TLI are the perfect mnemonics for C language source.
For example, met is “main()'s Exit Type” (int), ala is “A Large Algebraic” (bignum), ile an “Incremented Local Entity” (index
counter), gly means “Grow Larger memorY”, gln is “Grown Larger Now”
@@ -374,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
@@ -416,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:
-
typedefstruct{
-size_t places;/* number of places in base 2 to the power of (8*sizeof(type)) */
- type *number;/* dynamically allocated memory for number */
-} bignum
+
typedefstruct{
+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!
@@ -453,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
@@ -476,51 +475,51 @@ 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
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)inC/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)inC/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
bounds and memory leaks. Since the program frees all memory in all possible
execution paths, even when it must bail out, valgrind should be happy. An early
version of my program however reported this:
-
valgrind --leak-check=full --show-leak-kinds=all ./prog 6
-[...]
-==14615== HEAP SUMMARY:
-==14615== in use at exit: 4,096 bytes in 1 blocks
-==14615== total heap usage: 4 allocs, 3 frees, 4,108 bytes allocated
-==14615==
-==14615== 4,096 bytes in 1 blocks are still reachable in loss record 1 of 1
-==14615== at 0x4C236C0: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck-amd64-freebsd.so)
-==14615== by 0x4F62175: ??? (in /lib/libc.so.7)
-==14615== by 0x4F62073: ??? (in /lib/libc.so.7)
-==14615== by 0x4F514EE: ??? (in /lib/libc.so.7)
-==14615== by 0x4F51265: vfprintf_l (in /lib/libc.so.7)
-==14615== by 0x4F3E001: printf (in /lib/libc.so.7)
-==14615== by 0x40101E: phe (in ./prog)
-==14615== by 0x400A9F: main (in ./prog)
-==14615==
-==14615== LEAK SUMMARY:
-==14615== definitely lost: 0 bytes in 0 blocks
-==14615== indirectly lost: 0 bytes in 0 blocks
-==14615== possibly lost: 0 bytes in 0 blocks
-==14615== still reachable: 4,096 bytes in 1 blocks
-==14615== suppressed: 0 bytes in 0 blocks
-==14615==
-==14615== For counts of detected and suppressed errors, rerun with: -v
-==14615== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+
valgrind --leak-check=full --show-leak-kinds=all ./prog 6
+ [...]
+ ==14615== HEAP SUMMARY:
+ ==14615== in use at exit: 4,096 bytes in 1 blocks
+ ==14615== total heap usage: 4 allocs, 3 frees, 4,108 bytes allocated
+ ==14615==
+ ==14615== 4,096 bytes in 1 blocks are still reachable in loss record 1 of 1
+ ==14615== at 0x4C236C0: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck-amd64-freebsd.so)
+ ==14615== by 0x4F62175: ??? (in /lib/libc.so.7)
+ ==14615== by 0x4F62073: ??? (in /lib/libc.so.7)
+ ==14615== by 0x4F514EE: ??? (in /lib/libc.so.7)
+ ==14615== by 0x4F51265: vfprintf_l (in /lib/libc.so.7)
+ ==14615== by 0x4F3E001: printf (in /lib/libc.so.7)
+ ==14615== by 0x40101E: phe (in ./prog)
+ ==14615== by 0x400A9F: main (in ./prog)
+ ==14615==
+ ==14615== LEAK SUMMARY:
+ ==14615== definitely lost: 0 bytes in 0 blocks
+ ==14615== indirectly lost: 0 bytes in 0 blocks
+ ==14615== possibly lost: 0 bytes in 0 blocks
+ ==14615== still reachable: 4,096 bytes in 1 blocks
+ ==14615== suppressed: 0 bytes in 0 blocks
+ ==14615==
+ ==14615== For counts of detected and suppressed errors, rerun with: -v
+ ==14615== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
From which I concluded that printf(3) allocated a single 4K block for
which no matching free(3) existed. But how to free memory allocated deep
down in the guts of the Standard I/O library? After some serious head
@@ -533,30 +532,30 @@ and any buffer set by the setbuf or setvbuf function i
(and deallocated if it was automatically allocated).
So I fclose(stdout) before returning and now:
-
valgrind --leak-check=full --show-leak-kinds=all ./prog 6
-==14571== Memcheck, a memory error detector
-==14571== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
-==14571== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
-==14571== Command: ./prog 6
-==14571==
-0000000000000006
-0000000000000003 1
-000000000000000A 2
-0000000000000005 3
-0000000000000010 4
-0000000000000008 5
-0000000000000004 6
-0000000000000002 7
-0000000000000001 8
-==14571==
-==14571== HEAP SUMMARY:
-==14571== in use at exit: 0 bytes in 0 blocks
-==14571== total heap usage: 4 allocs, 4 frees, 4,120 bytes allocated
-==14571==
-==14571== All heap blocks were freed -- no leaks are possible
-==14571==
-==14571== For counts of detected and suppressed errors, rerun with: -v
-==14571== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+
valgrind --leak-check=full --show-leak-kinds=all ./prog 6
+ ==14571== Memcheck, a memory error detector
+ ==14571== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
+ ==14571== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
+ ==14571== Command: ./prog 6
+ ==14571==
+ 0000000000000006
+ 0000000000000003 1
+ 000000000000000A 2
+ 0000000000000005 3
+ 0000000000000010 4
+ 0000000000000008 5
+ 0000000000000004 6
+ 0000000000000002 7
+ 0000000000000001 8
+ ==14571==
+ ==14571== HEAP SUMMARY:
+ ==14571== in use at exit: 0 bytes in 0 blocks
+ ==14571== total heap usage: 4 allocs, 4 frees, 4,120 bytes allocated
+ ==14571==
+ ==14571== All heap blocks were freed -- no leaks are possible
+ ==14571==
+ ==14571== For counts of detected and suppressed errors, rerun with: -v
+ ==14571== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
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
@@ -692,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.
@@ -704,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,
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,
-
staticvoid phe(const ala not);
-staticvoid gly(ala *const not,const and his);
-met main(met val,const pro *const his[]);
+
staticvoid phe(const ala not);
+staticvoid 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
@@ -727,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
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 3669de38a..9116877a7 100644
--- a/2015/yang/README.md
+++ b/2015/yang/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-echo Some text | ./prog
+ echo Some text | ./prog
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -38,24 +38,24 @@ so you need not worry about this.
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
+ 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.
```sh
-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](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
+ g++ -O3 -std=c++98 fuuko.c -lm -o fuuko_cpp98
+ echo IOCCC | ./fuuko_cpp98 > output_cpp98.c
```
Don't like [dango](https://en.wikipedia.org/wiki/Dango) either? Use a C++11
@@ -64,16 +64,16 @@ 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
+ 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.
```sh
-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
diff --git a/2015/yang/index.html b/2015/yang/index.html
index 37dde2615..567b9d1b1 100644
--- a/2015/yang/index.html
+++ b/2015/yang/index.html
@@ -132,8 +132,7 @@
Author:
Name: Don Yang
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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?
@@ -158,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.
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/README.md b/2018/README.md
index bfe99ae13..74cb7f74b 100644
--- a/2018/README.md
+++ b/2018/README.md
@@ -64,14 +64,14 @@ and 22 (one third of 666).
Rule 22, now known as "Catch 22" states:
```
-| 22) Your source code, data files, remarks and program output must NOT
-| identify the authors of your code. The judges STRONGLY prefer to
-| not know who is submitting entries to the IOCCC.
+ | 22) Your source code, data files, remarks and program output must NOT
+ | identify the authors of your code. The judges STRONGLY prefer to
+ | not know who is submitting entries to the IOCCC.
-| The "Peter Honeyman is exempt" guideline also applies to this rule.
-| Identifying yourself, in an obvious way in your code, data, remarks
-| or program output, unless you are Peter Honeyman or pretending
-| to be Peter Honeyman, will be grounds for disqualification of your entry.
+ | The "Peter Honeyman is exempt" guideline also applies to this rule.
+ | Identifying yourself, in an obvious way in your code, data, remarks
+ | or program output, unless you are Peter Honeyman or pretending
+ | to be Peter Honeyman, will be grounds for disqualification of your entry.
```
A number of other entries were based on [iocccsize.c](iocccsize.c), making
diff --git a/2018/algmyr/README.md b/2018/algmyr/README.md
index 0e4dbe80e..f97116b54 100644
--- a/2018/algmyr/README.md
+++ b/2018/algmyr/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
To use this entry requires, in some invocations, a sound processing program.
@@ -14,7 +14,7 @@ compile and use an IOCCC entry that requires sound?](../../faq.html#sox).
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2018 algmyr bugs](../../bugs.html#2018_algmyr).
@@ -23,16 +23,16 @@ 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
+ ./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
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -165,13 +165,13 @@ standards compliant). This is used to print the usage instructions.
Compiling using
```sh
-gcc -Wall -Wextra -pedantic
+ gcc -Wall -Wextra -pedantic
```
gives only `-Wmisleading-indentation` which is sensible considering the source code. While
```sh
-clang -Wall -Wextra -pedantic
+ clang -Wall -Wextra -pedantic
```
is a bit more pessimistic and gives `-Wempty-body` (I like loops without
@@ -180,7 +180,7 @@ 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
+ clang -Wall -Wextra -pedantic -Weverything
```
produces a few page faults of warnings and makes me feel generally bad about
diff --git a/2018/algmyr/index.html b/2018/algmyr/index.html
index db568f6bc..d9736f462 100644
--- a/2018/algmyr/index.html
+++ b/2018/algmyr/index.html
@@ -132,8 +132,7 @@
Author:
Name: Anton Älgmyr
-Location: SE - Kingdom of Sweden (Sweden)
-
./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.
@@ -243,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 a736cd2e3..e95cef1d8 100644
--- a/2018/anderson/README.md
+++ b/2018/anderson/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version of this entry. See [Alternate
@@ -11,14 +11,14 @@ code](#alternate-code) below for more details.
## To use:
```sh
-./prog < textfile
+ ./prog < textfile
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -32,7 +32,7 @@ it was not the shape of the Roman V that we, or the compiler, didn't like.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -44,7 +44,7 @@ Use `prog.alt` as you would `prog` above.
### Alternate try:
```sh
-./try.alt.sh
+ ./try.alt.sh
```
@@ -59,7 +59,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
+ 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
diff --git a/2018/anderson/index.html b/2018/anderson/index.html
index 52b04db8d..e26fc1522 100644
--- a/2018/anderson/index.html
+++ b/2018/anderson/index.html
@@ -132,8 +132,7 @@
Author:
Name: Derek Anderson
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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!
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 bbf8d0359..429e5f379 100644
--- a/2018/bellard/README.md
+++ b/2018/bellard/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version that should work with Windows. See [Alternate
@@ -11,7 +11,7 @@ code](#alternate-code) below.
## To use:
```sh
-./prog > lena.ppm
+ ./prog > lena.ppm
```
@@ -22,7 +22,7 @@ running the above command (`./prog > lena.ppm`), open `lena.ppm` in your
graphics viewer of choice. After that try:
```sh
-./try.sh
+ ./try.sh
```
NOTE: the script uses the tools `pngtopam(1)` (or `pngtopnm(1)` for older
@@ -45,7 +45,7 @@ for Windows.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -100,9 +100,9 @@ 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
+ ./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][1] and [vintage cars][2] come from
diff --git a/2018/bellard/index.html b/2018/bellard/index.html
index f82b81910..4faf34ef3 100644
--- a/2018/bellard/index.html
+++ b/2018/bellard/index.html
@@ -132,8 +132,7 @@
@@ -142,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
@@ -164,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:
@@ -201,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 122371d24..c98896bb8 100644
--- a/2018/burton1/README.md
+++ b/2018/burton1/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version of this entry. See [Alternate
@@ -11,14 +11,14 @@ code](#alternate-code) below.
## To use:
```sh
-./prog < any-file
+ ./prog < any-file
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -33,7 +33,7 @@ with `-Wno-` options.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -83,7 +83,7 @@ E.g:
```c
-main(){system("hd");} // it's turtles all the way down!
+ main(){system("hd");} // it's turtles all the way down!
```
is not acceptable.
@@ -97,15 +97,15 @@ 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);
-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!)
@@ -116,22 +116,22 @@ 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
-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.
@@ -140,16 +140,16 @@ They are derived from the solutions above, but are still fascinating as concise
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
-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>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.
@@ -157,13 +157,13 @@ This was not reported above since the newline kept getting appended by processin
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
-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:
@@ -258,13 +258,13 @@ the expression within the ternary remains too complex.
Try:
```sh
-cat prog.c prog.alt.c
+ cat prog.c prog.alt.c
```
or
```sh
-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).
diff --git a/2018/burton1/index.html b/2018/burton1/index.html
index 9f81f6f54..f977f41c1 100644
--- a/2018/burton1/index.html
+++ b/2018/burton1/index.html
@@ -132,8 +132,7 @@
Author:
Name: Dave Burton
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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:
@@ -188,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:
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.
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:
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:
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
@@ -322,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).
@@ -142,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!
@@ -229,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.
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
@@ -274,25 +273,25 @@ 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
-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
keyword distribution over time. The top five for the decades:
-
1980s 1990s 2000s 2010s
------ ----- ----- -----
-94 if 532 char 375 if 254 int
-69 for 524 if 372 char 217 for
-59 while 417 int 332 int 198 if
-48 char 223 for 184 for 121 return
-43 int 223 void 165 return 104 char
+
1980s 1990s 2000s 2010s
+ ----- ----- ----- -----
+ 94 if 532 char 375 if 254 int
+ 69 for 524 if 372 char 217 for
+ 59 while 417 int 332 int 198 if
+ 48 char 223 for 184 for 121 return
+ 43 int 223 void 165 return 104 char
The keyword list is external to the program, and is easily changed, sorted, checked, verified.
This allows such additional programs in concert with the tool’s primary operation.
A poor-man’s de-obfuscator can be based upon the output of tac -t and a
@@ -300,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:
@@ -402,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, …):
-
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,
@@ -430,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.
Cody Boone Ferguson was relentless in his pursuit of bugs.
Thanks to his reports, the version of unob.sh is stronger,
@@ -443,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).
diff --git a/2018/endoh1/README.md b/2018/endoh1/README.md
index 6e1710e5d..e3d54e5fd 100644
--- a/2018/endoh1/README.md
+++ b/2018/endoh1/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./prog < textfile > output.gif
+ ./prog < textfile > output.gif
```
@@ -17,7 +17,7 @@ make
To see the input files and feed them to the program, redirecting to GIF files:
```sh
-./try.sh
+ ./try.sh
```
@@ -41,8 +41,8 @@ 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
+ 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
@@ -52,14 +52,14 @@ letters that leave the mark and ones that do not?
Other examples:
```sh
-./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.
```sh
-./prog < prog.c > prog.gif
+ ./prog < prog.c > prog.gif
```
@@ -142,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.
@@ -159,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:
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?
@@ -142,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
+
./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 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
+# 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.
@@ -168,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
+
./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 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
+# 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.
@@ -204,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:
Preface
@@ -229,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
@@ -440,13 +439,15 @@ an option I’ve mentioned and the other one is to do with the number of
offspring)! If you want something of a walk through I suggest you follow the
following:
-
Enable quiet mode and set an invalid mutation range; for example specify:
-
-qr101
-
Take a look at the first few lines. Kill the program and try invoking it
-with the following options:
-
-qr5
-
-
+
Enable quiet mode and set an invalid mutation range; for example specify:
+
+
-qr101
+
+
Take a look at the first few lines. Kill the program and try invoking it
+with the following options:
+
+
-qr5
+
Look at the first few lines again and compare it to the output of step #1.
With the default string most modern systems shouldn’t take much time to - given
decent parameters - come to an answer here but if necessary kill the program.
@@ -460,27 +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"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
-
-It will search for MONKEY in both cases; in other words it’s the last one.
+
./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:
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
@@ -489,9 +489,8 @@ examples of the last set of three above are equivalent i.e. the following two
are equivalent:
-q-\
-q --
-
-As for the caveat I referenced what does the following do?
-
./weasel-qr 5
+
As for the caveat I referenced what does the following do?
+
./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
@@ -499,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
@@ -537,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:
-q
@@ -576,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
@@ -677,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
@@ -690,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:
@@ -714,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 '!!
-> '
+
$ ./weasel '!!
+ > '
-'
-' not in keyboard " !"#$<%:>&'()*+,-./0123456789;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~"
+'
+ ' 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
@@ -738,9 +737,9 @@ rather confusing and hard to read.
as well as some C keywords.
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
@@ -814,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
@@ -822,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
@@ -832,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:
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:
This entry requires at least C99 even if you translate digraphs. The program
@@ -858,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
Any undocumented bugs are the result of insolent monkeys tampering with any
@@ -1013,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:
“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
@@ -1055,10 +1054,9 @@ 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:
-
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
for the contest but decided for the message by itself in the end). I would
diff --git a/2018/giles/README.md b/2018/giles/README.md
index 8ed725f0c..4d6887630 100644
--- a/2018/giles/README.md
+++ b/2018/giles/README.md
@@ -5,27 +5,27 @@ IOCCC entry that requires SDL1 or SDL2?](../../faq.html#SDL) if you don't have i
installed and don't know how to do so.
```sh
-make
+ make
```
## To use:
```sh
-./prog
+ ./prog
```
## Try:
```sh
-./prog ioccc.txt
+ ./prog ioccc.txt
-./prog prog.c
+ ./prog prog.c
-./prog sand.txt
+ ./prog sand.txt
-./prog sand.alt.txt
+ ./prog sand.alt.txt
```
NOTE: these invocations will take quite some time to finish.
diff --git a/2018/giles/index.html b/2018/giles/index.html
index 42509d773..cf82e435c 100644
--- a/2018/giles/index.html
+++ b/2018/giles/index.html
@@ -132,8 +132,7 @@
Author:
Name: Edward Giles
-Location: AU - Commonwealth of Australia (Australia)
-
+Location: AU - Commonwealth of Australia (Australia)
@@ -145,17 +144,17 @@ Location: AU - Commonwealth of Australi
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 6bfcd14e8..08004924f 100644
--- a/2018/hou/README.md
+++ b/2018/hou/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2018 hou bugs](../../bugs.html#2018_hou).
@@ -19,7 +19,7 @@ For more detailed information see [2018 hou bugs](../../bugs.html#2018_hou).
## To use:
```sh
-./prog < input.json > output.html
+ ./prog < input.json > output.html
```
View `output.html` in a browser.
@@ -28,7 +28,7 @@ View `output.html` in a browser.
## Try:
```sh
-./try.sh
+ ./try.sh
```
The script will generate a JSON file called `ioccc.json`, showing it via
diff --git a/2018/hou/index.html b/2018/hou/index.html
index fa0e059ef..fe7d571de 100644
--- a/2018/hou/index.html
+++ b/2018/hou/index.html
@@ -132,8 +132,7 @@
Author:
Name: Qiming HOU
-Location: CN - People’s Republic of China (China)
-
+Location: CN - People’s Republic of China (China)
@@ -142,16 +141,16 @@ Location: CN - People’s Republic of C
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/index.html b/2018/index.html
index 4ffc4a75b..a9fc5ab59 100644
--- a/2018/index.html
+++ b/2018/index.html
@@ -166,14 +166,14 @@ It is something completely different.
would have been much higher had some people paid attention to rules 2
and 22 (one third of 666).
Rule 22, now known as “Catch 22” states:
-
| 22) Your source code, data files, remarks and program output must NOT
-| identify the authors of your code. The judges STRONGLY prefer to
-| not know who is submitting entries to the IOCCC.
+
| 22) Your source code, data files, remarks and program output must NOT
+ | identify the authors of your code. The judges STRONGLY prefer to
+ | not know who is submitting entries to the IOCCC.
-| The "Peter Honeyman is exempt" guideline also applies to this rule.
-| Identifying yourself, in an obvious way in your code, data, remarks
-| or program output, unless you are Peter Honeyman or pretending
-| to be Peter Honeyman, will be grounds for disqualification of your entry.
+ | The "Peter Honeyman is exempt" guideline also applies to this rule.
+ | Identifying yourself, in an obvious way in your code, data, remarks
+ | or program output, unless you are Peter Honeyman or pretending
+ | to be Peter Honeyman, will be grounds for disqualification of your entry.
A number of other entries were based on iocccsize.c, making
derivative works rather than original works.
Still other entries were too large, violating the first line of rule 2:
diff --git a/2018/mills/README.md b/2018/mills/README.md
index 04cb65e24..5d630e036 100644
--- a/2018/mills/README.md
+++ b/2018/mills/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
If you wish to save state so that you can run the program and keep files changed
@@ -9,7 +9,7 @@ If you wish to save state so that you can run the program and keep files changed
like:
```sh
-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
@@ -22,8 +22,8 @@ will be corrupt if it does.
The current status of this entry is:
```
-STATUS: known bug - please help us fix
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: known bug - please help us fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2018 mills bugs](../../bugs.html#2018_mills).
@@ -32,14 +32,14 @@ For more detailed information see [2018 mills bugs](../../bugs.html#2018_mills).
## To use:
```sh
-./prog
+ ./prog
```
## Try:
```sh
-./prog
+ ./prog
```
At the `>boot` prompt, type return.
@@ -48,11 +48,11 @@ 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
-cc prog.c
-a.out
+ cat > prog.c
+ main(){ printf("Hello, world!\n"); }
+ ^D
+ cc prog.c
+ a.out
```
where `^D` is EOF.
@@ -60,8 +60,8 @@ where `^D` is EOF.
Next try:
```sh
-cc mullender.c
-a.out
+ cc mullender.c
+ a.out
```
... and enjoy the classic [1984/mullender](../../1984/mullender/index.html) entry as
@@ -82,7 +82,7 @@ This program can take you back to the start of everything, it is possible to
run v0. Just type:
```sh
-./v0
+ ./v0
```
NOTE: To quit v0, press Control-E.
@@ -92,7 +92,7 @@ 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 .
+ @ ln dd dmr .
```
An `ls` will reveal that C hasn't been invented yet! IOBCC anyone? The
@@ -103,7 +103,7 @@ 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
+ ./prog
```
At the `>boot` prompt, type return.
@@ -119,7 +119,7 @@ shown earlier.
But wait, there is even more! Try:
```sh
-./v6
+ ./v6
```
At the `@` prompt, type `rkunix`. You might want to type `stty -lcase` as
@@ -160,15 +160,15 @@ To run BSD 2.9, do `make` to build `prog` and then `./prog` to run it.
You should see a prompt from the first-stage bootloader that looks like
```
->boot
+ >boot
```
Hit enter/return at this point and you will get to the second-stage boot loader
that looks like
```
-40Boot
-:
+ 40Boot
+ :
```
The 40 in the prompt indicates that the bootloader has correctly determined
@@ -179,32 +179,32 @@ the system to look at the first partition on the first `RK05` fixed disk, find
the `rkunix` file and load it. You should eventually see the following:
```
->boot
+ >boot
-40Boot
-: rk(0,0)rkunix
+ 40Boot
+ : rk(0,0)rkunix
-Berkeley UNIX (Rev. 2.9.1) Sun Nov 20 14:55:50 PST 1983
-mem = 135872
+ Berkeley UNIX (Rev. 2.9.1) Sun Nov 20 14:55:50 PST 1983
+ mem = 135872
-CONFIGURE SYSTEM:
-xp ? csr 176700 vector 254 skipped: No CSR
-rk 0 csr 177400 vector 220 attached
-hk ? csr 177440 vector 210 skipped: No CSR
-rl ? csr 174400 vector 160 skipped: No CSR
-rp ? csr 176700 vector 254 skipped: No CSR
-ht 0 csr 172440 vector 224 skipped: No CSR
-tm 0 csr 172520 vector 224 skipped: No CSR
-ts 0 csr 172520 vector 224 skipped: No CSR
-dh ? csr 160020 vector 370 skipped: No CSR
-dm ? csr 170500 vector 360 skipped: No autoconfig routines
-dz ? csr 160110 vector 320 skipped: No CSR
-dz ? csr 160110 vector 320 skipped: No CSR
-dn 0 csr 175200 vector 300 skipped: No autoconfig routines
-vp ? csr 177500 vector 174 skipped: No autoconfig routines
-lp ? csr 177514 vector 200 skipped: No CSR
-Erase=^?, kill=^U, intr=^C
-#
+ CONFIGURE SYSTEM:
+ xp ? csr 176700 vector 254 skipped: No CSR
+ rk 0 csr 177400 vector 220 attached
+ hk ? csr 177440 vector 210 skipped: No CSR
+ rl ? csr 174400 vector 160 skipped: No CSR
+ rp ? csr 176700 vector 254 skipped: No CSR
+ ht 0 csr 172440 vector 224 skipped: No CSR
+ tm 0 csr 172520 vector 224 skipped: No CSR
+ ts 0 csr 172520 vector 224 skipped: No CSR
+ dh ? csr 160020 vector 370 skipped: No CSR
+ dm ? csr 170500 vector 360 skipped: No autoconfig routines
+ dz ? csr 160110 vector 320 skipped: No CSR
+ dz ? csr 160110 vector 320 skipped: No CSR
+ dn 0 csr 175200 vector 300 skipped: No autoconfig routines
+ vp ? csr 177500 vector 174 skipped: No autoconfig routines
+ lp ? csr 177514 vector 200 skipped: No CSR
+ Erase=^?, kill=^U, intr=^C
+ #
```
Congratulations, you are running BSD UNIX 2.9 in single-user mode as root.
@@ -221,15 +221,15 @@ Let's try some:
```sh
-# 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
@@ -262,21 +262,21 @@ disk image. Type `make v6` to build it, then type `./prog` to run it.
You should see the boot loader prompt which is a single `@`:
```
-@
+ @
```
At this point, you again must type a special incantation: `rkunix`. After that
you should see:
```
-@rkunix
-mem = 1035
-RESTRICTED RIGHTS
+ @rkunix
+ mem = 1035
+ RESTRICTED RIGHTS
-Use, duplication or disclosure is subject to
-restrictions stated in Contract with Western
-Electric Company, Inc.
-#
+ Use, duplication or disclosure is subject to
+ restrictions stated in Contract with Western
+ Electric Company, Inc.
+ #
```
You are now running a single-user session of v6 UNIX. You might want to start
@@ -288,35 +288,35 @@ may need to use Control-E to quit the emulation.
Assuming you're more careful than that, we can try a few commands:
```
-@rkunix
-mem = 1035
-RESTRICTED RIGHTS
+ @rkunix
+ mem = 1035
+ RESTRICTED RIGHTS
-Use, duplication or disclosure is subject to
-restrictions stated in Contract with Western
-Electric Company, Inc.
-# STTY -LCASE
-# ls
-bin
-dev
-etc
-hpunix
-lib
-mnt
-rkunix
-rpunix
-tmp
-unix
-usr
-# cat > foo.c
-main()
-{
- printf("Hello, World!\n");
-}
-^D
-# cc foo.c
-# ./a.out
-Hello, World!
+ Use, duplication or disclosure is subject to
+ restrictions stated in Contract with Western
+ Electric Company, Inc.
+ # STTY -LCASE
+ # ls
+ bin
+ dev
+ etc
+ hpunix
+ lib
+ mnt
+ rkunix
+ rpunix
+ tmp
+ unix
+ usr
+ # cat > foo.c
+ main()
+ {
+ printf("Hello, World!\n");
+ }
+ ^D
+ # cc foo.c
+ # ./a.out
+ Hello, World!
```
Why is Version 6 interesting? Well, it was the oldest version that I could
@@ -371,17 +371,17 @@ native PDP-7 emulation, it gets its own binary. Type `./v0` to run it. You
should see the login prompt.
```
-login:
+ login:
```
There are two user accounts `ken` and `dmr`, with the passwords `ken` and `dmr`
respectively. Let's try the Dennis Richie's `dmr` account:
```
-login: dmr
-password: dmr
-@ ls
-. ?
+ login: dmr
+ password: dmr
+ @ ls
+ . ?
```
Even though this is not Ken's doing, I feel this gives me licence to
@@ -408,56 +408,56 @@ of the user home directories (this will eventually become `/`, the root
path). We can do
```
-@ ln dd dmr .
-```
+ @ ln dd dmr .
+ ```
-To make the new link (note that `ln` doesn't support paths either, so you have
+ To make the new link (note that `ln` doesn't support paths either, so you have
to give it three arguments -- a directory in the current dir, a file in that
directory, and the new name).
Now `ls` will work, and we can try some other things while we are here:
```
-login: dmr
-password: dmr
-@ ln dd dmr .
-@ ls
-dd
-system
-as.s
-b_readme
-bi.s
-bl.s
-db.s
-hello.b
-ops.s
-.
-@ cat b_readme
-Here is how to compile and run hello.b:
+ login: dmr
+ password: dmr
+ @ ln dd dmr .
+ @ ls
+ dd
+ system
+ as.s
+ b_readme
+ bi.s
+ bl.s
+ db.s
+ hello.b
+ ops.s
+ .
+ @ cat b_readme
+ Here is how to compile and run hello.b:
-@ bc hello.b hello.s
-@ as ops.s bl.s hello.s bi.s
-I
-II
-ops.s
-bl.s
-hello.s
-bi.s
-@ a.out
-Hello, World!
+ @ bc hello.b hello.s
+ @ as ops.s bl.s hello.s bi.s
+ I
+ II
+ ops.s
+ bl.s
+ hello.s
+ bi.s
+ @ a.out
+ Hello, World!
-@ bc hello.b hello.s
-@ as ops.s bl.s hello.s bi.s
-I
-II
-ops.s
-bl.s
-hello.s
-bi.s
-@ a.out
-Hello, World!
-@
+ @ bc hello.b hello.s
+ @ as ops.s bl.s hello.s bi.s
+ I
+ II
+ ops.s
+ bl.s
+ hello.s
+ bi.s
+ @ a.out
+ Hello, World!
+ @
```
The last command is invoking the compiler for an extremely early version of
diff --git a/2018/mills/index.html b/2018/mills/index.html
index 0c81725fe..bed5d3d5a 100644
--- a/2018/mills/index.html
+++ b/2018/mills/index.html
@@ -132,8 +132,7 @@
Author:
Name: Christopher Mills
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,35 +141,35 @@ 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.
Bugs and (Mis)features:
The current status of this entry is:
-
STATUS: known bug - please help us fix
-STATUS: INABIAF - please **DO NOT** fix
+
STATUS: known bug - please help us fix
+ STATUS: INABIAF - please **DO NOT** fix
… 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.
@@ -181,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.
@@ -200,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.
@@ -225,42 +224,42 @@ can build versions that can run each of the following:
Building and Running BSD 2.9:
To run BSD 2.9, do make to build prog and then ./prog to run it.
You should see a prompt from the first-stage bootloader that looks like
-
>boot
+
>boot
Hit enter/return at this point and you will get to the second-stage boot loader
that looks like
-
40Boot
-:
+
40Boot
+ :
The 40 in the prompt indicates that the bootloader has correctly determined
that we are running on a PDP-11/40.
At this point, type the rather cryptic command rk(0,0)rkunix – this tells
the system to look at the first partition on the first RK05 fixed disk, find
the rkunix file and load it. You should eventually see the following:
-
>boot
+
>boot
-40Boot
-: rk(0,0)rkunix
+ 40Boot
+ : rk(0,0)rkunix
-Berkeley UNIX (Rev. 2.9.1) Sun Nov 20 14:55:50 PST 1983
-mem = 135872
+ Berkeley UNIX (Rev. 2.9.1) Sun Nov 20 14:55:50 PST 1983
+ mem = 135872
-CONFIGURE SYSTEM:
-xp ? csr 176700 vector 254 skipped: No CSR
-rk 0 csr 177400 vector 220 attached
-hk ? csr 177440 vector 210 skipped: No CSR
-rl ? csr 174400 vector 160 skipped: No CSR
-rp ? csr 176700 vector 254 skipped: No CSR
-ht 0 csr 172440 vector 224 skipped: No CSR
-tm 0 csr 172520 vector 224 skipped: No CSR
-ts 0 csr 172520 vector 224 skipped: No CSR
-dh ? csr 160020 vector 370 skipped: No CSR
-dm ? csr 170500 vector 360 skipped: No autoconfig routines
-dz ? csr 160110 vector 320 skipped: No CSR
-dz ? csr 160110 vector 320 skipped: No CSR
-dn 0 csr 175200 vector 300 skipped: No autoconfig routines
-vp ? csr 177500 vector 174 skipped: No autoconfig routines
-lp ? csr 177514 vector 200 skipped: No CSR
-Erase=^?, kill=^U, intr=^C
-#
+ CONFIGURE SYSTEM:
+ xp ? csr 176700 vector 254 skipped: No CSR
+ rk 0 csr 177400 vector 220 attached
+ hk ? csr 177440 vector 210 skipped: No CSR
+ rl ? csr 174400 vector 160 skipped: No CSR
+ rp ? csr 176700 vector 254 skipped: No CSR
+ ht 0 csr 172440 vector 224 skipped: No CSR
+ tm 0 csr 172520 vector 224 skipped: No CSR
+ ts 0 csr 172520 vector 224 skipped: No CSR
+ dh ? csr 160020 vector 370 skipped: No CSR
+ dm ? csr 170500 vector 360 skipped: No autoconfig routines
+ dz ? csr 160110 vector 320 skipped: No CSR
+ dz ? csr 160110 vector 320 skipped: No CSR
+ dn 0 csr 175200 vector 300 skipped: No autoconfig routines
+ vp ? csr 177500 vector 174 skipped: No autoconfig routines
+ lp ? csr 177514 vector 200 skipped: No CSR
+ Erase=^?, kill=^U, intr=^C
+ #
Congratulations, you are running BSD UNIX 2.9 in single-user mode as root.
On the other hand, if you did a typo somewhere, the boot loader has probably
crashed and halted – if so, type Control-E to quit the emulator and try
@@ -270,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.
@@ -300,51 +299,51 @@ possible, but I didn’t get around to it… As the Judges can no doubt attest,
Research UNIX v6 and BSD 2.9 use the same executable, but require a different
disk image. Type make v6 to build it, then type ./prog to run it.
You should see the boot loader prompt which is a single @:
-
@
+
@
At this point, you again must type a special incantation: rkunix. After that
you should see:
-
@rkunix
-mem = 1035
-RESTRICTED RIGHTS
+
@rkunix
+ mem = 1035
+ RESTRICTED RIGHTS
-Use, duplication or disclosure is subject to
-restrictions stated in Contract with Western
-Electric Company, Inc.
-#
+ Use, duplication or disclosure is subject to
+ restrictions stated in Contract with Western
+ Electric Company, Inc.
+ #
You are now running a single-user session of v6 UNIX. You might want to start
with stty -lcase because otherwise everything will be IN ALL CAPS.
Again, if you failed typing seven characters without making a mistake, you
may need to use Control-E to quit the emulation.
Assuming you’re more careful than that, we can try a few commands:
-
@rkunix
-mem = 1035
-RESTRICTED RIGHTS
+
@rkunix
+ mem = 1035
+ RESTRICTED RIGHTS
-Use, duplication or disclosure is subject to
-restrictions stated in Contract with Western
-Electric Company, Inc.
-# STTY -LCASE
-# ls
-bin
-dev
-etc
-hpunix
-lib
-mnt
-rkunix
-rpunix
-tmp
-unix
-usr
-# cat > foo.c
-main()
-{
- printf("Hello, World!\n");
-}
-^D
-# cc foo.c
-# ./a.out
-Hello, World!
+ Use, duplication or disclosure is subject to
+ restrictions stated in Contract with Western
+ Electric Company, Inc.
+ # STTY -LCASE
+ # ls
+ bin
+ dev
+ etc
+ hpunix
+ lib
+ mnt
+ rkunix
+ rpunix
+ tmp
+ unix
+ usr
+ # cat > foo.c
+ main()
+ {
+ printf("Hello, World!\n");
+ }
+ ^D
+ # cc foo.c
+ # ./a.out
+ Hello, World!
Why is Version 6 interesting? Well, it was the oldest version that I could
find a boot image of that had a C compiler… This C compiler is recognizably
C, but not quite the same syntax as we have today. It’s much closer to the
@@ -387,13 +386,13 @@ it hadn’t been named that yet).
You can try out this version by typing make v0. Since this version is a
native PDP-7 emulation, it gets its own binary. Type ./v0 to run it. You
should see the login prompt.
-
login:
+
login:
There are two user accounts ken and dmr, with the passwords ken and dmr
respectively. Let’s try the Dennis Richie’s dmr account:
-
login: dmr
-password: dmr
-@ ls
-. ?
+
login: dmr
+ password: dmr
+ @ ls
+ . ?
Even though this is not Ken’s doing, I feel this gives me licence to
include this quote from the BSD fortune program:
@@ -415,51 +414,51 @@ directory doesn’t have that yet, but we can make it, because the home
directory has a hard link to dd, which is the directory that holds all
of the user home directories (this will eventually become /, the root
path). We can do
-
@ ln dd dmr .
+
@ ln dd dmr .
To make the new link (note that ln doesn’t support paths either, so you have
to give it three arguments – a directory in the current dir, a file in that
directory, and the new name).
Now ls will work, and we can try some other things while we are here:
-
login: dmr
-password: dmr
-@ ln dd dmr .
-@ ls
-dd
-system
-as.s
-b_readme
-bi.s
-bl.s
-db.s
-hello.b
-ops.s
-.
-@ cat b_readme
-Here is how to compile and run hello.b:
+
login: dmr
+ password: dmr
+ @ ln dd dmr .
+ @ ls
+ dd
+ system
+ as.s
+ b_readme
+ bi.s
+ bl.s
+ db.s
+ hello.b
+ ops.s
+ .
+ @ cat b_readme
+ Here is how to compile and run hello.b:
-@ bc hello.b hello.s
-@ as ops.s bl.s hello.s bi.s
-I
-II
-ops.s
-bl.s
-hello.s
-bi.s
-@ a.out
-Hello, World!
+ @ bc hello.b hello.s
+ @ as ops.s bl.s hello.s bi.s
+ I
+ II
+ ops.s
+ bl.s
+ hello.s
+ bi.s
+ @ a.out
+ Hello, World!
-@ bc hello.b hello.s
-@ as ops.s bl.s hello.s bi.s
-I
-II
-ops.s
-bl.s
-hello.s
-bi.s
-@ a.out
-Hello, World!
-@
+ @ bc hello.b hello.s
+ @ as ops.s bl.s hello.s bi.s
+ I
+ II
+ ops.s
+ bl.s
+ hello.s
+ bi.s
+ @ a.out
+ Hello, World!
+ @
The last command is invoking the compiler for an extremely early version of
the [B programming language] 3, the predecessor to C. Thompson missed the
convenience of writing code in a high-level language – Multics was written
diff --git a/2018/poikola/README.md b/2018/poikola/README.md
index 6c44bc2c1..7c19d2635 100644
--- a/2018/poikola/README.md
+++ b/2018/poikola/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./prog
+ ./prog
```
@@ -18,7 +18,7 @@ On a terminal that supports 24 bit color, has black background, and size at
least 125x38, try:
```sh
-./try.sh
+ ./try.sh
```
@@ -27,8 +27,8 @@ least 125x38, try:
It is said by some students of Astronomy:
```
-Oh, Be A Fine Gal, Kiss Me!
-Oh, Be A Fine Gentleman, Kiss Me!
+ Oh, Be A Fine Gal, Kiss Me!
+ Oh, Be A Fine Gentleman, Kiss Me!
```
Many [Mnemonic variations](http://www.star.ucl.ac.uk/%7Epac/obafgkmrns.html) exist.
@@ -41,13 +41,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
+ cc -o prog -std=gnu11 -O3 prog.c
```
or
```sh
-make
+ make
```
### Poster:
@@ -164,16 +164,18 @@ Because the rot13 is too easy to decode with the plain eyes, I decided to use
the [Caesar cipher](https://en.wikipedia.org/wiki/Caesar_cipher) with the key
18:
+```
Lzw xajkl tsffwj ak wfugvwv mkafy AWWW 754 xdgslk gf dafw 47. Al ak hjaflwv
gfdq gf dalldw-wfvasf esuzafwk.
+```
If you want to or must know and don't know how to decipher this, you might look
at the [Caesar cipher decoder](https://www.dcode.fr/caesar-cipher). Find the
text that says:
```
-Manual decryption and parameters
-Shift/Key (number)
+ Manual decryption and parameters
+ Shift/Key (number)
```
and enter 18 and then click the button that says: `DECRYPT (BRUTEFORCE)`.
diff --git a/2018/poikola/index.html b/2018/poikola/index.html
index 3eeb00b2f..c2b1d57fc 100644
--- a/2018/poikola/index.html
+++ b/2018/poikola/index.html
@@ -132,8 +132,7 @@
Author:
Name: Timo Poikola
-Location: FI - Republic of Finland (Finland)
-
@@ -142,25 +141,25 @@ 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!
-Oh, Be A Fine Gentleman, Kiss Me!
+
Oh, Be A Fine Gal, Kiss Me!
+ Oh, Be A Fine Gentleman, Kiss Me!
Many Mnemonic variations exist.
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.
@@ -242,13 +241,13 @@ questions:
Because the rot13 is too easy to decode with the plain eyes, I decided to use
the Caesar cipher with the key
18:
-
Lzw xajkl tsffwj ak wfugvwv mkafy AWWW 754 xdgslk gf dafw 47. Al ak hjaflwv
-gfdq gf dalldw-wfvasf esuzafwk.
+
Lzw xajkl tsffwj ak wfugvwv mkafy AWWW 754 xdgslk gf dafw 47. Al ak hjaflwv
+ gfdq gf dalldw-wfvasf esuzafwk.
If you want to or must know and don’t know how to decipher this, you might look
at the Caesar cipher decoder. Find the
text that says:
-
Manual decryption and parameters
-Shift/Key (number)
+
Manual decryption and parameters
+ Shift/Key (number)
and enter 18 and then click the button that says: DECRYPT (BRUTEFORCE).
@@ -142,15 +141,15 @@ Location: US - United States of America
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
@@ -166,32 +165,32 @@ grouped into strongly connected components. Given a set of nodes
representing targets and edges representing dependencies between them,
it produces a build order with any dependency cycles gathered.
For example, the following input (provided as example-1.txt):
So, node 0 has edges to / depends on nodes 4 and 8, node 1 depends on
node 0, and so on. Then, it groups the graph’s nodes into
strongly connected components and prints them in reverse-topologically
sorted order:
-
0: 8
-1: 0 1 4
-2: 2 3
-3: 5 6
-4: 7
+
0: 8
+ 1: 0 1 4
+ 2: 2 3
+ 3: 5 6
+ 4: 7
It uses Tarjan’s strongly connected components
algorithm
for the grouping and reverse-topological sorting, along with a bonus hidden
diff --git a/2018/yang/README.md b/2018/yang/README.md
index 1b96a4566..bfbd9bf7a 100644
--- a/2018/yang/README.md
+++ b/2018/yang/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -11,16 +11,16 @@ 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
+ less generated1.c
+ less generated2.c
+ less generated3.c
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -45,7 +45,7 @@ of `./left`, `./right` and `./shift` and the additionally generated programs.
The final message can be revealed using
```sh
-./msg9 < prog.c
+ ./msg9 < prog.c
```
But what combinations will generate `./msg3`, `./msg4`, `./msg5`, `./msg6`,
@@ -60,8 +60,8 @@ But what combinations will generate `./msg3`, `./msg4`, `./msg5`, `./msg6`,
same text to `stdout`, but rotated 90 degrees counterclockwise.
```sh
-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
@@ -69,9 +69,9 @@ 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
+ ./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
@@ -84,18 +84,18 @@ 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
+ ./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:
```sh
-./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
@@ -113,8 +113,8 @@ 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
+ ./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
diff --git a/2018/yang/index.html b/2018/yang/index.html
index 33e768987..1b46cb805 100644
--- a/2018/yang/index.html
+++ b/2018/yang/index.html
@@ -132,8 +132,7 @@
Author:
Name: Don Yang
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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
@@ -165,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:
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.
@@ -187,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.
-
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.
@@ -205,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:
-
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/README.md b/2019/README.md
index 0e65c3d23..d7e551c15 100644
--- a/2019/README.md
+++ b/2019/README.md
@@ -40,9 +40,9 @@ There are again nods to entries of the years:
These nods to not run afoul of the guideline:
```
-We tend to dislike programs that:
-...
-are rather similar to previous entries
+ We tend to dislike programs that:
+ ...
+ are rather similar to previous entries
```
because the entry [2019/dogon](2019/dogon/index.html) appropriately pays homage
diff --git a/2019/adamovsky/README.md b/2019/adamovsky/README.md
index 9947e88bc..212eabbfe 100644
--- a/2019/adamovsky/README.md
+++ b/2019/adamovsky/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2019 adamovsky bugs](../../bugs.html#2019_adamovsky).
@@ -19,14 +19,14 @@ For more detailed information see [2019 adamovsky bugs](../../bugs.html#2019_ada
## To use:
```sh
-./prog file.unl
+ ./prog file.unl
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -40,7 +40,7 @@ better way to understand the entry but to fuzz it, we stumbled on a string of
bytes which crashed it:
```
-````.0`.0`.0`c.0``sssss
+ ````.0`.0`.0`c.0``sssss
```
Functional programming is not a panacea against core dumps, after all.
@@ -48,7 +48,7 @@ Functional programming is not a panacea against core dumps, after all.
This can be demonstrated by:
```sh
-./prog crash.unl
+ ./prog crash.unl
```
@@ -85,7 +85,7 @@ by the sheer length of the dividing line and totally overlooks the rest of the p
When built directly using
```sh
-make
+ make
```
the program (`prog`) accepts a single parameter with the name of an Unlambda program. You can
@@ -93,7 +93,7 @@ download the [Colossal Cave Adventure][1] (the [advent.unl](advent.unl) file)
and run it like this:
```sh
-./prog advent.unl
+ ./prog advent.unl
```
> NOTE: the file was added to the entry so there is no need to download it.
@@ -106,7 +106,7 @@ There is an alternative build path that requires the 2018 IOCCC size tool to com
source [iocccsize_2018.c](iocccsize_2018.c) in the project directory and call
```sh
-make identify
+ make identify
```
It will build the tool and use it to build an alternative program `prog2`, which in turn will
diff --git a/2019/adamovsky/index.html b/2019/adamovsky/index.html
index 3749e261b..ecc6846dd 100644
--- a/2019/adamovsky/index.html
+++ b/2019/adamovsky/index.html
@@ -132,8 +132,7 @@
Even after pre-processing and indenting, the C code of this entry it
is about as understandable as the Unlambda code.
Pretending that we don’t know a bit of functional programming :) and lacking a
better way to understand the entry but to fuzz it, we stumbled on a string of
bytes which crashed it:
-
````.0`.0`.0`c.0``sssss
+
````.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:
@@ -182,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.
@@ -195,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 719335393..b02f13418 100644
--- a/2019/burton/README.md
+++ b/2019/burton/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2019 burton bugs](../../bugs.html#2019_burton).
@@ -19,16 +19,16 @@ For more detailed information see [2019 burton bugs](../../bugs.html#2019_burton
## To use:
```sh
-./prog < file
+ ./prog < file
-./cow file
+ ./cow file
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -52,8 +52,8 @@ 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
+ WARN="-Wno-implicit-int -Wno-missing-variable-declarations -Wno-parentheses"
+ cc -Wall -Wextra -Weverything -pedantic $WARN -include stdio.h -o prog prog.c
```
### Description:
@@ -64,7 +64,7 @@ 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
+ out=cat ./check.sh ./prog
```
Interestingly, and a spoiler here: macOS and FreeBSD implement the common
@@ -98,7 +98,7 @@ interface.
Included is a version without compilation warnings:
```sh
-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
diff --git a/2019/burton/index.html b/2019/burton/index.html
index c50907bd3..8fc78da6b 100644
--- a/2019/burton/index.html
+++ b/2019/burton/index.html
@@ -132,8 +132,7 @@
Author:
Name: Dave Burton
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,17 +141,17 @@ Location: US - United States of America
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
@@ -164,14 +163,14 @@ interesting.
Feed it anything on stdin.
The output should look familiar.
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
@@ -190,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:
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?
@@ -177,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 f1cd260e4..4210d5af6 100644
--- a/2019/diels-grabsch1/README.md
+++ b/2019/diels-grabsch1/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./prog < file > file.Z
+ ./prog < file > file.Z
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -38,20 +38,20 @@ compresses differently? The judges know. :)
#### Usage:
```sh
-./prog < input.txt > input.txt.Z
+ ./prog < input.txt > input.txt.Z
```
#### Example:
```sh
-./prog < guidelines.txt > guidelines.txt.Z
+ ./prog < guidelines.txt > guidelines.txt.Z
```
#### Check for correctness:
```sh
-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](../../2015/mills2/mills2.c) instead of
diff --git a/2019/diels-grabsch1/index.html b/2019/diels-grabsch1/index.html
index a979198de..76e2f87b0 100644
--- a/2019/diels-grabsch1/index.html
+++ b/2019/diels-grabsch1/index.html
@@ -132,8 +132,7 @@
+Location: DE - Federal Republic of Germany (Germany)
@@ -142,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
@@ -158,12 +157,12 @@ compresses differently? The judges know. :)
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 f4145302e..fb3f3c5d7 100644
--- a/2019/diels-grabsch2/README.md
+++ b/2019/diels-grabsch2/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./prog
+ ./prog
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -34,9 +34,9 @@ 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
+ $ sha512sum prog.c; ./prog
+ 43bd0c4381a5078d2850fca9ae5e0647596bcc03cd67d8d973ad02ff35c316c728e7b347ca70abe6c74e745e63646cc7643cb0cffcd3d9a969cbf31a7ce5bf68 prog.c
+ 43bd0c4381a5078d2850fca9ae5e0647596bcc03cd67d8d973ad02ff35c316c728e7b347ca70abe6c74e745e63646cc7643cb0cffcd3d9a969cbf31a7ce5bf68
```
It started as a complicated "hello world" program that prints some random hex
@@ -70,7 +70,7 @@ are step 1 and step 2 achieved then?
Regarding step 1, note that the large string literal
```
-"`x{bh}ndbq..."
+ "`x{bh}ndbq..."
```
in the last line doesn't look like C code. Moreover, it is too short
diff --git a/2019/diels-grabsch2/index.html b/2019/diels-grabsch2/index.html
index 644092985..eb3535cc3 100644
--- a/2019/diels-grabsch2/index.html
+++ b/2019/diels-grabsch2/index.html
@@ -132,8 +132,7 @@
+Location: DE - Federal Republic of Germany (Germany)
@@ -142,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
@@ -154,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:
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
@@ -181,7 +180,7 @@ the #defines are only used to shorten redundant parts of the code,
they are not meant to obfuscate much. Having that out of the way, how
are step 1 and step 2 achieved then?
Regarding step 1, note that the large string literal
-
"`x{bh}ndbq..."
+
"`x{bh}ndbq..."
in the last line doesn’t look like C code. Moreover, it is too short
to contain even a compressed representation of all preceding and
subsequent code. Instead, the preceding code including the "
diff --git a/2019/dogon/README.md b/2019/dogon/README.md
index ca1f02c22..8d76d1ee9 100644
--- a/2019/dogon/README.md
+++ b/2019/dogon/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: uses gets() - change to fgets() if possible
+ STATUS: uses gets() - change to fgets() if possible
```
For more detailed information see [2019 dogon bugs](../../bugs.html#2019_dogon).
@@ -19,14 +19,14 @@ For more detailed information see [2019 dogon bugs](../../bugs.html#2019_dogon).
## To use:
```sh
-./prog < pattern.mc
+ ./prog < pattern.mc
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
Make sure that you keep focus of windows in mind when going back and forth to
@@ -248,11 +248,11 @@ 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); }
+ 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
diff --git a/2019/dogon/index.html b/2019/dogon/index.html
index dfc425079..954f3e8c8 100644
--- a/2019/dogon/index.html
+++ b/2019/dogon/index.html
@@ -132,8 +132,7 @@
Author:
Name: Gil Dogon
-Location: IL - State of Israel (Israel)
-
Make sure that you keep focus of windows in mind when going back and forth to
the program and the script.
Judges’ remarks:
@@ -322,11 +321,11 @@ 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:
-
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:
@@ -174,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
@@ -189,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:
@@ -205,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
@@ -265,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 23c08a726..4429c7dfd 100644
--- a/2019/endoh/README.md
+++ b/2019/endoh/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
NOTE: the use of the C compiler optimiser was disabled and `-g` was enabled for
@@ -13,7 +13,7 @@ this entry because it is SUPPOSED to crash and it needs debugging symbols.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2019 endoh bugs](../../bugs.html#2019_endoh).
@@ -22,7 +22,7 @@ For more detailed information see [2019 endoh bugs](../../bugs.html#2019_endoh).
## To use:
```sh
-./prog
+ ./prog
```
@@ -31,7 +31,7 @@ For more detailed information see [2019 endoh bugs](../../bugs.html#2019_endoh).
If you have `gdb(1)` installed:
```sh
-./try.sh
+ ./try.sh
```
Note that in macOS installing `gdb(1)` takes multiple steps - it's not just a
@@ -41,7 +41,7 @@ only been tested with linux.
You might also wish to try:
```sh
-gdb ./prog || lldb ./prog
+ gdb ./prog || lldb ./prog
```
and then type in `r` (to run program) and then `bt` (for backtrace).
@@ -60,53 +60,53 @@ ascii` when debugging it to reveal its purpose.
Compile prog.c with no optimization.
```sh
-cc -g -O0 -o prog prog.c
+ cc -g -O0 -o prog prog.c
```
Then, run it. You will see a segmentation fault.
```sh
-$ ./prog
-Segmentation fault (core dumped)
+ $ ./prog
+ Segmentation fault (core dumped)
```
Let's debug. As usual, run it under gdb.
```sh
-$ gdb ./prog
-(gdb) run
-Starting program: /home/.../prog
+ $ gdb ./prog
+ (gdb) run
+ Starting program: /home/.../prog
-Program received signal SIGSEGV, Segmentation fault.
-0x0000000000000000 in ?? ()
+ Program received signal SIGSEGV, Segmentation fault.
+ 0x0000000000000000 in ?? ()
```
Okay, check the backtrace.
```
-(gdb) backtrace
-#0 0x0000000000000000 in ?? ()
-#1 0x0000555555555201 in x23 () at prog.c:35
-#2 0x000055555555571a in x64 () at prog.c:100
-#3 0x0000555555555747 in x65 () at prog.c:101
-#4 0x0000555555555774 in x66 () at prog.c:102
-#5 0x00005555555557ce in x69 () at prog.c:105
-#6 0x0000555555555828 in x6e () at prog.c:110
-#7 0x0000555555555747 in x65 () at prog.c:101
- ...
+ (gdb) backtrace
+ #0 0x0000000000000000 in ?? ()
+ #1 0x0000555555555201 in x23 () at prog.c:35
+ #2 0x000055555555571a in x64 () at prog.c:100
+ #3 0x0000555555555747 in x65 () at prog.c:101
+ #4 0x0000555555555774 in x66 () at prog.c:102
+ #5 0x00005555555557ce in x69 () at prog.c:105
+ #6 0x0000555555555828 in x6e () at prog.c:110
+ #7 0x0000555555555747 in x65 () at prog.c:101
+ ...
```
See the line numbers and lookup the ASCII table.
```
- 35 = '#'
-100 = 'd'
-101 = 'e'
-102 = 'f'
-105 = 'i'
-110 = 'n'
-101 = 'e'
-...
+ 35 = '#'
+ 100 = 'd'
+ 101 = 'e'
+ 102 = 'f'
+ 105 = 'i'
+ 110 = 'n'
+ 101 = 'e'
+ ...
```
### One more thing:
@@ -114,27 +114,27 @@ See the line numbers and lookup the ASCII table.
The original program can be used as a GDB command file.
```
-gdb -q -x prog.c ./prog | cat
-Reading symbols from ./prog...done.
+ gdb -q -x prog.c ./prog | cat
+ Reading symbols from ./prog...done.
-Program received signal SIGSEGV, Segmentation fault.
-0x0000000000000000 in ?? ()
-#0 0x0000000000000000 in ?? ()
-#1 0x0000555555555201 in x23 () at prog.c:35
-#2 0x000055555555571a in x64 () at prog.c:100
-#3 0x0000555555555747 in x65 () at prog.c:101
-#4 0x0000555555555774 in x66 () at prog.c:102
-#5 0x00005555555557ce in x69 () at prog.c:105
-#6 0x0000555555555828 in x6e () at prog.c:110
-#7 0x0000555555555747 in x65 () at prog.c:101
-...
+ Program received signal SIGSEGV, Segmentation fault.
+ 0x0000000000000000 in ?? ()
+ #0 0x0000000000000000 in ?? ()
+ #1 0x0000555555555201 in x23 () at prog.c:35
+ #2 0x000055555555571a in x64 () at prog.c:100
+ #3 0x0000555555555747 in x65 () at prog.c:101
+ #4 0x0000555555555774 in x66 () at prog.c:102
+ #5 0x00005555555557ce in x69 () at prog.c:105
+ #6 0x0000555555555828 in x6e () at prog.c:110
+ #7 0x0000555555555747 in x65 () at prog.c:101
+ ...
```
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
+ 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
```
@@ -142,79 +141,79 @@ 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.
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.
$ gdb ./prog
+(gdb)run
+Starting program: /home/.../prog
-Program received signal SIGSEGV, Segmentation fault.
-0x0000000000000000 in ??()
+Program received signal SIGSEGV, Segmentation fault.
+0x0000000000000000 in ??()
Okay, check the backtrace.
-
(gdb) backtrace
-#0 0x0000000000000000 in ?? ()
-#1 0x0000555555555201 in x23 () at prog.c:35
-#2 0x000055555555571a in x64 () at prog.c:100
-#3 0x0000555555555747 in x65 () at prog.c:101
-#4 0x0000555555555774 in x66 () at prog.c:102
-#5 0x00005555555557ce in x69 () at prog.c:105
-#6 0x0000555555555828 in x6e () at prog.c:110
-#7 0x0000555555555747 in x65 () at prog.c:101
- ...
+
(gdb) backtrace
+ #0 0x0000000000000000 in ?? ()
+ #1 0x0000555555555201 in x23 () at prog.c:35
+ #2 0x000055555555571a in x64 () at prog.c:100
+ #3 0x0000555555555747 in x65 () at prog.c:101
+ #4 0x0000555555555774 in x66 () at prog.c:102
+ #5 0x00005555555557ce in x69 () at prog.c:105
+ #6 0x0000555555555828 in x6e () at prog.c:110
+ #7 0x0000555555555747 in x65 () at prog.c:101
+ ...
gdb -q -x prog.c ./prog | cat
+ Reading symbols from ./prog...done.
-Program received signal SIGSEGV, Segmentation fault.
-0x0000000000000000 in ?? ()
-#0 0x0000000000000000 in ?? ()
-#1 0x0000555555555201 in x23 () at prog.c:35
-#2 0x000055555555571a in x64 () at prog.c:100
-#3 0x0000555555555747 in x65 () at prog.c:101
-#4 0x0000555555555774 in x66 () at prog.c:102
-#5 0x00005555555557ce in x69 () at prog.c:105
-#6 0x0000555555555828 in x6e () at prog.c:110
-#7 0x0000555555555747 in x65 () at prog.c:101
-...
+ Program received signal SIGSEGV, Segmentation fault.
+ 0x0000000000000000 in ?? ()
+ #0 0x0000000000000000 in ?? ()
+ #1 0x0000555555555201 in x23 () at prog.c:35
+ #2 0x000055555555571a in x64 () at prog.c:100
+ #3 0x0000555555555747 in x65 () at prog.c:101
+ #4 0x0000555555555774 in x66 () at prog.c:102
+ #5 0x00005555555557ce in x69 () at prog.c:105
+ #6 0x0000555555555828 in x6e () at prog.c:110
+ #7 0x0000555555555747 in x65 () at prog.c:101
+ ...
By using this, you can confirm that it is actually a quine.
@@ -176,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.
output: The path to the output file. Optional, defaults to out.wav.
@@ -197,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/index.html b/2019/index.html
index 3bbf13343..3b7f6dc98 100644
--- a/2019/index.html
+++ b/2019/index.html
@@ -150,9 +150,9 @@ vocabulary!
We tend to dislike programs that:
-...
-are rather similar to previous entries
+
We tend to dislike programs that:
+ ...
+ are rather similar to previous entries
because the entry 2019/dogon appropriately pays homage
to past entries without blatantly reusing their code.
…We’ll stop spouting spoilers now. Have fun exploring all the entries!
diff --git a/2019/karns/README.md b/2019/karns/README.md
index 277f6c546..a01b9c128 100644
--- a/2019/karns/README.md
+++ b/2019/karns/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
NOTE: we disable the optimiser because this program has problems with it
@@ -13,7 +13,7 @@ enabled.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2019 karns bugs](../../bugs.html#2019_karns).
@@ -22,13 +22,13 @@ For more detailed information see [2019 karns bugs](../../bugs.html#2019_karns).
## To use:
```sh
-./prog < textfile_that_fits_on_the_screen
+ ./prog < textfile_that_fits_on_the_screen
```
You might want to type:
```sh
-reset
+ reset
```
after running the program to restore the terminal to its previous state.
@@ -37,13 +37,13 @@ after running the program to restore the terminal to its previous state.
## Try:
```sh
-./try.sh
+ ./try.sh
```
If you have more time you might want to try:
```sh
-./prog < README.md
+ ./prog < README.md
```
@@ -83,7 +83,7 @@ connected with anything.
This program usually compiles under both GCC and clang. Build with:
```sh
-$(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.
@@ -91,14 +91,14 @@ where `$(CC)` is cc, gcc, clang, or some other C compiler.
You can then run it with:
```sh
-cat | ./tbfs
+ cat | ./tbfs
```
Examples:
```sh
-./tbfs < maze
-./tbfs < prog.c
+ ./tbfs < maze
+ ./tbfs < prog.c
```
### Issues
diff --git a/2019/karns/index.html b/2019/karns/index.html
index e01c62cf4..dbe986a6c 100644
--- a/2019/karns/index.html
+++ b/2019/karns/index.html
@@ -132,8 +132,7 @@
Author:
Name: Joshua Karns
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,22 +141,22 @@ Location: US - United States of America
To build:
-
make
+
make
NOTE: we disable the optimiser because this program has problems with it
enabled.
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
@@ -180,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 d0649825b..6d4c43522 100644
--- a/2019/lynn/README.md
+++ b/2019/lynn/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2019 lynn bugs](../../bugs.html#2019_lynn).
@@ -19,14 +19,14 @@ For more detailed information see [2019 lynn bugs](../../bugs.html#2019_lynn).
## To use:
```sh
-./prog
+ ./prog
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -63,7 +63,7 @@ typeclasses. Just pass dictionaries explicitly.
Build the compiler:
```sh
-cc -o prog prog.c
+ cc -o prog prog.c
```
### Demos:
@@ -73,7 +73,7 @@ cc -o prog prog.c
Test the compiler on [fib.hs](fib.hs):
```sh
-(./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.
@@ -82,7 +82,7 @@ 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
+ ghc ghcfib.hs
```
@@ -94,9 +94,9 @@ 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
+ (./prog < hint.hs ; cat prog.c) > hint.c
+ make hint
+ ./hint
```
The output program behaves like the compiler itself.
@@ -117,15 +117,15 @@ 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
+ (./prog < lol.hs ; cat prog.c) > lol.c
+ make lol
+ ./lol
```
A GHC wrapper is provided:
```sh
-ghc ghclol.hs
+ ghc ghclol.hs
```
@@ -136,16 +136,16 @@ way to print the strongly-connected components of a graph in reverse topological
order.
```sh
-(./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:
```sh
-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
@@ -162,7 +162,7 @@ disabling layout-based rules, making every operator left-associative with same
precedence, and only defining 6 primitive functions:
```
-: + - * / <=
+ : + - * / <=
```
The arithmetic operations behave as they do in C on `unsigned int`s, and `(:)` is
@@ -195,7 +195,7 @@ function, and the result is printed to standard output.
`Bool` must be defined as:
```
-data Bool = True | False;
+ data Bool = True | False;
```
so that it matches the Scott-encoded booleans internally used by the primitive
@@ -205,17 +205,17 @@ The alternatives in a `case` expressions must list every data constructor in
the order they are defined. For example, if we have:
```
-data Foo a b = Bar a | Baz | Qux Int [b]
+ data Foo a b = Bar a | Baz | Qux Int [b]
```
then a `case` expression that examines a term of this type must have the form:
```
-case x of
- { Bar a -> ...
- ; Baz -> ...
- ; Qux n bs -> ...
- }
+ case x of
+ { Bar a -> ...
+ ; Baz -> ...
+ ; Qux n bs -> ...
+ }
```
We stress braces and semicolons are required. Our fussy parser treats
diff --git a/2019/lynn/index.html b/2019/lynn/index.html
index 7184c8036..a44868304 100644
--- a/2019/lynn/index.html
+++ b/2019/lynn/index.html
@@ -132,8 +132,7 @@
Author:
Name: Ben Lynn
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,15 +141,15 @@ Location: US - United States of America
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.
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.
-
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.)
@@ -225,7 +224,7 @@ optional. Some complain about a zoo of twisty little operators, all alike. Our
compiler addresses such concerns by making braces and semicolons compulsory,
disabling layout-based rules, making every operator left-associative with same
precedence, and only defining 6 primitive functions:
-
: + - * / <=
+
: + - * / <=
The arithmetic operations behave as they do in C on unsigned ints, and (:) is
Haskell’s cons function. Like Haskell and unlike C, (<=) returns a Bool
(which are Church booleans behind the scenes) and not an Int.
@@ -246,18 +245,18 @@ type [Int] -> [Int], and our compiler treats this like the funct
into Prelude.interact, that is, the entire standard input is passed to this
function, and the result is printed to standard output.
Bool must be defined as:
-
data Bool = True | False;
+
data Bool = True | False;
so that it matches the Scott-encoded booleans internally used by the primitive
function (<=).
The alternatives in a case expressions must list every data constructor in
the order they are defined. For example, if we have:
-
data Foo a b = Bar a | Baz | Qux Int [b]
+
data Foo a b = Bar a | Baz | Qux Int [b]
then a case expression that examines a term of this type must have the form:
-
case x of
- { Bar a -> ...
- ; Baz -> ...
- ; Qux n bs -> ...
- }
+
case x of
+ { Bar a -> ...
+ ; Baz -> ...
+ ; Qux n bs -> ...
+ }
We stress braces and semicolons are required. Our fussy parser treats
semicolons as separators, not terminators.
The effect of erroneous input is undefined. It may be best to develop with GHC,
diff --git a/2019/mills/README.md b/2019/mills/README.md
index d3e8af532..7e0cb0686 100644
--- a/2019/mills/README.md
+++ b/2019/mills/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2019 mills bugs](../../bugs.html#2019_mills).
@@ -19,16 +19,16 @@ 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
+ make cpclean
+ # Let this run for about about an hour and then kill it:
+ ./prog Shakespeare.txt
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
However, as the binary model files used to produce the output are in an
@@ -93,56 +93,56 @@ 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
+ make
```
After it builds, train it using
```sh
-./prog Shakespere.txt
+ ./prog Shakespere.txt
```
This will immediately start outputting gibberish to the output, e.g.
```sh
-./prog Shakespere.txt
+ ./prog Shakespere.txt
```
produces:
```
-sins ohennAu
-T-teooclelp tiThoWy
+ sins ohennAu
+ T-teooclelp tiThoWy
-g
-nlakuafy
-e
-sselW usnsofueB Aoee pasfUsuslhe ooM ot Wou moy
-me neltAl -no IoyI mhuyakse inT-l chu ghenn ffo? fnsoe yhyye
-ue nnfrlass heUthole saounlcesyee pee
-t,
-T0:0% 3.210888
-o',,vU
- An ,hTf lnm Far rur:s moilt WoEgrv wonds mith Aog thernw
-Rni So
-co Nnd :
-For an bImy pgafoun:
-Wf'r hom wortiverita
-int fod mous Eheledet,
-Tho he theket nonS wnu-ang dorlaMSp
-nrocWiSe tflg 'o.
-T0:0% 2.995950
-d whecedhencrysesil yr bn,
-we hh y thiwt
+ g
+ nlakuafy
+ e
+ sselW usnsofueB Aoee pasfUsuslhe ooM ot Wou moy
+ me neltAl -no IoyI mhuyakse inT-l chu ghenn ffo? fnsoe yhyye
+ ue nnfrlass heUthole saounlcesyee pee
+ t,
+ T0:0% 3.210888
+ o',,vU
+ An ,hTf lnm Far rur:s moilt WoEgrv wonds mith Aog thernw
+ Rni So
+ co Nnd :
+ For an bImy pgafoun:
+ Wf'r hom wortiverita
+ int fod mous Eheledet,
+ Tho he theket nonS wnu-ang dorlaMSp
+ nrocWiSe tflg 'o.
+ T0:0% 2.995950
+ d whecedhencrysesil yr bn,
+ we hh y thiwt
-hut fithlot,
-Fmdy s he alt
-Vh th no dh foud bobt werw:s Aotnf Fhwi't whe, eusu
+ hut fithlot,
+ Fmdy s he alt
+ Vh th no dh foud bobt werw:s Aotnf Fhwi't whe, eusu
-lhh thele wewcond ary soupfy wind tDont couc ths:
-er fucwald oncli hen bos, f
-T0:1% 2.878945
+ lhh thele wewcond ary soupfy wind tDont couc ths:
+ er fucwald oncli hen bos, f
+ T0:1% 2.878945
```
The gibberish is the networks attempt to write a play. So far, it's not very
@@ -150,7 +150,7 @@ successful! Between the chunks of gibberish are training progress reports
that look like
```
-T0:1% 2.878945
+ T0:1% 2.878945
```
This tells you that we are 1% through training epoch 0, and that the training
@@ -158,31 +158,31 @@ This tells you that we are 1% through training epoch 0, and that the training
reduce and the generated snippets will improve quickly:
```
-ses, kuth
-LAs of the wish,
-As, I nos you,
-Yov not to nalll,
-Tr tot wonds.
+ ses, kuth
+ LAs of the wish,
+ As, I nos you,
+ Yov not to nalll,
+ Tr tot wonds.
-First Sondy, llt lrte, our, tw.
+ First Sondy, llt lrte, our, tw.
-First.
+ First.
-BRUTUS:
-Helsting the kith gops of hoch Whay, fars surd what to,
-The cownens golt te.
-T0:12% 2.259114
-eplerrotrur tandans one wiok thy or thach and cullice ded yourssting
-And wours:
-Whed ur surt.
+ BRUTUS:
+ Helsting the kith gops of hoch Whay, fars surd what to,
+ The cownens golt te.
+ T0:12% 2.259114
+ eplerrotrur tandans one wiok thy or thach and cullice ded yourssting
+ And wours:
+ Whed ur surt.
-SINENIUS:
-On we lain bith
-rerytund: tich lon hyivetetgor.
+ SINENIUS:
+ On we lain bith
+ rerytund: tich lon hyivetetgor.
-VOLUONIA:
-He brich nom dove worthan then wise,
-T0:13% 2.254926
+ VOLUONIA:
+ He brich nom dove worthan then wise,
+ T0:13% 2.254926
```
It's already started to figure out things about Shakespeare plays -- how to
@@ -194,40 +194,40 @@ Eventually, we will finish with the training data set and move on to a
validation cycle:
```
-y fath onother,
-I sucess,
-For I me the west crare.
+ y fath onother,
+ I sucess,
+ For I me the west crare.
-TRANIO:
-Whow and'd have not to had you you one in my lapteny she very ame come me a gut and shourd aghir you as ignested; shend to make I strem
-To h
-T0:99% 1.924063
- notnce gaud and is nicked thou day, ha the dusing you disaid: in thim, you things in ere thee thus erile Iht that tare theme my hast thesp thou shay: thou not eaten-or-ho-bess resing: I the but had d
-T0:99% 1.923128
-V0:0% 1.678907
-V0:9% 1.700527
-V0:18% 1.733179
-V0:27% 1.714891
-V0:36% 1.716672
-V0:45% 1.782946
-V0:54% 1.835629
-V0:63% 1.876108
-V0:72% 1.906814
-V0:81% 1.924096
-V0:90% 1.954492
-V0:99% 1.969287
-serfs you'll alliencseard:
-We
-got you? before
-I say.
+ TRANIO:
+ Whow and'd have not to had you you one in my lapteny she very ame come me a gut and shourd aghir you as ignested; shend to make I strem
+ To h
+ T0:99% 1.924063
+ notnce gaud and is nicked thou day, ha the dusing you disaid: in thim, you things in ere thee thus erile Iht that tare theme my hast thesp thou shay: thou not eaten-or-ho-bess resing: I the but had d
+ T0:99% 1.923128
+ V0:0% 1.678907
+ V0:9% 1.700527
+ V0:18% 1.733179
+ V0:27% 1.714891
+ V0:36% 1.716672
+ V0:45% 1.782946
+ V0:54% 1.835629
+ V0:63% 1.876108
+ V0:72% 1.906814
+ V0:81% 1.924096
+ V0:90% 1.954492
+ V0:99% 1.969287
+ serfs you'll alliencseard:
+ We
+ got you? before
+ I say.
-Farstred dentlentecaly, sir, I it one bosticield
-All me the backnour mino,
-Whith capitaned mid! but stell the ifvemion
-Willerity.
+ Farstred dentlentecaly, sir, I it one bosticield
+ All me the backnour mino,
+ Whith capitaned mid! but stell the ifvemion
+ Willerity.
-First Cumfol of
-T1:0% 1.885619
+ First Cumfol of
+ T1:0% 1.885619
```
Validation cycles are used to test the network to see if it has learned to
@@ -237,7 +237,7 @@ on the validation set is also displayed with a validation progress report that
looks like
```
-V0:36% 1.716672
+ V0:36% 1.716672
```
which means we are 36% of the way through the validation for epoch 0, and the
@@ -260,7 +260,7 @@ 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
+ ./prog Shakespeare.txt cp01_1.970
```
After the validation cycle finishes, OMLET begins the next epoch by restarting
@@ -276,7 +276,7 @@ parameters to generate data. Inference mode takes the checkpoint file as
command like
```sh
-./prog < cp55_1.807
+ ./prog < cp55_1.807
```
Running it produces an infinite amount of generated output, until you hit
@@ -295,8 +295,8 @@ executable name `prog`) is the simplest recurrent neural network. It looks
like
```c
-h = tanh(Wxh * x + Whh * h' + Bh)
-y = Why * h + By
+ h = tanh(Wxh * x + Whh * h' + Bh)
+ y = Why * h + By
```
where
@@ -318,53 +318,53 @@ It is the presence of the hidden state vector that allows the RNN to
state. If you type
```sh
-make lin1
+ make lin1
```
OMLET will create an [ADALINE][10] network that does
```c
-y = Wxy * x + By
+ y = Wxy * x + By
```
This is a simple [linear][11] [feed-forward network][12]. You can run it with
```sh
-./lin1 Shakespeare.txt
+ ./lin1 Shakespeare.txt
```
The linear network won't be able to get past the gibberish stage, because it
lacks history:
```sh
-./lin1 Shakespeare.txt
+ ./lin1 Shakespeare.txt
```
produces:
```
-UERond w,
+ UERond w,
-Gir:
-KINof s, mesther s thouth.
-E:
-KINTret, at fu,
-GOMy t, as sth kesewit sooos atse ang k, ck,
-Sotheouserivesthecowhet been's, t he, h nre; t and, har wiread of pincer cedst sur has, ut:
+ Gir:
+ KINof s, mesther s thouth.
+ E:
+ KINTret, at fu,
+ GOMy t, as sth kesewit sooos atse ang k, ck,
+ Sotheouserivesthecowhet been's, t he, h nre; t and, har wiread of pincer cedst sur has, ut:
-T14:67% 2.465115
-UKESpan,
-NGaromy soreate e m esewfoure pamitherarjulthengeoly tl.
-NG s at e! w.
+ T14:67% 2.465115
+ UKESpan,
+ NGaromy soreate e m esewfoure pamitherarjulthengeoly tl.
+ NG s at e! w.
-WAllinoully?
-Wamisw ofilem:
-I'delandinarrstath har aksubly s cath Whern t Is, weciss:
+ WAllinoully?
+ Wamisw ofilem:
+ I'delandinarrstath har aksubly s cath Whern t Is, weciss:
-GLat s; llde.
-Y aterit dsthence
-T14:67% 2.465404
+ GLat s; llde.
+ Y aterit dsthence
+ T14:67% 2.465404
```
It is able to guess at what character is likely to follow the current one
@@ -389,9 +389,9 @@ 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
+ 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
@@ -415,13 +415,13 @@ the hard limit with `limit -h stacksize` and set it with
You can try the deeper network by doing
```sh
-make rnn2
+ make rnn2
```
(or even `make rnn3` if you want a three-layer RNN) and train it with
```sh
-./rnn2 Shakespeare.txt
+ ./rnn2 Shakespeare.txt
```
The additional depth should allow the network to make better predictions (it
@@ -445,13 +445,13 @@ 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
+ make lstm2
```
and train with it with
```sh
-./lstm2 Shakespeare.txt
+ ./lstm2 Shakespeare.txt
```
The LSTM is much easier to train because it explicitly decides how to update
@@ -465,11 +465,11 @@ 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)
-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
@@ -497,7 +497,7 @@ 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
+ make gru2
```
### Building your own networks
@@ -511,9 +511,9 @@ 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)'
+ -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
@@ -556,16 +556,16 @@ 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)))' \
--DBK=' hp = I(HS), \
- z = S(A(L(HS, x), L(HS, hp))), \
- r = S(A(L(HS, x), L(HS, hp))), \
- c = T(A(L(HS, x), L(HS, hp))), \
- zc = OG(1, -1, z), \
- h = C(hp, A(M(zc, hp), M(z, c))), \
- y = h'
+ -DHS=128, \
+ -DNW=' x = I(n), \
+ y = L(n, MD(MD(x)))' \
+ -DBK=' hp = I(HS), \
+ z = S(A(L(HS, x), L(HS, hp))), \
+ r = S(A(L(HS, x), L(HS, hp))), \
+ c = T(A(L(HS, x), L(HS, hp))), \
+ zc = OG(1, -1, z), \
+ h = C(hp, A(M(zc, hp), M(z, c))), \
+ y = h'
```
We are using a few new tricks here -- first, we are defining `HS` as the size
diff --git a/2019/mills/index.html b/2019/mills/index.html
index 092e863eb..70635adb6 100644
--- a/2019/mills/index.html
+++ b/2019/mills/index.html
@@ -132,8 +132,7 @@
Author:
Name: Christopher Mills
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,17 +141,17 @@ Location: US - United States of America
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:
@@ -201,122 +200,122 @@ 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
+
sins ohennAu
+ T-teooclelp tiThoWy
-g
-nlakuafy
-e
-sselW usnsofueB Aoee pasfUsuslhe ooM ot Wou moy
-me neltAl -no IoyI mhuyakse inT-l chu ghenn ffo? fnsoe yhyye
-ue nnfrlass heUthole saounlcesyee pee
-t,
-T0:0% 3.210888
-o',,vU
- An ,hTf lnm Far rur:s moilt WoEgrv wonds mith Aog thernw
-Rni So
-co Nnd :
-For an bImy pgafoun:
-Wf'r hom wortiverita
-int fod mous Eheledet,
-Tho he theket nonS wnu-ang dorlaMSp
-nrocWiSe tflg 'o.
-T0:0% 2.995950
-d whecedhencrysesil yr bn,
-we hh y thiwt
+ g
+ nlakuafy
+ e
+ sselW usnsofueB Aoee pasfUsuslhe ooM ot Wou moy
+ me neltAl -no IoyI mhuyakse inT-l chu ghenn ffo? fnsoe yhyye
+ ue nnfrlass heUthole saounlcesyee pee
+ t,
+ T0:0% 3.210888
+ o',,vU
+ An ,hTf lnm Far rur:s moilt WoEgrv wonds mith Aog thernw
+ Rni So
+ co Nnd :
+ For an bImy pgafoun:
+ Wf'r hom wortiverita
+ int fod mous Eheledet,
+ Tho he theket nonS wnu-ang dorlaMSp
+ nrocWiSe tflg 'o.
+ T0:0% 2.995950
+ d whecedhencrysesil yr bn,
+ we hh y thiwt
-hut fithlot,
-Fmdy s he alt
-Vh th no dh foud bobt werw:s Aotnf Fhwi't whe, eusu
+ hut fithlot,
+ Fmdy s he alt
+ Vh th no dh foud bobt werw:s Aotnf Fhwi't whe, eusu
-lhh thele wewcond ary soupfy wind tDont couc ths:
-er fucwald oncli hen bos, f
-T0:1% 2.878945
+ lhh thele wewcond ary soupfy wind tDont couc ths:
+ er fucwald oncli hen bos, f
+ T0:1% 2.878945
The gibberish is the networks attempt to write a play. So far, it’s not very
successful! Between the chunks of gibberish are training progress reports
that look like
-
T0:1% 2.878945
+
T0:1% 2.878945
This tells you that we are 1% through training epoch 0, and that the training
loss is about 2.88. As the training continues, the training loss will
reduce and the generated snippets will improve quickly:
-
ses, kuth
-LAs of the wish,
-As, I nos you,
-Yov not to nalll,
-Tr tot wonds.
+
ses, kuth
+ LAs of the wish,
+ As, I nos you,
+ Yov not to nalll,
+ Tr tot wonds.
-First Sondy, llt lrte, our, tw.
+ First Sondy, llt lrte, our, tw.
-First.
+ First.
-BRUTUS:
-Helsting the kith gops of hoch Whay, fars surd what to,
-The cownens golt te.
-T0:12% 2.259114
-eplerrotrur tandans one wiok thy or thach and cullice ded yourssting
-And wours:
-Whed ur surt.
+ BRUTUS:
+ Helsting the kith gops of hoch Whay, fars surd what to,
+ The cownens golt te.
+ T0:12% 2.259114
+ eplerrotrur tandans one wiok thy or thach and cullice ded yourssting
+ And wours:
+ Whed ur surt.
-SINENIUS:
-On we lain bith
-rerytund: tich lon hyivetetgor.
+ SINENIUS:
+ On we lain bith
+ rerytund: tich lon hyivetetgor.
-VOLUONIA:
-He brich nom dove worthan then wise,
-T0:13% 2.254926
+ VOLUONIA:
+ He brich nom dove worthan then wise,
+ T0:13% 2.254926
It’s already started to figure out things about Shakespeare plays – how to
spell short English words, how long lines tend to be, and that characters take
turns speaking with their names capitalized. The training loss has dropped to
2.25 and the improvement is noticeable.
Eventually, we will finish with the training data set and move on to a
validation cycle:
-
y fath onother,
-I sucess,
-For I me the west crare.
+
y fath onother,
+ I sucess,
+ For I me the west crare.
-TRANIO:
-Whow and'd have not to had you you one in my lapteny she very ame come me a gut and shourd aghir you as ignested; shend to make I strem
-To h
-T0:99% 1.924063
- notnce gaud and is nicked thou day, ha the dusing you disaid: in thim, you things in ere thee thus erile Iht that tare theme my hast thesp thou shay: thou not eaten-or-ho-bess resing: I the but had d
-T0:99% 1.923128
-V0:0% 1.678907
-V0:9% 1.700527
-V0:18% 1.733179
-V0:27% 1.714891
-V0:36% 1.716672
-V0:45% 1.782946
-V0:54% 1.835629
-V0:63% 1.876108
-V0:72% 1.906814
-V0:81% 1.924096
-V0:90% 1.954492
-V0:99% 1.969287
-serfs you'll alliencseard:
-We
-got you? before
-I say.
+ TRANIO:
+ Whow and'd have not to had you you one in my lapteny she very ame come me a gut and shourd aghir you as ignested; shend to make I strem
+ To h
+ T0:99% 1.924063
+ notnce gaud and is nicked thou day, ha the dusing you disaid: in thim, you things in ere thee thus erile Iht that tare theme my hast thesp thou shay: thou not eaten-or-ho-bess resing: I the but had d
+ T0:99% 1.923128
+ V0:0% 1.678907
+ V0:9% 1.700527
+ V0:18% 1.733179
+ V0:27% 1.714891
+ V0:36% 1.716672
+ V0:45% 1.782946
+ V0:54% 1.835629
+ V0:63% 1.876108
+ V0:72% 1.906814
+ V0:81% 1.924096
+ V0:90% 1.954492
+ V0:99% 1.969287
+ serfs you'll alliencseard:
+ We
+ got you? before
+ I say.
-Farstred dentlentecaly, sir, I it one bosticield
-All me the backnour mino,
-Whith capitaned mid! but stell the ifvemion
-Willerity.
+ Farstred dentlentecaly, sir, I it one bosticield
+ All me the backnour mino,
+ Whith capitaned mid! but stell the ifvemion
+ Willerity.
-First Cumfol of
-T1:0% 1.885619
+ First Cumfol of
+ T1:0% 1.885619
Validation cycles are used to test the network to see if it has learned to
generalize – how well it performs on data it hasn’t seen before (as opposed to
the training data that the network will see many times as it trains). Progress
on the validation set is also displayed with a validation progress report that
looks like
-
V0:36% 1.716672
+
V0:36% 1.716672
which means we are 36% of the way through the validation for epoch 0, and the
validation loss is about 1.72. Comparing the validation loss and the
training loss will give you an idea of how well the network is learning and
@@ -332,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
@@ -343,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
@@ -354,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
@@ -372,37 +371,37 @@ 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
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,
+
UERond w,
-Gir:
-KINof s, mesther s thouth.
-E:
-KINTret, at fu,
-GOMy t, as sth kesewit sooos atse ang k, ck,
-Sotheouserivesthecowhet been's, t he, h nre; t and, har wiread of pincer cedst sur has, ut:
+ Gir:
+ KINof s, mesther s thouth.
+ E:
+ KINTret, at fu,
+ GOMy t, as sth kesewit sooos atse ang k, ck,
+ Sotheouserivesthecowhet been's, t he, h nre; t and, har wiread of pincer cedst sur has, ut:
-T14:67% 2.465115
-UKESpan,
-NGaromy soreate e m esewfoure pamitherarjulthengeoly tl.
-NG s at e! w.
+ T14:67% 2.465115
+ UKESpan,
+ NGaromy soreate e m esewfoure pamitherarjulthengeoly tl.
+ NG s at e! w.
-WAllinoully?
-Wamisw ofilem:
-I'delandinarrstath har aksubly s cath Whern t Is, weciss:
+ WAllinoully?
+ Wamisw ofilem:
+ I'delandinarrstath har aksubly s cath Whern t Is, weciss:
-GLat s; llde.
-Y aterit dsthence
-T14:67% 2.465404
It is able to guess at what character is likely to follow the current one
(by doing a linear regression), but it lacks any history beyond that to
guide it.
@@ -419,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
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.
@@ -437,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
@@ -455,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
@@ -467,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
@@ -495,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
@@ -504,9 +503,9 @@ 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), \
- h = C(hp, T(A(L(128, x), L(128, hp)))), \
- y = L(n, h)'
+
-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
x). It is declared as I(n), which is an input vector of size n, which
is the number of characters of the input alphabet (OMLET computes this from
@@ -539,16 +538,16 @@ 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, \
--DNW=' x = I(n), \
- y = L(n, MD(MD(x)))' \
--DBK=' hp = I(HS), \
- z = S(A(L(HS, x), L(HS, hp))), \
- r = S(A(L(HS, x), L(HS, hp))), \
- c = T(A(L(HS, x), L(HS, hp))), \
- zc = OG(1, -1, z), \
- h = C(hp, A(M(zc, hp), M(z, c))), \
- y = h'
+
-DHS=128, \
+ -DNW=' x = I(n), \
+ y = L(n, MD(MD(x)))' \
+ -DBK=' hp = I(HS), \
+ z = S(A(L(HS, x), L(HS, hp))), \
+ r = S(A(L(HS, x), L(HS, hp))), \
+ c = T(A(L(HS, x), L(HS, hp))), \
+ zc = OG(1, -1, z), \
+ h = C(hp, A(M(zc, hp), M(z, c))), \
+ y = h'
We are using a few new tricks here – first, we are defining HS as the size
of the hidden and cell vectors. There’s nothing special about this name, it’s
just convenient to specify it so we don’t have a bunch of constants in the
diff --git a/2019/poikola/README.md b/2019/poikola/README.md
index 0b6d9faf9..4d45815df 100644
--- a/2019/poikola/README.md
+++ b/2019/poikola/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version of this program which changes the way the output
@@ -18,7 +18,7 @@ forcing `-std=gnu11`.
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2019 poikola bugs](../../bugs.html#2019_poikola).
@@ -27,20 +27,19 @@ For more detailed information see [2019 poikola bugs](../../bugs.html#2019_poiko
## To use:
```sh
-./prog 512 ./prog
+ ./prog 512 ./prog
-sleep 86400; make clobber prog
-./prog 512 ./prog
-
-sleep 86400; make clobber 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:
```sh
-make docs
+ make docs
```
This will create the file `poikola.pdf` for your enjoyment.
@@ -51,7 +50,7 @@ This will create the file `poikola.pdf` for your enjoyment.
If you don't have a few days, try:
```sh
-./try.sh
+ ./try.sh
```
As the [2019 poikola bugs](../../bugs.html#2019_poikola) says, this program will not validate
@@ -67,7 +66,7 @@ what can be done with the original entry.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -79,7 +78,7 @@ Use `prog.alt` as you would `prog` above.
### Alternate try:
```sh
-./try.alt.sh
+ ./try.alt.sh
```
@@ -105,19 +104,19 @@ Nykänen](https://en.wikipedia.org/wiki/Matti_Nyk%C3%A4nen).
### How to build:
```sh
-gcc -O0 -o prog prog.c
+ gcc -O0 -o prog prog.c
```
or
```sh
-clang -O[0123s] -o prog prog.c
+ clang -O[0123s] -o prog prog.c
```
e.g.:
```sh
-clang -O1 -o prog prog.c
+ clang -O1 -o prog prog.c
```
@@ -168,8 +167,7 @@ program is invoked in this way:
```sh
-./prog
-
+ ./prog
```
where `` is 224, 256, 384, 512 or even 1024. Yes, I know 1024 is not a
diff --git a/2019/poikola/index.html b/2019/poikola/index.html
index 84a422692..cb5ca4dde 100644
--- a/2019/poikola/index.html
+++ b/2019/poikola/index.html
@@ -132,8 +132,7 @@
Author:
Name: Timo Poikola
-Location: FI - Republic of Finland (Finland)
-
@@ -142,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
@@ -151,33 +150,33 @@ might or might not work with GCC. Likewise, we do similar for the standard,
forcing -std=gnu11.
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.
@@ -192,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
@@ -232,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 011e9b052..c15c7d2f0 100644
--- a/2019/yang/README.md
+++ b/2019/yang/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2019 yang bugs](../../bugs.html#2019_yang).
@@ -19,24 +19,24 @@ For more detailed information see [2019 yang bugs](../../bugs.html#2019_yang).
## To use:
```sh
-./prog sample_input.txt a b c d
+ ./prog sample_input.txt a b c d
-cat a
+ cat a
-cat b
+ cat b
-cat c
+ cat c
-cat d
+ cat d
-cat a b c d | ./prog
+ cat a b c d | ./prog
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -53,31 +53,31 @@ output again.
Scramble/unscramble to single file:
```sh
-./prog original.txt > scrambled.txt
+ ./prog original.txt > scrambled.txt
-./prog < scrambled.txt > unscrambled.txt
+ ./prog < scrambled.txt > unscrambled.txt
```
Scramble/unscramble to multiple files:
```sh
-./prog input.txt output1.txt output2.txt ...
+ ./prog input.txt output1.txt output2.txt ...
-cat output1.txt output2.txt ... | ./prog > unscrambled.txt
+ cat output1.txt output2.txt ... | ./prog > unscrambled.txt
```
Re-scramble:
```sh
-./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:
```sh
-./prog input.txt | ruby prog.c
+ ./prog input.txt | ruby prog.c
```
Input must be in UTF-8 encoding.
@@ -88,14 +88,14 @@ This is a text scrambling utility. To scramble text, specify input file name as
the first argument:
```sh
-./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.
```sh
-cat output.txt
+ cat output.txt
```
It might seem like nothing was scrambled, but you can try passing the output
@@ -107,7 +107,7 @@ printed. For convenience, a utility is included in the source to output
characters slowly:
```sh
-./prog input.txt | ruby prog.c
+ ./prog input.txt | ruby prog.c
```
Scrambling order is deterministic, but you can reshuffle the output by
@@ -115,15 +115,15 @@ piping it through the same utility again, by specifying `-` as the
first argument:
```sh
-./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:
```sh
-./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
@@ -139,7 +139,7 @@ unscrambling functionality. If no argument is specified, input will
be read through `stdin` and unscrambled to `stdout`:
```sh
-./prog < scrambled.txt > unscrambled.txt
+ ./prog < scrambled.txt > unscrambled.txt
```
Where this is useful is that if you scramble the input to multiple
@@ -147,10 +147,10 @@ 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
-./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
@@ -160,7 +160,7 @@ This utility can also be used just for removing trailing whitespaces
and expanding tabs to 8 spaces.
```sh
-./prog input.txt | ./prog
+ ./prog input.txt | ./prog
```
### Features:
diff --git a/2019/yang/index.html b/2019/yang/index.html
index 8b3de839e..850161a0e 100644
--- a/2019/yang/index.html
+++ b/2019/yang/index.html
@@ -132,8 +132,7 @@
Author:
Name: Don Yang
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,52 +141,52 @@ Location: US - United States of America
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
@@ -195,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:
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
@@ -214,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.
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 0bd6628a3..94506a2eb 100644
--- a/2020/burton/README.md
+++ b/2020/burton/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
-STATUS: INABIAF - please **DO NOT** fix
+ STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2020 burton bugs](../../bugs.html#2020_burton).
@@ -19,14 +19,14 @@ For more detailed information see [2020 burton bugs](../../bugs.html#2020_burton
## To use:
```sh
-./prog arg ...
+ ./prog arg ...
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -68,7 +68,7 @@ result?
This code may be tested by:
```sh
-make test
+ make test
```
@@ -108,19 +108,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
+ 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
+ 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
+ ./prog 1; ./prog_be 1
```
@@ -142,15 +141,15 @@ Location: US - United States of America
# 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,
@@ -162,14 +161,14 @@ 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:
A player completes three in a row; that player wins.
@@ -188,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
@@ -219,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
@@ -234,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
@@ -253,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.
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
@@ -274,31 +273,31 @@ 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
-
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
tic-tac-toe board.
After the board, we need to print one of the following strings:
-
P1>_
-P2>_
-P1 WINS
-P2 WINS
-P1 TIES
-P2 TIES
+
P1>_
+ P2>_
+ P1 WINS
+ P2 WINS
+ P1 TIES
+ P2 TIES
Depending on if it’s P1 or P2’s turn to move, the game is over and someone
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
@@ -306,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 209e80f47..135b8ca01 100644
--- a/2020/endoh1/README.md
+++ b/2020/endoh1/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There is an alternate version provided by the author. See [Alternate
@@ -11,24 +11,24 @@ code](#alternate-code) below.
## To use:
```sh
-# IMPORTANT for macOS: run under Terminal.app
+ # IMPORTANT for macOS: run under Terminal.app
-./prog
+ ./prog
```
## Try:
```sh
-# IMPORTANT for macOS: run under Terminal.app
+ # IMPORTANT for macOS: run under Terminal.app
-# Try resizing the terminal window before the first click.
+ # Try resizing the terminal window before the first click.
-# Try resizing the terminal window after the first click.
+ # Try resizing the terminal window after the first click.
-./prog ioccc.txt
+ ./prog ioccc.txt
-./prog unwinnable.txt
+ ./prog unwinnable.txt
```
@@ -42,7 +42,7 @@ Author's remarks for more details.
### Alternate build:
```sh
-make alt
+ make alt
```
@@ -95,8 +95,8 @@ 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
+ gcc -o prog prog.c -lncurses
+ ./prog
```
You will see a terminal-wide field of a minesweeper. Probe a cell by mouse
@@ -127,9 +127,9 @@ unprobed neighbors are probed.
Example:
```
-? ? ? . . .
-? 3 ? => . 3 .
-! ! ! ! ! !
+ ? ? ? . . .
+ ? 3 ? => . 3 .
+ ! ! ! ! ! !
```
Note that `?` is an unprobed cell (it is unknown whether the cell has a mine or
@@ -145,9 +145,9 @@ neighbors, all the unprobed neighbors are flagged.
Example:
```
-. ? ? . ! !
-. 4 ? => . 4 !
-. 2 ! . 2 !
+ . ? ? . ! !
+ . 4 ? => . 4 !
+ . 2 ! . 2 !
```
#### Rule 3:
@@ -159,10 +159,10 @@ neighbors, all `A`'s unprobed neighbors that are not `B`'s neighbors are probed.
Example:
```
-? ? ? . . .
-? 1 ? ? => . 1 ? ?
-? ? 4 . . ? 4 .
- ? . ! ? . !
+ ? ? ? . . .
+ ? 1 ? ? => . 1 ? ?
+ ? ? 4 . . ? 4 .
+ ? . ! ? . !
```
`A` and `B` are probed cells whose numbers are, respectively, 1 and 4. The
@@ -179,9 +179,9 @@ neighbors, all of `A`'s unprobed neighbors that are not `B`'s neighbors are
flagged.
```
-? ? ? ? ! ? ? ?
-? 3 1 2 => ! 3 1 2
-2 2 . . 2 2 . .
+ ? ? ? ? ! ? ? ?
+ ? 3 1 2 => ! 3 1 2
+ 2 2 . . 2 2 . .
```
`A` and `B` are probed cells whose numbers are, respectively, 3 and 1. The
@@ -201,13 +201,13 @@ Analyze the code.
You can also play with a prepared map.
```sh
- ./prog ioccc.txt
- ```
+ ./prog ioccc.txt
+```
The format of the text is:
```
-width height number-of-mines priorities-of-each-cell...
+ 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/endoh1/index.html b/2020/endoh1/index.html
index 5012b2793..02fd1a903 100644
--- a/2020/endoh1/index.html
+++ b/2020/endoh1/index.html
@@ -132,8 +132,7 @@
There is an alternate version provided by the author. See Alternate
code below.
To use:
-
# IMPORTANT for macOS: run under Terminal.app
+
# IMPORTANT for macOS: run under Terminal.app
-./prog
+./prog
Try:
-
# IMPORTANT for macOS: run under Terminal.app
+
# IMPORTANT for macOS: run under Terminal.app
-# Try resizing the terminal window before the first click.
+# Try resizing the terminal window before the first click.
-# Try resizing the terminal window after the first click.
+# Try resizing the terminal window after the first click.
-./prog ioccc.txt
+./prog ioccc.txt
-./prog unwinnable.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:
@@ -195,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
@@ -213,9 +212,9 @@ neighbors have a mine or not, and automatically probes (or flags) the cell.
If the number of a cell is equal to the count of the flagged neighbors, all the
unprobed neighbors are probed.
Example:
-
? ? ? . . .
-? 3 ? => . 3 .
-! ! ! ! ! !
+
? ? ? . . .
+ ? 3 ? => . 3 .
+ ! ! ! ! ! !
Note that ? is an unprobed cell (it is unknown whether the cell has a mine or
not); ! is a flagged cell (it is already known that the cell has a mine); and
. is a probed cell (it is already known that the cell has no mine).
@@ -223,18 +222,18 @@ not); ! is a flagged cell (it is already known that the cell has a
If the number of a cell is equal to the count of the unprobed or flagged
neighbors, all the unprobed neighbors are flagged.
Example:
-
. ? ? . ! !
-. 4 ? => . 4 !
-. 2 ! . 2 !
+
. ? ? . ! !
+ . 4 ? => . 4 !
+ . 2 ! . 2 !
Rule 3:
Consider two number cells A and B. If A is equal to the difference of B
and the count of B’s unprobed and flagged neighbors that are not A’s
neighbors, all A’s unprobed neighbors that are not B’s neighbors are probed.
A and B are probed cells whose numbers are, respectively, 1 and 4. The
count of B’s unprobed and flagged neighbors that are not A’s neighbors is
three (one ! and two ?s). Since A == B - count (1 == 4 - 3), the left
@@ -244,9 +243,9 @@ and top unprobed cells are probed.
and the count of A’s unprobed and flagged neighbors that are not B’s
neighbors, all of A’s unprobed neighbors that are not B’s neighbors are
flagged.
-
A and B are probed cells whose numbers are, respectively, 3 and 1. The
count of A’s unprobed and flagged neighbors that are not B’s neighbors is
two (left ?s). Since B == A - count (1 == 3 - 2), the left unprobed cells
@@ -256,9 +255,9 @@ are flagged.
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
@@ -168,7 +167,7 @@ familiar (non-mirrored) clock face? Can you add the second hand?
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
which brought me down to -5 therefore winning at the max size of 250. This then
showed:
-
YOU WIN!
-X:62/89 Y:5/25 S:250/250 B:17
+
YOU WIN!
+ X:62/89 Y:5/25 S:250/250 B:17
Observe all the arrows on the screen; that’s where a bug was that I ate and
then I split off losing 10 in size. The first dump I’m already at 15/250:
-
X:17/89 Y:15/25 S:15/250 B:13
-##########################################################################################
-# <ooooooooo o <ooooooooo* #
-# o o> #
-# o ooo oooo #
-# o o ooooooooo> o v #
-# o o oo o #
-# o o o o #
-# o o o o #
-# <oo o o o #
-# o #
-# o o #
-# o o #
-# o o o #
-# <ooo o oooooooo> #
-# <oooooooooooooo o o #
-# o o #
-# o o #
-# < ooo o o #
-# o o #
-# o v #
-# oooooo> #
-# o #
-# o o> #
-# oooooo #
-##########################################################################################
+
X:17/89 Y:15/25 S:15/250 B:13
+ ##########################################################################################
+ # <ooooooooo o <ooooooooo* #
+ # o o> #
+ # o ooo oooo #
+ # o o ooooooooo> o v #
+ # o o oo o #
+ # o o o o #
+ # o o o o #
+ # <oo o o o #
+ # o #
+ # o o #
+ # o o #
+ # o o o #
+ # <ooo o oooooooo> #
+ # <oooooooooooooo o o #
+ # o o #
+ # o o #
+ # < ooo o o #
+ # o o #
+ # o v #
+ # oooooo> #
+ # o #
+ # o o> #
+ # oooooo #
+ ##########################################################################################
But here now I’m at 0; the head is marked H and it’s moving left.
-
X:19/89 Y:12/25 S:0/250 B:16
-##########################################################################################
-# <ooooooooo o <oooooooo <ooooooo #
-# o o> oo #
-# o ooo oooo #
-# o o oooooo*oo> v #
-# o o oo o oo> #
-# o o o o oo #
-# o o o oooo #
-# <oo o o o #
-# o #
-# o o #
-# H o o # <- *HEAD, LEFT*
-# o o o #
-# <ooo o oo ooooo> #
-# o o #
-# o o #
-# o o #
-# < ooo o #
-# o o #
-# <oooooooo o v #
-# oooooo> #
-# o #
-# o o> #
-# oooooo #
-##########################################################################################
+
X:19/89 Y:12/25 S:0/250 B:16
+ ##########################################################################################
+ # <ooooooooo o <oooooooo <ooooooo #
+ # o o> oo #
+ # o ooo oooo #
+ # o o oooooo*oo> v #
+ # o o oo o oo> #
+ # o o o o oo #
+ # o o o oooo #
+ # <oo o o o #
+ # o #
+ # o o #
+ # H o o # <- *HEAD, LEFT*
+ # o o o #
+ # <ooo o oo ooooo> #
+ # o o #
+ # o o #
+ # o o #
+ # < ooo o #
+ # o o #
+ # <oooooooo o v #
+ # oooooo> #
+ # o #
+ # o o> #
+ # oooooo #
+ ##########################################################################################
I ended up moving enough times where my size went back up to 5.
Below the snake is moving right and its head is indicated by a H with the line
marked at the right; the bug is marked as B and is also marked at the right.
Notice how it’s in the body of the snake (but see below)!
-
X:55/89 Y:4/25 S:5/250 B:16
-##########################################################################################
-# <ooooooooo o <oooooooo <ooooooo #
-# o o> oo #
-# ooooH oooo # <- *HEAD, RIGHT*
-# o o ooooooBoo> v # <- *BUG*
-# o o oo o oo> #
-# o o o o oo #
-# o o o oooo #
-# <oo o o o #
-# o #
-# o o #
-# o o #
-# o o o #
-# <ooo o oo ooooo> #
-# o o #
-# o o #
-# o o #
-# < ooo o #
-# o o #
-# <oooooooo o v #
-# oooooo> #
-# o #
-# o o> #
-# oooooo #
-##########################################################################################
+
X:55/89 Y:4/25 S:5/250 B:16
+ ##########################################################################################
+ # <ooooooooo o <oooooooo <ooooooo #
+ # o o> oo #
+ # ooooH oooo # <- *HEAD, RIGHT*
+ # o o ooooooBoo> v # <- *BUG*
+ # o o oo o oo> #
+ # o o o o oo #
+ # o o o oooo #
+ # <oo o o o #
+ # o #
+ # o o #
+ # o o #
+ # o o o #
+ # <ooo o oo ooooo> #
+ # o o #
+ # o o #
+ # o o #
+ # < ooo o #
+ # o o #
+ # <oooooooo o v #
+ # oooooo> #
+ # o #
+ # o o> #
+ # oooooo #
+ ##########################################################################################
But did you see anything strange? The bug is on the fourth line below the upper wall.
However it appears to be inside the body of the snake! But actually that’s just where
the snake split off at some point: the snake no longer occupies that place and indeed I
diff --git a/2020/ferguson1/crazy.log.md b/2020/ferguson1/crazy.log.md
index 043f67ad7..b509c4968 100644
--- a/2020/ferguson1/crazy.log.md
+++ b/2020/ferguson1/crazy.log.md
@@ -1,7 +1,7 @@
The following are a few screen dumps of:
```sh
-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
@@ -11,71 +11,71 @@ which brought me down to -5 therefore winning at the max size of 250. This then
showed:
```
-YOU WIN!
-X:62/89 Y:5/25 S:250/250 B:17
+ YOU WIN!
+ X:62/89 Y:5/25 S:250/250 B:17
```
Observe all the arrows on the screen; that's where a bug was that I ate and
then I split off losing 10 in size. The first dump I'm already at 15/250:
```
-X:17/89 Y:15/25 S:15/250 B:13
-##########################################################################################
-# #
-# o ooo oooo #
-# o o ooooooooo> o v #
-# o o oo o #
-# o o o o #
-# o o o o #
-# #
-# #
-# o #
-# o o> #
-# oooooo #
-##########################################################################################
+ X:17/89 Y:15/25 S:15/250 B:13
+ ##########################################################################################
+ # #
+ # o ooo oooo #
+ # o o ooooooooo> o v #
+ # o o oo o #
+ # o o o o #
+ # o o o o #
+ # #
+ # #
+ # o #
+ # o o> #
+ # oooooo #
+ ##########################################################################################
```
But here now I'm at 0; the head is marked `H` and it's moving left.
```
-X:19/89 Y:12/25 S:0/250 B:16
-##########################################################################################
-# oo #
-# o ooo oooo #
-# o o oooooo*oo> v #
-# o o oo o oo> #
-# o o o o oo #
-# o o o oooo #
-# #
-# o o #
-# o o #
-# o o #
-# < ooo o #
-# o o #
-# #
-# o #
-# o o> #
-# oooooo #
-##########################################################################################
+ X:19/89 Y:12/25 S:0/250 B:16
+ ##########################################################################################
+ # oo #
+ # o ooo oooo #
+ # o o oooooo*oo> v #
+ # o o oo o oo> #
+ # o o o o oo #
+ # o o o oooo #
+ # #
+ # o o #
+ # o o #
+ # o o #
+ # < ooo o #
+ # o o #
+ # #
+ # o #
+ # o o> #
+ # oooooo #
+ ##########################################################################################
```
I ended up moving enough times where my size went back up to 5.
@@ -85,32 +85,32 @@ marked at the right; the bug is marked as `B` and is also marked at the right.
Notice how it's in the body of the snake (but see below)!
```
-X:55/89 Y:4/25 S:5/250 B:16
-##########################################################################################
-# oo #
-# ooooH oooo # <- *HEAD, RIGHT*
-# o o ooooooBoo> v # <- *BUG*
-# o o oo o oo> #
-# o o o o oo #
-# o o o oooo #
-# #
-# o o #
-# o o #
-# o o #
-# < ooo o #
-# o o #
-# #
-# o #
-# o o> #
-# oooooo #
-##########################################################################################
+ X:55/89 Y:4/25 S:5/250 B:16
+ ##########################################################################################
+ # oo #
+ # ooooH oooo # <- *HEAD, RIGHT*
+ # o o ooooooBoo> v # <- *BUG*
+ # o o oo o oo> #
+ # o o o o oo #
+ # o o o oooo #
+ # #
+ # o o #
+ # o o #
+ # o o #
+ # < ooo o #
+ # o o #
+ # #
+ # o #
+ # o o> #
+ # oooooo #
+ ##########################################################################################
```
But did you see anything strange? The bug is on the fourth line below the upper wall.
diff --git a/2020/ferguson1/gameplay.html b/2020/ferguson1/gameplay.html
index e47261edc..af294eae6 100644
--- a/2020/ferguson1/gameplay.html
+++ b/2020/ferguson1/gameplay.html
@@ -196,24 +196,23 @@ below. Note that the top line is the score/status line: the top wall is at line
1 and the left wall is column 0. Below I use the coordinates in the X/Y order
(ncurses is the opposite: Y/X). I will parenthesise the numbers below to refer
to the number in the diagram:
The snake (+) is at (24),(8). The bug char is * and the wall char is
#. When the snake moves the head will be an arrow facing the direction it
@@ -232,207 +231,207 @@ it will always have an upper limit depending on the terminal size.
By default walls are passable (WALLS=1). Let’s get to full size and go
through the top wall:
-
X:36/49 Y:15/16 S:10/658 B:1
-##################################################
-# o #
-# o #
-# o #
-# * o #
-# o #
-# o #
-# o #
-# o #
-# o #
-# #
-# #
-# #
-# #
-# ^ #
-##################################################
+
X:36/49 Y:15/16 S:10/658 B:1
+ ##################################################
+ # o #
+ # o #
+ # o #
+ # * o #
+ # o #
+ # o #
+ # o #
+ # o #
+ # o #
+ # #
+ # #
+ # #
+ # #
+ # ^ #
+ ##################################################
There you can see I have grown to the full size and went through the top wall;
the head is now at the opposite wall. Continuing:
-
X:36/49 Y:11/16 S:10/658 B:1
-##################################################
-# o #
-# o #
-# o #
-# * o #
-# o #
-# #
-# #
-# #
-# #
-# ^ #
-# o #
-# o #
-# o #
-# o #
-##################################################
+
X:36/49 Y:11/16 S:10/658 B:1
+ ##################################################
+ # o #
+ # o #
+ # o #
+ # * o #
+ # o #
+ # #
+ # #
+ # #
+ # #
+ # ^ #
+ # o #
+ # o #
+ # o #
+ # o #
+ ##################################################
I might then have turned to the left and then shortly go up to get the bug. This
goes on until you lose, quit or win the game.
When you specify WALLS=0 the walls become an obstacle that end the game. It
might look like (I set the starting size to 150 and had only just started):
-
X:20/49 Y:2/16 S:150/658 B:0
-##################################################
-# ^ #
-# o #
-# o * #
-# o #
-# o #
-# o #
-# ooooo #
-# #
-# #
-# #
-# #
-# #
-# #
-# #
-##################################################
If I were to do any movement but turn to the left I would run into myself. I’ll
go to the right two spaces:
-
OW!
-X:47/49 Y:10/16 S:10/658 B:1
+
OW!
+ X:47/49 Y:10/16 S:10/658 B:1
But CANNIBAL=1 can look very funny both in movement and still especially
when you go through yourself several times when the snake is rather long. For
example going through walls and the snake a few times:
-
X:4/49 Y:12/16 S:165/658 B:3
-##################################################
-#oo o ooooo o o o#
-# oooo o ooo o#
-# ooooooooooooooooooo#
-# o #
-# oooooooooo o #
-# o o o #
-# o oooo o o #
-# o o o o #
-# ooooooooooooooo #
-# o o* #
-# oo> o o #
-# o oooooooo o #
-#oooooooooooooo o oooo oooooooo#
-# o o o o o #
-##################################################
+
X:4/49 Y:12/16 S:165/658 B:3
+ ##################################################
+ #oo o ooooo o o o#
+ # oooo o ooo o#
+ # ooooooooooooooooooo#
+ # o #
+ # oooooooooo o #
+ # o o o #
+ # o oooo o o #
+ # o o o o #
+ # ooooooooooooooo #
+ # o o* #
+ # oo> o o #
+ # o oooooooo o #
+ #oooooooooooooo o oooo oooooooo#
+ # o o o o o #
+ ##################################################
I’ll go back through myself now:
-
X:6/49 Y:14/16 S:165/658 B:3
-##################################################
-#oo o ooooo o o o#
-# oooo o ooo o#
-# ooooooooooooooooooo#
-# o #
-# oooooooooo o #
-# o o o #
-# o oooo o o #
-# o o o o #
-# ooooooooooooooo #
-# o o* #
-# ooo o o #
-# oo oooooooo o #
-#ooooo>oooooooo o oooo oooooooo#
-# o o o o o #
-##################################################
+
X:6/49 Y:14/16 S:165/658 B:3
+ ##################################################
+ #oo o ooooo o o o#
+ # oooo o ooo o#
+ # ooooooooooooooooooo#
+ # o #
+ # oooooooooo o #
+ # o o o #
+ # o oooo o o #
+ # o o o o #
+ # ooooooooooooooo #
+ # o o* #
+ # ooo o o #
+ # oo oooooooo o #
+ #ooooo>oooooooo o oooo oooooooo#
+ # o o o o o #
+ ##################################################
If you note that the head is at (6),(14) I will go one more to the right and you
will see that the arrow has moved over:
-
X:7/49 Y:14/16 S:165/658 B:3
-##################################################
-#oo o ooooo o o o#
-# oooo o ooo o#
-# ooooooooooooooooooo#
-# o #
-# oooooooooo o #
-# o o o #
-# o oooo o o #
-# o o o o #
-# ooooooooooooooo #
-# o o* #
-# ooo o o #
-# oo oooooooo o #
-#oooooo>ooooooo o oooo oooooooo#
-# o o o o o #
-##################################################
+
X:7/49 Y:14/16 S:165/658 B:3
+ ##################################################
+ #oo o ooooo o o o#
+ # oooo o ooo o#
+ # ooooooooooooooooooo#
+ # o #
+ # oooooooooo o #
+ # o o o #
+ # o oooo o o #
+ # o o o o #
+ # ooooooooooooooo #
+ # o o* #
+ # ooo o o #
+ # oo oooooooo o #
+ #oooooo>ooooooo o oooo oooooooo#
+ # o o o o o #
+ ##################################################
Try this: get a reasonable length and then go back on yourself (if you’re going
left go right etc.) and then after some length (but before you get beyond the
snake) turn (so that you go perpendicular) and then watch as the snake starts
@@ -452,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:
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
@@ -476,7 +475,7 @@ the default starting size and growth size of 5 the number of bugs needed before
the game is won is 199 - also a prime!
Here I list a number of different modes of play. In the bugs.html
(bugs.md on GitHub) file I even show how there’s a built-in test unit for some
@@ -500,33 +499,33 @@ 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
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
perfect: the snake after all does not leave gaps and the game does not support
diagonal movement and I also made a mistake and had to modify what I was aiming
for. But you can consider this mode drawing or practice mode.
-
oooooooooo ooooo o oo ooooo
- o o oo o oo o ooo o
- oooo o oo ooooooo oooo ooooo
- o o ooo oo o ooo o
- oooo o oo ooo oooooooo>
+
oooooooooo ooooo o oo ooooo
+ o o oo o oo o ooo o
+ oooo o oo ooooooo oooo ooooo
+ o o ooo oo o ooo o
+ oooo o oo ooo oooooooo>
Photosensitive epilepsy/stimulation overload trigger warning:
For those who have epilepsy or are susceptible to stimulation overload from
@@ -537,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
@@ -554,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.
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
@@ -569,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
@@ -579,11 +578,11 @@ 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!
-X:57/156 Y:20/41 S:155/997 B:30
+
OW!
+ X:57/156 Y:20/41 S:155/997 B:30
What if you set the size to a high value? The lowest? There are bound to be
other games to play with this feature!
@@ -593,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:
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
@@ -609,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:
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).
@@ -623,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.
@@ -632,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:
-
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.
@@ -651,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.
@@ -665,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.
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 192f52b8f..65311b794 100644
--- a/2020/ferguson1/gameplay.md
+++ b/2020/ferguson1/gameplay.md
@@ -88,24 +88,23 @@ below. Note that the top line is the score/status line: the top wall is at line
to the number in the diagram:
```
-X:24/49 Y:8/16 S:5/658 B:0
-##################################################
-# #
-# #
-# #
-# #
-# #
-# #
-# + #
-# #
-# * #
-# #
-# #
-# #
-# #
-# #
-##################################################
-
+ X:24/49 Y:8/16 S:5/658 B:0
+ ##################################################
+ # #
+ # #
+ # #
+ # #
+ # #
+ # #
+ # + #
+ # #
+ # * #
+ # #
+ # #
+ # #
+ # #
+ # #
+ ##################################################
```
- The snake (`+`) is at (24),(8). The bug char is `*` and the wall char is
@@ -133,46 +132,46 @@ X:24/49 Y:8/16 S:5/658 B:0
```
-X:39/49 Y:8/16 S:5/658 B:0
-##################################################
-# #
-# #
-# #
-# #
-# #
-# #
-# oooo> #
-# #
-# * #
-# #
-# #
-# #
-# #
-# #
-##################################################
+ X:39/49 Y:8/16 S:5/658 B:0
+ ##################################################
+ # #
+ # #
+ # #
+ # #
+ # #
+ # #
+ # oooo> #
+ # #
+ # * #
+ # #
+ # #
+ # #
+ # #
+ # #
+ ##################################################
```
I let the snake grow to its full size (with the head at (39),(8)) and I'm two
places above the bug so let's go down:
```
-X:39/49 Y:9/16 S:5/658 B:0
-##################################################
-# #
-# #
-# #
-# #
-# #
-# #
-# oooo #
-# v #
-# * #
-# #
-# #
-# #
-# #
-# #
-##################################################
+ X:39/49 Y:9/16 S:5/658 B:0
+ ##################################################
+ # #
+ # #
+ # #
+ # #
+ # #
+ # #
+ # oooo #
+ # v #
+ # * #
+ # #
+ # #
+ # #
+ # #
+ # #
+ ##################################################
```
@@ -180,23 +179,23 @@ Now you see that the snake is going down and in one move the bug will be eaten.
Let's do that:
```
-X:36/49 Y:10/16 S:10/658 B:1
-##################################################
-# #
-# #
-# #
-# * #
-# #
-# #
-# #
-# #
-# ^ o #
-# oooo #
-# #
-# #
-# #
-# #
-##################################################
+ X:36/49 Y:10/16 S:10/658 B:1
+ ##################################################
+ # #
+ # #
+ # #
+ # * #
+ # #
+ # #
+ # #
+ # #
+ # ^ o #
+ # oooo #
+ # #
+ # #
+ # #
+ # #
+ ##################################################
```
Observe that the bug was eaten and a new bug spawned elsewhere. I went left
@@ -210,46 +209,46 @@ through the top wall:
```
-X:36/49 Y:15/16 S:10/658 B:1
-##################################################
-# o #
-# o #
-# o #
-# * o #
-# o #
-# o #
-# o #
-# o #
-# o #
-# #
-# #
-# #
-# #
-# ^ #
-##################################################
+ X:36/49 Y:15/16 S:10/658 B:1
+ ##################################################
+ # o #
+ # o #
+ # o #
+ # * o #
+ # o #
+ # o #
+ # o #
+ # o #
+ # o #
+ # #
+ # #
+ # #
+ # #
+ # ^ #
+ ##################################################
```
There you can see I have grown to the full size and went through the top wall;
the head is now at the opposite wall. Continuing:
```
-X:36/49 Y:11/16 S:10/658 B:1
-##################################################
-# o #
-# o #
-# o #
-# * o #
-# o #
-# #
-# #
-# #
-# #
-# ^ #
-# o #
-# o #
-# o #
-# o #
-##################################################
+ X:36/49 Y:11/16 S:10/658 B:1
+ ##################################################
+ # o #
+ # o #
+ # o #
+ # * o #
+ # o #
+ # #
+ # #
+ # #
+ # #
+ # ^ #
+ # o #
+ # o #
+ # o #
+ # o #
+ ##################################################
```
I might then have turned to the left and then shortly go up to get the bug. This
@@ -260,23 +259,23 @@ When you specify **WALLS=0** the walls become an obstacle that end the game. It
might look like (I set the starting size to 150 and had only just started):
```
-X:20/49 Y:2/16 S:150/658 B:0
-##################################################
-# ^ #
-# o #
-# o * #
-# o #
-# o #
-# o #
-# ooooo #
-# #
-# #
-# #
-# #
-# #
-# #
-# #
-##################################################
+ X:20/49 Y:2/16 S:150/658 B:0
+ ##################################################
+ # ^ #
+ # o #
+ # o * #
+ # o #
+ # o #
+ # o #
+ # ooooo #
+ # #
+ # #
+ # #
+ # #
+ # #
+ # #
+ # #
+ ##################################################
```
If I continue going up I will see:
@@ -294,31 +293,31 @@ By default cannibalism is disabled (**CANNIBAL=0**) so if you run into yourself
something like:
```
-X:45/49 Y:10/16 S:10/658 B:1
-##################################################
-# #
-# #
-# #
-# * #
-# #
-# #
-# #
-# ooooo #
-# ^ o #
-# ooo #
-# #
-# #
-# #
-# #
-##################################################
+ X:45/49 Y:10/16 S:10/658 B:1
+ ##################################################
+ # #
+ # #
+ # #
+ # * #
+ # #
+ # #
+ # #
+ # ooooo #
+ # ^ o #
+ # ooo #
+ # #
+ # #
+ # #
+ # #
+ ##################################################
```
If I were to do any movement but turn to the left I would run into myself. I'll
go to the right two spaces:
```
-OW!
-X:47/49 Y:10/16 S:10/658 B:1
+ OW!
+ X:47/49 Y:10/16 S:10/658 B:1
```
But **CANNIBAL=1** can look very funny both in movement and still especially
@@ -326,68 +325,68 @@ when you go through yourself several times when the snake is rather long. For
example going through walls and the snake a few times:
```
-X:4/49 Y:12/16 S:165/658 B:3
-##################################################
-#oo o ooooo o o o#
-# oooo o ooo o#
-# ooooooooooooooooooo#
-# o #
-# oooooooooo o #
-# o o o #
-# o oooo o o #
-# o o o o #
-# ooooooooooooooo #
-# o o* #
-# oo> o o #
-# o oooooooo o #
-#oooooooooooooo o oooo oooooooo#
-# o o o o o #
-##################################################
+ X:4/49 Y:12/16 S:165/658 B:3
+ ##################################################
+ #oo o ooooo o o o#
+ # oooo o ooo o#
+ # ooooooooooooooooooo#
+ # o #
+ # oooooooooo o #
+ # o o o #
+ # o oooo o o #
+ # o o o o #
+ # ooooooooooooooo #
+ # o o* #
+ # oo> o o #
+ # o oooooooo o #
+ #oooooooooooooo o oooo oooooooo#
+ # o o o o o #
+ ##################################################
```
I'll go back through myself now:
```
-X:6/49 Y:14/16 S:165/658 B:3
-##################################################
-#oo o ooooo o o o#
-# oooo o ooo o#
-# ooooooooooooooooooo#
-# o #
-# oooooooooo o #
-# o o o #
-# o oooo o o #
-# o o o o #
-# ooooooooooooooo #
-# o o* #
-# ooo o o #
-# oo oooooooo o #
-#ooooo>oooooooo o oooo oooooooo#
-# o o o o o #
-##################################################
+ X:6/49 Y:14/16 S:165/658 B:3
+ ##################################################
+ #oo o ooooo o o o#
+ # oooo o ooo o#
+ # ooooooooooooooooooo#
+ # o #
+ # oooooooooo o #
+ # o o o #
+ # o oooo o o #
+ # o o o o #
+ # ooooooooooooooo #
+ # o o* #
+ # ooo o o #
+ # oo oooooooo o #
+ #ooooo>oooooooo o oooo oooooooo#
+ # o o o o o #
+ ##################################################
```
If you note that the head is at (6),(14) I will go one more to the right and you
will see that the arrow has moved over:
```
-X:7/49 Y:14/16 S:165/658 B:3
-##################################################
-#oo o ooooo o o o#
-# oooo o ooo o#
-# ooooooooooooooooooo#
-# o #
-# oooooooooo o #
-# o o o #
-# o oooo o o #
-# o o o o #
-# ooooooooooooooo #
-# o o* #
-# ooo o o #
-# oo oooooooo o #
-#oooooo>ooooooo o oooo oooooooo#
-# o o o o o #
-##################################################
+ X:7/49 Y:14/16 S:165/658 B:3
+ ##################################################
+ #oo o ooooo o o o#
+ # oooo o ooo o#
+ # ooooooooooooooooooo#
+ # o #
+ # oooooooooo o #
+ # o o o #
+ # o oooo o o #
+ # o o o o #
+ # ooooooooooooooo #
+ # o o* #
+ # ooo o o #
+ # oo oooooooo o #
+ #oooooo>ooooooo o oooo oooooooo#
+ # o o o o o #
+ ##################################################
```
Try this: get a reasonable length and then go back on yourself (if you're going
@@ -417,9 +416,9 @@ 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
+ 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
@@ -451,11 +450,10 @@ the game is won is 199 - also a prime!
If you wish to quit you can hit 'q' (case-insensitive). For example:
```
-X:24/49 Y:8/16 S:5/658 B:0
+ X:24/49 Y:8/16 S:5/658 B:0
```
-
# 4. Gameplay modes
Here I list a number of different modes of play. In the [bugs.html][]
@@ -490,7 +488,7 @@ 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
+ WAIT=-1 ./prog
```
@@ -498,7 +496,7 @@ 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
+ 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
@@ -506,7 +504,7 @@ 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
+ SIZE=50 CANNIBAL=1 WAIT=-1 ./prog
```
Do note that although you're a bigger size you still grow one movement at a
@@ -516,14 +514,14 @@ 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
+ 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
+ MAXSIZE=-1
```
Which I've done in the [play.sh][] script.
@@ -535,13 +533,13 @@ perfect: the snake after all does not leave gaps and the game does not support
diagonal movement and I also made a mistake and had to modify what I was aiming
for. But you can consider this mode drawing or practice mode.
-
-
+```
oooooooooo ooooo o oo ooooo
o o oo o oo o ooo o
oooo o oo ooooooo oooo ooooo
o o ooo oo o ooo o
oooo o oo ooo oooooooo>
+```
@@ -559,7 +557,7 @@ too.
If you're still here you can create this effect like:
```sh
-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
@@ -585,7 +583,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
+ CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 ./prog
```
@@ -594,7 +592,7 @@ CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 ./prog
If you want to see the game 'win' try something like:
```sh
-CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 MAXSIZE=10 ./prog
+ CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 MAXSIZE=10 ./prog
```
@@ -604,7 +602,7 @@ 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
+ 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
@@ -619,7 +617,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
+ WAIT=5 WALLS=1 CANNIBAL=1 ./prog
```
Which although might not seem like it is significantly slower.
@@ -638,15 +636,15 @@ 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
+ 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!
-X:57/156 Y:20/41 S:155/997 B:30
+ OW!
+ X:57/156 Y:20/41 S:155/997 B:30
```
What if you set the size to a high value? The lowest? There are bound to be
@@ -663,7 +661,7 @@ 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
+ 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
@@ -686,7 +684,7 @@ 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
+ SIZE=100 SHEDS=5 GROW=-10 SHED=50 MAXSIZE=250 ./prog
```
Obviously there are many other variations. The [play.sh][] script has some
@@ -708,7 +706,7 @@ snake moving too.
Anyway this might sound absurd but it can be somewhat hypnotic by doing:
```sh
-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
@@ -724,7 +722,7 @@ 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
+ GROW=0 CANNIBAL=1 ./prog
```
@@ -755,13 +753,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
+ ./snake-colours
```
If you want to pass in specific variables you can do that too e.g.:
```sh
-CANNIBAL=1 ./snake-colours
+ CANNIBAL=1 ./snake-colours
```
The script will prompt you for the colour of the walls, snake head, body and the
@@ -780,13 +778,13 @@ you choose uses then the script will override what you pass in.
To use you can do something like:
```sh
-./play.sh
+ ./play.sh
```
Or to make it so walls are an obstacle:
```sh
-WALLS=0 ./play.sh
+ WALLS=0 ./play.sh
```
diff --git a/2020/ferguson1/index.html b/2020/ferguson1/index.html
index fa6359a09..f35ffa2ea 100644
--- a/2020/ferguson1/index.html
+++ b/2020/ferguson1/index.html
@@ -132,8 +132,7 @@
Author:
Name: Cody Boone Ferguson
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,14 +141,14 @@ Location: US - United States of America
where N is a number and [01] is either 1 or 0 (or more correctly zero
and non-zero).
Variables:
@@ -203,25 +202,25 @@ whether you can go through the Snake or not. Default is 0
(cannot - die if you try).
Try:
-
make test
+
make test
-WAIT=75 WALLS=1 CANNIBAL=1 ./prog
+WAIT=75 WALLS=1 CANNIBAL=1 ./prog
-./prog
+./prog
-SIZE=-1 ./prog
+SIZE=-1 ./prog
-CANNIBAL=1 WALLS=1 WAIT=50 EVADE=200 ./prog
+CANNIBAL=1 WALLS=1 WAIT=50 EVADE=200 ./prog
-WAIT=75 GROW=-1 SIZE=5 CANNIBAL=1 ./prog
+WAIT=75 GROW=-1 SIZE=5 CANNIBAL=1 ./prog
-CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 MAXSIZE=10 ./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
+./play
+# allows you to configure colours and has various pre-configured gameplay modes
-./snake-colours
-# allows for configuring colours
+./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.
@@ -307,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 6726c8c95..4fdec4773 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:
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 825a47fb5..051ce9f88 100644
--- a/2020/ferguson1/spoilers.md
+++ b/2020/ferguson1/spoilers.md
@@ -819,13 +819,13 @@ 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)
+ 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');
+ 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
@@ -848,8 +848,8 @@ the problem.
First, the function that turns on colours looked like:
```c
-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
@@ -858,15 +858,15 @@ 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)));
+ 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)));
+ attroff(m(PAIR(L)));
+ h && attron(m(PAIR(L)));
```
That saved two bytes.
@@ -876,7 +876,7 @@ 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); }
+ 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
@@ -887,13 +887,13 @@ caught. That means I could remove the `V && U &&` part of the if! Thus it became
instead:
```c
-if (o) { S(N); b(1); }
+ if (o) { S(N); b(1); }
```
Then this
```c
-!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
@@ -914,7 +914,7 @@ 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,' ');
+ !o && D && q *U,*V,' ');
```
That reduced the count further. But then I wondered if even that much is needed.
@@ -931,7 +931,7 @@ 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,' ');
+ !o && q *U,*V,' ');
```
Technically it would be a `" "` (see [HACKING.html][] or on GitHub
diff --git a/2020/ferguson1/terminals.html b/2020/ferguson1/terminals.html
index dd854fddb..30281c68c 100644
--- a/2020/ferguson1/terminals.html
+++ b/2020/ferguson1/terminals.html
@@ -151,23 +151,23 @@ 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
-terminal supports bold
-terminal supports colours
+
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)
+ terminal rows 41 (38 playable)
+ terminal cols 155 (153 playable)
-snake size: 997 (max size: 5776)
- bugs: 199 (max size: 1155)
+ snake size: 997 (max size: 5776)
+ bugs: 199 (max size: 1155)
-at least 34 columns (currently 155) recommended for snake size 997
-at least 37 columns (currently 155) recommended for capped snake size 5776
+ at least 34 columns (currently 155) recommended for snake size 997
+ at least 37 columns (currently 155) recommended for capped snake size 5776
-No problems detected.
+ No problems detected.
Terminal rows and cols are the current values (the number of columns shown later
as well). The snake size is the default size to win (based on the variables, see
below). The max size: 5776 is the capped size (or ‘capsize’). The 199 bugs is
@@ -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
+
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,20 +245,21 @@ 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
even just the reset command.
The Linux man page says:
-
You might have to run the reset tool like:
-
<LF>reset<LF>
+
You might have to run the `reset` tool like:
- (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.
+ <LF>reset<LF>
+
+ (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.
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
@@ -305,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
@@ -313,34 +314,33 @@ problems even with monochrome terminals. Later I say what to do to remove colour
support in the source code itself.
With init_pair() and pair_content(), the value of pair must be in a range
-from 0 to and including COLOR_PAIRS-1. (There may be an
-implementation-specific upper limit on the valid value of pair, but any such
-limit is at least 63.) Valid values for f and b are the range from 0 to and
-including COLORS-1.
+
With init_pair() and pair_content(), the value of pair must be in a range
+ from 0 to and including COLOR_PAIRS-1. (There may be an
+ implementation-specific upper limit on the valid value of pair, but any such
+ limit is at least 63.) Valid values for f and b are the range from 0 to and
+ including COLORS-1.
The manpage for init_pair() says this:
-
These limits apply to color values and color pairs. Values outside these limits are not legal, and may result in a runtime error:
+
These limits apply to color values and color pairs. Values outside these limits are not legal, and may result in a runtime error:
- [...]
+ [...]
- COLOR_PAIRS corresponds to the terminal database's max_pairs capability, (see terminfo(5)).
+ COLOR_PAIRS corresponds to the terminal database's max_pairs capability, (see terminfo(5)).
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:
@@ -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:
-
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 18f8e5a49..0bb19941e 100644
--- a/2020/ferguson1/terminals.md
+++ b/2020/ferguson1/terminals.md
@@ -31,28 +31,28 @@ 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
+ $ make test
```
This compiles the program [termcaps.c](termcaps.c) and runs it; you should see something like:
```
-terminal supports cursor movement
-terminal supports making cursor invisible
-terminal supports bold
-terminal supports colours
+ 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)
+ terminal rows 41 (38 playable)
+ terminal cols 155 (153 playable)
-snake size: 997 (max size: 5776)
- bugs: 199 (max size: 1155)
+ snake size: 997 (max size: 5776)
+ bugs: 199 (max size: 1155)
-at least 34 columns (currently 155) recommended for snake size 997
-at least 37 columns (currently 155) recommended for capped snake size 5776
+ at least 34 columns (currently 155) recommended for snake size 997
+ at least 37 columns (currently 155) recommended for capped snake size 5776
-No problems detected.
+ No problems detected.
```
Terminal rows and cols are the current values (the number of columns shown later
@@ -68,21 +68,21 @@ If I pass in any of the variables **GROW**, **MAXSIZE**, **SIZE** and/or
example:
```sh
-terminal supports cursor movement
-terminal supports making cursor invisible
-terminal supports bold
-terminal supports colours
+ 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)
+ terminal rows 41 (38 playable)
+ terminal cols 155 (153 playable)
-snake size: 5776 (max size: 5776)
- bugs: 5771 (max size: 5771)
+ 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
+ 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.
+ No problems detected.
```
As you can see it tells you the max size (the 'capsized' snake) as well as the
@@ -129,15 +129,19 @@ To specify the lines/columns of curses program per instance use the `LINES` and
For demonstration consider the following:
- $ echo $LINES $COLUMNS
- 42 157
+```sh
+ $ 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
+```sh
+ $ 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:
@@ -162,9 +166,10 @@ 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
-
+```sh
+ 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
@@ -174,17 +179,20 @@ even just the `reset` command.
The Linux man page says:
+```
You might have to run the `reset` tool like:
reset
(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
+```sh
+ echo -e \\033c
+```
Otherwise try `clear; stty sane` (that will turn on echo also) or if all else
fails log out and back in.
@@ -201,12 +209,16 @@ 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
+```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:
- COLUMNS=997 ./prog
+```sh
+ COLUMNS=997 ./prog
+```
Then they will see a different effect. Again the same reason: the player trying
to be funny.
@@ -253,7 +265,9 @@ 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
+```sh
+ 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
@@ -265,74 +279,90 @@ support in the source code itself.
According to X/Open Curses, Issue 7 (pg. 57):
- With init_pair() and pair_content(), the value of pair must be in a range
- from 0 to and including COLOR_PAIRS-1. (There may be an
- implementation-specific upper limit on the valid value of pair, but any such
- limit is at least 63.) Valid values for f and b are the range from 0 to and
- including COLORS-1.
+```
+ With init_pair() and pair_content(), the value of pair must be in a range
+ from 0 to and including COLOR_PAIRS-1. (There may be an
+ implementation-specific upper limit on the valid value of pair, but any such
+ limit is at least 63.) Valid values for f and b are the range from 0 to and
+ including COLORS-1.
+```
The manpage for `init_pair()` says this:
- These limits apply to color values and color pairs. Values outside these limits are not legal, and may result in a runtime error:
+```
+ These limits apply to color values and color pairs. Values outside these limits are not legal, and may result in a runtime error:
- [...]
+ [...]
- COLOR_PAIRS corresponds to the terminal database's max_pairs capability, (see terminfo(5)).
+ COLOR_PAIRS corresponds to the terminal database's max_pairs capability, (see terminfo(5)).
+```
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
+```c
+ #include
- int main()
- {
- initscr();
- start_color();
- printw("COLORS: %d\nCOLOR_PAIRS: %d\n", COLORS, COLOR_PAIRS);
- getch();
- endwin();
- }
+ 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
+```sh
+ TERM=linux-m ./colour_pairs
+ COLORS: 0
+ COLOR_PAIRS: 0
+```
Without specifying the TERM I get:
- COLORS: 256
- COLOR_PAIRS: 32767
+```
+ COLORS: 256
+ COLOR_PAIRS: 32767
+```
In the case that colour is supported the standard states that there will be more
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();
+```c
+ 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);
+ 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();
- }
+ getch();
+ endwin();
+ }
+```
Running it like
- TERM=linux-m ./colour_pairs
+```sh
+ 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:
- COLORS: 256
- COLOR_PAIRS: 32767
+```
+ COLORS: 256
+ COLOR_PAIRS: 32767
+```
Which leads me to believe that if you try using a value outside the range it
won't work for a colour-capable terminal but it doesn't matter for monochrome
@@ -351,7 +381,6 @@ you can also comment out the `init_pair()` calls.
Perhaps you only need to add the `return;` to `C()`. My guess is that's the case
but I do not know for certain.
-
[HACKING.md]: HACKING.md
[HACKING.html]: HACKING.html
[Linux keyboard and console HOWTO]: https://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO.html
diff --git a/2020/ferguson1/troubleshooting.html b/2020/ferguson1/troubleshooting.html
index 74db28edb..4e4c4c49a 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.
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,29 +381,29 @@ 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:
-
SIZE=0x3
-SIZE=3
-SIZE=03
+
SIZE=0x3
+ SIZE=3
+ SIZE=03
The way the functions work is if 0x (or 0X) it’s considered hex; if prefixed
with a 0 it’s octal and otherwise it’s decimal. If you specify invalid data
(even if only at the beginning of the string) the functions return 0. For
example:
-
SIZE=0
-SIZE=f
-SIZE=-
-SIZE=f1
+
SIZE=0
+ SIZE=f
+ SIZE=-
+ SIZE=f1
are all equivalent.
Observe that:
-
SIZE=08
+
SIZE=08
is invalid input because octal only has digits 0 - 7: the resulting size will be
0.
I discuss the signed/unsigned issue to do with curses and sizes in C being
@@ -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):
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:
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.
@@ -142,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
+
./prog
-# get recode help:
-./recode-h
+# 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]
+# 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 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 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
+# 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
+# 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
+# pseudo-randomly select settings
+./recode-r
-# show Enigma machine settings after selection / generation:
-./recode-v
+# 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:
@@ -206,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:
@@ -318,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),
@@ -339,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:
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:
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.)
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
@@ -441,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
@@ -494,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! :)
-
The layout of recode.c isn’t too significant (but see below) but I want to
mention prog.c especially:
@@ -525,9 +524,9 @@ ended his life. (I later made a bug fix but I consider this inconsequential).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:
-
For the lazy obfuscation.html has the deciphered version. I am afraid I’m not
@@ -540,8 +539,8 @@ GitHub), not enciphered, one might just go there instead. Still it’s a fun way
to explore this entry.
As for the obfuscation.key file if you observe the contents you’ll find the
word OBFUSCATION:
Ways that my simulator differs from the real thing. Not all of these are bugs
and some could be considered features; others are just differences.
@@ -688,8 +687,8 @@ simulator make sure to use
Rotors
I, II and III and the starting positions at B, B and C respectively (as in left,
centre, right). To do this click the button at the top right that looks like:
-
o->
-<-o
+
o->
+ <-o
and then select the rotors. Next click the button again at the left of the
rotor selection ‘screen’. Then use the arrow buttons above each rotor to set
from left to right B, B and C. After this you can type your message in the input
@@ -704,7 +703,7 @@ determine if the ring settings being different from ABC would cause
(this is the thing I mention I’m uncertain about in the bugs section).
Going back to the configuring the online simulator try inputting the text IOCCC
and you’ll see the resulting text being:
-
UUMMX
+
UUMMX
Which is exactly as my entry shows! So at least for the starting position BBC
and an empty plugboard
and the other defaults in my entry (which appear to be consistent with the
diff --git a/2020/ferguson2/obfuscation.html b/2020/ferguson2/obfuscation.html
index 6978aa99d..a4e7778fa 100644
--- a/2020/ferguson2/obfuscation.html
+++ b/2020/ferguson2/obfuscation.html
@@ -138,40 +138,43 @@ there is an aesthetic appeal to my eyes too).
(including what was originally two arrays plus some additional ints).
Negative pointer offsets. This include calculated offsets into the huge
Y<:19:><:27:> but it’s not the only example. Here the compound literal of 13
-ints:
-
int *z=(int[13]) { 0 } , *e, *g;
+ints:
+
+
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:
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
@@ -189,40 +192,47 @@ unspecified I changed it to what it is now. Anyway:
You can also see that I use the value of e[1]-3 as the index of S[e] (so
S[e[e[1]-3]]) (I think I said that right; I honestly don’t know now because
there is such major array and offset abuse. The entire prog.c is riddled
-with offset abuses.).
-
If you observe that above the compound literal z is of size 13 but I point
+with offset abuses.).
+
+
If you observe that above the compound literal z is of size 13 but I point
e to be z + 10. Why? Twofold: (1) I decided to make use of one of them as a
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:
-
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
than one way: *g for the iteration but also e[1] for the actual element of
both Y[14] and Y[15]. I also happen to use S (via r which points to S + 10)
-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);
+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);
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
attached to S? Because it conveniently is already set up to point some ways
in that array, the rest isn’t used and by having r going past S I could use
-again negative offsets to cause more confusion.
-
Although this is clearly already shown in the above there are other ways I
+again negative offsets to cause more confusion.
+
+
Although this is clearly already shown in the above there are other ways I
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:
-
Replacing a number of if ..s with ... && (...)s (in one case at least
it’s nested further: f && (f = 0 && (a = W(A,a)));).
Three different char arrays in one: the rotors settings, the positions and
@@ -233,9 +243,11 @@ arrays here require some index calculations like i+i%3 and i+
on which ‘array’ is needed. At other points I refer to those elements by direct
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:
(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
with the rest of the char arrays so that’s what I have done. They have
different purposes and they’re referred to differently. I will cite next the
@@ -261,26 +273,26 @@ it to 9.
The judges don’t like obfuscation through the C preprocessor. That’s fair
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')
+obfuscation but rather to save bytes. For examples:
+
+
%: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
it’d be many more. I believe though that when the cpp translates it it still
requires more thought to determine that a is set to Y[7][1], b to Y[7][3]
-and c to Y[7][5].
-
+and c to Y[7][5].
Obfuscation wrt recode.c
To cause confusion I have used the same names of variables and functions
@@ -300,16 +312,16 @@ I don’t believe deciphering recode.c will explain how my entry works because
recode.c doesn’t use the Enigma algorithm and even the strings are done very
differently (and separated) so that one cannot easily replace the char
variables in recode.c, move them to prog.c, compile and expect it to work right.
-
Also what is this about ?
-
/\
- / This is *not* what you think:
- void D(char*x){ /* ... */ }
+
Also what is this about ?
+
+
/\
+/ 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
misleading comment (conversely this makes this hint both misleading - and
-also not).
-
+also not).
@@ -142,26 +141,26 @@ Location: AU - Commonwealth of Australi
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
+
./try.sh
+./prog< pi.wav
-# See
-./prog 867-5309 > jenny.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
@@ -181,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
@@ -241,12 +240,12 @@ shorthand.
frequency determines which row the digit is in, and the higher frequency
determines the column. There are 4 possible row frequencies and 4 possible
column frequencies.
-
This program determines which frequencies are present in the input by passing it
through a set of 8 virtual resonators, each tuned to one of the frequencies used
for DTMF. These can be implemented using only basic arithmetic, and they are
diff --git a/2020/kurdyukov1/README.md b/2020/kurdyukov1/README.md
index 1277c7931..227c9411b 100644
--- a/2020/kurdyukov1/README.md
+++ b/2020/kurdyukov1/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
There are alternate versions of this entry. See [Alternate
@@ -11,19 +11,19 @@ code](#alternate-code) below for more details.
## To use:
```sh
-./prog
-# input some text
+ ./prog
+ # input some text
-echo text | ./prog
+ echo text | ./prog
-./prog < file
+ ./prog < file
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -47,7 +47,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
+ make alt
```
diff --git a/2020/kurdyukov1/index.html b/2020/kurdyukov1/index.html
index 6863b68a0..a970ea07d 100644
--- a/2020/kurdyukov1/index.html
+++ b/2020/kurdyukov1/index.html
@@ -132,8 +132,7 @@
There are alternate versions of this entry. See Alternate
code below for more details.
To use:
-
./prog
-# input some text
+
./prog
+# input some text
-echo text |./prog
+echo text |./prog
-./prog< file
+./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.
@@ -165,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.
diff --git a/2020/kurdyukov2/README.md b/2020/kurdyukov2/README.md
index a8b97e09f..389aeb676 100644
--- a/2020/kurdyukov2/README.md
+++ b/2020/kurdyukov2/README.md
@@ -1,26 +1,26 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./prog
+ ./prog
```
## Try:
```sh
-# Take a selfie
-./prog 1000 selfie.jpg output.jpg
-# Admire your portrait in cubist style
+ # Take a selfie
+ ./prog 1000 selfie.jpg output.jpg
+ # Admire your portrait in cubist style
-# Also try:
-./try.sh
+ # Also try:
+ ./try.sh
```
@@ -42,7 +42,7 @@ process is content aware, so the algorithm tries to match most of the informatio
However, it doesn't find the best theoretically possible layout.
```sh
-./prog 1000 input.jpg output.jpg
+ ./prog 1000 input.jpg output.jpg
```
### Building
@@ -57,20 +57,20 @@ 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"
+ 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"
+ make prog_png LIBPNG="-lpng"
```
And the PPM version (no additional dependencies, can read raw/ASCII PPM, writes
raw PPM):
```
-make prog_ppm
+ make prog_ppm
```
### Building on macOS with MacPorts:
@@ -81,13 +81,13 @@ information!
First, make sure you have the compiler tools installed e.g. by:
```sh
-sudo xcode-select --install
+ sudo xcode-select --install
```
Make sure you install [MacPorts](https://www.macports.org/install.php). Then do:
```sh
-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
@@ -96,7 +96,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"
+ make LDFLAGS="-I/opt/local/include -L/opt/local/lib"
```
### Building on macOS with Homebrew
@@ -104,7 +104,7 @@ make LDFLAGS="-I/opt/local/include -L/opt/local/lib"
First, make sure you have the compiler tools installed e.g. by:
```sh
-sudo xcode-select --install
+ sudo xcode-select --install
```
Make sure you install [Homebrew](https://brew.sh).
@@ -112,14 +112,14 @@ Make sure you install [Homebrew](https://brew.sh).
Then:
```sh
-brew install libjpeg libpng
-eval "$(brew shellenv)"
+ brew install libjpeg libpng
+ eval "$(brew shellenv)"
```
You are now ready to compile this entry:
```sh
-make clobber all
+ make clobber all
```
@@ -140,7 +140,7 @@ 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
+ 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](try.sh) script.
diff --git a/2020/kurdyukov2/index.html b/2020/kurdyukov2/index.html
index ba0bbc665..c4da60725 100644
--- a/2020/kurdyukov2/index.html
+++ b/2020/kurdyukov2/index.html
@@ -132,8 +132,7 @@
# Take a selfie
-./prog 1000 selfie.jpg output.jpg
-# Admire your portrait in cubist style
+
# Take a selfie
+./prog 1000 selfie.jpg output.jpg
+# Admire your portrait in cubist style
-# Also try:
-./try.sh
+# 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?
@@ -162,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
@@ -170,32 +169,32 @@ 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):
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
@@ -207,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:
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:
@@ -170,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 5e840ff6d..e8f7234cd 100644
--- a/2020/kurdyukov4/README.md
+++ b/2020/kurdyukov4/README.md
@@ -1,14 +1,14 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./prog text_file output_length context_length random_seed
+ ./prog text_file output_length context_length random_seed
```
@@ -18,7 +18,7 @@ When running this, ask yourself why it gets progressively slower when the
context length decreases:
```sh
-./try.sh
+ ./try.sh
```
> Performance depends on the number of same hashes found.
@@ -42,11 +42,11 @@ of this string will have a 50% chance of occurrence.
Example:
```
-echo "00000000000000000000 01 02 02 02 02 02 02" > test.txt
-./prog test.txt 1000 2 123
-# more twos in output
-./rand test.txt 1000 2 123
-# more ones in output
+ echo "00000000000000000000 01 02 02 02 02 02 02" > test.txt
+ ./prog test.txt 1000 2 123
+ # more twos in output
+ ./rand test.txt 1000 2 123
+ # more ones in output
```
> But this will happen very rarely on real data.
@@ -71,7 +71,7 @@ Now can you appreciate the award title a bit better?
### Building:
```sh
-cc prog.c -o prog
+ cc prog.c -o prog
```
### Usage:
@@ -80,7 +80,7 @@ This program generates random text from the provided dictionary using a Markov
chain, outputting to `stdout`.
```sh
-./prog input.txt 2000 10 12345
+ ./prog input.txt 2000 10 12345
```
Parameters are:
@@ -111,37 +111,37 @@ You can try this with the inputs provided with
```sh
-$ ./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,
-Have other some, he is in Rome: but where is Warwick frowns at his. PRINCE EDWAR
-D: Where is the light: But I will watch thy waking, what work he makes Amongst y
-ou? Come, sirs, We shall write to you, fortune and The hazard of much blood. I w
-ould to heaven, respective lenity, And fire-eyed fury be my convoy in the senten
-ced; 'tis too horrible, so bloody on the banks If they were created, Would bring
- them to our presence? FLORIZEL: And those his golden crown, What is six winters
-? they are but Lewis and Warwick bids you come too late come from the king's fri
-end, and will do't; for, look you, sir, For still thy true servitor: I will rend
- an oak And peg thee in his knotty entrails till Thou hast hazel eyes: what eye
-but such an eye would spy out such a day to-morrow, or next day: He is within th
-e limit of the like, forsworn to love, Send her a story of more woe Than this is
- a merry ballad, but a very pretty one. MOPSA: Thou hast amazed me, My name is E
-lbow: I do lean upon, Now thou art: Thy tears are womanish; thy wild acts denote
- The unreasonably: come, you must: and there, I then do't to them? VOLUMNIA: Now
- the red pestilence hangs in our aim, which is yours. What is't your honour, as
-in war, since then, You have said before: My child is dead; or 'twere not 'long
-of him; but he, like you, lads; about your ears it is Menenius? Second Officer:
-Come, come, young wanton and effeminate boy, Takes on the hungry beach Fillip th
-e stars Shall bitterly begin his wooing that we have in hand are angry And frown
-ing brow to brow, ourselves, Still your own affections are devised, As blanks, b
-enevolences, and I thank thee for it. KING HENRY VI: Master lieutenant comes. Ma
-ster lieutenant comes. Master lieutenant, pray you,-- CORIOLANUS: What's that to
- him? CHRISTOPHER: At Pembroke, Sir James Blunt, And Rice ap Thomas with a virtu
+ 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,
+ Have other some, he is in Rome: but where is Warwick frowns at his. PRINCE EDWAR
+ D: Where is the light: But I will watch thy waking, what work he makes Amongst y
+ ou? Come, sirs, We shall write to you, fortune and The hazard of much blood. I w
+ ould to heaven, respective lenity, And fire-eyed fury be my convoy in the senten
+ ced; 'tis too horrible, so bloody on the banks If they were created, Would bring
+ them to our presence? FLORIZEL: And those his golden crown, What is six winters
+ ? they are but Lewis and Warwick bids you come too late come from the king's fri
+ end, and will do't; for, look you, sir, For still thy true servitor: I will rend
+ an oak And peg thee in his knotty entrails till Thou hast hazel eyes: what eye
+ but such an eye would spy out such a day to-morrow, or next day: He is within th
+ e limit of the like, forsworn to love, Send her a story of more woe Than this is
+ a merry ballad, but a very pretty one. MOPSA: Thou hast amazed me, My name is E
+ lbow: I do lean upon, Now thou art: Thy tears are womanish; thy wild acts denote
+ The unreasonably: come, you must: and there, I then do't to them? VOLUMNIA: Now
+ the red pestilence hangs in our aim, which is yours. What is't your honour, as
+ in war, since then, You have said before: My child is dead; or 'twere not 'long
+ of him; but he, like you, lads; about your ears it is Menenius? Second Officer:
+ Come, come, young wanton and effeminate boy, Takes on the hungry beach Fillip th
+ e stars Shall bitterly begin his wooing that we have in hand are angry And frown
+ ing brow to brow, ourselves, Still your own affections are devised, As blanks, b
+ enevolences, and I thank thee for it. KING HENRY VI: Master lieutenant comes. Ma
+ ster lieutenant comes. Master lieutenant, pray you,-- CORIOLANUS: What's that to
+ him? CHRISTOPHER: At Pembroke, Sir James Blunt, And Rice ap Thomas with a virtu
```
@@ -142,13 +141,13 @@ Location: RU - Russian Federation
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.
@@ -164,11 +163,11 @@ way it works too fast regardless of the context length, and it’s much less fun
If some string only appears after half the input, the first instance
of this string will have a 50% chance of occurrence.
Example:
-
echo "00000000000000000000 01 02 02 02 02 02 02" > test.txt
-./prog test.txt 1000 2 123
-# more twos in output
-./rand test.txt 1000 2 123
-# more ones in output
+
echo "00000000000000000000 01 02 02 02 02 02 02" > test.txt
+ ./prog test.txt 1000 2 123
+ # more twos in output
+ ./rand test.txt 1000 2 123
+ # more ones in output
But this will happen very rarely on real data.
– Author
@@ -184,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:
dictionary filename
@@ -210,33 +209,33 @@ the output of this size in bytes exists somewhere in the dictionary.
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,
-Have other some, he is in Rome: but where is Warwick frowns at his. PRINCE EDWAR
-D: Where is the light: But I will watch thy waking, what work he makes Amongst y
-ou? Come, sirs, We shall write to you, fortune and The hazard of much blood. I w
-ould to heaven, respective lenity, And fire-eyed fury be my convoy in the senten
-ced; 'tis too horrible, so bloody on the banks If they were created, Would bring
- them to our presence? FLORIZEL: And those his golden crown, What is six winters
-? they are but Lewis and Warwick bids you come too late come from the king's fri
-end, and will do't; for, look you, sir, For still thy true servitor: I will rend
- an oak And peg thee in his knotty entrails till Thou hast hazel eyes: what eye
-but such an eye would spy out such a day to-morrow, or next day: He is within th
-e limit of the like, forsworn to love, Send her a story of more woe Than this is
- a merry ballad, but a very pretty one. MOPSA: Thou hast amazed me, My name is E
-lbow: I do lean upon, Now thou art: Thy tears are womanish; thy wild acts denote
- The unreasonably: come, you must: and there, I then do't to them? VOLUMNIA: Now
- the red pestilence hangs in our aim, which is yours. What is't your honour, as
-in war, since then, You have said before: My child is dead; or 'twere not 'long
-of him; but he, like you, lads; about your ears it is Menenius? Second Officer:
-Come, come, young wanton and effeminate boy, Takes on the hungry beach Fillip th
-e stars Shall bitterly begin his wooing that we have in hand are angry And frown
-ing brow to brow, ourselves, Still your own affections are devised, As blanks, b
-enevolences, and I thank thee for it. KING HENRY VI: Master lieutenant comes. Ma
-ster lieutenant comes. Master lieutenant, pray you,-- CORIOLANUS: What's that to
- him? CHRISTOPHER: At Pembroke, Sir James Blunt, And Rice ap Thomas with a virtu
+
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,
+ Have other some, he is in Rome: but where is Warwick frowns at his. PRINCE EDWAR
+ D: Where is the light: But I will watch thy waking, what work he makes Amongst y
+ ou? Come, sirs, We shall write to you, fortune and The hazard of much blood. I w
+ ould to heaven, respective lenity, And fire-eyed fury be my convoy in the senten
+ ced; 'tis too horrible, so bloody on the banks If they were created, Would bring
+ them to our presence? FLORIZEL: And those his golden crown, What is six winters
+ ? they are but Lewis and Warwick bids you come too late come from the king's fri
+ end, and will do't; for, look you, sir, For still thy true servitor: I will rend
+ an oak And peg thee in his knotty entrails till Thou hast hazel eyes: what eye
+ but such an eye would spy out such a day to-morrow, or next day: He is within th
+ e limit of the like, forsworn to love, Send her a story of more woe Than this is
+ a merry ballad, but a very pretty one. MOPSA: Thou hast amazed me, My name is E
+ lbow: I do lean upon, Now thou art: Thy tears are womanish; thy wild acts denote
+ The unreasonably: come, you must: and there, I then do't to them? VOLUMNIA: Now
+ the red pestilence hangs in our aim, which is yours. What is't your honour, as
+ in war, since then, You have said before: My child is dead; or 'twere not 'long
+ of him; but he, like you, lads; about your ears it is Menenius? Second Officer:
+ Come, come, young wanton and effeminate boy, Takes on the hungry beach Fillip th
+ e stars Shall bitterly begin his wooing that we have in hand are angry And frown
+ ing brow to brow, ourselves, Still your own affections are devised, As blanks, b
+ enevolences, and I thank thee for it. KING HENRY VI: Master lieutenant comes. Ma
+ ster lieutenant comes. Master lieutenant, pray you,-- CORIOLANUS: What's that to
+ him? CHRISTOPHER: At Pembroke, Sir James Blunt, And Rice ap Thomas with a virtu
@@ -142,15 +141,15 @@ Location: US - United States of America
Now play output.mid and output2.mid in an audio player that can play MIDI
files.
Judges’ remarks:
@@ -180,9 +179,9 @@ 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
+
./prog <input.mid >output.mid
If the program encounters an error, no output will generally be produced, and
it will exit with a specific status code. Meanings of the various status codes
are listed below, under the “Program error codes” heading. On success, the
diff --git a/2020/tsoj/README.md b/2020/tsoj/README.md
index 3bdf19c46..f0584ee54 100644
--- a/2020/tsoj/README.md
+++ b/2020/tsoj/README.md
@@ -1,7 +1,7 @@
## To build:
```sh
-make
+ make
```
@@ -12,16 +12,16 @@ to those familiar with vi. See [Alternate code](#alternate-code) below.
## To use:
```sh
-./prog
+ ./prog
```
## Try:
```sh
-# 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
```
@@ -34,16 +34,16 @@ where instead of `w`, `a`, `s` and `d`, you can use `k`, `h`, `j` and `l`.
### Alternate build:
```sh
-make alt
-```
+ make alt
+ ```
### Alternate use:
```sh
-# 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
@@ -69,11 +69,11 @@ reverse indentation style.
```
- /\
- //\\
- / \
-/______\
- /\/\
+ /\
+ //\\
+ / \
+ /______\
+ /\/\
```
@@ -81,8 +81,8 @@ reverse indentation style.
#### Linux
```
-cc -std=c99 -O3 prog.c -o prog
-./prog
+ cc -std=c99 -O3 prog.c -o prog
+ ./prog
```
#### Windows
@@ -91,8 +91,8 @@ The only way I found to make it work is to use [MSYS2](https://www.msys2.org).
When using the MSYS2 shell you can install gcc via pacman.
```
-cc -std=c99 -O3 prog.c -o prog
-./prog.exe
+ cc -std=c99 -O3 prog.c -o prog
+ ./prog.exe
```
#### Warnings
diff --git a/2020/tsoj/index.html b/2020/tsoj/index.html
index 8b3f1bd5b..299f12b18 100644
--- a/2020/tsoj/index.html
+++ b/2020/tsoj/index.html
@@ -132,8 +132,7 @@
Author:
Name: tsoj
-Location: DE - Federal Republic of Germany (Germany)
-
+Location: DE - Federal Republic of Germany (Germany)
@@ -142,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:
@@ -174,20 +173,20 @@ reverse indentation style.
Quit: q
Pause: p, then use any other key to resume
-
/\
- //\\
- / \
-/______\
- /\/\
+
/\
+ //\\
+ / \
+ /______\
+ /\/\
Compile and run
Linux
-
cc -std=c99 -O3 prog.c -o prog
-./prog
+
cc -std=c99 -O3 prog.c -o prog
+ ./prog
Windows
The only way I found to make it work is to use MSYS2.
When using the MSYS2 shell you can install gcc via pacman.
-
cc -std=c99 -O3 prog.c -o prog
-./prog.exe
+
cc -std=c99 -O3 prog.c -o prog
+ ./prog.exe
Warnings
-Wno-missing-prototypes
diff --git a/2020/yang/README.md b/2020/yang/README.md
index 0826b3290..dac49559d 100644
--- a/2020/yang/README.md
+++ b/2020/yang/README.md
@@ -1,21 +1,21 @@
## To build:
```sh
-make
+ make
```
## To use:
```sh
-./prog [PIN] < input.txt > output.c
+ ./prog [PIN] < input.txt > output.c
```
## Try:
```sh
-./try.sh
+ ./try.sh
```
@@ -23,7 +23,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
+ make cppp
```
See the author's remarks for more details.
@@ -45,9 +45,9 @@ spoiler](spoiler.html) that shows how this entry was written.
### Synopsis
```sh
-echo "Hello world" | ./prog 12345 > encoded.c
+ echo "Hello world" | ./prog 12345 > encoded.c
-gcc -DPIN=12345 encoded.c -o ./decoded && ./decoded
+ gcc -DPIN=12345 encoded.c -o ./decoded && ./decoded
```
### Details
@@ -55,23 +55,23 @@ gcc -DPIN=12345 encoded.c -o ./decoded && ./decoded
Mile is a C code generator. Run without arguments for the help message below:
```
-usage: [PIN] < input.txt > output.c
+ usage: [PIN] < input.txt > output.c
-where [PIN] is an integer in the range of 1..65535
+ 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:
```sh
-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.
```sh
-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
diff --git a/2020/yang/index.html b/2020/yang/index.html
index 50ad1f1ac..7ce97c488 100644
--- a/2020/yang/index.html
+++ b/2020/yang/index.html
@@ -132,8 +132,7 @@
Author:
Name: Don Yang
-Location: US - United States of America (United States)
-
+Location: US - United States of America (United States)
@@ -142,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.
@@ -160,20 +159,20 @@ What is compiling this entry about?
spoiler that shows how this entry was written.
Mile is a C code generator. Run without arguments for the help message below:
-
usage: [PIN] < input.txt > output.c
+
usage: [PIN] < input.txt > output.c
-where [PIN] is an integer in the range of 1..65535
+ 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/bin/output-index-author.sh b/bin/output-index-author.sh
index 2196fa6db..d241bda2f 100755
--- a/bin/output-index-author.sh
+++ b/bin/output-index-author.sh
@@ -101,7 +101,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an
# set variables referenced in the usage message
#
-export VERSION="1.5.2 2024-03-26"
+export VERSION="1.6 2024-03-31"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -788,6 +788,7 @@ fi
# write each author's information to temporary markdown file
#
+export NOT_FIRST_AUTHOR
for author_handle in $AUTHOR_HANDLE_SET; do
# determine the author handle JSON path
@@ -838,6 +839,14 @@ for author_handle in $AUTHOR_HANDLE_SET; do
# write this author's information
#
{
+ # If not the first author, add a line break
+ #
+ if [[ -n $NOT_FIRST_AUTHOR ]]; then
+ echo "
"
+ fi
+
+ # Output this author's information
+ #
echo "* Name: [$FULL_NAME](${DOCROOT_SLASH}authors.html#$author_handle) "
if [[ $LOCATION_CODE == null ]]; then
echo "Location: [unknown](${DOCROOT_SLASH}location.html#$LOCATION_CODE) - _${LOCATION_NAME}_"
@@ -850,7 +859,6 @@ for author_handle in $AUTHOR_HANDLE_SET; do
"_${LOCATION_NAME}_ (_${LOCATION_COMMON_NAME}_)"
fi
fi
- echo "
"
} | if [[ -z $NOOP ]]; then
cat >> "$TMP_FILE"
else
@@ -859,6 +867,7 @@ for author_handle in $AUTHOR_HANDLE_SET; do
echo "$0: debug[3]: -n disabled write of author's information into: $TMP_FILE" 1>&2
fi
fi
+ NOT_FIRST_AUTHOR="true"
done
# convert temporary markdown file into HTML
diff --git a/bugs.html b/bugs.html
index b5ab42cbf..4681ab487 100644
--- a/bugs.html
+++ b/bugs.html
@@ -206,9 +206,9 @@ segfault in macOS of 1989/paul: changing the
In rare cases they are valid. For instance Cody noticed in linux the following
warning in 1985/applin with gcc:
-
applin.c:1:78: warning: incompatible implicit declaration of built-in function 'execlp' [-Wbuiltin-declaration-mismatch]
- 1 | main(v,c)char**c;{for(v[c++]=strdup("Hello, world!\n");(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);}
- | ^~~~~~
+
applin.c:1:78: warning: incompatible implicit declaration of built-in function 'execlp' [-Wbuiltin-declaration-mismatch]
+ 1 | main(v,c)char**c;{for(v[c++]=strdup("Hello, world!\n");(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);}
+ | ^~~~~~
and this reminded him of his fix to
1984/anonymous. In the case of 1984/anonymous it
was a bit more involved but with 1985/applin one need only add to the Makefile
@@ -234,7 +234,7 @@ editor that does formatting it can cause problems. Sometimes formatters can even
break code! Cody Boone Ferguson has
experienced this many times with vim so he tends to disable all format options
when formatting code. In vim you should be able to do that with:
-
:set formatoptions=
+
:set formatoptions=
STATUS: known bug - please help us fix
Entries with this status have one or more bugs that need to be fixed. Are you
able to fix it? We welcome your help!
@@ -417,9 +417,9 @@ 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:
-
$ ./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
@@ -490,12 +490,12 @@ Cody). You are welcome to try and fix it if you can!
Tips from Cody:
The reason this is crashing is that the array irk is being accessed way out of
bounds by the int gnat. For instance:
-
Program terminated with signal SIGSEGV, Segmentation fault.
-#0 0x0000000000401335 in main (ABBA@entry=<optimized out>, tang@entry=<optimized out>, gnat@entry=<optimized out>, Near@entry=<optimized out>)
- at ver2.c:23
-23 &&gnat!({)Near,noon,/*krelc*/)<0&&(Near= - irk[-gnat--]-2)))&&main(ABBA,
-(gdb) p gnat
-$1 = -518733305
+
Program terminated with signal SIGSEGV, Segmentation fault.
+ #0 0x0000000000401335 in main (ABBA@entry=<optimized out>, tang@entry=<optimized out>, gnat@entry=<optimized out>, Near@entry=<optimized out>)
+ at ver2.c:23
+ 23 &&gnat!({)Near,noon,/*krelc*/)<0&&(Near= - irk[-gnat--]-2)))&&main(ABBA,
+ (gdb) p gnat
+ $1 = -518733305
Magic of the entry:
The real trouble is that the code is generated and in a complex way or rather
ways.
@@ -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:
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);doecho"$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);doecho"$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
@@ -627,21 +627,21 @@ 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:
-
which seems to be an error message (one of the fixes was to make it not use
perror(3) - this fixed something else though it’s no longer known what).
The script shark.sh has some issues too in that due to
@@ -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
@@ -710,38 +710,38 @@ have to remove the outer () pair.
Leo Broukhis, before he was an IOCCC judge, sent the IOCCC judges an email:
-
From: leo _at_ zycad -dot- com (Leo Broukhis)
-Date: Tue, 30 Jan 96 17:37:51 PST
-To: judges _at_ toad -dot- com
-Subject: IOCCC 1992 - a bug
+
From: leo _at_ zycad -dot- com (Leo Broukhis)
+ Date: Tue, 30 Jan 96 17:37:51 PST
+ To: judges _at_ toad -dot- com
+ Subject: IOCCC 1992 - a bug
-Dear Judges,
+ Dear Judges,
-albert.c (even in its fixed form) still has a bug. Although I don't
-remember the number that exposed the bug (afair, resulting in coredump)
-in albert.orig.c that has been fixed in albert.c,
+ albert.c (even in its fixed form) still has a bug. Although I don't
+ remember the number that exposed the bug (afair, resulting in coredump)
+ in albert.orig.c that has been fixed in albert.c,
- 've found a number exposing another bug: 10000000001 (that's 9 0's).
-Both albert and albert.orig loop without printing anything, although
-the first factor is 101 and is usually found in an instant.
+ 've found a number exposing another bug: 10000000001 (that's 9 0's).
+ Both albert and albert.orig loop without printing anything, although
+ 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:
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
@@ -785,55 +785,55 @@ them.
Some tips from Cody:
This entry relies on specific compiler warnings. With gcc it will look something
like:
-
[...]
-lush.c: In function 'main':
-lush.c:40: warning: "f" redefined
- 40 | main
- |
-lush.c:1: note: this is the location of the previous definition
- 1 | #define gets(_) fgets((_),999,stdin)
- |
-lush.c:42: warning: "f" redefined
- 42 | #define f 001:
- |
-lush.c:40: note: this is the location of the previous definition
- 40 | main
- |
-lush.c:44: warning: "f" redefined
- 44 | #define f 100:
- |
-lush.c:42: note: this is the location of the previous definition
- 42 | #define f 001:
- |
-lush.c:45: warning: "f" redefined
- 45 | _[i--
- |
-lush.c:44: note: this is the location of the previous definition
- 44 | #define f 100:
- |
-lush.c:46: warning: "f" redefined
- 46 | #define f 126:
- |
-lush.c:45: note: this is the location of the previous definition
- 45 | _[i--
- |
+
[...]
+ lush.c: In function 'main':
+ lush.c:40: warning: "f" redefined
+ 40 | main
+ |
+ lush.c:1: note: this is the location of the previous definition
+ 1 | #define gets(_) fgets((_),999,stdin)
+ |
+ lush.c:42: warning: "f" redefined
+ 42 | #define f 001:
+ |
+ lush.c:40: note: this is the location of the previous definition
+ 40 | main
+ |
+ lush.c:44: warning: "f" redefined
+ 44 | #define f 100:
+ |
+ lush.c:42: note: this is the location of the previous definition
+ 42 | #define f 001:
+ |
+ lush.c:45: warning: "f" redefined
+ 45 | _[i--
+ |
+ lush.c:44: note: this is the location of the previous definition
+ 44 | #define f 100:
+ |
+ lush.c:46: warning: "f" redefined
+ 46 | #define f 126:
+ |
+ lush.c:45: note: this is the location of the previous definition
+ 45 | _[i--
+ |
Now one can use sed to get the warning: line correct but there is more to it
than that. For instance this is what it looks like with clang:
-
lush.c:40:9: warning: 'f' macro redefined [-Wmacro-redefined]
-#define f 001:
- ^
-lush.c:1:9: note: previous definition is here
-#define f 000:
- ^
-lush.c:42:9: warning: 'f' macro redefined [-Wmacro-redefined]
-#define f 100:
- ^
-lush.c:40:9: note: previous definition is here
-#define f 001:
- ^
+
lush.c:40:9: warning: 'f' macro redefined [-Wmacro-redefined]
+ #define f 001:
+ ^
+ lush.c:1:9: note: previous definition is here
+ #define f 000:
+ ^
+ lush.c:42:9: warning: 'f' macro redefined [-Wmacro-redefined]
+ #define f 100:
+ ^
+ lush.c:40:9: note: previous definition is here
+ #define f 001:
+ ^
As you might see the part under the warning: line is different.
The entry is supposed to show warnings and then print:
-
Hello World.
+
Hello World.
Can you help us?
1992/vern
STATUS: INABIAF - please DO NOT fix
@@ -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.
@@ -869,12 +869,12 @@ not a misunderstanding).
The expression `(a*)*` compiles but loops forever.
+
The expression `(a*)*` compiles but loops forever.
-There is no check for trailing backslash (`\`) in the pattern.
+ There is no check for trailing backslash (`\`) in the pattern.
-There is no check for unbalanced brackets. Omitting a closing bracket
-will generate a "Pattern too long" error, which is not the real error.
+ There is no check for unbalanced brackets. Omitting a closing bracket
+ will generate a "Pattern too long" error, which is not the real error.
STATUS: missing file - please provide it
The author wrote in the documentation file ant.txt that
there is a version of the code that is not obfuscated. This file, agag.c does
@@ -909,24 +909,24 @@ 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
-inC. Mark Schnitzius is the author of this
-program.
+
$ ./schnitzi schnitzi.info
+This program answers questions about paragraphs
+of text posed to it in English. It is written
+inC. 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.
+The Loch Ness monster has been captured. Elvis
+is alive. Hostler was a woman. The NASA moon
+landings were clearly faked.
-? What is foo'?
+? 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
+
sh: -c: line 0: unexpected EOF while looking for matching `''
+ sh: -c: line 1: syntax error: unexpected end of file
with the program terminating. Other characters will also cause this problem.
@@ -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
@@ -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!
The fractally minded may be able to detect that mode 0 does not calculate
-Mandelbrot/Julian sets correctly. Can you find the bug? Better still, can you
-fix it without breaking something else?
+
The fractally minded may be able to detect that mode 0 does not calculate
+ Mandelbrot/Julian sets correctly. Can you find the bug? Better still, can you
+ fix it without breaking something else?
You are welcome to try and fix it and open a pull request, providing that it
doesn’t break something else.
1995
@@ -1100,12 +1100,12 @@ it calls getchar() via the pointer m. So this is a fea
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! :-)
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.
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"|./dlowe1>&2|grep 7
-7668
+
$ echo "7 P 6 d P P 8 p"|./dlowe1>&2|grep 7
+7668
Okay so now it sees it, grep. But watch!
-
$ echo "7 P 6 d P P 8 p"|./dlowe2>foo 1>&1
-7668
-$ cat foo
+
$ echo "7 P 6 d P P 8 p"|./dlowe2>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"|./dlowe1>foo 1>&1
-$ cat foo
-$
+
$ echo "7 P 6 d P P 8 p"|./dlowe1>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,86 +1259,86 @@ 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
-usewarnings;_:$_= <> ; definedorexit; @ARGV=split; __:$_= shift;definedorgoto _; 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]}
+
#!/usr/bin/env perl
+usewarnings;_:$_= <> ; definedorexit; @ARGV=split; __:$_= shift;definedorgoto _; 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
-5 p
-5
-5 + 5 p
-unimplemented
-5
-P
-5
-p
-5
+
p
+ stack empty
+ 5 p
+ 5
+ 5 + 5 p
+ unimplemented
+ 5
+ P
+ 5
+ p
+ 5
So you can see that if one uses operators it just shows ‘unimplemented’ (observe
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).
For instance inputting D followed by XX:
-
Undefined subroutine &main::nn called at ./pl.pl line 2, <> line 6.
-Undefined subroutine &main::[[ called at ./pl.pl line 2, <> line 1.
+
Undefined subroutine &main::nn called at ./pl.pl line 2, <> line 6.
+ Undefined subroutine &main::[[ called at ./pl.pl line 2, <> line 1.
That means then that in linux despite the subroutines seemingly not existing it
works in the code, at least in some cases.
As far as the unimplemented error goes: the author stated that it means there is
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.
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.
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,81 +1587,81 @@ sleeping.
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:
- -u command line option
- (maybe you meant: __start)
-ld: symbol(s) not found for architecture arm64
+
Undefined symbols for architecture arm64:
+ "start", referenced from:
+ -u command line option
+ (maybe you meant: __start)
+ ld: symbol(s) not found for architecture arm64
We believe that this simply won’t work with non x86 specific systems but perhaps
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:
Arguments matching `/[^2]22$/` cause the program to segfault
-after rapidly exhausting the available stack space. I could
-probably fix this by adding some special cases to the code,
-but [Blaine the Mono] it's quite a bit more exciting this way,
-don't you think?[/Blaine] Since the trailing `22` will be
-its own atom anyway, you can just insert a space in front of
-it if you run into this feature (e.g. `1 22` instead of `122`).
+
Arguments matching `/[^2]22$/` cause the program to segfault
+ after rapidly exhausting the available stack space. I could
+ probably fix this by adding some special cases to the code,
+ but [Blaine the Mono] it's quite a bit more exciting this way,
+ don't you think?[/Blaine] Since the trailing `22` will be
+ its own atom anyway, you can just insert a space in front of
+ it if you run into this feature (e.g. `1 22` instead of `122`).
-Arguments matching `/(?:.){10,}/` will produce visually incorrect
-results (e.g., generation 1 starting from 1111111111 will
-print as `: 1`), but there's nothing interesting about these
-arguments that can't be modeled using shorter runs of the same
-symbol.
+ Arguments matching `/(?:.){10,}/` will produce visually incorrect
+ results (e.g., generation 1 starting from 1111111111 will
+ print as `: 1`), but there's nothing interesting about these
+ arguments that can't be modeled using shorter runs of the same
+ symbol.
-Arguments matching `/(?:.){257,}/` may produce mathematically
-incorrect results (e.g., generation 1 starting from a string
-of 257 `1`s will be calculated as `11`); the remark from the
-previous paragraph applies here also.
+ Arguments matching `/(?:.){257,}/` may produce mathematically
+ incorrect results (e.g., generation 1 starting from a string
+ of 257 `1`s will be calculated as `11`); the remark from the
+ previous paragraph applies here also.
@@ -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:
-
If you pick a number higher than 19186, the program will return a
-solution but it will be a rotation of one of the first 19186. This is
-because the cross shaped piece fits 48 ways in the 4x4 cube, but only
-2 of those ways are unique - you can rotate one of those to make any
-of the other 46. The algorithm used always places the cross piece
-first, so the first two placings of that piece result in the 19186
-unique solutions.
+
If you pick a number higher than 19186, the program will return a
+ solution but it will be a rotation of one of the first 19186. This is
+ because the cross shaped piece fits 48 ways in the 4x4 cube, but only
+ 2 of those ways are unique - you can rotate one of those to make any
+ of the other 46. The algorithm used always places the cross piece
+ first, so the first two placings of that piece result in the 19186
+ unique solutions.
-If you pick a number higher than 460464 (24x19186) the program will
-return without outputting a solution. If you can wait that long.
+ If you pick a number higher than 460464 (24x19186) the program will
+ return without outputting a solution. If you can wait that long.
@@ -1917,124 +1917,123 @@ fact it is trying to execute code in memory (as noted above). The function
pointers were changed a bit but this has not helped solve the problem with
macOS. A few things that were noticed depending on asan sanitisers specified.
With address in linux:
-
richards.c:101:9: runtime error: null pointer passed as argument 2, which is declared to never be null
+
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 */}
Okay but what about argument 2? Well W is defined as:
(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:
-
UndefinedBehaviorSanitizer:DEADLYSIGNAL
-==10834==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0xffffffffffffffff (pc 0x00019f446748 bp 0x00016f353100 sp 0x00016f352b90 T139066)
-==10834==The signal is caused by a WRITE memory access.
- #0 0x19f446748 in _platform_memmove+0xa8 (libsystem_platform.dylib:arm64e+0x3748) (BuildId: 756cd10d62a032839e57cbaa810c95ac32000000200000000100000000030d00)
- #1 0x100c33c2c in main richards.c:202
- #2 0x19f0bff24 (<unknown module>)
+
Adding the proper PROT_WRITE constant to the mmap() call does not seem to
help. Of course with the address this is not surprising so why is a different
address allocated in macOS? Or is it?
Now with address sanitiser both linux and macOS crash at:
-
=================================================================
-==10983==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x00016f8d5e78 at pc 0x0001005dd910 bp 0x00016f8d5cd0 sp 0x00016f8d5cc8
-READ of size 8 at 0x00016f8d5e78 thread T0
- #0 0x1005dd90c in rd richards.c:132
- #1 0x1005ddf8c in re richards.c:149
- #2 0x1005110a0 in t richards.c:108
- #3 0x1005df72c in main richards.c:189
- #4 0x19f0bff24 (<unknown module>)
+
=================================================================
+ ==10983==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x00016f8d5e78 at pc 0x0001005dd910 bp 0x00016f8d5cd0 sp 0x00016f8d5cc8
+ READ of size 8 at 0x00016f8d5e78 thread T0
+ #0 0x1005dd90c in rd richards.c:132
+ #1 0x1005ddf8c in re richards.c:149
+ #2 0x1005110a0 in t richards.c:108
+ #3 0x1005df72c in main richards.c:189
+ #4 0x19f0bff24 (<unknown module>)
-Address 0x00016f8d5e78 is located in stack of thread T0 at offset 56 in frame
- #0 0x1005dd678 in rd richards.c:129
+ Address 0x00016f8d5e78 is located in stack of thread T0 at offset 56 in frame
+ #0 0x1005dd678 in rd richards.c:129
- This frame has 2 object(s):
- [32, 36) 'v.addr'
- [48, 56) 'a' (line 130) <== Memory access at offset 56 overflows this variable
-HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
- (longjmp and C++ exceptions *are* supported)
-SUMMARY: AddressSanitizer: stack-buffer-overflow richards.c:132 in rd
-Shadow bytes around the buggy address:
- 0x00702df3ab70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3ab80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3ab90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3aba0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3abb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-=>0x00702df3abc0: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 04 f2 00[f3]
- 0x00702df3abd0: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3abe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3abf0: 00 00 00 00 f1 f1 f1 f1 00 f3 f3 f3 00 00 00 00
- 0x00702df3ac00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3ac10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-Shadow byte legend (one shadow byte represents 8 application bytes):
- Addressable: 00
- Partially addressable: 01 02 03 04 05 06 07
- Heap left redzone: fa
- Freed heap region: fd
- Stack left redzone: f1
- Stack mid redzone: f2
- Stack right redzone: f3
- Stack after return: f5
- Stack use after scope: f8
- Global redzone: f9
- Global init order: f6
- Poisoned by user: f7
- Container overflow: fc
- Array cookie: ac
- Intra object redzone: bb
- ASan internal: fe
- Left alloca redzone: ca
- Right alloca redzone: cb
-==10983==ABORTING
-/bin/bash: line 1: 10983 Abort trap: 6 ./richards
+ This frame has 2 object(s):
+ [32, 36) 'v.addr'
+ [48, 56) 'a' (line 130) <== Memory access at offset 56 overflows this variable
+ HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
+ (longjmp and C++ exceptions *are* supported)
+ SUMMARY: AddressSanitizer: stack-buffer-overflow richards.c:132 in rd
+ Shadow bytes around the buggy address:
+ 0x00702df3ab70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3ab80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3ab90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3aba0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3abb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ =>0x00702df3abc0: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 04 f2 00[f3]
+ 0x00702df3abd0: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3abe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3abf0: 00 00 00 00 f1 f1 f1 f1 00 f3 f3 f3 00 00 00 00
+ 0x00702df3ac00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3ac10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ Shadow byte legend (one shadow byte represents 8 application bytes):
+ Addressable: 00
+ Partially addressable: 01 02 03 04 05 06 07
+ Heap left redzone: fa
+ Freed heap region: fd
+ Stack left redzone: f1
+ Stack mid redzone: f2
+ Stack right redzone: f3
+ Stack after return: f5
+ Stack use after scope: f8
+ Global redzone: f9
+ Global init order: f6
+ Poisoned by user: f7
+ Container overflow: fc
+ Array cookie: ac
+ Intra object redzone: bb
+ ASan internal: fe
+ Left alloca redzone: ca
+ Right alloca redzone: cb
+ ==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:
-
-richards.c:169:15: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'o ()' (aka 'void ()') [-Wincompatible-pointer-types]
-f *lib1[] = { T, T, T, T, T } ;
+
richards.c:169:15: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'o ()' (aka 'void ()') [-Wincompatible-pointer-types]
+ f *lib1[] = { T, T, T, T, T } ;
-...
+ ...
-richards.c:170:15: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'o ()' (aka 'void ()') [-Wincompatible-pointer-types]
-f *lib2[] = { T, ld, lp, lx, l1 } ;
- ^
-richards.c:170:18: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
-f *lib2[] = { T, ld, lp, lx, l1 } ;
- ^~
-richards.c:170:22: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
-f *lib2[] = { T, ld, lp, lx, l1 } ;
+ richards.c:170:15: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'o ()' (aka 'void ()') [-Wincompatible-pointer-types]
+ f *lib2[] = { T, ld, lp, lx, l1 } ;
+ ^
+ richards.c:170:18: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
+ f *lib2[] = { T, ld, lp, lx, l1 } ;
^~
-richards.c:170:26: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
-f *lib2[] = { T, ld, lp, lx, l1 } ;
+ richards.c:170:22: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
+ f *lib2[] = { T, ld, lp, lx, l1 } ;
^~
-richards.c:170:30: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
-f *lib2[] = { T, ld, lp, lx, l1 } ;
- ^~
+ richards.c:170:26: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
+ f *lib2[] = { T, ld, lp, lx, l1 } ;
+ ^~
+ richards.c:170:30: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
+ f *lib2[] = { T, ld, lp, lx, l1 } ;
+ ^~
This can be fixed easily enough however but it doesn’t appear to matter in this
case.
The memory locations of `argv` are used for various purposes. Therefore, the
-program name (default `deckmyn`) must be *at least 4 characters long*, including
-possibly the path. This, along with the ending `'\0'`, gives a minimum 5 bytes of
-useful memory space. Otherwise, the program may attempt to write outside the
-string.
+
The memory locations of `argv` are used for various purposes. Therefore, the
+ program name (default `deckmyn`) must be *at least 4 characters long*, including
+ possibly the path. This, along with the ending `'\0'`, gives a minimum 5 bytes of
+ useful memory space. Otherwise, the program may attempt to write outside the
+ string.
-The code is quite sensitive. Errors in the input can lead to strange results.
-The code does not read beyond the end of the music input, but that is about the
-only error checking available. Any input that is not according to the rules in
-the deckmyn.html, may cause errors.
+ The code is quite sensitive. Errors in the input can lead to strange results.
+ The code does not read beyond the end of the music input, but that is about the
+ only error checking available. Any input that is not according to the rules in
+ the deckmyn.html, may cause errors.
-The program has no special hardware limitations or requirements, other than 8bit
-`char` (`signed` or `unsigned`) and two's complement negatives.
+ The program has no special hardware limitations or requirements, other than 8bit
+ `char` (`signed` or `unsigned`) and two's complement negatives.
-The limitations of using `char` as counters for e.g. the number of music staves
-are minor. 127 staves to a page is rather a lot.
+ The limitations of using `char` as counters for e.g. the number of music staves
+ are minor. 127 staves to a page is rather a lot.
-The file layout must be exactly the same as deckmyn.c though, only the locations
-of space (`" "`) may differ.
+ The file layout must be exactly the same as deckmyn.c though, only the locations
+ of space (`" "`) may differ.
-Every element in the music is given by a string of *exactly* 3 characters. Any
-violation of this will result in the rest of the music being interpreted in some
-randomly wrong way. Notice that in a file, the newline is also a character!
-Therefore, when preparing music in a file, care should be taken that the last
-musical element of a line is only 2 characters!
+ Every element in the music is given by a string of *exactly* 3 characters. Any
+ violation of this will result in the rest of the music being interpreted in some
+ randomly wrong way. Notice that in a file, the newline is also a character!
+ Therefore, when preparing music in a file, care should be taken that the last
+ musical element of a line is only 2 characters!
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:
+
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:
+ 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.
-
@@ -2267,19 +2265,19 @@ 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
+
echo'No. I want chocolate!'|./prog> chocolate.raw./prog e < chocolate.raw
and get:
-
No. I want some chocolate!
+
No. I want some chocolate!
but instead we get:
-
IT FHOCOLITE!
+
IT FHOCOLITE!
which is very wrong. If however one does:
-
echo IOCCC | ./prog > ioccc.raw
+
echo IOCCC | ./prog > ioccc.raw
-./prog e < ioccc.raw
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
@@ -2366,8 +2364,8 @@ fixing the syntax error in the generated ioccc.json file.
After exiting the program (with ctrl-e) if you try running it again you will
likely see:
-
>bootT5pw
- ]h_ 8D3[]
+
>bootT5pw
+ ]h_ 8D3[]
where [] is the cursor. When this happens if you hit enter (this is necessary
or else it’ll happen again) and then exit again (ctrl-e) and run prog again
it’ll be okay.
@@ -2447,20 +2445,20 @@ 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:
-
which shows it works. However as the de.sh script refers to all letters it can’t
find a perfect pangram. BTW, as far as the question of whether the umlaut
letters or the Eszett are considered letters in the German alphabet, Cody noted
in the de.sh/de.alt.sh scripts:
-
# Are the umlauts ä, ö, ü and Eszett (ß) letters in the German alphabet? There
-# is more than one opinion on the subject but a lot of words do have an umlaut
-# (or Umlaut in German). In some (probably all) systems this script outputs
-# nothing probably because it's very hard to form a perfect pangram in German,
-# if it's not impossible. Nevertheless, we do include the other characters
-# whether or not they are in your view considered part of the alphabet for the
-# reason that so many words have them.
+
# Are the umlauts ä, ö, ü and Eszett (ß) letters in the German alphabet? There
+ # is more than one opinion on the subject but a lot of words do have an umlaut
+ # (or Umlaut in German). In some (probably all) systems this script outputs
+ # nothing probably because it's very hard to form a perfect pangram in German,
+ # if it's not impossible. Nevertheless, we do include the other characters
+ # whether or not they are in your view considered part of the alphabet for the
+ # reason that so many words have them.
2019/dogon
STATUS: uses gets() - change to fgets() if possible
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:
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 81cd8437a..80e1cda41 100644
--- a/bugs.md
+++ b/bugs.md
@@ -114,9 +114,9 @@ In rare cases they are valid. For instance Cody noticed in linux the following
warning in [1985/applin](1985/applin/applin.c) with gcc:
```
-applin.c:1:78: warning: incompatible implicit declaration of built-in function 'execlp' [-Wbuiltin-declaration-mismatch]
- 1 | main(v,c)char**c;{for(v[c++]=strdup("Hello, world!\n");(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);}
- | ^~~~~~
+ applin.c:1:78: warning: incompatible implicit declaration of built-in function 'execlp' [-Wbuiltin-declaration-mismatch]
+ 1 | main(v,c)char**c;{for(v[c++]=strdup("Hello, world!\n");(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);}
+ | ^~~~~~
```
and this reminded him of his fix to
@@ -156,7 +156,7 @@ experienced this many times with vim so he tends to disable all format options
when formatting code. In vim you should be able to do that with:
```
-:set formatoptions=
+ :set formatoptions=
```
@@ -422,9 +422,9 @@ The purpose of this program is to print out a string of rubbish. In particular
you should see something like:
```sh
-$ ./decot
-'",x); /*
-\
+ $ ./decot
+ '",x); /*
+ \
```
without a newline after the `\`. This is not a bug.
@@ -528,7 +528,7 @@ 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
+ ./ver2 < westley.c
```
### A useful note on changing/fixing this program
@@ -547,12 +547,12 @@ The reason this is crashing is that the array `irk` is being accessed way out of
bounds by the int `gnat`. For instance:
```
-Program terminated with signal SIGSEGV, Segmentation fault.
-#0 0x0000000000401335 in main (ABBA@entry=, tang@entry=, gnat@entry=, Near@entry=)
- at ver2.c:23
-23 &&gnat!({)Near,noon,/*krelc*/)<0&&(Near= - irk[-gnat--]-2)))&&main(ABBA,
-(gdb) p gnat
-$1 = -518733305
+ Program terminated with signal SIGSEGV, Segmentation fault.
+ #0 0x0000000000401335 in main (ABBA@entry=, tang@entry=, gnat@entry=, Near@entry=)
+ at ver2.c:23
+ 23 &&gnat!({)Near,noon,/*krelc*/)<0&&(Near= - irk[-gnat--]-2)))&&main(ABBA,
+ (gdb) p gnat
+ $1 = -518733305
```
### Magic of the entry:
@@ -576,7 +576,7 @@ 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
+ /**//*/};)/**/pain(*//**/tang ,gnat/**//*/,ABBA~,0-0(avnz;)0-0,tang,raeN
```
In `ver0` it'll be the same but the others are more interesting.
@@ -584,13 +584,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/**/);}/*//**/
+ 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
+ /**//*/};)/**/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`.
@@ -654,61 +654,61 @@ 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
-./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
```
@@ -725,7 +725,7 @@ 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
+ echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
```
which should apply the identity transformation to a minimal holoalphabetic
@@ -734,12 +734,12 @@ 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
-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.
@@ -747,13 +747,13 @@ 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
+ echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw | ./jaw
```
they will get just
```
-oops
+ oops
```
which seems to be an error message (one of the fixes was to make it not use
@@ -843,7 +843,7 @@ that that is the error message.
Another thing is that the code:
```c
-printf((W,Y));
+ printf((W,Y));
```
appears to be wrong because `W` is a `FILE *` and `Y` is a `char[]` but if one
@@ -865,20 +865,20 @@ have to remove the outer `()` pair.
Leo Broukhis, before he was an IOCCC judge, sent the IOCCC judges an email:
```
-From: leo _at_ zycad -dot- com (Leo Broukhis)
-Date: Tue, 30 Jan 96 17:37:51 PST
-To: judges _at_ toad -dot- com
-Subject: IOCCC 1992 - a bug
+ From: leo _at_ zycad -dot- com (Leo Broukhis)
+ Date: Tue, 30 Jan 96 17:37:51 PST
+ To: judges _at_ toad -dot- com
+ Subject: IOCCC 1992 - a bug
-Dear Judges,
+ Dear Judges,
-albert.c (even in its fixed form) still has a bug. Although I don't
-remember the number that exposed the bug (afair, resulting in coredump)
-in albert.orig.c that has been fixed in albert.c,
+ albert.c (even in its fixed form) still has a bug. Although I don't
+ remember the number that exposed the bug (afair, resulting in coredump)
+ in albert.orig.c that has been fixed in albert.c,
- 've found a number exposing another bug: 10000000001 (that's 9 0's).
-Both albert and albert.orig loop without printing anything, although
-the first factor is 101 and is usually found in an instant.
+ 've found a number exposing another bug: 10000000001 (that's 9 0's).
+ Both albert and albert.orig loop without printing anything, although
+ the first factor is 101 and is usually found in an instant.
```
@@ -886,7 +886,7 @@ A quick debugging session from Cody suggests that the problem with this value
is that:
```c
-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
@@ -894,13 +894,12 @@ 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);
- *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
@@ -911,7 +910,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 )))))
+ if ((((( !(aa=setjmp(ppp->ppp))||aa==aaaaaa )))))
```
appears to be entered because of the return value of `setjmp()`, not the other
@@ -979,56 +978,56 @@ This entry relies on specific compiler warnings. With gcc it will look something
like:
```
-[...]
-lush.c: In function 'main':
-lush.c:40: warning: "f" redefined
- 40 | main
- |
-lush.c:1: note: this is the location of the previous definition
- 1 | #define gets(_) fgets((_),999,stdin)
- |
-lush.c:42: warning: "f" redefined
- 42 | #define f 001:
- |
-lush.c:40: note: this is the location of the previous definition
- 40 | main
- |
-lush.c:44: warning: "f" redefined
- 44 | #define f 100:
- |
-lush.c:42: note: this is the location of the previous definition
- 42 | #define f 001:
- |
-lush.c:45: warning: "f" redefined
- 45 | _[i--
- |
-lush.c:44: note: this is the location of the previous definition
- 44 | #define f 100:
- |
-lush.c:46: warning: "f" redefined
- 46 | #define f 126:
- |
-lush.c:45: note: this is the location of the previous definition
- 45 | _[i--
- |
+ [...]
+ lush.c: In function 'main':
+ lush.c:40: warning: "f" redefined
+ 40 | main
+ |
+ lush.c:1: note: this is the location of the previous definition
+ 1 | #define gets(_) fgets((_),999,stdin)
+ |
+ lush.c:42: warning: "f" redefined
+ 42 | #define f 001:
+ |
+ lush.c:40: note: this is the location of the previous definition
+ 40 | main
+ |
+ lush.c:44: warning: "f" redefined
+ 44 | #define f 100:
+ |
+ lush.c:42: note: this is the location of the previous definition
+ 42 | #define f 001:
+ |
+ lush.c:45: warning: "f" redefined
+ 45 | _[i--
+ |
+ lush.c:44: note: this is the location of the previous definition
+ 44 | #define f 100:
+ |
+ lush.c:46: warning: "f" redefined
+ 46 | #define f 126:
+ |
+ lush.c:45: note: this is the location of the previous definition
+ 45 | _[i--
+ |
```
Now one can use `sed` to get the `warning:` line correct but there is more to it
than that. For instance this is what it looks like with clang:
```
-lush.c:40:9: warning: 'f' macro redefined [-Wmacro-redefined]
-#define f 001:
- ^
-lush.c:1:9: note: previous definition is here
-#define f 000:
- ^
-lush.c:42:9: warning: 'f' macro redefined [-Wmacro-redefined]
-#define f 100:
- ^
-lush.c:40:9: note: previous definition is here
-#define f 001:
- ^
+ lush.c:40:9: warning: 'f' macro redefined [-Wmacro-redefined]
+ #define f 001:
+ ^
+ lush.c:1:9: note: previous definition is here
+ #define f 000:
+ ^
+ lush.c:42:9: warning: 'f' macro redefined [-Wmacro-redefined]
+ #define f 100:
+ ^
+ lush.c:40:9: note: previous definition is here
+ #define f 001:
+ ^
```
As you might see the part under the `warning:` line is different.
@@ -1036,7 +1035,7 @@ As you might see the part under the `warning:` line is different.
The entry is supposed to show warnings and then print:
```
-Hello World.
+ Hello World.
```
Can you help us?
@@ -1066,7 +1065,7 @@ in column width it will not display right. To see the number of columns in your
terminal try:
```sh
-echo $COLUMNS
+ echo $COLUMNS
```
@@ -1076,8 +1075,8 @@ 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]...
+ 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.
@@ -1100,12 +1099,12 @@ not a misunderstanding).
The author stated that:
```
-The expression `(a*)*` compiles but loops forever.
+ The expression `(a*)*` compiles but loops forever.
-There is no check for trailing backslash (`\`) in the pattern.
+ There is no check for trailing backslash (`\`) in the pattern.
-There is no check for unbalanced brackets. Omitting a closing bracket
-will generate a "Pattern too long" error, which is not the real error.
+ There is no check for unbalanced brackets. Omitting a closing bracket
+ will generate a "Pattern too long" error, which is not the real error.
```
@@ -1165,25 +1164,25 @@ 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
-in C. Mark Schnitzius is the author of this
-program.
+ $ ./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.
+ The Loch Ness monster has been captured. Elvis
+ is alive. Hostler was a woman. The NASA moon
+ landings were clearly faked.
-? What is foo'?
+ ? 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
+ sh: -c: line 0: unexpected EOF while looking for matching `''
+ sh: -c: line 1: syntax error: unexpected end of file
```
with the program terminating. Other characters will also cause this problem.
@@ -1191,7 +1190,7 @@ with the program terminating. Other characters will also cause this problem.
Of course if you do something like:
```
-What is 'foo'?
+ What is 'foo'?
```
it will work fine.
@@ -1277,7 +1276,7 @@ below.
You might wish to run the command:
```sh
-make diff_orig_prog
+ make diff_orig_prog
```
to see what had to change for the buffer size, when looking at the below.
@@ -1285,7 +1284,7 @@ Furthermore you will want to look at:
```sh
-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
@@ -1364,7 +1363,7 @@ 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
+ ./schnitzi < schnitzi.c
```
can be compiled and the output of that new program when fed itself can also be
@@ -1425,9 +1424,9 @@ Since it works there is no need to fix this except for a challenge to yourself.
The judges said the following in their remarks:
```
-The fractally minded may be able to detect that mode 0 does not calculate
-Mandelbrot/Julian sets correctly. Can you find the bug? Better still, can you
-fix it without breaking something else?
+ The fractally minded may be able to detect that mode 0 does not calculate
+ Mandelbrot/Julian sets correctly. Can you find the bug? Better still, can you
+ fix it without breaking something else?
```
You are welcome to try and fix it and open a pull request, providing that it
@@ -1464,16 +1463,16 @@ The judges suggested that the following commands should result in output:
```sh
-./leo 1 | cat - /dev/tty | gs -
+ ./leo 1 | cat - /dev/tty | gs -
-./leo 37 80 | cat - /dev/tty | gs -
+ ./leo 37 80 | cat - /dev/tty | gs -
```
The first one can work if one does instead:
```sh
-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
@@ -1534,28 +1533,28 @@ 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
-+++ 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
@@ -1622,8 +1621,8 @@ 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
+ $ ./schnitzi 9|wc -l
+ 771999
```
The larger the number the bigger the file can become too, even becoming
@@ -1653,7 +1652,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
+ 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.
@@ -1667,41 +1666,40 @@ 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
-$
+ $ 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:
```sh
-$ 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:
```sh
-$ 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!
```sh
-$ 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:
```sh
-$ 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
@@ -1715,8 +1713,8 @@ 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
+ $ echo 1 2 + p | ./dlowe
+ 3
```
so something is wrong with some commands/operators.
@@ -1724,8 +1722,8 @@ so something is wrong with some commands/operators.
Another feature that does work in linux is:
```sh
-$ echo poot | ./dlowe
-poot was here!
+ $ echo poot | ./dlowe
+ poot was here!
```
Can you help fix these problems?
@@ -1738,50 +1736,50 @@ well. A note below might suggest that doing this creates incomplete perl.
Anyway:
```c
-#include
-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
+ 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:
```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]}
+ #!/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
-5 p
-5
-5 + 5 p
-unimplemented
-5
-P
-5
-p
-5
+ p
+ stack empty
+ 5 p
+ 5
+ 5 + 5 p
+ unimplemented
+ 5
+ P
+ 5
+ p
+ 5
```
So you can see that if one uses operators it just shows 'unimplemented' (observe
@@ -1792,7 +1790,7 @@ To not get 'unimplemented' you can remove from the perl:
```perl
-sub AUTOLOAD { print"unimplemented\n"}
+ sub AUTOLOAD { print"unimplemented\n"}
```
(Note that the author stated this was used for exception handling so another
@@ -1804,25 +1802,25 @@ 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
-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
@@ -1831,8 +1829,8 @@ it seems likely that there is something missing (which the below shows as well).
For instance inputting `D` followed by `XX`:
```
-Undefined subroutine &main::nn called at ./pl.pl line 2, <> line 6.
-Undefined subroutine &main::[[ called at ./pl.pl line 2, <> line 1.
+ Undefined subroutine &main::nn called at ./pl.pl line 2, <> line 6.
+ Undefined subroutine &main::[[ called at ./pl.pl line 2, <> line 1.
```
That means then that in linux despite the subroutines seemingly not existing it
@@ -1844,9 +1842,9 @@ 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
+ $ echo 5 5 + p | ./dlowe.pl
+ unimplemented
+ 5
```
which might (?) suggest that the `+` operator is unimplemented. Unfortunately it
@@ -1861,30 +1859,30 @@ 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 "
-";(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:
```c
-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
@@ -1896,8 +1894,8 @@ crash this makes sense.
The example command above _should_ print:
```sh
-$ 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.
@@ -1919,7 +1917,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
+ ./primenum 13
```
will seemingly wait for input exactly because it is waiting for input. See the
@@ -2176,26 +2174,26 @@ It appears that the crash happens in more than one place. For instance it has
happened at
```c
-XCheckMaskEvent(d, 4,&e)
+ 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)
+ 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
+ (lldb) p d
+ (Display *) 0x0000000000000001
```
It is believed that it also happened at
```c
-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.
@@ -2203,7 +2201,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);
+ usleep(p*200);
```
which happens to be in a `while()` loop.
@@ -2241,17 +2239,17 @@ Segmentation fault will occur in some systems. For instance on macOS with the
arm64 chip:
```sh
-./gavin > kernel
+ ./gavin > kernel
```
When trying to link `gavin.o` to produce `sh`, the linker generates:
```
-Undefined symbols for architecture arm64:
- "start", referenced from:
- -u command line option
- (maybe you meant: __start)
-ld: symbol(s) not found for architecture arm64
+ Undefined symbols for architecture arm64:
+ "start", referenced from:
+ -u command line option
+ (maybe you meant: __start)
+ ld: symbol(s) not found for architecture arm64
```
We believe that this simply won't work with non x86 specific systems but perhaps
@@ -2263,73 +2261,73 @@ 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
-+++ 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
+ 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 (B)
+ @@ -52,7 +53,7 @@ else
- G (_);
- G (o);
--G (main)
-+G (cain)
- {
- Z, k = K;
- if (!t)
+ 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:
```make
-# Special flags for the gavin entry
-#
-# FYI: Older versions of GCC have a bug in -O2 optimization, hence -O1
-#
-GAVIN_OPT= -O1
-GAVIN_FLAGS=\
- '-DY(m)=*((int*)(m))'\
- '-DE(f,a,b,c)=((G((*)))(f))(a,b,c)'\
- '-DM=for(D=0;D<786432;D++)'\
- '-DZ=int i=0,j=0,h,n,p=393728,s=26739,C,D'\
- '-DV=0x90200'\
- '-DK=0'\
- '-DR=while((C=E(V-8,100,0,0))&3&&(D=E(V-8,96,0,0))|3){'\
- '-DL(c,d)=E(V+8,100,c,0);R}E(V+8,96,d,0);R}'
+ # Special flags for the gavin entry
+ #
+ # FYI: Older versions of GCC have a bug in -O2 optimization, hence -O1
+ #
+ GAVIN_OPT= -O1
+ GAVIN_FLAGS=\
+ '-DY(m)=*((int*)(m))'\
+ '-DE(f,a,b,c)=((G((*)))(f))(a,b,c)'\
+ '-DM=for(D=0;D<786432;D++)'\
+ '-DZ=int i=0,j=0,h,n,p=393728,s=26739,C,D'\
+ '-DV=0x90200'\
+ '-DK=0'\
+ '-DR=while((C=E(V-8,100,0,0))&3&&(D=E(V-8,96,0,0))|3){'\
+ '-DL(c,d)=E(V+8,100,c,0);R}E(V+8,96,d,0);R}'
-# ...
+ # ...
-# Best of Show
-#
-gavin: gavin.c
- ${CC} ${GAVIN_OPT} -o gavin ${GAVIN_FLAGS} gavin.c
- ${RM} -f kernel
- ./gavin > kernel
- ${CC} ${GAVIN_OPT} -c ${GAVIN_FLAGS} -DB=_start '-Dputchar(a)=' gavin.c
- ${RM} -f sh
- ${LD} -s -o sh gavin.o
- ${RM} -f vi
- ${CP} sh vi
- ${RM} -f fs.tar
- ${TAR} -cvf fs.tar sh vi gavin.c index.html prim
+ # Best of Show
+ #
+ gavin: gavin.c
+ ${CC} ${GAVIN_OPT} -o gavin ${GAVIN_FLAGS} gavin.c
+ ${RM} -f kernel
+ ./gavin > kernel
+ ${CC} ${GAVIN_OPT} -c ${GAVIN_FLAGS} -DB=_start '-Dputchar(a)=' gavin.c
+ ${RM} -f sh
+ ${LD} -s -o sh gavin.o
+ ${RM} -f vi
+ ${CP} sh vi
+ ${RM} -f fs.tar
+ ${TAR} -cvf fs.tar sh vi gavin.c index.html prim
-gavin_clean:
- ${RM} -f sh vi kernel gavin.o
+ gavin_clean:
+ ${RM} -f sh vi kernel gavin.o
-gavin_clobber: gavin_clean
- ${RM} -f gavin fs.tar
+ gavin_clobber: gavin_clean
+ ${RM} -f gavin fs.tar
-gavin_files: boot.b lilo.conf prim gavin_install.txt
+ gavin_files: boot.b lilo.conf prim gavin_install.txt
```
The current ([Makefile](2004/gavin/Makefile) was modified to try and
@@ -2351,24 +2349,24 @@ things that are not bugs but documented (mis)features.
The author stated that:
```
-Arguments matching `/[^2]22$/` cause the program to segfault
-after rapidly exhausting the available stack space. I could
-probably fix this by adding some special cases to the code,
-but [Blaine the Mono] it's quite a bit more exciting this way,
-don't you think?[/Blaine] Since the trailing `22` will be
-its own atom anyway, you can just insert a space in front of
-it if you run into this feature (e.g. `1 22` instead of `122`).
+ Arguments matching `/[^2]22$/` cause the program to segfault
+ after rapidly exhausting the available stack space. I could
+ probably fix this by adding some special cases to the code,
+ but [Blaine the Mono] it's quite a bit more exciting this way,
+ don't you think?[/Blaine] Since the trailing `22` will be
+ its own atom anyway, you can just insert a space in front of
+ it if you run into this feature (e.g. `1 22` instead of `122`).
-Arguments matching `/(?:.){10,}/` will produce visually incorrect
-results (e.g., generation 1 starting from 1111111111 will
-print as `: 1`), but there's nothing interesting about these
-arguments that can't be modeled using shorter runs of the same
-symbol.
+ Arguments matching `/(?:.){10,}/` will produce visually incorrect
+ results (e.g., generation 1 starting from 1111111111 will
+ print as `: 1`), but there's nothing interesting about these
+ arguments that can't be modeled using shorter runs of the same
+ symbol.
-Arguments matching `/(?:.){257,}/` may produce mathematically
-incorrect results (e.g., generation 1 starting from a string
-of 257 `1`s will be calculated as `11`); the remark from the
-previous paragraph applies here also.
+ Arguments matching `/(?:.){257,}/` may produce mathematically
+ incorrect results (e.g., generation 1 starting from a string
+ of 257 `1`s will be calculated as `11`); the remark from the
+ previous paragraph applies here also.
```
@@ -2522,8 +2520,8 @@ obnoxious in macOS as it shows it at runtime (redirecting `stderr` to
with at least `computer.tofu` input file:
```diff
-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)
```
@@ -2573,20 +2571,19 @@ Incorrect formulas will ungracefully crash the program.
The author stated:
```
-If you pick a number higher than 19186, the program will return a
-solution but it will be a rotation of one of the first 19186. This is
-because the cross shaped piece fits 48 ways in the 4x4 cube, but only
-2 of those ways are unique - you can rotate one of those to make any
-of the other 46. The algorithm used always places the cross piece
-first, so the first two placings of that piece result in the 19186
-unique solutions.
+ If you pick a number higher than 19186, the program will return a
+ solution but it will be a rotation of one of the first 19186. This is
+ because the cross shaped piece fits 48 ways in the 4x4 cube, but only
+ 2 of those ways are unique - you can rotate one of those to make any
+ of the other 46. The algorithm used always places the cross piece
+ first, so the first two placings of that piece result in the 19186
+ unique solutions.
-If you pick a number higher than 460464 (24x19186) the program will
-return without outputting a solution. If you can wait that long.
+ If you pick a number higher than 460464 (24x19186) the program will
+ return without outputting a solution. If you can wait that long.
```
-
## 2006/toledo2
@@ -2729,7 +2726,7 @@ macOS. A few things that were noticed depending on `asan` sanitisers specified.
With `address` in linux:
```
-richards.c:101:9: runtime error: null pointer passed as argument 2, which is declared to never be null
+ 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:
@@ -2744,13 +2741,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];
+ #define W(c) e=memmove(e,x[(u)c], y[(u)c])+y[(u)c];
```
so it would appear that
```c
-x[(u)c]
+ x[(u)c]
```
(at least in my tired head?) is NULL. But why does it work then?
@@ -2760,25 +2757,25 @@ NOTE: `u` is `int`.
Under macOS (with the arm64 chip) we get:
```
-UndefinedBehaviorSanitizer:DEADLYSIGNAL
-==10834==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0xffffffffffffffff (pc 0x00019f446748 bp 0x00016f353100 sp 0x00016f352b90 T139066)
-==10834==The signal is caused by a WRITE memory access.
- #0 0x19f446748 in _platform_memmove+0xa8 (libsystem_platform.dylib:arm64e+0x3748) (BuildId: 756cd10d62a032839e57cbaa810c95ac32000000200000000100000000030d00)
- #1 0x100c33c2c in main richards.c:202
- #2 0x19f0bff24 ()
+ UndefinedBehaviorSanitizer:DEADLYSIGNAL
+ ==10834==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0xffffffffffffffff (pc 0x00019f446748 bp 0x00016f353100 sp 0x00016f352b90 T139066)
+ ==10834==The signal is caused by a WRITE memory access.
+ #0 0x19f446748 in _platform_memmove+0xa8 (libsystem_platform.dylib:arm64e+0x3748) (BuildId: 756cd10d62a032839e57cbaa810c95ac32000000200000000100000000030d00)
+ #1 0x100c33c2c in main richards.c:202
+ #2 0x19f0bff24 ()
-==10834==Register values:
- x[0] = 0xffffffffffffffff x[1] = 0x0000000100ab18c1 x[2] = 0x00000000000000cf x[3] = 0x0000000000000000
- x[4] = 0x0000000100ab18a1 x[5] = 0x0000000000000001 x[6] = 0x000000000000000a x[7] = 0x0000000000000000
- x[8] = 0x00000001015972b8 x[9] = 0xffffffffffffffff x[10] = 0x0000000000000001 x[11] = 0x00000000000001f0
-x[12] = 0x0000000000000001 x[13] = 0x00000000000003e0 x[14] = 0x0000000000000001 x[15] = 0x0000000000000084
-x[16] = 0x000000019f4466a0 x[17] = 0x00000001ff3ad908 x[18] = 0x0000000000000000 x[19] = 0x0000000100c32a80
-x[20] = 0x00000001017e0000 x[21] = 0x00000001017e1910 x[22] = 0x000000016f353530 x[23] = 0x000000019f13a366
-x[24] = 0x000000016f3534b0 x[25] = 0x0000000000000001 x[26] = 0x0000000000000000 x[27] = 0x0000000000000000
-x[28] = 0x0000000000000000 fp = 0x000000016f353100 lr = 0x0000000100aaf880 sp = 0x000000016f352b90
-UndefinedBehaviorSanitizer can not provide additional info.
-SUMMARY: UndefinedBehaviorSanitizer: SEGV (libsystem_platform.dylib:arm64e+0x3748) (BuildId: 756cd10d62a032839e57cbaa810c95ac32000000200000000100000000030d00) in _platform_memmove+0xa8
-==10834==ABORTING
+ ==10834==Register values:
+ x[0] = 0xffffffffffffffff x[1] = 0x0000000100ab18c1 x[2] = 0x00000000000000cf x[3] = 0x0000000000000000
+ x[4] = 0x0000000100ab18a1 x[5] = 0x0000000000000001 x[6] = 0x000000000000000a x[7] = 0x0000000000000000
+ x[8] = 0x00000001015972b8 x[9] = 0xffffffffffffffff x[10] = 0x0000000000000001 x[11] = 0x00000000000001f0
+ x[12] = 0x0000000000000001 x[13] = 0x00000000000003e0 x[14] = 0x0000000000000001 x[15] = 0x0000000000000084
+ x[16] = 0x000000019f4466a0 x[17] = 0x00000001ff3ad908 x[18] = 0x0000000000000000 x[19] = 0x0000000100c32a80
+ x[20] = 0x00000001017e0000 x[21] = 0x00000001017e1910 x[22] = 0x000000016f353530 x[23] = 0x000000019f13a366
+ x[24] = 0x000000016f3534b0 x[25] = 0x0000000000000001 x[26] = 0x0000000000000000 x[27] = 0x0000000000000000
+ x[28] = 0x0000000000000000 fp = 0x000000016f353100 lr = 0x0000000100aaf880 sp = 0x000000016f352b90
+ UndefinedBehaviorSanitizer can not provide additional info.
+ SUMMARY: UndefinedBehaviorSanitizer: SEGV (libsystem_platform.dylib:arm64e+0x3748) (BuildId: 756cd10d62a032839e57cbaa810c95ac32000000200000000100000000030d00) in _platform_memmove+0xa8
+ ==10834==ABORTING
```
and naturally it does not work.
@@ -2790,68 +2787,67 @@ address allocated in macOS? Or is it?
Now with `address` sanitiser both linux and macOS crash at:
```
-=================================================================
-==10983==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x00016f8d5e78 at pc 0x0001005dd910 bp 0x00016f8d5cd0 sp 0x00016f8d5cc8
-READ of size 8 at 0x00016f8d5e78 thread T0
- #0 0x1005dd90c in rd richards.c:132
- #1 0x1005ddf8c in re richards.c:149
- #2 0x1005110a0 in t richards.c:108
- #3 0x1005df72c in main richards.c:189
- #4 0x19f0bff24 ()
+ =================================================================
+ ==10983==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x00016f8d5e78 at pc 0x0001005dd910 bp 0x00016f8d5cd0 sp 0x00016f8d5cc8
+ READ of size 8 at 0x00016f8d5e78 thread T0
+ #0 0x1005dd90c in rd richards.c:132
+ #1 0x1005ddf8c in re richards.c:149
+ #2 0x1005110a0 in t richards.c:108
+ #3 0x1005df72c in main richards.c:189
+ #4 0x19f0bff24 ()
-Address 0x00016f8d5e78 is located in stack of thread T0 at offset 56 in frame
- #0 0x1005dd678 in rd richards.c:129
+ Address 0x00016f8d5e78 is located in stack of thread T0 at offset 56 in frame
+ #0 0x1005dd678 in rd richards.c:129
- This frame has 2 object(s):
- [32, 36) 'v.addr'
- [48, 56) 'a' (line 130) <== Memory access at offset 56 overflows this variable
-HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
- (longjmp and C++ exceptions *are* supported)
-SUMMARY: AddressSanitizer: stack-buffer-overflow richards.c:132 in rd
-Shadow bytes around the buggy address:
- 0x00702df3ab70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3ab80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3ab90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3aba0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3abb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-=>0x00702df3abc0: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 04 f2 00[f3]
- 0x00702df3abd0: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3abe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3abf0: 00 00 00 00 f1 f1 f1 f1 00 f3 f3 f3 00 00 00 00
- 0x00702df3ac00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 0x00702df3ac10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-Shadow byte legend (one shadow byte represents 8 application bytes):
- Addressable: 00
- Partially addressable: 01 02 03 04 05 06 07
- Heap left redzone: fa
- Freed heap region: fd
- Stack left redzone: f1
- Stack mid redzone: f2
- Stack right redzone: f3
- Stack after return: f5
- Stack use after scope: f8
- Global redzone: f9
- Global init order: f6
- Poisoned by user: f7
- Container overflow: fc
- Array cookie: ac
- Intra object redzone: bb
- ASan internal: fe
- Left alloca redzone: ca
- Right alloca redzone: cb
-==10983==ABORTING
-/bin/bash: line 1: 10983 Abort trap: 6 ./richards
+ This frame has 2 object(s):
+ [32, 36) 'v.addr'
+ [48, 56) 'a' (line 130) <== Memory access at offset 56 overflows this variable
+ HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
+ (longjmp and C++ exceptions *are* supported)
+ SUMMARY: AddressSanitizer: stack-buffer-overflow richards.c:132 in rd
+ Shadow bytes around the buggy address:
+ 0x00702df3ab70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3ab80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3ab90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3aba0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3abb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ =>0x00702df3abc0: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 04 f2 00[f3]
+ 0x00702df3abd0: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3abe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3abf0: 00 00 00 00 f1 f1 f1 f1 00 f3 f3 f3 00 00 00 00
+ 0x00702df3ac00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 0x00702df3ac10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ Shadow byte legend (one shadow byte represents 8 application bytes):
+ Addressable: 00
+ Partially addressable: 01 02 03 04 05 06 07
+ Heap left redzone: fa
+ Freed heap region: fd
+ Stack left redzone: f1
+ Stack mid redzone: f2
+ Stack right redzone: f3
+ Stack after return: f5
+ Stack use after scope: f8
+ Global redzone: f9
+ Global init order: f6
+ Poisoned by user: f7
+ Container overflow: fc
+ Array cookie: ac
+ Intra object redzone: bb
+ ASan internal: fe
+ Left alloca redzone: ca
+ Right alloca redzone: cb
+ ==10983==ABORTING
+ /bin/bash: line 1: 10983 Abort trap: 6 ./richards
```
which corresponds to the code:
```c
-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
@@ -2860,27 +2856,26 @@ linux.
A warning of interest when compiling is:
```
+ richards.c:169:15: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'o ()' (aka 'void ()') [-Wincompatible-pointer-types]
+ f *lib1[] = { T, T, T, T, T } ;
-richards.c:169:15: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'o ()' (aka 'void ()') [-Wincompatible-pointer-types]
-f *lib1[] = { T, T, T, T, T } ;
+ ...
-...
-
-richards.c:170:15: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'o ()' (aka 'void ()') [-Wincompatible-pointer-types]
-f *lib2[] = { T, ld, lp, lx, l1 } ;
- ^
-richards.c:170:18: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
-f *lib2[] = { T, ld, lp, lx, l1 } ;
- ^~
-richards.c:170:22: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
-f *lib2[] = { T, ld, lp, lx, l1 } ;
- ^~
-richards.c:170:26: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
-f *lib2[] = { T, ld, lp, lx, l1 } ;
- ^~
-richards.c:170:30: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
-f *lib2[] = { T, ld, lp, lx, l1 } ;
- ^~
+ richards.c:170:15: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'o ()' (aka 'void ()') [-Wincompatible-pointer-types]
+ f *lib2[] = { T, ld, lp, lx, l1 } ;
+ ^
+ richards.c:170:18: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
+ f *lib2[] = { T, ld, lp, lx, l1 } ;
+ ^~
+ richards.c:170:22: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
+ f *lib2[] = { T, ld, lp, lx, l1 } ;
+ ^~
+ richards.c:170:26: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
+ f *lib2[] = { T, ld, lp, lx, l1 } ;
+ ^~
+ richards.c:170:30: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types]
+ f *lib2[] = { T, ld, lp, lx, l1 } ;
+ ^~
```
This can be fixed easily enough however but it doesn't appear to matter in this
@@ -2942,8 +2937,8 @@ fire](https://en.wikipedia.org/wiki/Halt_and_Catch_Fire_(computing)) :-)
The author stated:
```
-If there is a division by zero, square-root of a negative number, or similar
-operation, then the results are undefined.
+ If there is a division by zero, square-root of a negative number, or similar
+ operation, then the results are undefined.
```
@@ -2956,31 +2951,31 @@ operation, then the results are undefined.
The author stated:
```
-The memory locations of `argv` are used for various purposes. Therefore, the
-program name (default `deckmyn`) must be *at least 4 characters long*, including
-possibly the path. This, along with the ending `'\0'`, gives a minimum 5 bytes of
-useful memory space. Otherwise, the program may attempt to write outside the
-string.
+ The memory locations of `argv` are used for various purposes. Therefore, the
+ program name (default `deckmyn`) must be *at least 4 characters long*, including
+ possibly the path. This, along with the ending `'\0'`, gives a minimum 5 bytes of
+ useful memory space. Otherwise, the program may attempt to write outside the
+ string.
-The code is quite sensitive. Errors in the input can lead to strange results.
-The code does not read beyond the end of the music input, but that is about the
-only error checking available. Any input that is not according to the rules in
-the deckmyn.html, may cause errors.
+ The code is quite sensitive. Errors in the input can lead to strange results.
+ The code does not read beyond the end of the music input, but that is about the
+ only error checking available. Any input that is not according to the rules in
+ the deckmyn.html, may cause errors.
-The program has no special hardware limitations or requirements, other than 8bit
-`char` (`signed` or `unsigned`) and two's complement negatives.
+ The program has no special hardware limitations or requirements, other than 8bit
+ `char` (`signed` or `unsigned`) and two's complement negatives.
-The limitations of using `char` as counters for e.g. the number of music staves
-are minor. 127 staves to a page is rather a lot.
+ The limitations of using `char` as counters for e.g. the number of music staves
+ are minor. 127 staves to a page is rather a lot.
-The file layout must be exactly the same as deckmyn.c though, only the locations
-of space (`" "`) may differ.
+ The file layout must be exactly the same as deckmyn.c though, only the locations
+ of space (`" "`) may differ.
-Every element in the music is given by a string of *exactly* 3 characters. Any
-violation of this will result in the rest of the music being interpreted in some
-randomly wrong way. Notice that in a file, the newline is also a character!
-Therefore, when preparing music in a file, care should be taken that the last
-musical element of a line is only 2 characters!
+ Every element in the music is given by a string of *exactly* 3 characters. Any
+ violation of this will result in the rest of the music being interpreted in some
+ randomly wrong way. Notice that in a file, the newline is also a character!
+ Therefore, when preparing music in a file, care should be taken that the last
+ musical element of a line is only 2 characters!
```
@@ -3012,21 +3007,20 @@ The author stated:
The author stated:
```
-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:
+ 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:
+ 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
-
-will likely dump core.
+ echo ">Hello, world" | ./tromp
+ will likely dump core.
```
@@ -3231,7 +3225,7 @@ rely on the entry as the below shows. One should be able to do:
```sh
-echo 'No. I want chocolate!' | ./prog > chocolate.raw
+ echo 'No. I want chocolate!' | ./prog > chocolate.raw
./prog e < chocolate.raw
```
@@ -3239,27 +3233,27 @@ echo 'No. I want chocolate!' | ./prog > chocolate.raw
and get:
```
-No. I want some chocolate!
+ No. I want some chocolate!
```
but instead we get:
```
-IT FHOCOLITE!
+ IT FHOCOLITE!
```
which is very wrong. If however one does:
```
-echo IOCCC | ./prog > ioccc.raw
+ echo IOCCC | ./prog > ioccc.raw
-./prog e < ioccc.raw
+ ./prog e < ioccc.raw
```
they will properly get:
```
-IOCCC
+ IOCCC
```
@@ -3374,9 +3368,9 @@ 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
+ $ ./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 file `ioccc.html` will
@@ -3397,8 +3391,8 @@ After exiting the program (with ctrl-e) if you try running it again you will
likely see:
```
->bootT5pw
- ]h_ 8D3[]
+ >bootT5pw
+ ]h_ 8D3[]
```
where `[]` is the cursor. When this happens if you hit enter (this is necessary
@@ -3512,13 +3506,13 @@ 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
+ 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
+ aäbcdefghijklmnoöpqrsßtuüvwxyz
```
which shows it works. However as the de.sh script refers to all letters it can't
@@ -3527,13 +3521,13 @@ letters or the Eszett are considered letters in the German alphabet, Cody noted
in the de.sh/de.alt.sh scripts:
```
-# Are the umlauts ä, ö, ü and Eszett (ß) letters in the German alphabet? There
-# is more than one opinion on the subject but a lot of words do have an umlaut
-# (or Umlaut in German). In some (probably all) systems this script outputs
-# nothing probably because it's very hard to form a perfect pangram in German,
-# if it's not impossible. Nevertheless, we do include the other characters
-# whether or not they are in your view considered part of the alphabet for the
-# reason that so many words have them.
+ # Are the umlauts ä, ö, ü and Eszett (ß) letters in the German alphabet? There
+ # is more than one opinion on the subject but a lot of words do have an umlaut
+ # (or Umlaut in German). In some (probably all) systems this script outputs
+ # nothing probably because it's very hard to form a perfect pangram in German,
+ # if it's not impossible. Nevertheless, we do include the other characters
+ # whether or not they are in your view considered part of the alphabet for the
+ # reason that so many words have them.
```
## 2019/dogon
@@ -3564,12 +3558,12 @@ 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=
-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
@@ -3580,13 +3574,13 @@ He provides the following tips on this situation. A simpler way to find sockets
in the directory:
```sh
-file .*|grep socket|cut -f1 -d:
+ 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
+ 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. :-)
diff --git a/faq.html b/faq.html
index a57fcba7a..69d2f68f8 100644
--- a/faq.html
+++ b/faq.html
@@ -379,24 +379,24 @@ 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:
We recommend that the make clobber rule remove files that your entry
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
- rm -f $@
- cp -f prog $@
+
different_name: prog
+ rm -f $@
+ cp -f prog $@
FAQ 0.4: What platform should I assume for my entry?
Your entry must compile with GCC and run under at least one flavor of UNIX (e.g.
Linux or Solaris). To improve chances to win, it should work under both BSD and
@@ -779,19 +779,19 @@ 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
versions. Every Makefile has an alt rule but it will only do something if an
alternate version exists. To build all the entries along with any alternate code
you can do from the top level directory:
-
make clobber everything
+
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)
@@ -968,7 +968,7 @@ XQuartz, preferably on an Apple su
macOS, preferably the most recent version.
After it is installed, open the “XQuartz” application (usually located in
/Applications/Utilities/XQuartz.app) by typing at the command line:
-
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:
-
exportSDL2_INCLUDE_ROOT=/usr
+
exportSDL2_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:
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:
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:
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:
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:
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:
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
-``
-
-NOTE: The OpenGL development effort is being manageed by [vulkan.org](https://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:
-
-```sh
-sudo dnf install glew-devel SDL2-devel SDL2_image-devel glm-devel freetype-devel
+
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.
Older RHEL distributions might have to use “yum” instead of “dnf”
in the above command.
@@ -1387,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.
@@ -1416,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
@@ -1434,10 +1427,10 @@ instance the fix to 1988/reddy required only
these problems.
An annoying fact is that for ‘“compatibility” reasons’ fgets() retains the
newline and gets() does not. As the Unix version 7 man page used to say:
-
BUGS
+
BUGS
-The fgets(3) function retains the newline while gets(3) does not, all in the
-name of backward compatibility.
+ The fgets(3) function retains the newline while gets(3) does not, all in the
+ name of backward compatibility.
We’re not sure how this is compatibility but either way it can cause a
problem and it is this that has complicated most of the fixes though again some
can look almost identical.
@@ -1484,7 +1477,7 @@ stands (that is entry.alt.c to entry.c).
mullender.orig.c, mullender.alt.c and mullender.c. For later years, it
would be instead prog.orig.c, prog.alt.c and prog.c.
at the end of the output but this is completely normal if there are differences.
If the alt code is the same as the original, say with
1984/anonymous, then naturally there is no point in
@@ -1493,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
@@ -1510,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?
@@ -1635,20 +1628,20 @@ request for more information about pull requests.
Nearly all HTML files on the IOCCC web site
are built from markdown files.
If you see lines containing:
-
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
-<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
-<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
-<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
+
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
+ <!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
+ <!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
+ <!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
+ <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
This means that the file is generated by a tool from a bin directory tool.
You should NOT attempt to modify the file.
You may also find lines slightly below the above set that suggest another file to edit.
For example, in contact.html, one may read:
-
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-<!-- !!! Do not modify this web page, instead modify the file: contact.md -->
-<!-- !!! Do not modify this web page, instead modify the file: contact.md -->
-<!-- !!! Do not modify this web page, instead modify the file: contact.md -->
-<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
+
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
+ <!-- !!! Do not modify this web page, instead modify the file: contact.md -->
+ <!-- !!! Do not modify this web page, instead modify the file: contact.md -->
+ <!-- !!! Do not modify this web page, instead modify the file: contact.md -->
+ <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
This means that you could consider editing the referenced markdown file
in your IOCCC pull request.
In some cases, the HTML file is NOT based on markdown content, but instead
came from JSON and other data files. So instead of the above reference to a
markdown file, you will read:
-
<!-- The main section of this web page came from JSON and other data files -->
-<!-- -->
-<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-<!-- The main section of this web page was generated via the tool: bin/gen-years.sh -->
-<!-- The main section of this web page was generated via the tool: bin/gen-years.sh -->
-<!-- The main section of this web page was generated via the tool: bin/gen-years.sh -->
-<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
+
<!-- The main section of this web page came from JSON and other data files -->
+ <!-- -->
+ <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
+ <!-- The main section of this web page was generated via the tool: bin/gen-years.sh -->
+ <!-- The main section of this web page was generated via the tool: bin/gen-years.sh -->
+ <!-- The main section of this web page was generated via the tool: bin/gen-years.sh -->
+ <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
This means there is NOT even a markdown file to edit. Instead one must
modify JSON files and/or change a bin directory tool.
If this happens, consider opening up an IOCCC issue
and ask for help. See FAQ 5.3 for information on opening up an IOCCC issue.
FAQ 5.5: How may I correct or update IOCCC author information?
Authors of IOCCC winning entries are kept in JSON files of the form:
-
author/author_handle.json
+
author/author_handle.json
where author_handle is an author handle. See FAQ 6.5 for more
information about an author handles.
The contents of these JSON files contain the best known information
@@ -1713,11 +1706,11 @@ please consider submitting a change to replace the link accordingly.
If there is no alternative that you can find you might want to remove the link
instead by replacing the link with just phrase of text. For example,
if the text in some index.html file was:
-
See the [author's description of the program](https://example.com) for more information.
+
See the [author's description of the program](https://example.com) for more information.
Assuming that the author’s description cannot be found in the
Internet Wayback Machine archive, then
replace that text with:
-
See the **author's description of the program** (sorry the content is no longer available) for more information.
+
See the **author's description of the program** (sorry the content is no longer available) for more information.
If you just wish to report the bad link issue, see FAQ 5.3.
Section 6: Miscellaneous IOCCC
FAQ 6.0: How did an entry that breaks the size rule 2 win the IOCCC?
@@ -1778,14 +1771,14 @@ exaggeration.
An author_handle is string that refers to a given author and is unique to the
IOCCC. Each author has exactly one author_handle.
For each author_handle, there will be a JSON file of the form:
-
author/author_handle.json
+
author/author_handle.json
See FAQ 6.6 for information about the contents of these JSON file and
how they are used.
Because the author_handle is used to form a JSON filename, the string must be
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.
@@ -1798,15 +1791,15 @@ desire.
author_handle so that new winning entries can be associated with the same
author.
For an anonymous author, their handle is one of these forms:
-
Anonymous_year
+
Anonymous_year
or:
-
Anonymous_year.digits
+
Anonymous_year.digits
The latter form is in case there are more than one anonymous author in a given
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?
@@ -1824,7 +1817,7 @@ contact an authors of a IOCCC entry, they will consult the contents
of the author’s JSON file for ways to contact them.
Each author of an IOCCC winning entry has their own author_handle.json file
of the form:
-
author/author_handle.json
+
author/author_handle.json
where author_handle is an author handle. See FAQ 6.5 for more
information about an author handles.
author_handle.json JSON file contents
@@ -1833,54 +1826,54 @@ See
{
-"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:
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_commentJSON member and the JSON valueMUST
be the exact JSON string as shown above.
author_JSON_format_version
-
"author_JSON_format_version":"1.02023-06-10",
+
"author_JSON_format_version":"1.02023-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_versionJSON member and the JSON valueMUST be a JSON string.
@@ -1892,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_handleJSON member
and the JSON valueMUST be a JSON string that is also a value author handle.
@@ -1906,14 +1899,14 @@ without the trailing .json) of the author_handle.json
a change of author_handleJSON value would also require the
author_handle.json file to also be renamed.
full_name
-
"full_name":"YusukeEndoh",
+
"full_name":"YusukeEndoh",
This JSON member holds the full name of the author.
There MUST be one and only one full_nameJSON member and the JSON valueMUST
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_wordJSON member and the JSON valueMUST
be a JSON string. Moreover the string MUST be a lower case ASCII
@@ -1927,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.
@@ -1944,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 emailJSON member and the JSON valueMUST
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 urlJSON member and the JSON valueMUST
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 urlJSON member and the JSON valueMUST
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.
@@ -1985,14 +1978,14 @@ be a JSON string or it MUST be a JSON null.
and so the 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:
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
@@ -2012,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_urlJSON member and the JSON valueMUST
be a JSON string or it MUST be a JSON null. The JSON string just be a valid URL.
@@ -2023,16 +2016,16 @@ If the mastodon handle is a JSON null, them the mast
If the mastodon handle is a JSON string, then the mastodon_urlMUST be a JSON string.
The mastodon_url is just a translation of the above mentioned mastodon handle.
For example, if the Mastodon handle is:
-
@user@server.domain
+
@user@server.domain
Then the mastodon_url would be:
-
https://server.domain/@user
+
https://server.domain/@user
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 githubJSON member and the JSON valueMUST
be a JSON string or it MUST be a JSON null. The githubJSON stringMUST
@@ -2040,37 +2033,37 @@ start with an at sign (_@_) and The IOCCC uses GitHub to hold the official winner repo of the IOCCC,
and hosts official IOCCC web site on GitHub pages.
The IOCCC GitHub handle is:
-
@ioccc-src
+
@ioccc-src
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 affiliationJSON member and the JSON valueMUST
be a JSON string or it MUST be a JSON null.
An affiliation might be the name of a school, university, company, or organization.
It is recommended that the affiliation JSON string be the formal affiliation name.
For example, the affiliation for the IOCCC would be:
-
The International Obfuscared C Code Contest
+
The International Obfuscared C Code Contest
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:
The winning_entry_setJSON 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 valueMUST
be a non-empty JSON array. Each value in that JSON arrayMUST must contain
@@ -2086,9 +2079,9 @@ and/or correct IOCCC author information.
A entry_id is a 4-digit year, followed by an underscore, followed by a directory name.
For example, the entry_id associated with Cody Boone Ferguson’s 2nd winning IOCCC entry
of 2020 is found under the following directory:
-
2020/ferguson2
+
2020/ferguson2
The entry_id for that winning entry is:
-
2020_ferguson2
+
2020_ferguson2
FAQ 6.8: What is the purpose of the .top, .year and .path files?
The .top file resides at the top directory. This file contains the complete list
of IOCCC years.
@@ -2098,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:
@@ -2170,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 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:
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.
@@ -2217,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.
@@ -2225,61 +2218,61 @@ 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.
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
warrant the log:
-
Add fun link to 2020/ferguson1/play.sh
+
Add fun link to 2020/ferguson1/play.sh
-Did you know some people believe in snake human hybrids? I added a link to the
-script that discusses this and gives supposed examples.
+ Did you know some people believe in snake human hybrids? I added a link to the
+ script that discusses this and gives supposed examples.
Now a pull request has to be opened.
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.
-Delta compression using up to 10 threads
-Compressing objects: 100% (5/5), done.
-Writing objects: 100% (5/5), 739 bytes | 147.00 KiB/s, done.
-Total 5 (delta 4), reused 0 (delta 0), pack-reused 0
-remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
-remote:
-remote: Create a pull request for 'human-snakes' on GitHub by visiting:
-remote: https://github.com/xexyl/temp-test-ioccc/pull/new/human-snakes
-remote:
-To github.com:xexyl/temp-test-ioccc.git
- * [new branch] human-snakes -> human-snakes
-branch 'human-snakes' set up to track 'origin/human-snakes'.
+
Enumerating objects: 9, done.
+ Counting objects: 100% (9/9), done.
+ Delta compression using up to 10 threads
+ Compressing objects: 100% (5/5), done.
+ Writing objects: 100% (5/5), 739 bytes | 147.00 KiB/s, done.
+ Total 5 (delta 4), reused 0 (delta 0), pack-reused 0
+ remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
+ remote:
+ remote: Create a pull request for 'human-snakes' on GitHub by visiting:
+ remote: https://github.com/xexyl/temp-test-ioccc/pull/new/human-snakes
+ remote:
+ To github.com:xexyl/temp-test-ioccc.git
+ * [new branch] human-snakes -> human-snakes
+ branch 'human-snakes' set up to track 'origin/human-snakes'.
The link referred to above would then be opened to open a pull request. Just
follow the instructions at this point. If however it does not show a link it is
likely because the branch already exists in your GitHub account (for the repo).
In this case you can open the link:
https://github.com/ioccc-src/temp-test-ioccc/pulls which might show something
like:
-
xexyl:human-snakes had recent pushes 1 minute ago
+
xexyl:human-snakes had recent pushes 1 minute ago
and to the right of it you would see a button that says Compare & pull request
which you could click on. Do that and follow the instructions.
An important note is if you have more than one pull request opened it’ll only
@@ -2303,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:
-
-
-
-
+
+
+
+
+
```
This means that the file is generated by a tool from a [bin directory tool](bin/index.html).
@@ -2265,11 +2265,11 @@ You may also find lines slightly below the above set that suggest another file t
For example, in [contact.html](contact.html), one may read:
```
-
-
-
-
-
+
+
+
+
+
```
This means that you could consider editing the referenced markdown file
@@ -2285,13 +2285,13 @@ came from JSON and other data files. So instead of the above reference to a
markdown file, you will read:
```
-
-
-
-
-
-
-
+
+
+
+
+
+
+
```
This means there is **NOT even a markdown file to edit**. Instead one must
@@ -2306,7 +2306,7 @@ and ask for help. See [FAQ 5.3](#fix_an_entry) for information on opening up an
Authors of IOCCC winning entries are kept in JSON files of the form:
```
-author/author_handle.json
+ author/author_handle.json
```
where _author_handle_ is an author handle. See [FAQ 6.5](#author_handle) for more
@@ -2362,7 +2362,7 @@ instead by replacing the link with just phrase of text. For example,
if the text in some `index.html` file was:
```
-See the [author's description of the program](https://example.com) for more information.
+ See the [author's description of the program](https://example.com) for more information.
```
Assuming that the author's description cannot be found in the
@@ -2370,7 +2370,7 @@ Assuming that the author's description cannot be found in the
replace that text with:
```
-See the **author's description of the program** (sorry the content is no longer available) for more information.
+ See the **author's description of the program** (sorry the content is no longer available) for more information.
```
If you just wish to report the bad link issue, see [FAQ 5.3](#report_web_problem).
@@ -2464,7 +2464,7 @@ IOCCC. Each author has exactly one `author_handle`.
For each `author_handle`, there will be a JSON file of the form:
```
-author/author_handle.json
+ author/author_handle.json
```
See [FAQ 6.6](#author_json) for information about the contents of these JSON file and
@@ -2476,7 +2476,7 @@ answer). In particular, the `author_handle` must be an ASCII string that
matches this regexp:
```re
-^[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)
@@ -2496,13 +2496,13 @@ author.
For an anonymous `author`, their handle is one of these forms:
```
-Anonymous_year
+ Anonymous_year
```
or:
```
-Anonymous_year.digits
+ Anonymous_year.digits
```
@@ -2515,7 +2515,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]*$
+ Anonymous_[0-9][0-9][0-9][0-9][.0-9]*$
```
See [FAQ 5.5](#fix_author) for information about how to update
@@ -2543,7 +2543,7 @@ Each author of an IOCCC winning entry has their own `author_handle.json` file
of the form:
```
-author/author_handle.json
+ author/author_handle.json
```
where _author_handle_ is an author handle. See [FAQ 6.5](#author_handle) for more
@@ -2559,48 +2559,48 @@ A good way to understand the JSON file contents of a `author_handle.json` file
is to look at an example, the `author_handle.json` file for Yusuke Endoh:
```
-author/Yusuke_Endoh.json
+ author/Yusuke_Endoh.json
```
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",
- "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:
@@ -2852,7 +2852,7 @@ See the "Mastodon Address" section of that page in particular.
The IOCCC Mastodon handle is:
```json
-@ioccc@fosstodon.org
+ @ioccc@fosstodon.org
```
The IOCCC uses the Mastodon social network for announcements such
@@ -2888,13 +2888,13 @@ The `mastodon_url` is just a translation of the above mentioned [mastodon](#mast
For example, if the Mastodon handle is:
```
-@user@server.domain
+ @user@server.domain
```
Then the `mastodon_url` would be:
```
-https://server.domain/@user
+ https://server.domain/@user
```
If the author wishes to not specify an Mastodon URL, or if the Mastodon URL is
@@ -2926,7 +2926,7 @@ and hosts [official IOCCC web site](https://www.ioccc.org) on GitHub pages.
The IOCCC GitHub handle is:
```
-@ioccc-src
+ @ioccc-src
```
If the author wishes to not specify an GitHub handle, or if the GitHub handle is
@@ -2956,7 +2956,7 @@ It is recommended that the affiliation _JSON string_ be the formal affiliation n
For example, the affiliation for the IOCCC would be:
```
-The International Obfuscared C Code Contest
+ The International Obfuscared C Code Contest
```
If the author wishes to not specify an affiliation, or if the affiliation is
@@ -2978,7 +2978,7 @@ NOTE: The _JSON null_ is **NOT** enclosed in quotes!
{ "entry_id" : "2012_endoh1" },
{ "entry_id" : "2012_endoh2" },
{ "entry_id" : "2013_endoh1" },
-...
+ ...
{ "entry_id" : "2020_endoh1" },
{ "entry_id" : "2020_endoh2" },
{ "entry_id" : "2020_endoh3" }
@@ -3011,13 +3011,13 @@ For example, the `entry_id` associated with Cody Boone Ferguson's 2nd winning IO
of 2020 is found under the following directory:
```
-2020/ferguson2
+ 2020/ferguson2
```
The `entry_id` for that winning entry is:
```
-2020_ferguson2
+ 2020_ferguson2
```
@@ -3036,7 +3036,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
+ make genpath
```
@@ -3128,9 +3128,8 @@ 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"
+ ssh-keygen -t rsa -b 4096 -C "luser@example.com"
```
where `luser@example.com` is the email you want associated with your key.
@@ -3167,7 +3166,7 @@ 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]
+ 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
@@ -3175,7 +3174,7 @@ 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
+ cd temp-test-ioccc
```
You're ready to make your changes now!
@@ -3201,7 +3200,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
+ git add foo
```
where _foo_ is the file to add.
@@ -3216,7 +3215,7 @@ 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
+ ssh -T git@github.com
```
Cody would see:
@@ -3228,7 +3227,7 @@ Now, assuming that the forked repo is
```sh
-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.
@@ -3239,22 +3238,22 @@ Continuing the example above for
```sh
-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:
```sh
-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:
```sh
-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.
@@ -3263,10 +3262,10 @@ Then if necessary add a description for the log. For instance the above might
warrant the log:
```
-Add fun link to 2020/ferguson1/play.sh
+ Add fun link to 2020/ferguson1/play.sh
-Did you know some people believe in snake human hybrids? I added a link to the
-script that discusses this and gives supposed examples.
+ Did you know some people believe in snake human hybrids? I added a link to the
+ script that discusses this and gives supposed examples.
```
Now a pull request has to be opened.
@@ -3278,26 +3277,26 @@ 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
+ git push --set-upstream origin human-snakes
```
This might show:
```
-Enumerating objects: 9, done.
-Counting objects: 100% (9/9), done.
-Delta compression using up to 10 threads
-Compressing objects: 100% (5/5), done.
-Writing objects: 100% (5/5), 739 bytes | 147.00 KiB/s, done.
-Total 5 (delta 4), reused 0 (delta 0), pack-reused 0
-remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
-remote:
-remote: Create a pull request for 'human-snakes' on GitHub by visiting:
-remote: https://github.com/xexyl/temp-test-ioccc/pull/new/human-snakes
-remote:
-To github.com:xexyl/temp-test-ioccc.git
- * [new branch] human-snakes -> human-snakes
-branch 'human-snakes' set up to track 'origin/human-snakes'.
+ Enumerating objects: 9, done.
+ Counting objects: 100% (9/9), done.
+ Delta compression using up to 10 threads
+ Compressing objects: 100% (5/5), done.
+ Writing objects: 100% (5/5), 739 bytes | 147.00 KiB/s, done.
+ Total 5 (delta 4), reused 0 (delta 0), pack-reused 0
+ remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
+ remote:
+ remote: Create a pull request for 'human-snakes' on GitHub by visiting:
+ remote: https://github.com/xexyl/temp-test-ioccc/pull/new/human-snakes
+ remote:
+ To github.com:xexyl/temp-test-ioccc.git
+ * [new branch] human-snakes -> human-snakes
+ branch 'human-snakes' set up to track 'origin/human-snakes'.
```
The link referred to above would then be opened to open a pull request. Just
@@ -3308,7 +3307,7 @@ In this case you can open the link:
like:
```
-xexyl:human-snakes had recent pushes 1 minute ago
+ xexyl:human-snakes had recent pushes 1 minute ago
```
and to the right of it you would see a button that says _Compare & pull request_
@@ -3341,7 +3340,7 @@ 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
+ 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.
diff --git a/news.html b/news.html
index f67883f75..c4b9f134a 100644
--- a/news.html
+++ b/news.html
@@ -140,16 +140,16 @@ And while using Mastodon is free, the IOCCC judges
All web pages, including this one, are now constructed from markdown files and/or JSON data files using tools found in the bin directory.
2023-05-22
We have been busy preparing for an important / significant update to this web site. In the temp-test-ioccc GitHub repo we have made nearly 2645 changes to date.
-
While you are free to look at the [temp-test-ioccc GitHub repo](https://github.com/ioccc-src/temp-test-ioccc),
-please **do not link to it** as this repo and related web site will disappear once the main
-[IOCCC winner repo](https://github.com/ioccc-src/winner) has been updated.
+
While you are free to look at the [temp-test-ioccc GitHub repo](https://github.com/ioccc-src/temp-test-ioccc),
+ please **do not link to it** as this repo and related web site will disappear once the main
+ [IOCCC winner repo](https://github.com/ioccc-src/winner) has been updated.
-Also be aware that the [temp-test-ioccc GitHub repo](https://github.com/ioccc-src/temp-test-ioccc)
-is undergoing rapid changes. There are broken links and other things in mid-change.
+ Also be aware that the [temp-test-ioccc GitHub repo](https://github.com/ioccc-src/temp-test-ioccc)
+ is undergoing rapid changes. There are broken links and other things in mid-change.
-Once we are ready to update the [IOCCC winner repo](https://github.com/ioccc-src/winner)
-and its associated web site,
-we will post a news article warning of the pending change that is about to arrive.
+ Once we are ready to update the [IOCCC winner repo](https://github.com/ioccc-src/winner)
+ and its associated web site,
+ we will post a news article warning of the pending change that is about to arrive.
As per the suggestion of Toni Mikkola
(_@Virtaava@home.social_) we now maintain a
@@ -231,8 +231,8 @@ and/or follow us on Mastodon via IOCCC Twitter feed
in favor of our new IOCCC Mastodon feed.
Our Mastodon username is: @ioccc@fosstodon.org.
-
Please note: As of the date of this posting, our account was just setup,
-so there isn't much to read there, yet.
+
Please note: As of the date of this posting, our account was just setup,
+ so there isn't much to read there, yet.
In the future we plan to use Mastodon as our official announcement platform.
This will include announcing:
@@ -251,7 +251,7 @@ Proving a Mastodon username will be entirely optional.
If you do not yet have a Mastodon account, you may obtain a free mastodon account via:
joinmastodon.org.
If you do have / obtain a Mastodon account, please do us a favor and follow the IOCCC at:
-
**@ioccc@fosstodon.org**
+
**@ioccc@fosstodon.org**
The IOCCC wishes to thank the good folk running the
fosstodon.org
Mastodon hub.
diff --git a/news.md b/news.md
index c121901c5..2327166fc 100644
--- a/news.md
+++ b/news.md
@@ -29,16 +29,16 @@ All web pages, including this one, are now constructed from markdown files and/o
We have been busy preparing for an important / significant update to this web site. In the [temp-test-ioccc GitHub repo](https://github.com/ioccc-src/temp-test-ioccc) we have made nearly 2645 changes to date.
```
-While you are free to look at the [temp-test-ioccc GitHub repo](https://github.com/ioccc-src/temp-test-ioccc),
-please **do not link to it** as this repo and related web site will disappear once the main
-[IOCCC winner repo](https://github.com/ioccc-src/winner) has been updated.
+ While you are free to look at the [temp-test-ioccc GitHub repo](https://github.com/ioccc-src/temp-test-ioccc),
+ please **do not link to it** as this repo and related web site will disappear once the main
+ [IOCCC winner repo](https://github.com/ioccc-src/winner) has been updated.
-Also be aware that the [temp-test-ioccc GitHub repo](https://github.com/ioccc-src/temp-test-ioccc)
-is undergoing rapid changes. There are broken links and other things in mid-change.
+ Also be aware that the [temp-test-ioccc GitHub repo](https://github.com/ioccc-src/temp-test-ioccc)
+ is undergoing rapid changes. There are broken links and other things in mid-change.
-Once we are ready to update the [IOCCC winner repo](https://github.com/ioccc-src/winner)
-and its associated web site,
-we will post a news article warning of the pending change that is about to arrive.
+ Once we are ready to update the [IOCCC winner repo](https://github.com/ioccc-src/winner)
+ and its associated web site,
+ we will post a news article warning of the pending change that is about to arrive.
```
These 2645+ changes in the [temp-test-ioccc GitHub repo](https://github.com/ioccc-src/temp-test-ioccc)
@@ -108,8 +108,8 @@ 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"
+ "status_date" : "Mon Jan 30 02:28:44 PST 2023",
+ "latest_news" : "Mon Jan 30 02:28:44 PST 2023"
```
@@ -146,8 +146,8 @@ in favor of our new [IOCCC Mastodon](https://fosstodon.org/@ioccc) feed.
Our Mastodon username is: **@ioccc@fosstodon.org**.
```
-Please note: As of the date of this posting, our account was just setup,
-so there isn't much to read there, yet.
+ Please note: As of the date of this posting, our account was just setup,
+ so there isn't much to read there, yet.
```
In the future we plan to use Mastodon as our official announcement platform.
@@ -173,7 +173,7 @@ If you do not yet have a Mastodon account, you may obtain a **free mastodon acco
If you do have / obtain a Mastodon account, **please do us a favor and follow the IOCCC at**:
```
-**@ioccc@fosstodon.org**
+ **@ioccc@fosstodon.org**
```
The IOCCC wishes to thank the good folk running the
diff --git a/status.html b/status.html
index 4f1a9cbb6..a5db42d87 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-01T06:07:33+00:00",
+"news_update":"2024-04-01T09:56:43+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:
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 75d7dc43c..53efeec6a 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-01T06:07:33+00:00",
+ "news_update" : "2024-04-01T09:56:43+00:00",
"status_update" : "2024-03-31T05:02:06+00:00"
}
diff --git a/status.md b/status.md
index 9b24ce615..27e981ecb 100644
--- a/status.md
+++ b/status.md
@@ -11,7 +11,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"
+ "mandatory comment: because comments were removed from the original JSON spec"
```
@@ -101,7 +101,7 @@ 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
+ TZ=UTC ls -D '%FT%T+00:00' -ld news.html
```
**NOTE**: The date and time are given with respect to **UTC** timezone.
@@ -119,7 +119,7 @@ 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
+ TZ=UTC ls -D '%FT%T+00:00' -ld status.json
```
**NOTE**: The date and time are given with respect to **UTC** timezone.
diff --git a/thanks-for-help.html b/thanks-for-help.html
index 8ce5169b5..f69c14218 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.
Cody also fixed this to not crash when no arg is specified. Note that if the arg
@@ -288,18 +288,20 @@ 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):
-
Because of the macros C and V in the original code, the args to main()
+
Because of the macros C and V in the original code, the args to main()
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)
-{
+Manual. Thus it now looks like:
+
+
main(
+/* C program. (If you don't
+ * understand it look it
+ * up.) (In the C*/ Manual)
+{
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
@@ -333,21 +336,22 @@ all!
rename to c.
The chars _ and __ in main() were copied to file scope so that
subr() could actually compile but this does not affect the ones in
-main(). Why is this? You tell us!
-
The code in main() is where there are significant changes, changing from:
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
function is also in main() in the while condition? What happens if you
remove it from main()? What happens if you remove it from subr() or
-don’t even bother calling subr()?
-
+don’t even bother calling subr()?
Additional code was added in case the fix cannot be compiled by some compilers
should they object to main() having only one arg. This version will
automatically be compiled if the entry fails to compile for some reason but one
@@ -395,20 +399,19 @@ 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.
+
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 "
- ^~~~~~~~~
-1 warning generated.
-
+
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 "
+ ^~~~~~~~~
+ 1 warning generated.
which can be disabled. It results in the same behaviour but this way no warnings
are produced.
And of course as noted two strings had to be strdup()d.
+
:system(ccc(";kkt -oa, dijszdijs QQ"));return
+
+
And of course as noted two strings had to be strdup()d.
There might have been other changes as well.
1987
@@ -553,45 +562,45 @@ as well, however.
First of all, as noted above, the entry required -traditional-cpp (which
not all compilers supportclang does not support). It needed
that option in modern systems because of two things it did:
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
@@ -649,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
+
--- 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 fixed this to work with modern compilers. Modern compilers do not allow
code like:
-
#define D define
-#define a include
+
#define D define
+#define a include
-#D foo bar
-#a <stdio.h>
+#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
@@ -699,11 +708,11 @@ offered us some chocolate cake :-) See index.html for details on how to use the
script.
Cody also fixed the Makefile where typing make everything or make alt would
result in:
-
clang: error: no such file or directory: 'data'
-clang: error: no input files
-make: *** [Makefile:143: alt] Error 1
+
clang: error: no such file or directory: 'data'
+ clang: error: no input files
+ make: *** [Makefile:143: alt] Error 1
-shell returned 2
+ shell returned 2
because the alt rule had what normally is in the ${PROG}.alt rule.
Cody fixed this for modern systems. There were two problems to be resolved.
One can no longer do:
-
#define d define
+
#define d define
-#d b12(x) 12 x
+#d b12(x) 12 x
-/* etc. */
+/* 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
@@ -895,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).
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
@@ -982,31 +991,31 @@ making the generated code return a value from main() rather than ju
return;).
The following had to be added to the string s (which to fix the segfault was
changed from char*s to char s[]):
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**
+
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**
+
bupj)ghfut)c-::-tuejo**
That’s fine and well but since the code does not include stdio.h there
obviously would be a compilation error. Thus the compiler line had to updated to
have -include stdio.h which in this rotated string is:
-
.jodmvef!tuejp/i
+
.jodmvef!tuejp/i
which had to be added after:
-
efdmbsbujpo!
+
efdmbsbujpo!
which is the end of the warning disabled for clang as described above.
But now the system(q-69); had to be changed to system(q-86);.
Then, later on, Cody discovered that in some systems, clang triggers even more
@@ -1015,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:
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.
@@ -1095,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:
-
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:
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
@@ -1124,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:
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.
@@ -1296,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.
@@ -1346,9 +1355,9 @@ arg (as it was 0 at file scope already this is perfectly fine and it means
there’s no need to cast it to an int in the function call though that would also
work).
Cody also added the alt code, provided by the author, which is:
-
... 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.
+
... 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.
but fixed to work with clang as well.
NOTE: the N1 and N2 are provided as notes in the index.html file describing
this code. Other code is also described there.
@@ -1699,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:
-
@@ -1723,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
@@ -1746,10 +1755,10 @@ compute the character count in the code according to the contest rules of 1998
in the file charcount.pl.
Cody fixed the code to not trigger an internal compiler error in gcc:
-
:10:16: warning: type defaults to 'int' in declaration of 'zero' [-Wimplicit-int]
-: In function 'main':
-:12:1: warning: missing terminating " character
-:12:19: internal compiler error: invalid built-in macro "__FILE__"
+
:10:16: warning: type defaults to 'int' in declaration of 'zero' [-Wimplicit-int]
+ : In function 'main':
+ :12:1: warning: missing terminating " character
+ :12:19: internal compiler error: invalid built-in macro "__FILE__"
The string "01\015" had to be changed to ONE(O(1,1,2,6,0,6)). For an
interesting historical explanation and further details and fun, see the
historical remarks in the
@@ -1772,10 +1781,10 @@ command.
Cody also made the Makefile rule all symlink the entry to samefile as that
is the name of the program.
The author stated that:
-
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
-`sizeof (char *) == 8`), increase the manifest constant 32767 on line
-31.
+
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
+ `sizeof (char *) == 8`), increase the manifest constant 32767 on line
+ 31.
so Cody changed the constant to a macro in the Makefile called SZ so one can
more easily do this (though it indeed seems highly unlikely). See the index.html
for more details.
@@ -1842,7 +1851,7 @@ more confusing (even if not confusing).
Cody fixed an infinite loop that occurred if invalid input was entered, flooding
the screen with:
-
Black position and direction: illegal
+
Black position and direction: illegal
This was fixed by having the scanf(3) read in a string and then use atoi(3)
on it to assign to the ints, much like with 1987/lievaart. The strings are
char[5] and the % specifier is %4s which is enough for the game.
@@ -1857,26 +1866,26 @@ least for the curses mode, allows one to quit at any time by pressing ‘q’. S
below for more details.
Due to a terrible design choice of the SDL1 developers something had to be
changed. As was noted in the log:
-
The SDL version did not work for a number of reasons. First of all the
-code requires that SDL is defined. Second the path[sic] wrong header file was
-included. Third the SDL1 developers thought it would be a great idea
-(but obviously it's a terrible idea) to redefine main() (!!) so that any
-program that uses SDL1 has to have the same args as their definition.
-This program had 'main()' so the error message was:
+
The SDL version did not work for a number of reasons. First of all the
+ code requires that SDL is defined. Second the path[sic] wrong header file was
+ included. Third the SDL1 developers thought it would be a great idea
+ (but obviously it's a terrible idea) to redefine main() (!!) so that any
+ program that uses SDL1 has to have the same args as their definition.
+ This program had 'main()' so the error message was:
- thadgavin.c:60:1: error: conflicting types for 'SDL_main'
- main()
- ^
- /opt/local/include/SDL/SDL_main.h:34:14: note: expanded from macro 'main'
- #define main SDL_main
- ^
- /opt/local/include/SDL/SDL_main.h:35:12: note: previous declaration is here
- extern int SDL_main(int argc, char *argv[]);
- ^
- 1 warning and 1 error generated.
- make: *** [thadgavin_sdl] Error 1
+ thadgavin.c:60:1: error: conflicting types for 'SDL_main'
+ main()
+ ^
+ /opt/local/include/SDL/SDL_main.h:34:14: note: expanded from macro 'main'
+ #define main SDL_main
+ ^
+ /opt/local/include/SDL/SDL_main.h:35:12: note: previous declaration is here
+ extern int SDL_main(int argc, char *argv[]);
+ ^
+ 1 warning and 1 error generated.
+ make: *** [thadgavin_sdl] Error 1
-Thus main() was changed to 'int main(int argc, char **argv)'.
+ Thus main() was changed to 'int main(int argc, char **argv)'.
Cody also added an alternate version to help see what is going on in more modern
systems and in case you’re sensitive to rapidly moving swirling. See the
index.html for details on that. Note that this alternate version only will impact
@@ -1919,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:
@@ -1930,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:
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
@@ -2033,8 +2042,8 @@ it’s also how you invoke the program.
author’s remarks.
He also fixed the script herrmann1.sh for
shellcheck. In particular there were quite a few:
-
SC2086 (info): Double quote to prevent globbing and word splitting.
-SC2248 (style): Prefer double quoting even when variables don't contain special characters.
+
SC2086 (info): Double quote to prevent globbing and word splitting.
+ SC2248 (style): Prefer double quoting even when variables don't contain special characters.
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: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: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
@@ -2200,41 +2209,41 @@ to the repo for the script instead.
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 \
-|^
+
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:
+ 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
+ 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
@@ -2285,7 +2294,7 @@ and 64-bit. The solution has to do with the size difference between int
long 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.
@@ -2296,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:
-
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). :-)
@@ -2326,12 +2335,12 @@ not do it implicitly (like macOS does).
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
@@ -2361,21 +2370,21 @@ test it on.
Cody added the saved (with the SAVE command) BASIC program PET which was:
-
10 PRINT "2005'S IOCCC BEST EMULATOR"
-20 PRINT "BY STEPHEN SYKES!"
+
10 PRINT "2005'S IOCCC BEST EMULATOR"
+ 20 PRINT "BY STEPHEN SYKES!"
followed by the commands:
-
SAVE "PET"
+
SAVE "PET"
-READY.
-NEW
+ READY.
+ NEW
-READY.
-LOAD "PET"
+ READY.
+ LOAD "PET"
-READY.
-RUN
-2005'S IOCCC BEST EMULATOR
-BY STEPHEN SYKES!
+ READY.
+ RUN
+ 2005'S IOCCC BEST EMULATOR
+ BY STEPHEN SYKES!
to both save and test run it.
Cody added the try.sh script which runs in a loop with a
menu of things one might wish to try, asking if they wish to continue when done.
@@ -2790,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:
-
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).
@@ -2916,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
@@ -3232,10 +3241,10 @@ longer known.