Expand all leading tabs in markdown files

Given how problematic leading tabs in markdown files can be,
we have expanded all leading tabs in markdown files by:

```sh
find * -type f -name '*.md' -print |
  while read -r file; do
    rm -f "$file.tmp" ;
    expand < "$file" > "$file.tmp" ;
    mv -f -v "$file.tmp" "$file" ;
  done
```

Given the previous changes to `bin/pandoc-wrapper.sh` and other recent
commits and recent pull requests, the were were **NO** changes to
any HTML files.  This is a **good thing** as the expression goes.

No there are no leading tabs in any markdown files.
A check to catch any re-introduction of leading tabs
into any markdown file is on the way.

BTW: We do not have anything against leading tabs in files,
even though we have had to deal with their impact on forming
HTML from markdown files (as well as the calc source code).
It is just that this is one of those cases where tabs conflict
(sometimes caused by people wanting to change the classic
8-space tab model) with a desired outcome.

Perform `make www` to perform the above and test under macOS.
This commit is contained in:
Landon Curt Noll committed 2024-06-24 11:57:35 -07:00
1 parent bf28cac593
commit 7712db4a17
117 files changed
+1758 -1758

No files matched your search

+4 -4
View File
@@ -42,15 +42,15 @@ Some new compilers (in 1984) dislike lines 6 and 10 of the source, so we changed
them from:
``` <!---c-->
;++f)a[ b<<5|c] =d++,b+ =e;for( f=0;f<O
<<5|c]^ a[b<<5 |c]^=a[ (k-(b+1 ))<<5|c]
;++f)a[ b<<5|c] =d++,b+ =e;for( f=0;f<O
<<5|c]^ a[b<<5 |c]^=a[ (k-(b+1 ))<<5|c]
```
to:
``` <!---c-->
;++f)a[ b<<5|c] =d++,b+= e;for( f=0;f<O
<<5|c]^= a[b<<5 |c]^=a[ (k-(b+1 ))<<5|c]
;++f)a[ b<<5|c] =d++,b+= e;for( f=0;f<O
<<5|c]^= a[b<<5 |c]^=a[ (k-(b+1 ))<<5|c]
```
I hope you have a C beautifier!
+66 -66
View File
@@ -51,11 +51,11 @@ which is probably not as uncommon as you think :-).
``` <!---sh-->
./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
@@ -258,8 +258,8 @@ The [PDP](https://en.wikipedia.org/wiki/Programmed_Data_Processor) and
``` <!---c-->
for (;;) {
write(1, " :-)\b\b\b\b", 9);
delay();
write(1, " :-)\b\b\b\b", 9);
delay();
}
```
@@ -286,17 +286,17 @@ 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
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
sys 55
sob r2,1b
br pdp
```
This is not the code we originally wrote, but it is the code that we ultimately
@@ -334,20 +334,20 @@ 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
pushl $9
pushal str
pushl $1
calls $3, write
cvtwl $32767, r2
2:
decl r2
jneq 2b
jbr 1b
decl r2
jneq 2b
jbr 1b
write: .word 0
chmk $4
ret
chmk $4
ret
str: .ascii " :-)\b\b\b\b"
@@ -395,53 +395,53 @@ compiled in modern systems.
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);
}
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);
}
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");
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;
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;
}
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(" ");
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");
}
printf("};\n");
}
}
```
+1 -1
View File
@@ -75,7 +75,7 @@ disable the optimiser we might get something like:
``` <!---sh-->
$ ./marshall
choo choo
choo choo
Segmentation fault: 11
```
+1 -1
View File
@@ -24,7 +24,7 @@ supports the `-traditional-cpp` option.
### Alternate build:
``` <!--sh-->
make alt
make alt
```
### Alternate use:
+1 -1
View File
@@ -45,7 +45,7 @@ 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?
+4 -4
View File
@@ -52,7 +52,7 @@ Note the unusual structure:
``` <!---c-->
while (<condition>)
;
;
```
Did you notice that the body is empty?
@@ -68,9 +68,9 @@ 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);
"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.
+2 -2
View File
@@ -69,8 +69,8 @@ character.
(+ 2.5 3.1)
(defun fib (n)
(if (< n 2)
1
(+ (fib (- n 2)) (fib (- n 1)))))
1
(+ (fib (- n 2)) (fib (- n 1)))))
(fib 10)
(defun ! (x) (if (equal x 0) 1 (* x (! (- x 1)))))
(! 7)
+12 -12
View File
@@ -23,12 +23,12 @@
The second command, `./tromp 10 "hkl jq"`, will set up the keys kind of like
vim:
- h - left (left)
- k - rotate (up)
- l - right (right)
- j - drop (down)
- space - pause (space)
- q - quit (:q)
- h - left (left)
- k - rotate (up)
- l - right (right)
- j - drop (down)
- 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
@@ -80,12 +80,12 @@ will drop in a second, is 2. The default `cmd_string` is
`jkl pq`. The first 6 characters of `cmd_string` relate
to the following 6 game commands:
- j - left
- k - rotate
- l - right
- space - drop
- p - pause
- q - quit
- j - left
- k - rotate
- l - right
- space - drop
- p - pause
- q - quit
Specifying `cmd_string` allows one to redefine the commands.
The pause command pauses the game, clears the screen and
+6 -6
View File
@@ -91,12 +91,12 @@ Boolean expressions evaluate to 0 for false and 1 for true.
### Limits:
- Line numbers 1-10000
- Line length 999 characters
- FOR nesting 26
- GOSUB 999 levels
- Program Dynamically allocated
- Expressions -32768 - 32767 for 16 bit machines, -2147483648 - 2147483647 for 32 bit machines
- Line numbers 1-10000
- Line length 999 characters
- FOR nesting 26
- GOSUB 999 levels
- Program Dynamically allocated
- Expressions -32768 - 32767 for 16 bit machines, -2147483648 - 2147483647 for 32 bit machines
### Error checking / error reports:
+13 -13
View File
@@ -180,8 +180,8 @@ with one shell cmd at the far end.
p=0
for f in `ls /tmp/shark$$*`
do
p=`expr $p + 1`
mail -s "bundle ($p of $n) from '`whoami`'" $m < $f
p=`expr $p + 1`
mail -s "bundle ($p of $n) from '`whoami`'" $m < $f
done
rm /tmp/shark$$*
```
@@ -190,33 +190,33 @@ with one shell cmd at the far end.
### Shark history:
- May 1987: Karl Fox introduces 1023-byte `zcat.c` to USENET.
It's too late for the 4th IOCCC.
It's too late for the 4th IOCCC.
- May 21, 1987: James A. Woods extends idea to construct self
decompressing `shar` Trojan horse, utilizing `cc`, `shar`,
`zcat`, & `btoa`; size: 2303 bytes.
decompressing `shar` Trojan horse, utilizing `cc`, `shar`,
`zcat`, & `btoa`; size: 2303 bytes.
- May 23, 1987: `jaw` trims 250 bytes without much thought.
- June 2, 1987: 52 lines of shell, 1991 bytes, now made with `tar`,
short-circuit C-compile at far end, dual-use main.c,
portability mods. (jaw)
short-circuit C-compile at far end, dual-use main.c,
portability mods. (jaw)
- Mar-May 1988: abortive run at 5th IOCCC.
`jaw.c` - 1529 bytes. compile line: 152 bytes.
generated funny code with `execvp()` to invoke shell.
`jaw.c` - 1529 bytes. compile line: 152 bytes.
generated funny code with `execvp()` to invoke shell.
- Aug 29, 1988: production version, now at 1830 bytes.
- Jan 1990: Paul Eggert does tour-de-force shark re-engineering.
- May 24, 1990: collaboration yields 999-byte `jaw.c` core (see above)
and 1530-byte production shell code (w/comments).
Eggert comes through with lion's share of improvements.
7th IOCCC code now faster than the `btoa`/`zcat` it replaces.
and 1530-byte production shell code (w/comments).
Eggert comes through with lion's share of improvements.
7th IOCCC code now faster than the `btoa`/`zcat` it replaces.
- May 1990: `jaw` develops experimental replacement using
Dan Bernstein's high-compression 'squeeze'.
Dan Bernstein's high-compression 'squeeze'.
To which we add:
+1 -1
View File
@@ -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
+4 -4
View File
@@ -71,10 +71,10 @@ For example, the first block of code would read:
```
charlie,
doubletime me, OXFACE!
not interested, get out
mainly die, charly, *die*
signed charlotte
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
+24 -24
View File
@@ -88,23 +88,23 @@ results depending on the implementation of `curses`.
### Commands
```
h j k l left, down, up, right cursor movement
H J K L word left, page down, page up, word right
[ ] beginning and end of line
t b top and bottom of file
i enter insert mode, form-feed to quit
x delete character under the cursor
W write buffer to file
R refresh the screen
Q quit
h j k l left, down, up, right cursor movement
H J K L word left, page down, page up, word right
[ ] beginning and end of line
t b top and bottom of file
i enter insert mode, form-feed to quit
x delete character under the cursor
W write buffer to file
R refresh the screen
Q quit
```
### Exit status
```
0 success
2 missing edit filename
0 success
2 missing edit filename
```
@@ -142,24 +142,24 @@ screen with long lines. Paging up and down should work correctly, however.
### References:
[Fin80] Craig A. Finseth, "Theory and Practice of Text Editors or<br>
A Cookbook For An EMACS", TM-165, MIT Lab. for Computer<br>
Science
[Fin80] Craig A. Finseth, "Theory and Practice of Text Editors or<br>
A Cookbook For An EMACS", TM-165, MIT Lab. for Computer<br>
Science
[KeP81] Kernighan & Plauger, "Software Tools in Pascal",<br>
Addison-Wesley, 81, chapter 6
[KeP81] Kernighan & Plauger, "Software Tools in Pascal",<br>
Addison-Wesley, 81, chapter 6
[Mil86] Eugene W. Myers & Webb Miller, "Row-replacement Algorithms
for Screen Editors", TR 86-19, Dept. of Computer Science,<br>
U. of Arizona
[Mil86] Eugene W. Myers & Webb Miller, "Row-replacement Algorithms
for Screen Editors", TR 86-19, Dept. of Computer Science,<br>
U. of Arizona
[MyM86] Eugene W. Myers & Webb Miller, "A simple row-replacement<br>
method", TR 86-28, Dept. of Computer Science, U. of Arizona
[MyM86] Eugene W. Myers & Webb Miller, "A simple row-replacement<br>
method", TR 86-28, Dept. of Computer Science, U. of Arizona
[Mil87] Webb Miller, "A Software Tools Sampler", Prentice Hall, 87
ISBN 0-13-822305-X, chapter 5
[Mil87] Webb Miller, "A Software Tools Sampler", Prentice Hall, 87
ISBN 0-13-822305-X, chapter 5
[net90] "Editor 101/102" articles from comp.editors
[net90] "Editor 101/102" articles from comp.editors
<!--
+5 -5
View File
@@ -77,9 +77,9 @@ delimiters.
- `D`: dup (duplicate) top of `i` stack
- `'`: dup top of `s` stack
- `s`: pop top of `i` stack. If it is `n`, swap `(n+1)`th-top of `i` stack with top.
`1s`, for example, swaps the top two elements; `2s` swaps the top with the
third down; etc. This always pops the top of the `i` stack, even upon
failure.
`1s`, for example, swaps the top two elements; `2s` swaps the top with the
third down; etc. This always pops the top of the `i` stack, even upon
failure.
- `S`: pop top of `i` stack, then act just like `s` but upon `s` stack
- `l`: pop top of `s` stack, push its length onto `i` stack
- `a`: push argc onto `i` stack
@@ -91,8 +91,8 @@ delimiters.
- `/`: pop top two elements of `i` stack, divide, push back quotient
- `>`: pop top two elements of `i` stack, compare, push back 1 or 0 as in C
- `&`: pop top two elements of `i` stack, NAND, push back bitwise result
Note that NAND is sufficient to construct all bitwise operations, as
demonstrated by `icalc` in [sorta.README.html](sorta.README.html).
Note that NAND is sufficient to construct all bitwise operations, as
demonstrated by `icalc` in [sorta.README.html](sorta.README.html).
### System operations
+4 -4
View File
@@ -35,12 +35,12 @@ This is self-explanatory.
[1D=d2/1=1ddd1 ]:!ld
["0"Td]:0ld
[DD=!1_+=0]:@ld [ input m, m assumed nonnegative, append
binary representation of m to top of s stack ]ld
binary representation of m to top of s stack ]ld
["-"T_]:+ld
[D0 1s>=+1=@]:2ld [ input m, append - to top of s stack if m is negative,
then append binary representation of abs(m) to
top of s stack ]ld
then append binary representation of abs(m) to
top of s stack ]ld
[d1A:A2=A]:A 27182 a1>=A
[d2A:A1=A]:A 3145 a2>=A
@@ -152,7 +152,7 @@ Notice that `"2 2+"` is a literal string inside the program.
["rot13: fatal: cannot open "1ST`q]:hld
a2_+=g
1A 0 [ that 0 is for RDONLY ]ld
0 'o D0 1s>=hld
0 'o D0 1s>=hld
0Ou1=x [ in a more complex spawner, this would be done under a fork ]ld
```
+8 -8
View File
@@ -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.
| << >>
|
|
| << >> 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
+12 -12
View File
@@ -56,7 +56,7 @@ game:
``` <!---sh-->
make ttt
./ttt [first_move] # <- omit first arg to have it move first
./ttt [first_move] # <- omit first arg to have it move first
./ttt next_move
```
@@ -65,8 +65,8 @@ The shell script determines when the game is over, and automatically replaces
loss). The [ttt](%%REPO_URL%%/1991/westley/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:
@@ -81,9 +81,9 @@ The final might look like:
``` <!---c-->
a(X){/*/X=- a(X){/*/X=-
X -1;F;X=- -1;F;X=-
-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",
@@ -93,9 +93,9 @@ The final might look like:
"c(1);*J=--u?O?*J:*v[1]:53;X|=u<<57-*v[u];y(X);K=40+q;q?e(O,X),q&&(K='|'),e(X",
",O),R(),O|=1<<--i:J[*J-48+(X=O=0)]--;L(q=0);for(s(i=0);q=i<12;)s(i++),i>4&&N",
";s(q=12);P(48);P('}');P(59);N;q=0;L(1);for(i=5;i<13;)s(i++),N;L(2);}",0};
b(X){/*/X=- b(X){/*/X=-
X -1;F;X=- -1;F;X=- X
-1;F;}/*/ -1;F;}/*/
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(
@@ -104,9 +104,9 @@ The final might look like:
c(1);*J=--u?O?*J:*v[1]:53;X|=u<<57-*v[u];y(X);K=40+q;q?e(O,X),q&&(K='|'),e(X
,O),R(),O|=1<<--i:J[*J-48+(X=O=0)]--;L(q=0);for(s(i=0);q=i<12;)s(i++),i>4&&N
;s(q=12);P(48);P('}');P(59);N;q=0;L(1);for(i=5;i<13;)s(i++),N;L(2);}
c(X){/*/X=- c(X){/*/X=-
0 -1;F;X=- 0 -1;F;X=- 0
-1;F;}/*/ -1;F;}/*/
c(X){/*/X=- c(X){/*/X=-
0 -1;F;X=- 0 -1;F;X=- 0
-1;F;}/*/ -1;F;}/*/
ttt: I win!
```
+5 -5
View File
@@ -150,11 +150,11 @@ place to site some references on the AE, but I don't have any.
O(c,a,b) let c = a Or
boolean-or
b (a,b are
0 or 1)
0 or 1)
B(b, a) let Boolean
b = boolean
value of a
b = boolean
value of a
P(b, a) let b = 1 if
a>0, else 0. Positive
@@ -228,8 +228,8 @@ ourselves to two operand operations:
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))
( == z*x - y*x + y)
( == z*x + y*(1-x))
```
Next we imagine we have a [pc](https://en.wikipedia.org/wiki/Program_counter).
+11 -11
View File
@@ -1,9 +1,9 @@
## Useful files to view
- [buzzard.2.README.html](buzzard.2.README.html) - this file
- [buzzard.2.design.html](buzzard.2.design.html) - description of FIRST (design documentation of THIRD)
- [third](%%REPO_URL%%/1992/buzzard.2/third) - implementation of THIRD in FIRST
- [help.th](%%REPO_URL%%/1992/buzzard.2/help.th) - online listing of THIRD primitives
- [buzzard.2.README.html](buzzard.2.README.html) - this file
- [buzzard.2.design.html](buzzard.2.design.html) - description of FIRST (design documentation of THIRD)
- [third](%%REPO_URL%%/1992/buzzard.2/third) - implementation of THIRD in FIRST
- [help.th](%%REPO_URL%%/1992/buzzard.2/help.th) - online listing of THIRD primitives
## FIRST demos:
@@ -14,7 +14,7 @@ Use:
./first < demo_file
```
- [demo1.1st](%%REPO_URL%%/1992/buzzard.2/demo1.1st) - prints Hello World! assuming ASCII
- [demo1.1st](%%REPO_URL%%/1992/buzzard.2/demo1.1st) - prints Hello World! assuming ASCII
## THIRD demos:
@@ -28,12 +28,12 @@ Use:
## Demo files:
- [demo1.th](%%REPO_URL%%/1992/buzzard.2/demo1.th) - prints Hello World! regardless of character set
- [demo2.th](%%REPO_URL%%/1992/buzzard.2/demo2.th) - demonstrates a simple loop
- [demo3.th](%%REPO_URL%%/1992/buzzard.2/demo3.th) - demonstrates a simple if test
- [demo4.th](%%REPO_URL%%/1992/buzzard.2/demo4.th) - recursive factorial calculating on the way up
- [demo5.th](%%REPO_URL%%/1992/buzzard.2/demo5.th) - recursive factorial calculating on the way down
- [demo6.th](%%REPO_URL%%/1992/buzzard.2/demo6.th) - demonstrates switching from compiler to execution mode
- [demo1.th](%%REPO_URL%%/1992/buzzard.2/demo1.th) - prints Hello World! regardless of character set
- [demo2.th](%%REPO_URL%%/1992/buzzard.2/demo2.th) - demonstrates a simple loop
- [demo3.th](%%REPO_URL%%/1992/buzzard.2/demo3.th) - demonstrates a simple if test
- [demo4.th](%%REPO_URL%%/1992/buzzard.2/demo4.th) - recursive factorial calculating on the way up
- [demo5.th](%%REPO_URL%%/1992/buzzard.2/demo5.th) - recursive factorial calculating on the way down
- [demo6.th](%%REPO_URL%%/1992/buzzard.2/demo6.th) - demonstrates switching from compiler to execution mode
## Interactive THIRD:
File diff suppressed because it is too large. Load diff
+8 -8
View File
@@ -40,19 +40,19 @@ 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
/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.
+5 -5
View File
@@ -126,23 +126,23 @@ 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)
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)
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)
to add after squaring (default x=0 y=0)
-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)
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)
x=768 y=768; default for text x=63 y=23)
-text Produce text instead of raster.
```
+3 -3
View File
@@ -19,7 +19,7 @@ For more detailed information see [1992/vern in bugs.html](../../bugs.html#1992_
## To use:
``` <!---sh-->
./vern 3 # <-- default is 2
./vern 3 # <-- default is 2
```
@@ -31,7 +31,7 @@ You might start off by giving the following input:
63 43
76 55
71 52
67 57 # <-- this may take a while
67 57 # <-- this may take a while
```
@@ -126,7 +126,7 @@ does:
``` <!---sh-->
sed <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' |
sed 's/} /=/g;s/{ /i/g' >vern.tmp.c
sed 's/} /=/g;s/{ /i/g' >vern.tmp.c
```
and compiles `vern.tmp.c`.
+10 -10
View File
@@ -169,16 +169,16 @@ is reasonably accurate.
### Here are some cities you might like to try:
```
New York 41 -74
London 52 0
Moscow 56 38
New Delhi 29 77
Sydney -34 151
Los Angeles 34 -118
Paris 45 2
Rio de Janeiro -23 -43
Beijing 40 116
Tokyo 36 140
New York 41 -74
London 52 0
Moscow 56 38
New Delhi 29 77
Sydney -34 151
Los Angeles 34 -118
Paris 45 2
Rio de Janeiro -23 -43
Beijing 40 116
Tokyo 36 140
```
+1 -1
View File
@@ -36,7 +36,7 @@ For more detailed information see [1993/cmills in bugs.html](../../bugs.html#199
``` <!---sh-->
DISPLAY="your_X_server_display"
export DISPLAY
./cmills.alt [speed] # must be run on an X11 server
./cmills.alt [speed] # must be run on an X11 server
```
where:
+1 -1
View File
@@ -13,7 +13,7 @@ you need help.
## To use:
``` <!---sh-->
./jonth # must be run on an X11 server
./jonth # must be run on an X11 server
```
+6 -6
View File
@@ -74,15 +74,15 @@ Please don't type `^D` at the prompt!!
```
$ ./leo
(1296): 6433
?? 12 # one 3 is a bull, another is a cow, and 4 is a cow
?? 12 # one 3 is a bull, another is a cow, and 4 is a cow
(160): 5363
?? 02 # both 3's are cows
?? 02 # both 3's are cows
(21): 4231
?? 22 # 2 and 3 are bulls, 4 and 1 are cows
?? 22 # 2 and 3 are bulls, 4 and 1 are cows
(2): 4132
?? 13 # 3 is a bull; 1, 2 and 4 are cows
?? 13 # 3 is a bull; 1, 2 and 4 are cows
(1): 1234
?? 40 # you may enter everything there
?? 40 # you may enter everything there
```
##### EXAMPLE: Guess the computer's number
@@ -100,7 +100,7 @@ Please don't type `^D` at the prompt!!
(2): ???? 3355
00
(1): ???? 6444
40 # we have guessed the number
40 # we have guessed the number
```
+3 -3
View File
@@ -197,11 +197,11 @@ These failed miserably:
#### Debuggers: (tested at SunOS 4.1.2)
- `dbx` - Quit with a very 'informative' error message:
`"dbx: fatal error: Is a directory"`
`"dbx: fatal error: Is a directory"`
- `gdb` - Printed almost the same error message `": Is a directory"`.
It was, however, possible to step through the code but
not list it.
It was, however, possible to step through the code but
not list it.
#### Lints
+3 -3
View File
@@ -126,9 +126,9 @@ must move after firing to be able to fire again.
### Keys
- `j` - Left
- `l` - Right
- `k` - Fire
- `j` - Left
- `l` - Right
- `k` - Fire
This is a new breed of generic games. For instance:
+14 -14
View File
@@ -10,9 +10,9 @@ 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(!),
@@ -20,9 +20,9 @@ was to define a 3x3 to 3x3 map (instead of the 3x3 to 1x1 shown above).
Hence:
```
.o. ...
.o. ...
.\. --> .\o
... ...
... ...
```
This does of course have the odd problem with clashes. What if we want to roll
@@ -32,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
@@ -59,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
@@ -73,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`.
+39 -39
View File
@@ -40,12 +40,12 @@ What happens if you use something other than valid digits?
The octal expression may contain:
```
unary operators: +, -
binary operators +, -, *, /, %
hex numbers: x or X followed by hex digits
decimal numbers: d or D followed by decimal digits
octal numbers: octal digits
grouping: ()
unary operators: +, -
binary operators +, -, *, /, %
hex numbers: x or X followed by hex digits
decimal numbers: d or D followed by decimal digits
octal numbers: octal digits
grouping: ()
```
No spaces are allowed in the expression. To avoid shell expansion,
@@ -137,36 +137,36 @@ notes:
#define O5 main
O5(O2,O7,O3)char**O7;
{
return
return
/* N1 */ !(O2+=~01+01) ?\
00:
00:
/* N2 */ !(O2-=02>01) ?\
printf("\045\157\012",O5(012,O7+01,00)):
printf("\045\157\012",O5(012,O7+01,00)):
/* O */ !(O2-=02>>01) ?\
(**O7<=067 && **O7>057 ? O5(03,O7,*(*O7)++-060+010*O3):O3):
(**O7<=067 && **O7>057 ? O5(03,O7,*(*O7)++-060+010*O3):O3):
/* D */ !(O2-=-O3-~O3) ?\
(072>**O7 && 060<=**O7 ? O5(04,O7,012*O3-060+*(*O7)++):O3):
(072>**O7 && 060<=**O7 ? O5(04,O7,012*O3-060+*(*O7)++):O3):
/* X */ !(O2-=!O3+!!O3) ?\
(**O7>057 && **O7<=071 ? O5(05,O7,*(*O7)+++O3*020-060):
**O7<=0106 && 0101<=**O7 ? O5(05,O7,020*O3+*(*O7)++-067):
0140<**O7 && **O7<0147 ? O5(05,O7,-0127+*(*O7)+++020*O3):O3):
(**O7>057 && **O7<=071 ? O5(05,O7,*(*O7)+++O3*020-060):
**O7<=0106 && 0101<=**O7 ? O5(05,O7,020*O3+*(*O7)++-067):
0140<**O7 && **O7<0147 ? O5(05,O7,-0127+*(*O7)+++020*O3):O3):
/* F */ !(O2-=02-01) ?\
(**O7==050 ? 050**++*O7,O5(013,O7,O5(012,O7,00)):
**O7<056 && 054<**O7 ? 055**++*O7,-O5(06,O7,00):
054>**O7 && 052<**O7 ? 050**(*O7)++,O5(06,O7,00):
!(**O7^0170)||!(0130^**O7) ? *++*O7,O5(05,O7,00):
**O7==0144||**O7==0104 ? ++*O7,O5(04,O7,00):O5(03,O7,00)):
(**O7==050 ? 050**++*O7,O5(013,O7,O5(012,O7,00)):
**O7<056 && 054<**O7 ? 055**++*O7,-O5(06,O7,00):
054>**O7 && 052<**O7 ? 050**(*O7)++,O5(06,O7,00):
!(**O7^0170)||!(0130^**O7) ? *++*O7,O5(05,O7,00):
**O7==0144||**O7==0104 ? ++*O7,O5(04,O7,00):O5(03,O7,00)):
/* T' */ !--O2 ?\
(**O7==052 ? O5(07,O7,O3*(*++*O7,O5(06,O7,00))):
!(045-**O7) ? O5(07,O7,O3%(03+(*O7)++,O5(06,O7,00))):
!(**O7^057) ? O5(07,O7,O3/(03-*++*O7,O5(06,O7,00))):O3):
(**O7==052 ? O5(07,O7,O3*(*++*O7,O5(06,O7,00))):
!(045-**O7) ? O5(07,O7,O3%(03+(*O7)++,O5(06,O7,00))):
!(**O7^057) ? O5(07,O7,O3/(03-*++*O7,O5(06,O7,00))):O3):
/* T */ !(O2+=01-02) ?\
O5(07,O7,O5(06,O7,00)):
O5(07,O7,O5(06,O7,00)):
/* E' */ !(O2+=-02/02) ?\
(!(**O7-053)?O5(011,O7,O3+(++*O7,O5(010,O7,00))):
!(055^**O7) ? O5(011,O7,O3-(03+*(*O7)++,O5(010,O7,00))):O3):
(!(**O7-053)?O5(011,O7,O3+(++*O7,O5(010,O7,00))):
!(055^**O7) ? O5(011,O7,O3-(03+*(*O7)++,O5(010,O7,00))):O3):
/* E */ !(O2-=0563&0215) ?\
O5(011,O7,O5(010,O7,00)):
O5(011,O7,O5(010,O7,00)):
/* C */ (++*O7,O3);
}
```
@@ -190,12 +190,12 @@ The `E'` and `T'` states work like this:
``` <!---c-->
int eprime( int intermediate )
{
if( ch == '+' )
{
ch = nextchar();
return eprime( intermediate + t() );
}
else return intermediate;
if( ch == '+' )
{
ch = nextchar();
return eprime( intermediate + t() );
}
else return intermediate;
}
```
@@ -205,13 +205,13 @@ called with `0`):
``` <!---c-->
int octal( int intermediate )
{
if( ch>='0' && ch<='7' )
{
intermediate = intermediate * 8 + ch - '0';
ch = nextchar();
return octal( intermediate );
}
else return intermediate;
if( ch>='0' && ch<='7' )
{
intermediate = intermediate * 8 + ch - '0';
ch = nextchar();
return octal( intermediate );
}
else return intermediate;
}
```
+2 -2
View File
@@ -60,7 +60,7 @@ Any of the following, though not required, would be a plus:
If you think this may be you, send an email before 31 Dec 1995, to:
```
judges@toad.com (use the Subject: 3rd judge)
judges@toad.com (use the Subject: 3rd judge)
```
Include in your message:
@@ -82,7 +82,7 @@ access to put up some IOCCC html pages, please send an email (say prior
to 31 Dec 1995) to:
```
judges@toad.com (use the Subject: www site)
judges@toad.com (use the Subject: www site)
```
describing your site and any other appropriate comments. Thanks!
+2 -2
View File
@@ -90,7 +90,7 @@ For more information, see my article
[Using GraphTab; USENIX ;login: Sept/Oct 1992, pages 28-31](login_sept92-pp28-31.pdf).
```
MMMM,M,MM"MM,,,
MMMM,M,MM"MM,,,
,,MMMMMMMMM"""""""",
,MMMMM""" ",
,MMM" "
@@ -106,7 +106,7 @@ For more information, see my article
",," , " "MMMMMMMM " , "
,M , ""M,MMMMMMMM,M " ,,
,MM, MMMMMMMMMMMMMM,", M,
M,M,MM"M"M" """M"MM,M M
M,M,MM"M"M" """M"MM,M M
,MMMMMM M,MMMMM"M MM""M
M MMMMMM,M M"M"" M MMMM", ,
"M"MMMMMMMMMM"M ,MMMMM M ,,
+1 -1
View File
@@ -63,7 +63,7 @@ The basic theme (pun) of this program is:
```
"This time (everything) is not where it should be."
~~~~
~~~~
```
+15 -15
View File
@@ -32,8 +32,8 @@ Mode may be a value from 0 to 12.
## Try:
``` <!---sh-->
./try.color.sh # for colour displays
./try.bw.sh # for Black & White displays
./try.color.sh # for colour displays
./try.bw.sh # for Black & White displays
```
@@ -62,8 +62,8 @@ where `altmode` `1` - `4` correspond to mode `0` - `3` in the original entry and
### Alternate try:
``` <!---sh-->
./try.alt.color.sh # for colour displays
./try.alt.bw.sh # for Black & White displays
./try.alt.color.sh # for colour displays
./try.alt.bw.sh # for Black & White displays
```
@@ -169,15 +169,15 @@ compatible compiler (`gcc -ansi -pedantic` will do fine).
This entry has been tested on wide variety of machines including:
```
Machine OS
------- --
Decstation 5000/240 Ultrix 4.3A
DECAlpha 3000/300 OSF/1 v1.3 and v2.0
IBM RS6000 AIX v3
SPARCStation IPX SunOS 4.1.3
i486 Linux v1.1.8 (binarysize 3576 bytes
using `gcc -O6 -s -N` ;)
HP 9000/730 HP-UX
Machine OS
------- --
Decstation 5000/240 Ultrix 4.3A
DECAlpha 3000/300 OSF/1 v1.3 and v2.0
IBM RS6000 AIX v3
SPARCStation IPX SunOS 4.1.3
i486 Linux v1.1.8 (binarysize 3576 bytes
using `gcc -O6 -s -N` ;)
HP 9000/730 HP-UX
```
Also, many of the X server and X library versions have been tested and the
@@ -205,7 +205,7 @@ Well, obfuscated or not, some of the effects are very nice ;)
Mandelbrot set is calculated from the formula
```
2
2
Z = Z + Z
n+1 n 0
```
@@ -213,7 +213,7 @@ Mandelbrot set is calculated from the formula
and the Julia set is calculated from the formula
```
2
2
Z = Z + C
n+1 n
```
+6 -6
View File
@@ -97,10 +97,10 @@ Dessert: Chocolate torte
Antipasti: crudites, olives, roasted red peppers, cheese selection
Salad: Mixed greens with vinaigrette
Main Course: Spaghetti with tomato sauce containing mushrooms and black olives
selection of hot and mild Italian sausages
selection of hot and mild Italian sausages
Bread: Fresh French bread
Dessert: Cookie selection, featuring chocolate chocolate chip cookies and
chocolate butter cookies
chocolate butter cookies
### Session Three
@@ -108,7 +108,7 @@ Dessert: Cookie selection, featuring chocolate chocolate chip cookies and
Antipasti: Crudites, olive selection
Salad: Mixed greens with mustard vinaigrette
Main Course: Broiled salmon with lemon pepper mayonnaise, chard, mixture
of white and wild rices
of white and wild rices
Bread: Cheese bread with herbs
Dessert: Chocolate cheesecake (Courtesy of Elizabeth Watson)
@@ -119,8 +119,8 @@ Antipasti: Crudites, olive selection, roasted red peppers, cheese selection
Bread: Sourdough
Salad: Mixed spring greens with flowers, and mustard vinaigrette
Main Course: Surf and Turf--Grilled steaks of salmon and New York steak
grilled vegetables--onions, peppers, portobello mushrooms
wild rice
grilled vegetables--onions, peppers, portobello mushrooms
wild rice
Dessert: Chocolate mousse
@@ -142,7 +142,7 @@ Bread: Focaccia with black olives and mozzarella cheeses
Salad: Mixed spring greens with flowers and mustard vinaigrette
Soup: Homemade butternut squash soup with mushrooms
Main Course: Cracked Dungeness crab with lemon mayonnaise, broccoli,
mixture of white and brown rice
mixture of white and brown rice
Dessert: Key lime pie
+1 -1
View File
@@ -27,7 +27,7 @@ You might consider giving the following input:
... a male (who) gets very, very frustrated sitting in a chair all
the time because males are biologically driven to go out and hunt
giraffes.
-- Adjunct Professor Newt Gingrich, Reinhardt College, 1/7/95
-- Adjunct Professor Newt Gingrich, Reinhardt College, 1/7/95
```
... which can be done like:
+11 -11
View File
@@ -78,7 +78,7 @@ You take a big sheet of "arithmetic" paper and draw a line
of length 1 (between 2 crossings) at the center of the sheet:
```
|
|
```
This makes 2 open ends (I think the notion of an "open end" doesn't
@@ -123,15 +123,15 @@ Step 4:
Step 5:
```
._| . |_.
__| \./ \./ |__
\__| |__/
__./ \./ \.__
__I | I__
\__./ \.__/
__./ | | \.__
|_./ \./ \._|
| |
._| . |_.
__| \./ \./ |__
\__| |__/
__./ \./ \.__
__I | I__
\__./ \.__/
__./ | | \.__
|_./ \./ \._|
| |
```
@@ -252,7 +252,7 @@ even want to explain what it does. You've been warned!
```
* * *
* * *
```
Special thanks:
+38 -38
View File
@@ -203,61 +203,61 @@ Below is a description of the OC grammar.
Terminals are in quotes, `()` is used for bracketing.
```
program: decl*
program: decl*
decl: vardecl
fundecl
decl: vardecl
fundecl
vardecl: type NAME ;
type NAME "[" INT "]" ;
vardecl: type NAME ;
type NAME "[" INT "]" ;
fundecl: type NAME "(" args ")" "{" body "}"
fundecl: type NAME "(" args ")" "{" body "}"
args: /*empty*/
( arg "," )* arg
args: /*empty*/
( arg "," )* arg
arg: type NAME
arg: type NAME
body: vardecl* stmt*
body: vardecl* stmt*
stmt: ifstmt
whilestmt
dowhilestmt
"return" expr ";"
expr ";"
"{" stmt* "}"
";"
stmt: ifstmt
whilestmt
dowhilestmt
"return" expr ";"
expr ";"
"{" stmt* "}"
";"
ifstmt: "if" "(" expr ")" stmt
"if" "(" expr ")" stmt "else" stmt
ifstmt: "if" "(" expr ")" stmt
"if" "(" expr ")" stmt "else" stmt
whilestmt: "while" "(" expr ")" stmt
whilestmt: "while" "(" expr ")" stmt
dowhilestmt:"do" stmt "while" "(" expr ")" ";"
expr: expr binop expr
unop expr
expr "[" expr "]"
"(" expr ")"
expr "(" exprs ")"
NAME
INT
CHAR
STRING
expr: expr binop expr
unop expr
expr "[" expr "]"
"(" expr ")"
expr "(" exprs ")"
NAME
INT
CHAR
STRING
exprs: /*empty*/
(expr ",")* expr
exprs: /*empty*/
(expr ",")* expr
binop: "+" | "-" | "*" | "/" | "%" |
"=" |
"<" | "==" | "!="
binop: "+" | "-" | "*" | "/" | "%" |
"=" |
"<" | "==" | "!="
unop: "!" | "-" | "*"
unop: "!" | "-" | "*"
type: "int" stars
"char" stars
type: "int" stars
"char" stars
stars: "*"*
stars: "*"*
```
<hr style="width:10%;text-align:left;margin-left:0">
+9 -9
View File
@@ -104,16 +104,16 @@ A CGI script such as:
${ECHO} "Content-type: text/html"
${ECHO}
if [ -z "${QUERY_STRING}" ]; then
${ECHO} "QUERY_STRING not found"
${ECHO} "QUERY_STRING not found"
else
URL=`${EXPR} "$QUERY_STRING" : '[Uu][Rr][Ll]=\(.*\)'`
if [ -z "${URL}" ]; then
${ECHO} "No URL given in QUERY_STRING"
elif [ X`${EXPR} "${URL}" : '[Ff][Ii][Ll][Ee]:'` != X0 ]; then
${ECHO} "file: based URLs are not allowed"
else
${LYNX} -restrictions=all -source "${URL}" | ${POOT}
fi
URL=`${EXPR} "$QUERY_STRING" : '[Uu][Rr][Ll]=\(.*\)'`
if [ -z "${URL}" ]; then
${ECHO} "No URL given in QUERY_STRING"
elif [ X`${EXPR} "${URL}" : '[Ff][Ii][Ll][Ee]:'` != X0 ]; then
${ECHO} "file: based URLs are not allowed"
else
${LYNX} -restrictions=all -source "${URL}" | ${POOT}
fi
fi
```
+21 -21
View File
@@ -45,8 +45,8 @@ counter before shifting out each symbol, such as
``` <!---c-->
length = (encoding & 96) >> 5;
do {
putchar(encoding & 1 ? '-' : '.');
encoding >>= 1;
putchar(encoding & 1 ? '-' : '.');
encoding >>= 1;
} while (length--);
```
@@ -64,8 +64,8 @@ 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;
putchar(encoding & 1 ? '-' : '.');
encoding >>= 1;
while (encoding > 1);
```
@@ -89,8 +89,8 @@ is encoded still allows the encoding to be its own counter:
``` <!---c-->
do {
putchar(encoding & 1 ? '-' : '.');
encoding = (encoding + 32) >> 1;
putchar(encoding & 1 ? '-' : '.');
encoding = (encoding + 32) >> 1;
} while (encoding > 35);
```
@@ -145,21 +145,21 @@ 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(' ');
}
}
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
+39 -39
View File
@@ -92,10 +92,10 @@ has the value `a`. Another function called `K` is defined as `\x\y(x)`
and it evaluates as follows:
```
K p q
-> \x\y(x) p q
-> \y(p) q
-> p
K p q
-> \x\y(x) p q
-> \y(p) q
-> p
```
Another function of interest is `S`, defined as `\f\g\x((f x) (g x))`.
@@ -106,15 +106,15 @@ variables or lambda abstractions. In fact, even `I` is unnecessary,
since it is equivalent to `S K K`:
```
I z
-> \a(a) z
-> z
I z
-> \a(a) z
-> z
S K K z
-> \f\g\x((f x) (g x)) K K z
-> (K z) (K z)
-> \x\y(x) z (K z)
-> z
S K K z
-> \f\g\x((f x) (g x)) K K z
-> (K z) (K z)
-> \x\y(x) z (K z)
-> z
```
The algorithm for translating lambda expressions into combinator
@@ -122,9 +122,9 @@ 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
@@ -132,33 +132,33 @@ 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
@@ -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,
+1 -1
View File
@@ -53,7 +53,7 @@ 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;
I[strcspn (I, 45+__FILE__)] = O = 0;
```
The first number in the above C means the length starting from 0 up through the
+1 -1
View File
@@ -51,7 +51,7 @@ 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)
```
+8 -8
View File
@@ -113,14 +113,14 @@ following meanings:
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[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
+2 -2
View File
@@ -53,13 +53,13 @@ characters (semaphore smileys, if you will). For example, given the
input "Hello, world!", the output will be:
```
<> <> <> <> <> <>
<> <> <> <> <> <>
_() ()/ ()/ ()/ _\) () (/_ _\)
[] /^ |^^ /^^ /^^ [] ^^ |^^| ^^ [] [] ^^
<>[ [][ <>][ <>][ ][ [][] ][ ][
<> []
<> []
_()_ ()/ |() ()
[] ^^ [] /^^ ^^| |^^|
][ <>][ ][] [][]
+2 -2
View File
@@ -33,7 +33,7 @@ The author recommended on linux/x86, glibc 2.0, libc4/5:
``` <!---make-->
bmeyer: bmeyer.c
CC -DY="__setfpucw(0x127f)" -O6 $? -o $@ -lm
CC -DY="__setfpucw(0x127f)" -O6 $? -o $@ -lm
```
However many compilers use `-O3` as the maximum level for `-O` optimization.
@@ -42,7 +42,7 @@ And on linux/x86, glibc 2.1:
``` <!---make-->
bmeyer: bmeyer.c
gcc -DY='int x=0x127f; __asm__ ("fldcw %0" : : "m" (*&x))' $? -o $@ -lm
gcc -DY='int x=0x127f; __asm__ ("fldcw %0" : : "m" (*&x))' $? -o $@ -lm
```
Compile with the maximum possible optimization on your system.
+12 -12
View File
@@ -76,9 +76,9 @@ 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.
doesn't print a trailing newline.
f prints the contents of the stack, one number per line,
without modifying it.
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.
@@ -89,14 +89,14 @@ 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.
from the second.
* Pops 2 values and pushes their product.
/ Pops 2 values and pushes the result of dividing the second
by the first.
by the first.
^ Pops 2 values and pushes the result of raising the second
to the power of the first.
to the power of the first.
% Pops 2 values and pushes the remainder of the division that
/ would do.
/ would do.
```
The precision and range are double, like it or not, except that the
@@ -113,14 +113,14 @@ 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
"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
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
```
+8 -8
View File
@@ -115,13 +115,13 @@ from inside the monitor whilst standing on your head. In case of
confusion, please consult the following chart (\*):
```
N
^
|
E <---+---> W
|
v
S
N
^
|
E <---+---> W
|
v
S
```
(\*) Not to scale.
@@ -316,7 +316,7 @@ common tricks. Taken through the standard rounds listed in the
`select()`, the following may suffice as an additional compiler argument:
```
-Dusleep={time_t v[2]={0,10000};select(0,0,0,0,v);}
-Dusleep={time_t v[2]={0,10000};select(0,0,0,0,v);}
```
`gcc` complains about "unreachable code at beginning of switch
+33 -33
View File
@@ -120,9 +120,9 @@ I claim, by letters patently absurd:
operations.
6. The method of claim 1, further comprising a method where
* strings are encrypted in a manner suitable as C strings, and
* 7-bit ASCII characters with uniform distribution are maximally packed
subject to the restriction that each byte is not countable
* strings are encrypted in a manner suitable as C strings, and
* 7-bit ASCII characters with uniform distribution are maximally packed
subject to the restriction that each byte is not countable
7. A method for a computer-based system that uses a single shared code
sequence to either sum a plurality of bits in an N-bit word or reverses
@@ -134,46 +134,46 @@ I claim, by letters patently absurd:
#### FIG 1.
```
+--+--+--+--+--+--+--+--+
|32| |31| |30| |29| |
+--+--+--+--+--+--+--+--+
| |28| |27| |26| |25|
+--+--+--+--+--+--+--+--+
|24| |23| |22| |21| |
+--+--+--+--+--+--+--+--+
| |20| |19| |18| |17|
+--+--+--+--+--+--+--+--+
|16| |15| |14| |13| |
+--+--+--+--+--+--+--+--+
| |12| |11| |10| | 9|
+--+--+--+--+--+--+--+--+
| 8| | 7| | 6| | 5| |
+--+--+--+--+--+--+--+--+
| | 4| | 3| | 2| | 1|
+--+--+--+--+--+--+--+--+
+--+--+--+--+--+--+--+--+
|32| |31| |30| |29| |
+--+--+--+--+--+--+--+--+
| |28| |27| |26| |25|
+--+--+--+--+--+--+--+--+
|24| |23| |22| |21| |
+--+--+--+--+--+--+--+--+
| |20| |19| |18| |17|
+--+--+--+--+--+--+--+--+
|16| |15| |14| |13| |
+--+--+--+--+--+--+--+--+
| |12| |11| |10| | 9|
+--+--+--+--+--+--+--+--+
| 8| | 7| | 6| | 5| |
+--+--+--+--+--+--+--+--+
| | 4| | 3| | 2| | 1|
+--+--+--+--+--+--+--+--+
```
#### FIG. 2.
```
1 0
\ /
.
/ \
3 2
1 0
\ /
.
/ \
3 2
```
#### FIG. 3.
```
o o X . 29
o . . . 25
o . . o 21
. o . o 17
x . . . 13
. . x . 9
x x . . 5
x x O x 1
o o X . 29
o . . . 25
o . . o 21
. o . o 17
x . . . 13
. . x . 9
x x . . 5
x x O x 1
```
#### FIG. 4
+9 -9
View File
@@ -113,9 +113,9 @@ type `./herrmann1` to see the final result. The output will be
Final tape:
```
*
*
..OOIIIIIIIIIIIIIIIIOOOO..
*
*
```
(Note that the last frame of the animation is _not_ the final
@@ -217,9 +217,9 @@ Undefined state start.
Tape:
```
*
*
..OOOOOOOOIIIIOO..
*
*
```
and the return code will be 1. As you can see, the Turing machine
@@ -320,8 +320,8 @@ to use many variables more than once.
- I couldn't refrain from doing a little bit of nasty stuff like
#define a 0&0
#if !a
#define a 0&0
#if !a
Of course, it is a bit more subtle, and even useful.
@@ -363,15 +363,15 @@ the insertion of `#line` directives. If your compiler doesn't
support this option (and does insert `#line` directives), you
should change the call to `sed` to remove them, too: Add
-e "/^#line/ d"
-e "/^#line/ d"
to the sed parameters. Or, if your `#line` directives look like
# 15 "filename"
# 15 "filename"
add
-e "/^# [0-9]/ d"
-e "/^# [0-9]/ d"
instead.
+2 -2
View File
@@ -33,9 +33,9 @@ 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
+8 -8
View File
@@ -78,12 +78,12 @@ A: Yes, there are types of entries that show up over and over again.
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.
@@ -92,8 +92,8 @@ A: Yes, there are types of entries that show up over and over again.
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...
```
+2 -2
View File
@@ -66,9 +66,9 @@ You can use it for your shell scripting needs similar to a silent grep
``` <!---sh-->
if prog "${VARIABLE}" '<glob>'; then
echo VARIABLE matches
echo VARIABLE matches
else
echo no match
echo no match
fi
```
+1 -1
View File
@@ -128,7 +128,7 @@ the file `ring.pgm`:
``` <!---sh-->
./anonymous "ash nazg durhbatuluhk, ash nazg gimbatul, \
ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm
ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm
```
The source code assumes the ASCII character set; also, due to space
+9 -9
View File
@@ -25,15 +25,15 @@ 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
(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
so your payoff is 9 times your bet == 45
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
so your payoff is 9 times your bet == 45
```
The payout is according to "Vegas rules":
+1 -1
View File
@@ -115,7 +115,7 @@ To stop the server:
* Supports multiple `index.*` file extensions and types:
index.htm, index.html, index.php, index.pl, index.sh, index.rb, index.py
index.htm, index.html, index.php, index.pl, index.sh, index.rb, index.py
* Supports subset of [RFC 2616](https://datatracker.ietf.org/doc/html/rfc2616)
[HTTP/1.1](https://en.wikipedia.org/wiki/HTTP) methods: `GET`, `HEAD`, and
+11 -11
View File
@@ -124,38 +124,38 @@ numbers from 8 to 11.
characteristics](https://en.wikipedia.org/wiki/Euler_characteristic) is the number of "vertexes"
```
#
#
```
minus the number of "edges"
```
## # #. .#
# .# #. ('.' must be empty)
## # #. .#
# .# #. ('.' must be empty)
```
plus the number of "faces"
```
##
##
##
##
```
3. If we fill all these patterns to 2x2 squares,
```
#? ## #? #. .# ##
?? ?? #? .# #. ##
+1 -1 -1 -1 -1 +1
#? ## #? #. .# ##
?? ?? #? .# #. ##
+1 -1 -1 -1 -1 +1
```
substitute all possible "values" of `?` and sum them up, we get that it is
enough to calculate:
```
#. .# ##
.. #. #.
+1 -1 -1
#. .# ##
.. #. #.
+1 -1 -1
```
Note now it is simple and obfuscated enough to be used as
+11 -11
View File
@@ -62,21 +62,21 @@ The ALU has six instructions:
- `CLR_Y` - Clear [register](https://en.wikipedia.org/wiki/Processor_register) `Y`.
- `ADD` - Calculates `X` + `Y` and stores the result in `X`. If the result
is larger than 11 bits, the [CARRY
bit](https://en.wikipedia.org/wiki/Carry_flag) in `SR` is set otherwise
the `CARRY` bit is cleared.
is larger than 11 bits, the [CARRY
bit](https://en.wikipedia.org/wiki/Carry_flag) in `SR` is set otherwise
the `CARRY` bit is cleared.
- `SUB` - Calculates `X` - `Y` and stores the result in `X`. If `Y` was larger
than `X`, the [CARRY bit](https://en.wikipedia.org/wiki/Carry_flag)
in `SR` is set otherwise the `CARRY` bit is cleared.
than `X`, the [CARRY bit](https://en.wikipedia.org/wiki/Carry_flag)
in `SR` is set otherwise the `CARRY` bit is cleared.
- `TST` - If `X` == `Y` the `EQ` bit in `SR` is set, otherwise the `EQ` bit is
cleared. If `X` < `Y` the `LT` bit in `SR` is set, otherwise the `LT`
bit is cleared.
cleared. If `X` < `Y` the `LT` bit in `SR` is set, otherwise the `LT`
bit is cleared.
- `INC2` - Calculates `X` + 2 and stores the result in `X`. The [CARRY
bit](https://en.wikipedia.org/wiki/Carry_flag) is handled as in the
`ADD` instruction.
bit](https://en.wikipedia.org/wiki/Carry_flag) is handled as in the
`ADD` instruction.
Internally the [ALU](https://en.wikipedia.org/wiki/Arithmetic_logic_unit)
implements a one bit adder with a carry in and carry out. This adder is the core
@@ -209,7 +209,7 @@ taken to pre-process the program were measured using GNU `cpp` on my 2.0MHz P4
with 512Mb ram and a lot of disk.
```
Generated Recursive Max nest Intermediate
Generated Recursive Max nest Intermediate
Level prime nrs includes count file size Time
_3 < 8 2 322 9 74 748 4"
@@ -221,7 +221,7 @@ with 512Mb ram and a lot of disk.
_9 < 512 1 920 272 38 65 527 808(*) 1h 42'19"(*)
_10 < 1024 6 826 389 114 63 782 912(*) 2h 47'58"(*)
(*) Before cpp crashed.
(*) Before cpp crashed.
```
+1 -1
View File
@@ -414,7 +414,7 @@ is equivalent to:
``` <!---c-->
for (i=0; i&lt;10; i++) {
some_code;
some_code;
}
other_code;
```
+1 -1
View File
@@ -53,7 +53,7 @@ Use this to obfuscate your BF programs!
For a challenge, figure out what this obfuscated BF program does:
J4mzt?Vazexx-20d~&&~AxdUV!x(~Jz&V)x*(P=J)JUN(dizz)xx_!xx'0&{Vz;}&Jj
J4mzt?Vazexx-20d~&&~AxdUV!x(~Jz&V)x*(P=J)JUN(dizz)xx_!xx'0&{Vz;}&Jj
It takes two integers as input and outputs one integer.
+2 -2
View File
@@ -154,8 +154,8 @@ Supported operations and functions are:
+,-,*,/ | 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.
| 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.
+8 -8
View File
@@ -60,17 +60,17 @@ 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
```
@@ -180,8 +180,8 @@ the start of the program:
``` <!---c-->
int s[ ] = { 186, 94, 1426, 3098
,1047 , 122 , 1082 , 3083 , 1039
, 569 , 527 , 1054 , 531 } ;
,1047 , 122 , 1082 , 3083 , 1039
, 569 , 527 , 1054 , 531 } ;
```
Each piece is a bitmap, and represents a 3x3x3 cube.
+18 -18
View File
@@ -62,32 +62,32 @@ To search regexp from file, do:
Pipes might not work, see the section Limitations.
The options `-i`, `-c`, `-v` and `-n` are the classic ones:
* `-i` Ignore case.
* `-i` Ignore case.
* `-c` Count only, prints the number of matches, but not the matching lines.
* `-c` Count only, prints the number of matches, but not the matching lines.
* `-v` Invert match.
* `-v` Invert match.
* `-n` Prefixes each printed line by its line number (only if
`-c` was not given).
* `-n` Prefixes each printed line by its line number (only if
`-c` was not given).
This version of `grep` recognizes two more options, not present in normal
`grep` implementations:
* `-kN` Permit `N` insertions, deletions or mismatches of characters in the
matches, aka
[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).
The default is `-k0` (i.e. exact match).
* `-kN` Permit `N` insertions, deletions or mismatches of characters in the
matches, aka
[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).
The default is `-k0` (i.e. exact match).
* `-t` Add local transpositions to the set of allowed
[edit-operations](https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties).
That is, "`ab`" matches "`ba`" with one transposition (swap), and
"`obfuscated`" matches "`bofsuact`" with three swaps and two insertions,
i.e. use `-tk5` to find this.
* `-t` Add local transpositions to the set of allowed
[edit-operations](https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties).
That is, "`ab`" matches "`ba`" with one transposition (swap), and
"`obfuscated`" matches "`bofsuact`" with three swaps and two insertions,
i.e. use `-tk5` to find this.
Of course, one could construct a standard
[regexp](https://www.regular-expressions.info) that matches the same
+1 -1
View File
@@ -71,7 +71,7 @@ You will probably get warnings while compiling the code. In particular:
* I don't include any headers I don't strictly need to, so you'll get warnings
about (at least) `memcpy()`, `isdigit()`, `atoi()`, `calloc()`, `malloc()`
and `alloca()` if you didn't use `-DAH`.
- NOTE from judges: we added these includes in 2023.
- NOTE from judges: we added these includes in 2023.
* GCC likes to complain about `while (a = b)` (assignments as a condition).
+9 -9
View File
@@ -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
+6 -6
View File
@@ -11,7 +11,7 @@ To create a shared secret shared among `M` people with `N+1` needed to reconstru
``` <!---sh-->
./grothe -secret 1-/dev/urandom 2-/dev/urandom ... \
N-/dev/urandom 1+shared1 2+shared2 ... M+sharedM
N-/dev/urandom 1+shared1 2+shared2 ... M+sharedM
```
To reconstruct the original (an arbitrary combination of `N+1` or
@@ -77,17 +77,17 @@ 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
-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
1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat
+cookie_recipe_restore.txt
```
+1 -1
View File
@@ -81,7 +81,7 @@ For example, one can use the following expression to match a certain declaration
statement in [hou.c](%%REPO_URL%%/2012/hou/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,
+3 -3
View File
@@ -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
```
@@ -371,7 +371,7 @@ and change it to BLC8 with
``` <!---sh-->
$ cat deflate.Blc reverse.blc | ./tromp > rev.Blc
$ wc rev.Blc
0 1 9 rev.Blc
0 1 9 rev.Blc
```
and then try it out with:
+19 -19
View File
@@ -38,30 +38,30 @@ free list.
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
```
+3 -3
View File
@@ -44,14 +44,14 @@ Several people discovered an undocumented feature in that
certain comments such as:
``` <!---c-->
///*
///*
```
or:
``` <!---c-->
*\
/
*\
/
```
were not correctly parsed by the tool. The guidelines stated:
+1 -1
View File
@@ -75,7 +75,7 @@ Why late? Because:
The IOCCC no longer uses twitter. Today the IOCCC uses Mastodon.
For more information and to see our IOCCC Mastodon posts, see:
https://fosstodon.org/@ioccc
https://fosstodon.org/@ioccc
End of important 2023 update to this historic note.
```
+1 -1
View File
@@ -61,7 +61,7 @@ For extra fun, compile and run [fun.c](%%REPO_URL%%/2013/dlowe/fun.c):
``` <!---c-->
#include <stdio.h>
int main() {
printf("%d %d %d\n", (int)(-1.0/0.0), (int)(0.0/0.0), (int)(1.0/0.0));
printf("%d %d %d\n", (int)(-1.0/0.0), (int)(0.0/0.0), (int)(1.0/0.0));
}
```
+4 -4
View File
@@ -99,8 +99,8 @@ would not be true, the application would be the following:
,1,-1.3 ,1.3, 0, 0,0,0
,0 ,0,50, 80, 0,0,0 ,255
, 8,0}; int main (
int j) {if (j== 1 ){ if(
_[12] >_[10] )_[17]=1 ;} if
int j) {if (j== 1 ){ if(
_[12] >_[10] )_[17]=1 ;} if
(_[13] >_[11 ] ||_[17]==1) return 1
;_[6] = _ [13] / _[11]*(_[1]-_[ 0])
+_[ 0]; _ [7]=_[12]/_[10]*(_[3]-_[2] )+_
@@ -108,8 +108,8 @@ would not be true, the application would be the following:
;_[ 5]= _ [9]*_[9];_[9]=2*_[8]*_[9]+ _[7
];_[8 ] = _ [ 4 ]-_[5]+_[6];_[14 ]++
;if((_ [14]< _ [15])&&(_[4]+ _[ 5]
<_[16 ])) goto l2; putchar(
" #@*+ "[( int) _[14]%
<_[16 ])) goto l2; putchar(
" #@*+ "[( int) _[14]%
5 ]);_ [13 ] ++ ; main (
0) ;_[12]++; _[13] =0
;if(_ [17] !=1) putchar
+8 -8
View File
@@ -101,14 +101,14 @@ The compiler tool chain is the following.
raw.txt |
| |
+---------+---------+
|
| [link.rb]
V
main.c
|
| [gen-prog.c]
V
prog.c
|
| [link.rb]
V
main.c
|
| [gen-prog.c]
V
prog.c
```
* [parse.rb](%%REPO_URL%%/2014/endoh1/parse.rb) converts Ruby to AST.
+29 -29
View File
@@ -234,10 +234,10 @@ here:
Each row has six columns:
1. `Screen X` : `x` position of the object in the level.
2. `Screen Y` : `y` position of the object in the level.
3. `Sprite` : `id` of the sprite to be used for the object.
4. `CLASSFLAGS` : a bitmask that describe how the object behaves.
1. `Screen X` : `x` position of the object in the level.
2. `Screen Y` : `y` position of the object in the level.
3. `Sprite` : `id` of the sprite to be used for the object.
4. `CLASSFLAGS` : a bitmask that describe how the object behaves.
5. `CLASSPARAM0`: a parameter that depends on `CLASSFLAGS`.
6. `CLASSPARAM1`: a parameter that depends on `CLASSFLAGS`.
@@ -245,52 +245,52 @@ Each row has six columns:
* `ENEMY` (`1`)
An enemy. CLASSPARAM0 can be 0 if the enemies don't move, 1 if the
initial move direction is right, -1 if that direction is left. All
enemies that walk will change their direction after 20 steps. The
sprite of an enemy must have 2 other adjacent sprites: SPRITE-1,
used when the enemy dies, and SPRITE+1, used when it moves.
An enemy. CLASSPARAM0 can be 0 if the enemies don't move, 1 if the
initial move direction is right, -1 if that direction is left. All
enemies that walk will change their direction after 20 steps. The
sprite of an enemy must have 2 other adjacent sprites: SPRITE-1,
used when the enemy dies, and SPRITE+1, used when it moves.
* `BLOCK` (`2`)
A wall. Player can walk over the object but can not pass through it.
A wall. Player can walk over the object but can not pass through it.
* `OBJECT BLOCK` (`4`)
When the player hits the object from below, a new object is created.
CLASSFLAGS of the new object is defined in CLASSPARAM0. The sprite
used for the new object is defined in CLASSPARAM1. The sprite of the
new object must have an adjacent sprite: SPRITE+1, used when the
block is hit.
When the player hits the object from below, a new object is created.
CLASSFLAGS of the new object is defined in CLASSPARAM0. The sprite
used for the new object is defined in CLASSPARAM1. The sprite of the
new object must have an adjacent sprite: SPRITE+1, used when the
block is hit.
* `POWERUP` (`8`)
This is a power-up like the classic Mario mushroom. When the
character hits the power-up object, the character becomes the Super
character. If CLASSFLAGS has the bit ZOOM, the character height will
be doubled. The Super character can hit the enemies without dying,
but when this happens, the Super character goes back to being
normal.
This is a power-up like the classic Mario mushroom. When the
character hits the power-up object, the character becomes the Super
character. If CLASSFLAGS has the bit ZOOM, the character height will
be doubled. The Super character can hit the enemies without dying,
but when this happens, the Super character goes back to being
normal.
* `END` (`16`)
When the player hits this object the level ends; the player wins.
When the player hits this object the level ends; the player wins.
* `ZOOM` (`32`)
This flag can be used with POWERUP to indicate a power-up that
will double the size of the player (like the Mario mushroom).
This flag can be used with POWERUP to indicate a power-up that
will double the size of the player (like the Mario mushroom).
* `DESTROY` (`64`)
When the player hits the object (e.g. the classic Mario coin) the
object disappears but the engine does not count the points, so,
from the player point of view, this object is useless.
When the player hits the object (e.g. the classic Mario coin) the
object disappears but the engine does not count the points, so,
from the player point of view, this object is useless.
* `DESTROYUP` (`128`)
This object is like a BLOCK but when the player hits the object
from below, the object disappears.
This object is like a BLOCK but when the player hits the object
from below, the object disappears.
If `CLASSFLAGS` is `0` the object only has an aesthetic function.
+1 -1
View File
@@ -193,7 +193,7 @@ shifts mod 32:
```
1<<48
65536 0x00010000
65536 0x00010000
```
gcc 4.2.1 without arguments compiles cleanly (e.g. `cc prog.c -o prog`).
+34 -34
View File
@@ -17,11 +17,11 @@ were added over time.
dance began (this is called foreshadowing):
```
() forced precedence
- ~ ? unary minus, compl, byteswap
* / % & << >> mul, div, mod, bitand, shift: left, right
+ - | ^ add, sub, bitor, xor
NUM 0-9
() forced precedence
- ~ ? unary minus, compl, byteswap
* / % & << >> mul, div, mod, bitand, shift: left, right
+ - | ^ add, sub, bitor, xor
NUM 0-9
```
This seemed like a reasonable candidate to experiment with obfuscation; perhaps
@@ -34,39 +34,39 @@ The algorithm was and is rather straightforward:
```
expr() {
n = term()
t = token()
if (t == ADD) return n += expr()
if (t == SUB) return n -= expr()
if (t == BOR) return n |= expr()
if (t == XOR) return n ^= expr()
ungettoken(t)
return n
n = term()
t = token()
if (t == ADD) return n += expr()
if (t == SUB) return n -= expr()
if (t == BOR) return n |= expr()
if (t == XOR) return n ^= expr()
ungettoken(t)
return n
}
term() {
n = factor()
t = token()
if (t == MUL) return n *= term()
if (t == DIV) return n /= term()
if (t == AND) return n &= term()
if (t == RSH) return n >> term()
if (t == LSH) return n << term()
ungettoken(t)
return n
n = factor()
t = token()
if (t == MUL) return n *= term()
if (t == DIV) return n /= term()
if (t == AND) return n &= term()
if (t == RSH) return n >> term()
if (t == LSH) return n << term()
ungettoken(t)
return n
}
factor() {
t = token()
if (t == LPAREN) {
n = expr()
if token() == RPAREN
return n
error()
}
if (t == SUB) return -factor()
if (t == CMP) return ~factor()
if (t == QUE) return byteswap(factor())
if (t == DIG) return strtol()
error()
t = token()
if (t == LPAREN) {
n = expr()
if token() == RPAREN
return n
error()
}
if (t == SUB) return -factor()
if (t == CMP) return ~factor()
if (t == QUE) return byteswap(factor())
if (t == DIG) return strtol()
error()
}
```
+4 -4
View File
@@ -14,10 +14,10 @@ proceeds from there, using some identities that are confusingly similar and
interestingly combined (increasing obfuscation):
```
obc clr
--- ---
-~x x+1
~-x x-1
obc clr
--- ---
-~x x+1
~-x x-1
y-~x y+x+1
```
+6 -6
View File
@@ -46,12 +46,12 @@ 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
-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
+1 -1
View File
@@ -29,7 +29,7 @@ More generally use:
``` <!---sh-->
cc -o prog prog.c foo.c
./prog
^C # if necessary, where ^C is ctrl-C, interrrupt
^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.
+13 -13
View File
@@ -45,35 +45,35 @@ From the Makefile:
# Game parameters
#
DU=99999 # Time between steps in microseconds.
# Make it larger if the game is too fast for you.
# Make it larger if the game is too fast for you.
DW=28 # Pipe-to-pipe spacing, in columns.
# Farther apart is easier.
# 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.
# 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.
# Make this larger to make the game easier.
DA=100 # Acceleration due to gravity (scaled by 256).
# Smaller values make you glide slower.
# 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!
# 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.
# 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.
# 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.
# 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
+1 -1
View File
@@ -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
```
+59 -59
View File
@@ -58,9 +58,9 @@ Bell](http://members.tip.net.au/~dbell/) once described
as having one of the largest "yummo quotients" in number theory:
```
complexity of the solution
complexity of the solution
yummo quotient = -----------------------------------
complexity of the problem statement
complexity of the problem statement
```
[Erdős](https://en.wikipedia.org/wiki/Paul_Erdős) privately told one of the IOCCC judges:
@@ -261,31 +261,31 @@ built. In biochemistry, each is assigned a TLI (see [Proteinogenic amino
acid](https://en.wikipedia.org/wiki/Proteinogenic_amino_acid) for more info):
```
ala Alanine
cys Cysteine
asp Aspartic acid
glu Glutamic acid
phe Phenylalanine
gly Glycine
his Histidine
ile Isoleucine
lys Lysine
leu Leucine
met Methionine
asn Asparagine
pyl Pyrrolysine
pro Proline
gln Glutamine
arg Arginine
ser Serine
thr Threonine
sec Selenocysteine
val Valine
trp Tryptophan
tyr Tyrosine
asx Asparagine or Aspartic acid
glx Glutamic acid or Glutamine
xle Leucine or Isoleucine
ala Alanine
cys Cysteine
asp Aspartic acid
glu Glutamic acid
phe Phenylalanine
gly Glycine
his Histidine
ile Isoleucine
lys Lysine
leu Leucine
met Methionine
asn Asparagine
pyl Pyrrolysine
pro Proline
gln Glutamine
arg Arginine
ser Serine
thr Threonine
sec Selenocysteine
val Valine
trp Tryptophan
tyr Tyrosine
asx Asparagine or Aspartic acid
glx Glutamic acid or Glutamine
xle Leucine or Isoleucine
unk Unknown
```
@@ -294,10 +294,10 @@ the rule "[No original
research](https://en.wikipedia.org/wiki/Wikipedia: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.
@@ -336,23 +336,23 @@ Another identity operation. I've done it for you already. Use this
``` <!---sh-->
$ 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
-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:
@@ -390,15 +390,15 @@ Pseudocode, with comments matching those in the C source:
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 */
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 */
}
}
```
@@ -407,8 +407,8 @@ Pseudocode, with comments matching those in the C source:
``` <!---c-->
typedef struct {
size_t places; /* number of places in base 2 to the power of (8*sizeof(type)) */
type *number; /* dynamically allocated memory for number */
size_t places; /* number of places in base 2 to the power of (8*sizeof(type)) */
type *number; /* dynamically allocated memory for number */
} bignum
```
+2 -2
View File
@@ -23,9 +23,9 @@ For more detailed information see [2018/algmyr in bugs.html](../../bugs.html#201
## To use:
``` <!---sh-->
./prog < prog.c # Print garbage: might mess up your terminal
./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 -d 2 0 out.raw # Decode the first (0th) channel out of two
```
+1 -1
View File
@@ -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.
+21 -21
View File
@@ -137,7 +137,7 @@ The discrepancies found are documented and explained in the file
``` <!---sh-->
find ~/src/obc -type f -a -name "*.c" | xargs ./spotcheck.sh ./prog | ./spotdiff.sh |
grep -v keep | diff -bw - discrep* | grep "[<>] cl "
grep -v keep | diff -bw - discrep* | grep "[<>] cl "
```
In summary, there are only 6 unique entries out of 366 that have any variation
@@ -228,38 +228,38 @@ language_. It really is this easy with `tac`:
#!/usr/bin/env bash
script='
BEGIN {
last=nl="\n";
f="c11"; while(getline <f > 0) kw[$0]++; close(f);
last=nl="\n";
f="c11"; while(getline <f > 0) kw[$0]++; close(f);
}
function iskw(a) { return a in kw }
function indent(a) { return sprintf("%*s", n*3, " ") }
function newline() { if (!infor && last != nl) printf last=nl; }
function show(a) {
if (last==nl) printf "%s", indent()
printf "%s%s", space(), a
last=a
if (last==nl) printf "%s", indent()
printf "%s%s", space(), a
last=a
}
function space() {
return iskw(last) ||
(last ~ /[A-Za-z0-9_+-\/%^[&\]\)=:<>;]$/ && $0 !~ /[:;()\[\],]/) ? " " : ""
return iskw(last) ||
(last ~ /[A-Za-z0-9_+-\/%^[&\]\)=:<>;]$/ && $0 !~ /[:;()\[\],]/) ? " " : ""
}
/^\(/ { ++paren }
/^\)/ { --paren }
/^\(/ { ++paren }
/^\)/ { --paren }
/^for/ { newline(); infor=1 }
infor && /^;/ { ++infor; show($0 " "); next }
/^for/ { newline(); infor=1 }
infor && /^;/ { ++infor; show($0 " "); next }
infor==1 && /^:/ { ++infor }
infor>1 && paren==0 { infor=0 }
/^\?/ { tern++; n++; newline(); show($0 " "); next }
tern && /^:/ { newline(); show($0); --tern; --n; next }
/^\?/ { tern++; n++; newline(); show($0 " "); next }
tern && /^:/ { newline(); show($0); --tern; --n; next }
/^#/ { newline(); show($0); newline(); next }
/^;/ { show($0); newline(); next }
/^{/ { show($0); ++n; newline(); next }
/^}/ { n--; newline(); show($0); newline(); next }
/^#/ { newline(); show($0); newline(); next }
/^;/ { show($0); newline(); next }
/^{/ { show($0); ++n; newline(); next }
/^}/ { n--; newline(); show($0); newline(); next }
{ show($0) }
'
@@ -329,9 +329,9 @@ The following reserved word files are included:
* [kandr](%%REPO_URL%%/2018/burton2/kandr) from my venerable 1978 18th printing "The C Programming Language"
* [v7unix](%%REPO_URL%%/2018/burton2/v7unix) 7th edition Unix source code, extracted from c00.c
* [kandr2](%%REPO_URL%%/2018/burton2/kandr2) from my 1988 1st printing "The C Programming Language", 2e
* [ansi](%%REPO_URL%%/2018/burton2/ansi) ANSI X3.159-1989
* [c99](%%REPO_URL%%/2018/burton2/c99) ISO/IEC 9899:1999(E)
* [c11](%%REPO_URL%%/2018/burton2/c11) ISO/IEC 9899:201x(E) N1570
* [ansi](%%REPO_URL%%/2018/burton2/ansi) ANSI X3.159-1989
* [c99](%%REPO_URL%%/2018/burton2/c99) ISO/IEC 9899:1999(E)
* [c11](%%REPO_URL%%/2018/burton2/c11) ISO/IEC 9899:201x(E) N1570
* [c++98](%%REPO_URL%%/2018/burton2/c++98) http://en.cppreference.com/w/cpp/keyword
* [c++11](%%REPO_URL%%/2018/burton2/c++11) ISO/IEC 14882:2011(E) N3337 2012-01-16
* [c++14](%%REPO_URL%%/2018/burton2/c++14) ISO/IEC 14882:2014(E) N4296 2014-11-09
+14 -14
View File
@@ -59,20 +59,20 @@ different"](https://en.wikipedia.org/wiki/And_Now_for_Something_Completely_Diffe
is also used in the opening.
```
___-----__
_-- --__
_- _--_ \
_- /\ +-.:.:-+ /\ \
/ \/ |.:.:.:| \/ |
/ |:.:.:.| |
/ |.:.:.:| | ___-----___
| |.:.:| | / \
| |:.:.| | < It's ... |
\ |:.| | \ /
\ || | ---_____---
_--\ |
_- -__ |
__- --___ |
___-----__
_-- --__
_- _--_ \
_- /\ +-.:.:-+ /\ \
/ \/ |.:.:.:| \/ |
/ |:.:.:.| |
/ |.:.:.:| | ___-----___
| |.:.:| | / \
| |:.:.| | < It's ... |
\ |:.| | \ /
\ || | ---_____---
_--\ |
_- -__ |
__- --___ |
_- |
/ |
| |
+12 -12
View File
@@ -3,9 +3,9 @@
- [prog.c](prog.c)
* This is the source file to the `weasel` program [1].
- [prog.alt.c](prog.alt.c)
* This is the source code file to the `weasel.alt` program [1].
* This is the source code file to the `weasel.alt` program [1].
- [test.sh](test.sh)
* Script provided to test the weasel program [1].
* Script provided to test the weasel program [1].
- [test-strings.txt](test-strings.txt)
* The `test.sh` script reads from this file and runs the program with these
target strings.
@@ -47,18 +47,18 @@ remarks I have kept it in place. Please note that the paths below are dependent
on the prefix used in installation; where I suggest `/usr` it is equally
possible it could be under '/usr/local', for example.
[1] Note that [prog.c](prog.c) and
[prog.alt.c](prog.alt.c) would be
linked to `weasel.c` and `weasel.alt.c`
(respectively) in the `/usr/src/weasel`
subdirectory.
[1] Note that [prog.c](prog.c) and
[prog.alt.c](prog.alt.c) would be
linked to `weasel.c` and `weasel.alt.c`
(respectively) in the `/usr/src/weasel`
subdirectory.
[2] The file would most likely be compressed as
`weasel.1.gz` under the `/usr/share/man/man1`
subdirectory.
[2] The file would most likely be compressed as
`weasel.1.gz` under the `/usr/share/man/man1`
subdirectory.
[3] These files would be in the `/usr/share/doc/weasel`
subdirectory.
[3] These files would be in the `/usr/share/doc/weasel`
subdirectory.
<hr style="width:10%;text-align:left;margin-left:0">
+2 -2
View File
@@ -372,11 +372,11 @@ precise the following characters are acceptable; it equates to this in C (note
it includes a literal space `' '` but it doesn't include other
`isspace()` characters) and this is why some of the characters are escaped:
const char keyboard[]=" !\"#$<%:>&'()*+,-./0123456789;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`{|}~";
const char keyboard[]=" !\"#$<%:>&'()*+,-./0123456789;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`{|}~";
The simpler keyboard looks like:
const char keyboard[]=" !\"&'(),.0123456789;?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const char keyboard[]=" !\"&'(),.0123456789;?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
The program makes sure that the target string only has characters the keyboard
can actually produce but there is a certain type of input error that might
+1 -1
View File
@@ -311,7 +311,7 @@ Assuming you're more careful than that, we can try a few commands:
# cat > foo.c
main()
{
printf("Hello, World!\n");
printf("Hello, World!\n");
}
^D
# cc foo.c
+1 -1
View File
@@ -291,7 +291,7 @@ be applied.
[6]: https://en.wikipedia.org/wiki/Lambda_calculus "Lambda Calculus on Wikipedia"
[7]: https://en.wikipedia.org/wiki/Combinatory_logic "Combinatory Logic on Wikipedia"
[8]: https://inazz.jp/unlambda/ "Online Unlambda interpreter"
[9]: ../../2014/birken/index.html "Best use of port 1701"
[9]: ../../2014/birken/index.html "Best use of port 1701"
<!--
+1 -1
View File
@@ -53,7 +53,7 @@ We truly have not much more to add, except two things:
model RAM, you'd want to reduce the value of the Z define in the Makefile
to `0x10000000`, otherwise the entry will promptly crash. To do this you can do:
make clobber MEMORY=0x10000000 all
make clobber MEMORY=0x10000000 all
Notice that that value must be a power of two!
+1 -1
View File
@@ -93,7 +93,7 @@ Okay, check the backtrace.
#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.
+9 -9
View File
@@ -532,8 +532,8 @@ 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)'
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
@@ -578,14 +578,14 @@ GRU network:
``` <!---make-->
-DHS=128, \
-DNW=' x = I(n), \
y = L(n, MD(MD(x)))' \
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'
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
+5 -5
View File
@@ -102,7 +102,7 @@ The entirety of the program consists of a single iterated call to `printf(3)`.
``` <!---c-->
int main() {
while(*d) printf(fmt, arg);
while(*d) printf(fmt, arg);
}
```
@@ -316,8 +316,8 @@ One option would be to implement the logic as
``` <!---c-->
printf()
while (*ok) {
scanf();
printf();
scanf();
printf();
}
```
@@ -326,8 +326,8 @@ implement it like this
``` <!---c-->
while (*ok) {
scanf();
printf();
scanf();
printf();
}
```
+1 -1
View File
@@ -181,7 +181,7 @@ flagged.
```
? ? ? ? ! ? ? ?
? 3 1 2 => ! 3 1 2
2 2 . . 2 2 . .
2 2 . . 2 2 . .
```
`A` and `B` are probed cells whose numbers are, respectively, 3 and 1. The
+16 -16
View File
@@ -29,7 +29,7 @@ snake's syllabary) for all snake and herpetologist programmers alike.
* Modifications
- Modifying the colours
- Background colour
- Background colour
- Modifying the characters for the wall, bug and snake
- Modifying input keys
- Modifying the status/score line
@@ -40,7 +40,7 @@ snake's syllabary) for all snake and herpetologist programmers alike.
- Health (and/or Lives)
- Saving the game
- Different types of walls
- Blockades
- Blockades
- Diagonal movement
- Special abilities
- Obstacles
@@ -228,27 +228,27 @@ More generally the following expressions and data types (with format specifiers)
come to mind as information that might be of interest.
```
DESCRIPTION EXPRESSION TYPE FORMAT SPECIFIER
DESCRIPTION EXPRESSION TYPE FORMAT SPECIFIER
Snake size A size_t %zu
Snake size A size_t %zu
Y coordinate Y int %d
Y coordinate Y int %d
of snake head
X coordinate X int %d
X coordinate X int %d
of snake head
Max snake size g size_t %zu
Max snake size g size_t %zu
Bugs eaten c size_t %zu
Bugs eaten c size_t %zu
Bug line (Y) *U int %d
Bug line (Y) *U int %d
Bug column (X) *V int %d
Bug column (X) *V int %d
Snake size A size_t %zu
Snake size A size_t %zu
Growth size (per N size_t %zu
Growth size (per N size_t %zu
bug)
```
@@ -398,10 +398,10 @@ coordinates. This of course is very different now but the idea remains the same:
``` <!---c-->
if (p && !(*O>=O[1]||H>=M(1)))
{
if (X<1||X>=H)
X = X<1?H-1:1;
if (Y<2||Y>=*O)
Y = Y<2?*O-1:2;
if (X<1||X>=H)
X = X<1?H-1:1;
if (Y<2||Y>=*O)
Y = Y<2?*O-1:2;
}
```
+11 -11
View File
@@ -161,8 +161,8 @@ Here are some other features of the game:
* A drawing/practising mode (**WAIT** < 0 makes `timeout()` block).
* Computer plays the game (**WAIT=0**).<br>
- **EPILEPSY/STIMULATION OVERLOAD WARNING** included in the relevant
section (this goes for a low **EVADE** value too).
- **EPILEPSY/STIMULATION OVERLOAD WARNING** included in the relevant
section (this goes for a low **EVADE** value too).
* Grow-Shrink mode (Positive and Negative Winning) mode (see
[gameplay.html](gameplay.html) for more details).
@@ -234,15 +234,15 @@ very important.
<div id="toc">
* ['Bugs'](#bugs)
* [NAQs/IAQs - Never/Infrequently Asked Questions](#naqs)
- [Do I have any inspirations for this entry?](#inspirations)
- [Are there any features I thought of that I wanted to implement but did not get to for some reason or another?](#features)
- [Are there ways that one can make this game easier?](#easier)
- [Are there ways to make it harder?](#harder)
- [How do snakes grow in real life?](#moult)
- [Any other interesting things about snakes?](#other)
- [Why can you go the opposite direction and so immediately die when not cannibalising?](#opposite)
- [Do you have any **DELICIOUS CHOCOLATE CAKE** recipes?](#chocolatecake)
- [What are the files prog.alt.c, prog.2.c, prog-j.c and prog.alt.c ?](#alt)
- [Do I have any inspirations for this entry?](#inspirations)
- [Are there any features I thought of that I wanted to implement but did not get to for some reason or another?](#features)
- [Are there ways that one can make this game easier?](#easier)
- [Are there ways to make it harder?](#harder)
- [How do snakes grow in real life?](#moult)
- [Any other interesting things about snakes?](#other)
- [Why can you go the opposite direction and so immediately die when not cannibalising?](#opposite)
- [Do you have any **DELICIOUS CHOCOLATE CAKE** recipes?](#chocolatecake)
- [What are the files prog.alt.c, prog.2.c, prog-j.c and prog.alt.c ?](#alt)
* [Winning thoughts, dedications and thanks](#winning)
+5 -5
View File
@@ -184,8 +184,8 @@ rest of the snake has gone through). Doing `SHED=100 SHEDS=-1`:
```
ooooooooo>ooo>
^
>
^
>
```
The `^` points to the part that's split from the snake and which will be
@@ -194,8 +194,8 @@ it being `SHEDS=-3`:
```
<ooo<ooooo
^^^
<oo
^^^
<oo
```
If you go through the part that has split (which for some might be difficult
@@ -258,7 +258,7 @@ adjusts the max snake size. For 10 lines and 10 columns you would see:
terminal cols 10 (8 playable)
snake size: 49 (max size: 49)
bugs: 9 (max size: 9)
bugs: 9 (max size: 9)
at least 28 columns recommended for snake size 49 (is 10)
at least 28 columns recommended for snake size 49 (is 10)
Loaded 100 of 117 files, more files were not shown because too many files have changed in this diff. Show more