From 7712db4a17b6b0f9dce3a88367d8e0dde9b9633c Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Mon, 24 Jun 2024 11:57:35 -0700 Subject: [PATCH] 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. --- 1984/laman/README.md | 8 +- 1984/mullender/README.md | 132 ++--- 1986/marshall/compilers.md | 2 +- 1986/wall/README.md | 2 +- 1987/korn/README.md | 2 +- 1988/litmaath/README.md | 8 +- 1989/jar.2/README.md | 4 +- 1989/tromp/README.md | 24 +- 1990/dds/README.md | 12 +- 1990/jaw/README.md | 26 +- 1990/theorem/README.md | 2 +- 1990/westley/README.md | 8 +- 1991/ant/README.md | 48 +- 1991/brnstnd/README.md | 10 +- 1991/brnstnd/sorta.README.md | 8 +- 1991/rince/README.md | 16 +- 1991/westley/README.md | 24 +- 1992/buzzard.1/README.md | 10 +- 1992/buzzard.2/buzzard.2.README.md | 22 +- 1992/buzzard.2/buzzard.2.design.md | 748 ++++++++++++++--------------- 1992/gson/README.md | 16 +- 1992/imc/README.md | 10 +- 1992/vern/README.md | 6 +- 1992/westley/README.md | 20 +- 1993/cmills/README.md | 2 +- 1993/jonth/README.md | 2 +- 1993/leo/README.md | 12 +- 1993/lmfjyh/README.md | 6 +- 1993/rince/README.md | 6 +- 1993/rince/design.md | 28 +- 1993/vanb/README.md | 78 +-- 1994/README.md | 4 +- 1994/horton/README.md | 4 +- 1994/shapiro/README.md | 2 +- 1994/tvr/README.md | 30 +- 1995/README.md | 12 +- 1995/dodsond1/README.md | 2 +- 1995/leo/README.md | 22 +- 1996/august/README.md | 76 +-- 1998/dlowe/README.md | 18 +- 1998/dorssel/dorssel.md | 42 +- 1998/fanf/README.md | 78 +-- 1998/schweikh1/macos.md | 2 +- 1998/schweikh2/README.md | 2 +- 1998/tomtorfs/README.md | 16 +- 2000/anderson/README.md | 4 +- 2000/bmeyer/README.md | 4 +- 2000/dlowe/README.md | 24 +- 2000/rince/README.md | 16 +- 2000/robison/README.md | 66 +-- 2001/herrmann1/README.md | 18 +- 2001/kev/README.md | 4 +- 2001/ollinger/README.md | 16 +- 2001/schweikh/README.md | 4 +- 2004/anonymous/README.md | 2 +- 2004/burley/README.md | 18 +- 2004/hibachi/README.md | 2 +- 2004/kopczynski/README.md | 22 +- 2004/vik2/README.md | 22 +- 2005/anon/README.md | 2 +- 2005/timwi/README.md | 2 +- 2006/monge/README.md | 4 +- 2006/sykes1/README.md | 16 +- 2011/fredriksson/README.md | 36 +- 2011/richards/README.md | 2 +- 2012/blakely/README.md | 18 +- 2012/grothe/README.md | 12 +- 2012/hou/README.md | 2 +- 2012/tromp/README.md | 6 +- 2012/tromp/how.md | 38 +- 2013/README.md | 6 +- 2013/cable1/README.md | 2 +- 2013/dlowe/README.md | 2 +- 2014/deak/README.md | 8 +- 2014/endoh1/spoilers.md | 16 +- 2014/maffiodo1/README.md | 58 +-- 2015/burton/README.md | 2 +- 2015/burton/road.to.obscurity.md | 68 +-- 2015/burton/spoilers.md | 8 +- 2015/endoh1/README.md | 12 +- 2015/endoh3/README.md | 2 +- 2015/mills1/README.md | 26 +- 2015/mills2/README.md | 2 +- 2015/schweikhardt/README.md | 118 ++--- 2018/algmyr/README.md | 4 +- 2018/burton1/README.md | 2 +- 2018/burton2/README.md | 42 +- 2018/endoh2/README.md | 28 +- 2018/ferguson/FILES.md | 24 +- 2018/ferguson/README.md | 4 +- 2018/mills/README.md | 2 +- 2019/adamovsky/README.md | 2 +- 2019/dogon/README.md | 2 +- 2019/endoh/README.md | 2 +- 2019/mills/README.md | 18 +- 2020/carlini/README.md | 10 +- 2020/endoh1/README.md | 2 +- 2020/ferguson1/HACKING.md | 32 +- 2020/ferguson1/README.md | 22 +- 2020/ferguson1/bugs.md | 10 +- 2020/ferguson1/gameplay.md | 24 +- 2020/ferguson1/spoilers.md | 170 +++---- 2020/ferguson1/terminals.md | 52 +- 2020/ferguson1/troubleshooting.md | 48 +- 2020/ferguson2/README.md | 8 +- 2020/ferguson2/obfuscation.md | 84 ++-- 2020/ferguson2/recode.md | 16 +- README.md | 4 +- archive/historic/README.md | 4 +- author/README.md | 86 ++-- bin/README.md | 46 +- bugs.md | 188 ++++---- faq.md | 140 +++--- markdown.md | 6 +- next/guidelines.md | 18 +- thanks-for-help.md | 90 ++-- tmp/OLD_manifest/README.md | 24 +- 117 files changed, 1758 insertions(+), 1758 deletions(-) diff --git a/1984/laman/README.md b/1984/laman/README.md index 3048d648b..4943b3419 100644 --- a/1984/laman/README.md +++ b/1984/laman/README.md @@ -42,15 +42,15 @@ Some new compilers (in 1984) dislike lines 6 and 10 of the source, so we changed them from: ``` - ;++f)a[ b<<5|c] =d++,b+ =e;for( f=0;f - ;++f)a[ b<<5|c] =d++,b+= e;for( f=0;f ./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 ``` 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: ``` 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: ``` 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"); + } } ``` diff --git a/1986/marshall/compilers.md b/1986/marshall/compilers.md index 22a334b2b..cd6b75069 100644 --- a/1986/marshall/compilers.md +++ b/1986/marshall/compilers.md @@ -75,7 +75,7 @@ disable the optimiser we might get something like: ``` $ ./marshall - choo choo + choo choo Segmentation fault: 11 ``` diff --git a/1986/wall/README.md b/1986/wall/README.md index 7d0cf072b..02a75c60f 100644 --- a/1986/wall/README.md +++ b/1986/wall/README.md @@ -24,7 +24,7 @@ supports the `-traditional-cpp` option. ### Alternate build: ``` - make alt + make alt ``` ### Alternate use: diff --git a/1987/korn/README.md b/1987/korn/README.md index b8ff5ab3a..fe9e35f6f 100644 --- a/1987/korn/README.md +++ b/1987/korn/README.md @@ -45,7 +45,7 @@ is legal C, what type of value is `"have"`? 3. Note that the following expressions yield the same value: ``` - x[3] *(x+3) *(3+x) + x[3] *(x+3) *(3+x) ``` since addition is commutative. What can be said about this value? diff --git a/1988/litmaath/README.md b/1988/litmaath/README.md index 4bbcf41be..589c16104 100644 --- a/1988/litmaath/README.md +++ b/1988/litmaath/README.md @@ -52,7 +52,7 @@ Note the unusual structure: ``` while () - ; + ; ``` Did you notice that the body is empty? @@ -68,9 +68,9 @@ variables like: ``` fprintf(stderr, - "argv=%lo *argv=%lo **argv=%c argv[1]=%lo *argv[1]=%c argc=%d\n", - (long) argv, (long) *argv, *argv && **argv ? **argv : '@', - (long) argv[1], argv[1] && *argv[1] ? *argv[1] : '@', argc); + "argv=%lo *argv=%lo **argv=%c argv[1]=%lo *argv[1]=%c argc=%d\n", + (long) argv, (long) *argv, *argv && **argv ? **argv : '@', + (long) argv[1], argv[1] && *argv[1] ? *argv[1] : '@', argc); ``` ... which is what the [alternate code](#alternate-code) is. diff --git a/1989/jar.2/README.md b/1989/jar.2/README.md index b592cba9b..757a53f58 100644 --- a/1989/jar.2/README.md +++ b/1989/jar.2/README.md @@ -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) diff --git a/1989/tromp/README.md b/1989/tromp/README.md index 6f9512f0d..df3aa6ada 100644 --- a/1989/tromp/README.md +++ b/1989/tromp/README.md @@ -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 diff --git a/1990/dds/README.md b/1990/dds/README.md index 79174a23a..1898ccb83 100644 --- a/1990/dds/README.md +++ b/1990/dds/README.md @@ -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: diff --git a/1990/jaw/README.md b/1990/jaw/README.md index 7be149c4c..066046c6e 100644 --- a/1990/jaw/README.md +++ b/1990/jaw/README.md @@ -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: diff --git a/1990/theorem/README.md b/1990/theorem/README.md index 5286f64ae..dd5e85a41 100644 --- a/1990/theorem/README.md +++ b/1990/theorem/README.md @@ -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 diff --git a/1990/westley/README.md b/1990/westley/README.md index 949169640..7fd003a54 100644 --- a/1990/westley/README.md +++ b/1990/westley/README.md @@ -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 diff --git a/1991/ant/README.md b/1991/ant/README.md index 57bbed5a9..60cd90ec6 100644 --- a/1991/ant/README.md +++ b/1991/ant/README.md @@ -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
- A Cookbook For An EMACS", TM-165, MIT Lab. for Computer
- Science +[Fin80] Craig A. Finseth, "Theory and Practice of Text Editors or
+ A Cookbook For An EMACS", TM-165, MIT Lab. for Computer
+ Science -[KeP81] Kernighan & Plauger, "Software Tools in Pascal",
- Addison-Wesley, 81, chapter 6 +[KeP81] Kernighan & Plauger, "Software Tools in Pascal",
+ Addison-Wesley, 81, chapter 6 -[Mil86] Eugene W. Myers & Webb Miller, "Row-replacement Algorithms - for Screen Editors", TR 86-19, Dept. of Computer Science,
- U. of Arizona +[Mil86] Eugene W. Myers & Webb Miller, "Row-replacement Algorithms + for Screen Editors", TR 86-19, Dept. of Computer Science,
+ U. of Arizona -[MyM86] Eugene W. Myers & Webb Miller, "A simple row-replacement
- method", TR 86-28, Dept. of Computer Science, U. of Arizona +[MyM86] Eugene W. Myers & Webb Miller, "A simple row-replacement
+ 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 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: ``` - ./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: ``` - 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! ``` diff --git a/1992/buzzard.1/README.md b/1992/buzzard.1/README.md index 3700f9202..f4cfe27c6 100644 --- a/1992/buzzard.1/README.md +++ b/1992/buzzard.1/README.md @@ -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). diff --git a/1992/buzzard.2/buzzard.2.README.md b/1992/buzzard.2/buzzard.2.README.md index d029bcb75..07294c0b7 100644 --- a/1992/buzzard.2/buzzard.2.README.md +++ b/1992/buzzard.2/buzzard.2.README.md @@ -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: diff --git a/1992/buzzard.2/buzzard.2.design.md b/1992/buzzard.2/buzzard.2.design.md index d68af4b2b..c2f51db05 100644 --- a/1992/buzzard.2/buzzard.2.design.md +++ b/1992/buzzard.2/buzzard.2.design.md @@ -87,15 +87,15 @@ means that by default FIRST simply compiles things. #### Integer Operations ``` - SYMBOL NAME FUNCTION + SYMBOL NAME FUNCTION - - binary minus pop top 2 elements of stack, subtract, push + - binary minus pop top 2 elements of stack, subtract, push - * multiply pop top 2 elements of stack, multiply, push + * multiply pop top 2 elements of stack, multiply, push - / divide pop top 2 elements of stack, divide, push + / divide pop top 2 elements of stack, divide, push - <0 less than 0 pop top element of stack, push 1 if < 0 else 0 + <0 less than 0 pop top element of stack, push 1 if < 0 else 0 ``` Note that we can synthesize addition and negation from binary minus, @@ -106,28 +106,28 @@ but we cannot synthesize a time efficient divide or multiply from it. #### Memory Operations ``` - SYMBOL NAME FUNCTION + SYMBOL NAME FUNCTION - @ fetch pop top of stack, treat as address to push contents of + @ fetch pop top of stack, treat as address to push contents of - ! store top of stack is address, 2nd is value; store to memory - and pop both off the stack + ! store top of stack is address, 2nd is value; store to memory + and pop both off the stack ``` #### Input/Output Operations ``` - NAME FUNCTION + NAME FUNCTION - echo output top of stack through C's putchar() + echo output top of stack through C's putchar() - key push C's getchar() onto top of stack + key push C's getchar() onto top of stack - _read read a space-delimited word, find it in the - dictionary, and compile a pointer to - that word's code pointer onto the - current end of the dictionary + _read read a space-delimited word, find it in the + dictionary, and compile a pointer to + that word's code pointer onto the + current end of the dictionary ``` Although `_read` could be synthesized from key, we need `_read` to be able @@ -137,27 +137,27 @@ to compile words to be able to start any syntheses. #### Execution Operations ``` - NAME FUNCTION + NAME FUNCTION - exit leave the current function: pop the return stack - into the program counter + exit leave the current function: pop the return stack + into the program counter ``` #### Immediate (compilation) Operations ``` - SYMBOL NAME FUNCTION + SYMBOL NAME FUNCTION - : define read in the next space-delimited word, add it to - the end of our string storage, and generate - a header for the new word so that when it - is typed it compiles a pointer to itself - so that it can be executed. + : define read in the next space-delimited word, add it to + the end of our string storage, and generate + a header for the new word so that when it + is typed it compiles a pointer to itself + so that it can be executed. - immediate immediate when used immediately after a name following a ':', - it makes the word being defined run whenever - it is typed. + immediate immediate when used immediately after a name following a ':', + it makes the word being defined run whenever + it is typed. ``` `:` cannot be synthesized, because we could not synthesize anything. @@ -169,10 +169,10 @@ would preclude our being able to do any useful compilation. #### Stack Operations ``` - NAME FUNCTION + NAME FUNCTION - pick pop top of stack, use as index into stack and copy up - that element + pick pop top of stack, use as index into stack and copy up + that element ``` If the data stack were stored in main memory, we could synthesize `pick`; @@ -199,16 +199,16 @@ This is discussed some more in section 2. Here's a handy summary of all the FIRST words: ``` - WORD DESCRIPTION + WORD DESCRIPTION - - * / binary integer operations on the stack - <0 is top of stack less than 0? - @ ! read from or write to memory - echo key output or input one character - _read read a word from input and compile a pointer to it - exit stop running the current function - : compile the header of a definition - immediate modify the header to create an immediate word + - * / binary integer operations on the stack + <0 is top of stack less than 0? + @ ! read from or write to memory + echo key output or input one character + _read read a word from input and compile a pointer to it + exit stop running the current function + : compile the header of a definition + immediate modify the header to create an immediate word ``` Here is a sample FIRST program. I'm assuming you're using @@ -226,33 +226,33 @@ some device to indicate what's going on. (THIRD programs are an entirely different subject.) ``` - ( Our first line gives the symbols for the built-ins ) - : immediate _read @ ! - * / <0 exit echo key _pick + ( Our first line gives the symbols for the built-ins ) + : immediate _read @ ! - * / <0 exit echo key _pick - ( now we define a simple word that will print out a couple characters ) + ( now we define a simple word that will print out a couple characters ) - : L ( define a word named 'L' ) - 108 echo ( output an ascii 'l' ) - exit + : L ( define a word named 'L' ) + 108 echo ( output an ascii 'l' ) + exit - : hello ( define a word named 'hello') - 72 echo ( output an ascii 'H' ) - 101 echo ( output an ascii 'e' ) - 111 ( push ascii 'o' onto the stack ) - L L ( output two ascii 'l's ) - echo ( output the 'o' we pushed on the stack before ) - 10 echo ( print a newline ) - exit ( stop running this routine ) + : hello ( define a word named 'hello') + 72 echo ( output an ascii 'H' ) + 101 echo ( output an ascii 'e' ) + 111 ( push ascii 'o' onto the stack ) + L L ( output two ascii 'l's ) + echo ( output the 'o' we pushed on the stack before ) + 10 echo ( print a newline ) + exit ( stop running this routine ) - : test immediate ( define a word named 'test' that runs whenever typed ) - hello ( call hello ) - exit + : test immediate ( define a word named 'test' that runs whenever typed ) + hello ( call hello ) + exit - test + test - ( The result of running this program should be: - Hello - ) + ( The result of running this program should be: + Hello + ) ``` ## Section 2: Motivating THIRD @@ -306,7 +306,7 @@ In this section we'll eventually have real comments. The first thing we have to do is give the symbols for our built-ins. ``` - : immediate _read @ ! - * / < exit echo key _pick + : immediate _read @ ! - * / < exit echo key _pick ``` Next we want to be mildly self commenting, so we define the word `r` to push @@ -315,7 +315,7 @@ return stack pointer. (In fact, when we run `r`, the value of the return stack pointer is temporarily changed.) ``` - : r 1 exit + : r 1 exit ``` Next, we're currently executing a short loop that contains `_read` and @@ -325,12 +325,12 @@ the return stack, calls `_read`, then calls itself. Because it kills the top of the return stack, it can recurse indefinitely. ``` - : ] - r @ Get the value of the return stack pointer - 1 - Subtract one - r ! Store it back into the return stack pointer - _read Read and compile one word - ] Start over + : ] + r @ Get the value of the return stack pointer + 1 - Subtract one + r ! Store it back into the return stack pointer + _read Read and compile one word + ] Start over ``` Notice that we don't need to exit, since we never come back. Also, it's @@ -340,8 +340,8 @@ will never return! Now let's get compile running. ``` - : main immediate ] - main + : main immediate ] + main ``` Next off, I'm going to do this the easy but non-portable way, and put some @@ -349,14 +349,14 @@ character constant definitions in. I wanted them at the top of the file, but that would have burned too much of the return stack. ``` - : '"' 34 exit - : ')' 41 exit - : '\n' 10 exit - : 'space' 32 exit - : '0' 48 exit - : '-' 45 exit + : '"' 34 exit + : ')' 41 exit + : '\n' 10 exit + : 'space' 32 exit + : '0' 48 exit + : '-' 45 exit - : cr '\n' echo exit + : cr '\n' echo exit ``` Next, we want to define some temporary variables for locations `3`, `4`, and @@ -364,10 +364,10 @@ Next, we want to define some temporary variables for locations `3`, `4`, and ``` - : _x 3 @ exit - : _x! 3 ! exit - : _y 4 @ exit - : _y! 4 ! exit + : _x 3 @ exit + : _x! 3 ! exit + : _y 4 @ exit + : _y! 4 ! exit ``` OK. Now, we want to make THIRD look vaguely like FORTH, @@ -381,7 +381,7 @@ Swap by writing out the top two elements into temps, and then reading them back in the other order. ``` - : swap _x! _y! _x _y exit + : swap _x! _y! _x _y exit ``` Take another look and make sure you see why that works, @@ -393,23 +393,23 @@ negate the top element of the stack, and then subtract. To negate, we subtract from `0`. ``` - : + - 0 swap - - - - exit + : + + 0 swap - + - + exit ``` Create a copy of the top of stack. ``` - : dup _x! _x _x exit + : dup _x! _x _x exit ``` Get a mnemonic name for our dictionary pointer--we need to compile stuff, so it goes through this. ``` - : h 0 exit + : h 0 exit ``` We're going to need to advance that pointer, so let's @@ -418,23 +418,23 @@ Given a pointer to a memory location, increment the value at that memory location. ``` - : inc - dup @ Get another copy of the address, and get the value - so now we have value, address on top of stack. - 1 + Add one to the value - swap Swap to put the address on top of the stack - ! exit Write it to memory + : inc + dup @ Get another copy of the address, and get the value + so now we have value, address on top of stack. + 1 + Add one to the value + swap Swap to put the address on top of the stack + ! exit Write it to memory ``` `,` is a standard FORTH word. It should write the top of stack into the dictionary, and advance the pointer ``` - : , - h @ Get the value of the dictionary pointer - ! Write the top of stack there - h inc And increment the dictionary pointer - exit + : , + h @ Get the value of the dictionary pointer + ! Write the top of stack there + h inc And increment the dictionary pointer + exit ``` `'` is a standard FORTH word. It should push the address @@ -447,41 +447,41 @@ after the `'`. We push the word there, and advance the return stack pointer so that we don't execute it. ``` - : ' - r @ Get the address of the top of return stack - We currently have a pointer to the top of return stack - @ Get the value from there - We currently have a pointer to the instruction stream - dup Get another copy of it--the bottom copy will stick - around until the end of this word - 1 + Increment the pointer, pointing to the NEXT instruction - r @ ! Write it back onto the top of the return stack - We currently have our first copy of the old pointer - to the instruction stream - @ Get the value there--the address of the "next word" - exit + : ' + r @ Get the address of the top of return stack + We currently have a pointer to the top of return stack + @ Get the value from there + We currently have a pointer to the instruction stream + dup Get another copy of it--the bottom copy will stick + around until the end of this word + 1 + Increment the pointer, pointing to the NEXT instruction + r @ ! Write it back onto the top of the return stack + We currently have our first copy of the old pointer + to the instruction stream + @ Get the value there--the address of the "next word" + exit ``` Now we're set. `;` should be an immediate word that pushes the address of `exit` onto the stack, then writes it out. ``` - : ; immediate - ' exit Get the address of exit - , Compile it - exit And we should return + : ; immediate + ' exit Get the address of exit + , Compile it + exit And we should return ``` Now let's test out `;` by defining a useful word: ``` - : drop 0 * + ; + : drop 0 * + ; ``` Since we have `inc`, we ought to make `dec`: ``` - : dec dup @ 1 - swap ! ; + : dec dup @ 1 - swap ! ; ``` Our next goal, now that we have `;`, is to implement @@ -499,26 +499,26 @@ code it out--but we can't really break it into smaller words, because that'll trash the return stack. ``` - : tor - r @ @ Get the value off the top of the return stack - swap Bring the value to be pushed to the top of stack - r @ ! Write it over the current top of return stack - r @ 1 + r ! Increment the return stack pointer--but can't use inc - r @ ! Store our return address back on the return stack - ; + : tor + r @ @ Get the value off the top of the return stack + swap Bring the value to be pushed to the top of stack + r @ ! Write it over the current top of return stack + r @ 1 + r ! Increment the return stack pointer--but can't use inc + r @ ! Store our return address back on the return stack + ; ``` Next we want the opposite routine, which pops the top of the return stack, and puts it on the normal stack. ``` - : fromr - r @ @ Save old value - r @ 1 - r ! Decrement pointer - r @ @ Get value that we want off - swap Bring return address to top - r @ ! Store it and return - ; + : fromr + r @ @ Save old value + r @ 1 - r ! Decrement pointer + r @ @ Get value that we want off + swap Bring return address to top + r @ ! Store it and return + ; ``` Now, if we have a routine that's recursing, and we @@ -532,7 +532,7 @@ however, it's more complex since there's a new value on top of the return stack. ``` - : tail fromr fromr drop tor ; + : tail fromr fromr drop tor ; ``` Now, we want to do `if`. To do this, we need to convert @@ -542,43 +542,43 @@ up. `minus` gives us unary negation. ``` - : minus 0 swap - ; + : minus 0 swap - ; ``` If top of stack is boolean, `bnot` gives us inverse ``` - : bnot 1 swap - ; + : bnot 1 swap - ; ``` To compare two numbers, subtract and compare to `0`. ``` - : < - <0 ; + : < - <0 ; ``` `logical` turns the top of stack into either `0` or `1`. ``` - : logical - dup Get two copies of it - 0 < 1 if < 0, 0 otherwise - swap minus Swap number back up, and take negative - 0 < 1 if original was > 0, 0 otherwise - + Add them up--has to be 0 or 1! - ; + : logical + dup Get two copies of it + 0 < 1 if < 0, 0 otherwise + swap minus Swap number back up, and take negative + 0 < 1 if original was > 0, 0 otherwise + + Add them up--has to be 0 or 1! + ; ``` `not` returns 1 if top of stack is 0, and 0 otherwise ``` - : not logical bnot ; + : not logical bnot ; ``` We can test equality by subtracting and comparing to `0`. ``` - : = - not ; + : = - not ; ``` Just to show how you compute a branch: Suppose you've @@ -588,14 +588,14 @@ To branch, we use the return stack to read the offset, and add that on to the top of the return stack, and return. ``` - : branch - r @ Address of top of return stack - @ Our return address - @ Value from there: the branch offset - r @ @ Our return address again - + The address we want to execute at - r @ ! Store it back onto the return stack - ; + : branch + r @ Address of top of return stack + @ Our return address + @ Value from there: the branch offset + r @ @ Our return address again + + The address we want to execute at + r @ ! Store it back onto the return stack + ; ``` For conditional branches, we want to branch by a certain @@ -606,19 +606,19 @@ on the stack is `1` if we should branch, and `0` if not, the following computes the correct branch offset. ``` - : computebranch 1 - * 1 + ; + : computebranch 1 - * 1 + ; ``` Branch if the value on top of the stack is `0`. ``` - : notbranch - not - r @ @ @ Get the branch offset - computebranch Adjust as necessary - r @ @ + Calculate the new address - r @ ! Store it - ; + : notbranch + not + r @ @ @ Get the branch offset + computebranch Adjust as necessary + r @ @ + Calculate the new address + r @ ! Store it + ; ``` `here` is a standard FORTH word which returns a pointer to @@ -626,7 +626,7 @@ the current dictionary address--that is, the value of the dictionary pointer. ``` - : here h @ ; + : here h @ ; ``` We're ALL SET to compile `if...else...then` constructs! @@ -637,22 +637,22 @@ we leave the address where we compiled the dummy offset. `then` will calculate the offset and fill it in for us. ``` - : if immediate - ' notbranch , Compile notbranch - here Save the current dictionary address - 0 , Compile a dummy value - ; + : if immediate + ' notbranch , Compile notbranch + here Save the current dictionary address + 0 , Compile a dummy value + ; ``` `then` expects the address to `fixup` to be on the stack. ``` - : then immediate - dup Make another copy of the address - here Find the current location, where to branch to - swap - Calculate the difference between them - swap ! Bring the address to the top, and store it. - ; + : then immediate + dup Make another copy of the address + here Find the current location, where to branch to + swap - Calculate the difference between them + swap ! Bring the address to the top, and store it. + ; ``` Now that we can do `if...then` statements, we can do @@ -661,248 +661,248 @@ some parsing! Let's introduce real FORTH comments. exit. ``` - : find-) - key Read in a character - ')' = Compare it to close parentheses - not if If it's not equal - tail find-) repeat (popping R stack) - then Otherwise branch here and exit - ; + : find-) + key Read in a character + ')' = Compare it to close parentheses + not if If it's not equal + tail find-) repeat (popping R stack) + then Otherwise branch here and exit + ; - : ( immediate - find-) - ; + : ( immediate + find-) + ; - ( we should be able to do FORTH-style comments now ) + ( we should be able to do FORTH-style comments now ) - ( now that we've got comments, we can comment the rest of the code - in a legitimate [self parsing] fashion. Note that you can't - nest parentheses... ) + ( now that we've got comments, we can comment the rest of the code + in a legitimate [self parsing] fashion. Note that you can't + nest parentheses... ) - : else immediate - ' branch , ( compile a definite branch ) - here ( push the backpatching address ) - 0 , ( compile a dummy offset for branch ) - swap ( bring old backpatch address to top ) - dup here swap - ( calculate the offset from old address ) - swap ! ( put the address on top and store it ) - ; + : else immediate + ' branch , ( compile a definite branch ) + here ( push the backpatching address ) + 0 , ( compile a dummy offset for branch ) + swap ( bring old backpatch address to top ) + dup here swap - ( calculate the offset from old address ) + swap ! ( put the address on top and store it ) + ; - : over _x! _y! _y _x _y ; + : over _x! _y! _y _x _y ; - : add - _x! ( save the pointer in a temp variable ) - _x @ ( get the value pointed to ) - + ( add the incremement from on top of the stack ) - _x ! ( and save it ) - ; + : add + _x! ( save the pointer in a temp variable ) + _x @ ( get the value pointed to ) + + ( add the incremement from on top of the stack ) + _x ! ( and save it ) + ; - : allot h add ; + : allot h add ; - : maybebranch - logical ( force the TOS to be 0 or 1 ) - r @ @ @ ( load the branch offset ) - computebranch ( calculate the condition offset [either TOS or 1]) - r @ @ + ( add it to the return address ) - r @ ! ( store it to our return address and return ) - ; + : maybebranch + logical ( force the TOS to be 0 or 1 ) + r @ @ @ ( load the branch offset ) + computebranch ( calculate the condition offset [either TOS or 1]) + r @ @ + ( add it to the return address ) + r @ ! ( store it to our return address and return ) + ; - : mod _x! _y! ( get x then y off of stack ) - _y _y _x / _x * ( y - y / x * x ) - - - ; + : mod _x! _y! ( get x then y off of stack ) + _y _y _x / _x * ( y - y / x * x ) + - + ; - : printnum - dup - 10 mod '0' + - swap 10 / dup - if - printnum - echo - else - drop - echo - then - ; + : printnum + dup + 10 mod '0' + + swap 10 / dup + if + printnum + echo + else + drop + echo + then + ; - : . - dup 0 < - if - '-' echo minus - then - printnum - 'space' echo - ; + : . + dup 0 < + if + '-' echo minus + then + printnum + 'space' echo + ; - : debugprint dup . cr ; + : debugprint dup . cr ; - ( the following routine takes a pointer to a string, and prints it, - except for the trailing quote. returns a pointer to the next word - after the trailing quote ) + ( the following routine takes a pointer to a string, and prints it, + except for the trailing quote. returns a pointer to the next word + after the trailing quote ) - : _print - dup 1 + - swap @ - dup '"' = - if - drop exit - then - echo - tail _print - ; + : _print + dup 1 + + swap @ + dup '"' = + if + drop exit + then + echo + tail _print + ; - : print _print ; + : print _print ; - ( print the next thing from the instruction stream ) - : immprint - r @ @ - print - r @ ! - ; + ( print the next thing from the instruction stream ) + : immprint + r @ @ + print + r @ ! + ; - : find-" - key dup , - '"' = - if - exit - then - tail find-" - ; + : find-" + key dup , + '"' = + if + exit + then + tail find-" + ; - : " immediate - key drop - ' immprint , - find-" - ; + : " immediate + key drop + ' immprint , + find-" + ; - : do immediate - ' swap , ( compile 'swap' to swap the limit and start ) - ' tor , ( compile to push the limit onto the return stack ) - ' tor , ( compile to push the start on the return stack ) - here ( save this address so we can branch back to it ) - ; + : do immediate + ' swap , ( compile 'swap' to swap the limit and start ) + ' tor , ( compile to push the limit onto the return stack ) + ' tor , ( compile to push the start on the return stack ) + here ( save this address so we can branch back to it ) + ; - : i r @ 1 - @ ; - : j r @ 3 - @ ; + : i r @ 1 - @ ; + : j r @ 3 - @ ; - : > swap < ; - : <= 1 + < ; - : >= swap <= ; + : > swap < ; + : <= 1 + < ; + : >= swap <= ; - : inci - r @ 1 - ( get the pointer to i ) - inc ( add one to it ) - r @ 1 - @ ( find the value again ) - r @ 2 - @ ( find the limit value ) - <= - if - r @ @ @ r @ @ + r @ ! exit ( branch ) - then - fromr 1 + - fromr drop - fromr drop - tor - ; + : inci + r @ 1 - ( get the pointer to i ) + inc ( add one to it ) + r @ 1 - @ ( find the value again ) + r @ 2 - @ ( find the limit value ) + <= + if + r @ @ @ r @ @ + r @ ! exit ( branch ) + then + fromr 1 + + fromr drop + fromr drop + tor + ; - : loop immediate ' inci @ here - , ; + : loop immediate ' inci @ here - , ; - : loopexit + : loopexit - fromr drop ( pop off our return address ) - fromr drop ( pop off i ) - fromr drop ( pop off the limit of i ) - ; ( and return to the caller's caller routine ) + fromr drop ( pop off our return address ) + fromr drop ( pop off i ) + fromr drop ( pop off the limit of i ) + ; ( and return to the caller's caller routine ) - : execute - 8 ! - ' exit 9 ! - 8 tor - ; + : execute + 8 ! + ' exit 9 ! + 8 tor + ; - : :: ; ( :: is going to be a word that does ':' at runtime ) + : :: ; ( :: is going to be a word that does ':' at runtime ) - : fix-:: immediate 3 ' :: ! ; - fix-:: + : fix-:: immediate 3 ' :: ! ; + fix-:: - ( Override old definition of ':' with a new one that invokes ] ) - : : immediate :: ] ; + ( Override old definition of ':' with a new one that invokes ] ) + : : immediate :: ] ; - : command - here 5 ! ( store dict pointer in temp variable ) - _read ( compile a word ) - ( if we get control back: ) - here 5 @ - = if - tail command ( we didn't compile anything ) - then - here 1 - h ! ( decrement the dictionary pointer ) - here 5 @ ( get the original value ) - = if - here @ ( get the word that was compiled ) - execute ( and run it ) - else - here @ ( else it was an integer constant, so push it ) - here 1 - h ! ( and decrement the dictionary pointer again ) - then - tail command - ; + : command + here 5 ! ( store dict pointer in temp variable ) + _read ( compile a word ) + ( if we get control back: ) + here 5 @ + = if + tail command ( we didn't compile anything ) + then + here 1 - h ! ( decrement the dictionary pointer ) + here 5 @ ( get the original value ) + = if + here @ ( get the word that was compiled ) + execute ( and run it ) + else + here @ ( else it was an integer constant, so push it ) + here 1 - h ! ( and decrement the dictionary pointer again ) + then + tail command + ; - : make-immediate ( make a word just compiled immediate ) - here 1 - ( back up a word in the dictionary ) - dup dup ( save the pointer to here ) - h ! ( store as the current dictionary pointer ) - @ ( get the run-time code pointer ) - swap ( get the dict pointer again ) - 1 - ( point to the compile-time code pointer ) - ! ( write run-time code pointer on compile-time pointer ) - ; + : make-immediate ( make a word just compiled immediate ) + here 1 - ( back up a word in the dictionary ) + dup dup ( save the pointer to here ) + h ! ( store as the current dictionary pointer ) + @ ( get the run-time code pointer ) + swap ( get the dict pointer again ) + 1 - ( point to the compile-time code pointer ) + ! ( write run-time code pointer on compile-time pointer ) + ; - : ) - ' , , ( compile a push that address onto dictionary ) - ; + : ) + ' , , ( compile a push that address onto dictionary ) + ; - : does> immediate - ' command , ( jump back into command mode at runtime ) - here swap ! ( backpatch the build> to point to here ) - 2 , ( compile run-code primitive so we look like a word ) - ' fromr , ( compile fromr, which leaves var address on stack ) - ; + : does> immediate + ' command , ( jump back into command mode at runtime ) + here swap ! ( backpatch the build> to point to here ) + 2 , ( compile run-code primitive so we look like a word ) + ' fromr , ( compile fromr, which leaves var address on stack ) + ; - : _dump ( dump out the definition of a word, sort of ) - dup " (" . " , " - dup @ ( save the pointer and get the contents ) - dup ' exit - = if - " ;)" cr exit - then - . " ), " - 1 + - tail _dump - ; + : _dump ( dump out the definition of a word, sort of ) + dup " (" . " , " + dup @ ( save the pointer and get the contents ) + dup ' exit + = if + " ;)" cr exit + then + . " ), " + 1 + + tail _dump + ; - : dump _dump ; + : dump _dump ; - : # . cr ; + : # . cr ; - : var ; - : constant @ ; - : array + ; + : var ; + : constant @ ; + : array + ; - : [ immediate command ; - : _welcome " Welcome to THIRD. - Ok. - " ; + : [ immediate command ; + : _welcome " Welcome to THIRD. + Ok. + " ; - : ; immediate ' exit , command exit + : ; immediate ' exit , command exit - [ + [ - _welcome + _welcome ``` diff --git a/1992/gson/README.md b/1992/gson/README.md index 7484dfa50..2df7c256d 100644 --- a/1992/gson/README.md +++ b/1992/gson/README.md @@ -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: ``` - ./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. diff --git a/1992/imc/README.md b/1992/imc/README.md index 8a8e83d31..9e1430b20 100644 --- a/1992/imc/README.md +++ b/1992/imc/README.md @@ -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. ``` diff --git a/1992/vern/README.md b/1992/vern/README.md index 871d52fc0..4c404bac5 100644 --- a/1992/vern/README.md +++ b/1992/vern/README.md @@ -19,7 +19,7 @@ For more detailed information see [1992/vern in bugs.html](../../bugs.html#1992_ ## To use: ``` - ./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: ``` sed vern.tmp.c + sed 's/} /=/g;s/{ /i/g' >vern.tmp.c ``` and compiles `vern.tmp.c`. diff --git a/1992/westley/README.md b/1992/westley/README.md index b3fc80e0c..91f179a3e 100644 --- a/1992/westley/README.md +++ b/1992/westley/README.md @@ -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 ``` diff --git a/1993/cmills/README.md b/1993/cmills/README.md index 5156e375e..1e56321ec 100644 --- a/1993/cmills/README.md +++ b/1993/cmills/README.md @@ -36,7 +36,7 @@ For more detailed information see [1993/cmills in bugs.html](../../bugs.html#199 ``` 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: diff --git a/1993/jonth/README.md b/1993/jonth/README.md index b051c3596..eab417949 100644 --- a/1993/jonth/README.md +++ b/1993/jonth/README.md @@ -13,7 +13,7 @@ you need help. ## To use: ``` - ./jonth # must be run on an X11 server + ./jonth # must be run on an X11 server ``` diff --git a/1993/leo/README.md b/1993/leo/README.md index 765015a7e..60141a136 100644 --- a/1993/leo/README.md +++ b/1993/leo/README.md @@ -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 ``` diff --git a/1993/lmfjyh/README.md b/1993/lmfjyh/README.md index fbc53a9cf..67259f003 100644 --- a/1993/lmfjyh/README.md +++ b/1993/lmfjyh/README.md @@ -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 diff --git a/1993/rince/README.md b/1993/rince/README.md index bbd9ab90f..e5fe172ca 100644 --- a/1993/rince/README.md +++ b/1993/rince/README.md @@ -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: diff --git a/1993/rince/design.md b/1993/rince/design.md index fd6ddc151..7a5a8bd00 100644 --- a/1993/rince/design.md +++ b/1993/rince/design.md @@ -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`. diff --git a/1993/vanb/README.md b/1993/vanb/README.md index fbdcd02dc..247fbd8c6 100644 --- a/1993/vanb/README.md +++ b/1993/vanb/README.md @@ -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: ``` 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`): ``` 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; } ``` diff --git a/1994/README.md b/1994/README.md index 6a1e84efb..c9c4e96f0 100644 --- a/1994/README.md +++ b/1994/README.md @@ -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! diff --git a/1994/horton/README.md b/1994/horton/README.md index 0593cf47a..7f94673a0 100644 --- a/1994/horton/README.md +++ b/1994/horton/README.md @@ -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 ,, diff --git a/1994/shapiro/README.md b/1994/shapiro/README.md index 7280e0c29..c5aa7b3de 100644 --- a/1994/shapiro/README.md +++ b/1994/shapiro/README.md @@ -63,7 +63,7 @@ The basic theme (pun) of this program is: ``` "This time (everything) is not where it should be." - ~~~~ + ~~~~ ``` diff --git a/1994/tvr/README.md b/1994/tvr/README.md index daca22397..e39f0af76 100644 --- a/1994/tvr/README.md +++ b/1994/tvr/README.md @@ -32,8 +32,8 @@ Mode may be a value from 0 to 12. ## Try: ``` - ./try.color.sh # for colour displays - ./try.bw.sh # for Black & White displays + ./try.color.sh # for colour displays + ./try.bw.sh # for Black & White displays ``` @@ -62,8 +62,8 @@ where `altmode` `1` - `4` correspond to mode `0` - `3` in the original entry and ### Alternate try: ``` - ./try.alt.color.sh # for colour displays - ./try.alt.bw.sh # for Black & White displays + ./try.alt.color.sh # for colour displays + ./try.alt.bw.sh # for Black & White displays ``` @@ -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 ``` diff --git a/1995/README.md b/1995/README.md index 4698e511c..08b2b0f20 100644 --- a/1995/README.md +++ b/1995/README.md @@ -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 diff --git a/1995/dodsond1/README.md b/1995/dodsond1/README.md index 2b31ca68a..f2692f391 100644 --- a/1995/dodsond1/README.md +++ b/1995/dodsond1/README.md @@ -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: diff --git a/1995/leo/README.md b/1995/leo/README.md index 839acdf2f..76414ec1f 100644 --- a/1995/leo/README.md +++ b/1995/leo/README.md @@ -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: diff --git a/1996/august/README.md b/1996/august/README.md index 49c7d30f7..cff504d83 100644 --- a/1996/august/README.md +++ b/1996/august/README.md @@ -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: "*"* ```
diff --git a/1998/dlowe/README.md b/1998/dlowe/README.md index ecfa5dc6c..31d8780b1 100644 --- a/1998/dlowe/README.md +++ b/1998/dlowe/README.md @@ -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 ``` diff --git a/1998/dorssel/dorssel.md b/1998/dorssel/dorssel.md index 6b04cce9b..533c1b280 100644 --- a/1998/dorssel/dorssel.md +++ b/1998/dorssel/dorssel.md @@ -45,8 +45,8 @@ counter before shifting out each symbol, such as ``` 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 ``` 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: ``` 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 diff --git a/1998/fanf/README.md b/1998/fanf/README.md index 9c6e3f427..076035ea4 100644 --- a/1998/fanf/README.md +++ b/1998/fanf/README.md @@ -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, diff --git a/1998/schweikh1/macos.md b/1998/schweikh1/macos.md index 0b4f5b244..43664abdc 100644 --- a/1998/schweikh1/macos.md +++ b/1998/schweikh1/macos.md @@ -53,7 +53,7 @@ Shortly below that you will see, as noted above, the numbers: ``` if ((H = fopen (__FILE__+43, 43+__FILE__))) while ((fgets (L, (int)sizeof L, H)) != 0) { - I[strcspn (I, 45+__FILE__)] = O = 0; + I[strcspn (I, 45+__FILE__)] = O = 0; ``` The first number in the above C means the length starting from 0 up through the diff --git a/1998/schweikh2/README.md b/1998/schweikh2/README.md index 8dda2ea0e..7efb4b437 100644 --- a/1998/schweikh2/README.md +++ b/1998/schweikh2/README.md @@ -51,7 +51,7 @@ often produced an error of the form: ``` gcc -ansi schweikh2.alt.c -o schweikh2.alt as: Error: cca00NzV.s, line 58: Missing " at end of string - " + " as: Error: cca00NzV.s, line 58: malformed statement *** Error code 1 (bu21) ``` diff --git a/1998/tomtorfs/README.md b/1998/tomtorfs/README.md index 56e144af7..cc1f3988b 100644 --- a/1998/tomtorfs/README.md +++ b/1998/tomtorfs/README.md @@ -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 diff --git a/2000/anderson/README.md b/2000/anderson/README.md index f686cb3c9..ae26975a7 100644 --- a/2000/anderson/README.md +++ b/2000/anderson/README.md @@ -53,13 +53,13 @@ characters (semaphore smileys, if you will). For example, given the input "Hello, world!", the output will be: ``` - <> <> <> <> <> <> + <> <> <> <> <> <> _() ()/ ()/ ()/ _\) () (/_ _\) [] /^ |^^ /^^ /^^ [] ^^ |^^| ^^ [] [] ^^ <>[ [][ <>][ <>][ ][ [][] ][ ][ - <> [] + <> [] _()_ ()/ |() () [] ^^ [] /^^ ^^| |^^| ][ <>][ ][] [][] diff --git a/2000/bmeyer/README.md b/2000/bmeyer/README.md index 9404d564e..2dcaaaf6e 100644 --- a/2000/bmeyer/README.md +++ b/2000/bmeyer/README.md @@ -33,7 +33,7 @@ The author recommended on linux/x86, glibc 2.0, libc4/5: ``` 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: ``` 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. diff --git a/2000/dlowe/README.md b/2000/dlowe/README.md index c67af8148..05725aee7 100644 --- a/2000/dlowe/README.md +++ b/2000/dlowe/README.md @@ -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 ``` diff --git a/2000/rince/README.md b/2000/rince/README.md index cb3fb5a35..10bf221da 100644 --- a/2000/rince/README.md +++ b/2000/rince/README.md @@ -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 diff --git a/2000/robison/README.md b/2000/robison/README.md index 78568c5e4..cfa4583bf 100644 --- a/2000/robison/README.md +++ b/2000/robison/README.md @@ -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 diff --git a/2001/herrmann1/README.md b/2001/herrmann1/README.md index 905c624a4..2c8fcf683 100644 --- a/2001/herrmann1/README.md +++ b/2001/herrmann1/README.md @@ -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. diff --git a/2001/kev/README.md b/2001/kev/README.md index f3d4eeebd..72439e8f1 100644 --- a/2001/kev/README.md +++ b/2001/kev/README.md @@ -33,9 +33,9 @@ NOTE: each player's paddle is at the bottom and the opponent at the top. ## Try: ``` - ./kev # in one terminal + ./kev # in one terminal - ./kev localhost # in another terminal on the same host + ./kev localhost # in another terminal on the same host ``` If you need to change the speed you can reconfigure it like (say diff --git a/2001/ollinger/README.md b/2001/ollinger/README.md index 973fff731..02b1772da 100644 --- a/2001/ollinger/README.md +++ b/2001/ollinger/README.md @@ -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... ``` diff --git a/2001/schweikh/README.md b/2001/schweikh/README.md index cf5e26577..60bf4949b 100644 --- a/2001/schweikh/README.md +++ b/2001/schweikh/README.md @@ -66,9 +66,9 @@ You can use it for your shell scripting needs similar to a silent grep ``` if prog "${VARIABLE}" ''; then - echo VARIABLE matches + echo VARIABLE matches else - echo no match + echo no match fi ``` diff --git a/2004/anonymous/README.md b/2004/anonymous/README.md index 7e4a8c544..3e9b9655f 100644 --- a/2004/anonymous/README.md +++ b/2004/anonymous/README.md @@ -128,7 +128,7 @@ the file `ring.pgm`: ``` ./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 diff --git a/2004/burley/README.md b/2004/burley/README.md index bd1d6d0e0..09494816f 100644 --- a/2004/burley/README.md +++ b/2004/burley/README.md @@ -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": diff --git a/2004/hibachi/README.md b/2004/hibachi/README.md index 301873bbb..90c25fe32 100644 --- a/2004/hibachi/README.md +++ b/2004/hibachi/README.md @@ -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 diff --git a/2004/kopczynski/README.md b/2004/kopczynski/README.md index 03a1b1eee..511a08f29 100644 --- a/2004/kopczynski/README.md +++ b/2004/kopczynski/README.md @@ -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 diff --git a/2004/vik2/README.md b/2004/vik2/README.md index d8b8389c7..f5c931225 100644 --- a/2004/vik2/README.md +++ b/2004/vik2/README.md @@ -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. ``` diff --git a/2005/anon/README.md b/2005/anon/README.md index aa5ced269..30762bf02 100644 --- a/2005/anon/README.md +++ b/2005/anon/README.md @@ -414,7 +414,7 @@ is equivalent to: ``` for (i=0; i<10; i++) { - some_code; + some_code; } other_code; ``` diff --git a/2005/timwi/README.md b/2005/timwi/README.md index b7b0abc18..c3ee4452f 100644 --- a/2005/timwi/README.md +++ b/2005/timwi/README.md @@ -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. diff --git a/2006/monge/README.md b/2006/monge/README.md index 31173ab6d..b882f613f 100644 --- a/2006/monge/README.md +++ b/2006/monge/README.md @@ -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. diff --git a/2006/sykes1/README.md b/2006/sykes1/README.md index 52a1fbb55..4a03c9bd3 100644 --- a/2006/sykes1/README.md +++ b/2006/sykes1/README.md @@ -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: ``` 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. diff --git a/2011/fredriksson/README.md b/2011/fredriksson/README.md index fe3b69aef..dc6809df0 100644 --- a/2011/fredriksson/README.md +++ b/2011/fredriksson/README.md @@ -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 diff --git a/2011/richards/README.md b/2011/richards/README.md index 8bfbbed37..604a0df8e 100644 --- a/2011/richards/README.md +++ b/2011/richards/README.md @@ -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). diff --git a/2012/blakely/README.md b/2012/blakely/README.md index 4c40e92f1..ed16a2899 100644 --- a/2012/blakely/README.md +++ b/2012/blakely/README.md @@ -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 diff --git a/2012/grothe/README.md b/2012/grothe/README.md index 13cdd8f4f..a9f16a1f8 100644 --- a/2012/grothe/README.md +++ b/2012/grothe/README.md @@ -11,7 +11,7 @@ To create a shared secret shared among `M` people with `N+1` needed to reconstru ``` ./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: ``` ./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: ``` ./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 ``` diff --git a/2012/hou/README.md b/2012/hou/README.md index 8be5b52d5..46215b944 100644 --- a/2012/hou/README.md +++ b/2012/hou/README.md @@ -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): ``` - "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, diff --git a/2012/tromp/README.md b/2012/tromp/README.md index c7c1c4dac..c35016abb 100644 --- a/2012/tromp/README.md +++ b/2012/tromp/README.md @@ -1,9 +1,9 @@ ## To build: ``` - make all # On a 64-bit machine (default) + make all # On a 64-bit machine (default) - make tromp32 # On a 32-bit machine + make tromp32 # On a 32-bit machine ``` @@ -371,7 +371,7 @@ and change it to BLC8 with ``` $ 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: diff --git a/2012/tromp/how.md b/2012/tromp/how.md index e8eb1dd87..b3b175fa5 100644 --- a/2012/tromp/how.md +++ b/2012/tromp/how.md @@ -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 ``` diff --git a/2013/README.md b/2013/README.md index 6d82ca4db..5af4af912 100644 --- a/2013/README.md +++ b/2013/README.md @@ -44,14 +44,14 @@ Several people discovered an undocumented feature in that certain comments such as: ``` - ///* + ///* ``` or: ``` - *\ - / + *\ + / ``` were not correctly parsed by the tool. The guidelines stated: diff --git a/2013/cable1/README.md b/2013/cable1/README.md index f799d90ba..77f12b550 100644 --- a/2013/cable1/README.md +++ b/2013/cable1/README.md @@ -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. ``` diff --git a/2013/dlowe/README.md b/2013/dlowe/README.md index f78edd7ed..c8872ff80 100644 --- a/2013/dlowe/README.md +++ b/2013/dlowe/README.md @@ -61,7 +61,7 @@ For extra fun, compile and run [fun.c](%%REPO_URL%%/2013/dlowe/fun.c): ``` #include 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)); } ``` diff --git a/2014/deak/README.md b/2014/deak/README.md index 4fedd47c0..156783a72 100644 --- a/2014/deak/README.md +++ b/2014/deak/README.md @@ -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 diff --git a/2014/endoh1/spoilers.md b/2014/endoh1/spoilers.md index 4305a6948..d187deb3e 100644 --- a/2014/endoh1/spoilers.md +++ b/2014/endoh1/spoilers.md @@ -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. diff --git a/2014/maffiodo1/README.md b/2014/maffiodo1/README.md index dae408b1c..d6ba09675 100644 --- a/2014/maffiodo1/README.md +++ b/2014/maffiodo1/README.md @@ -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. diff --git a/2015/burton/README.md b/2015/burton/README.md index d95f35081..4f9eac200 100644 --- a/2015/burton/README.md +++ b/2015/burton/README.md @@ -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`). diff --git a/2015/burton/road.to.obscurity.md b/2015/burton/road.to.obscurity.md index 9825ffafe..828247a8b 100644 --- a/2015/burton/road.to.obscurity.md +++ b/2015/burton/road.to.obscurity.md @@ -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() } ``` diff --git a/2015/burton/spoilers.md b/2015/burton/spoilers.md index 15e407f2a..df70cceee 100644 --- a/2015/burton/spoilers.md +++ b/2015/burton/spoilers.md @@ -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 ``` diff --git a/2015/endoh1/README.md b/2015/endoh1/README.md index ab3f3e772..1f056987f 100644 --- a/2015/endoh1/README.md +++ b/2015/endoh1/README.md @@ -46,12 +46,12 @@ Compile the program as follows: ``` cc -O3 -std=c99 \ - -Wall -Wextra -pedantic -o prog prog.c \ - -Delta_u="Du*laplacian(u)-u*v*v+F*(1-u)" \ - -Delta_v="Dv*laplacian(v)+u*v*v-v*(F+K)" \ - -DF=0.040 -DK=0.060 -DDu=0.200 -DDv=0.100 \ - -DUV_BACKGROUND=1,0 -DUV_DROP=-0.5,0.5 \ - -DTIMESTEP=1.0 -DSPEED=2 -DRGB=255:128:192 + -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 diff --git a/2015/endoh3/README.md b/2015/endoh3/README.md index ad3add098..a7a53cccb 100644 --- a/2015/endoh3/README.md +++ b/2015/endoh3/README.md @@ -29,7 +29,7 @@ More generally use: ``` 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. diff --git a/2015/mills1/README.md b/2015/mills1/README.md index 1fc08454d..22a2fa4ae 100644 --- a/2015/mills1/README.md +++ b/2015/mills1/README.md @@ -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='" - c=0) :( O + c=0) :( O ``` diff --git a/2015/schweikhardt/README.md b/2015/schweikhardt/README.md index 2978b626d..673de789d 100644 --- a/2015/schweikhardt/README.md +++ b/2015/schweikhardt/README.md @@ -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 ``` $ 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: ``` 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 ``` diff --git a/2018/algmyr/README.md b/2018/algmyr/README.md index 5b3770e3c..4ce9f39ed 100644 --- a/2018/algmyr/README.md +++ b/2018/algmyr/README.md @@ -23,9 +23,9 @@ For more detailed information see [2018/algmyr in bugs.html](../../bugs.html#201 ## To use: ``` - ./prog < prog.c # Print garbage: might mess up your terminal + ./prog < prog.c # Print garbage: might mess up your terminal ./prog > out.raw - ./prog -d 2 0 out.raw # Decode the first (0th) channel out of two + ./prog -d 2 0 out.raw # Decode the first (0th) channel out of two ``` diff --git a/2018/burton1/README.md b/2018/burton1/README.md index ee380e51b..63f2c6405 100644 --- a/2018/burton1/README.md +++ b/2018/burton1/README.md @@ -83,7 +83,7 @@ E.g: ``` - main(){system("hd");} // it's turtles all the way down! + main(){system("hd");} // it's turtles all the way down! ``` is not acceptable. diff --git a/2018/burton2/README.md b/2018/burton2/README.md index 070c6c925..56d0d4c2c 100644 --- a/2018/burton2/README.md +++ b/2018/burton2/README.md @@ -137,7 +137,7 @@ The discrepancies found are documented and explained in the file ``` 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 0) kw[$0]++; close(f); + last=nl="\n"; + f="c11"; while(getline 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 diff --git a/2018/endoh2/README.md b/2018/endoh2/README.md index b09f60a76..4d7d80ae9 100644 --- a/2018/endoh2/README.md +++ b/2018/endoh2/README.md @@ -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 ... | + \ |:.| | \ / + \ || | ---_____--- + _--\ | + _- -__ | + __- --___ | _- | / | | | diff --git a/2018/ferguson/FILES.md b/2018/ferguson/FILES.md index 594da8863..21cc3400d 100644 --- a/2018/ferguson/FILES.md +++ b/2018/ferguson/FILES.md @@ -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.
diff --git a/2018/ferguson/README.md b/2018/ferguson/README.md index f8e8e9b32..5411e10f9 100644 --- a/2018/ferguson/README.md +++ b/2018/ferguson/README.md @@ -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 diff --git a/2018/mills/README.md b/2018/mills/README.md index 71c8ac7b6..740b82c09 100644 --- a/2018/mills/README.md +++ b/2018/mills/README.md @@ -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 diff --git a/2019/adamovsky/README.md b/2019/adamovsky/README.md index a8ac7abf0..477b2a185 100644 --- a/2019/adamovsky/README.md +++ b/2019/adamovsky/README.md @@ -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" -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: ``` -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 diff --git a/2020/carlini/README.md b/2020/carlini/README.md index c05f24cd9..9e3ff5cc0 100644 --- a/2020/carlini/README.md +++ b/2020/carlini/README.md @@ -102,7 +102,7 @@ The entirety of the program consists of a single iterated call to `printf(3)`. ``` 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 ``` printf() while (*ok) { - scanf(); - printf(); + scanf(); + printf(); } ``` @@ -326,8 +326,8 @@ implement it like this ``` while (*ok) { - scanf(); - printf(); + scanf(); + printf(); } ``` diff --git a/2020/endoh1/README.md b/2020/endoh1/README.md index aef6e2a9e..a7d514fa5 100644 --- a/2020/endoh1/README.md +++ b/2020/endoh1/README.md @@ -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 diff --git a/2020/ferguson1/HACKING.md b/2020/ferguson1/HACKING.md index c77eb4550..cc67b45e3 100644 --- a/2020/ferguson1/HACKING.md +++ b/2020/ferguson1/HACKING.md @@ -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: ``` 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; } ``` diff --git a/2020/ferguson1/README.md b/2020/ferguson1/README.md index ae4a97db7..63dcd7b86 100644 --- a/2020/ferguson1/README.md +++ b/2020/ferguson1/README.md @@ -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**).
- - **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.
* ['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) diff --git a/2020/ferguson1/bugs.md b/2020/ferguson1/bugs.md index c650984a2..f5db44c92 100644 --- a/2020/ferguson1/bugs.md +++ b/2020/ferguson1/bugs.md @@ -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`: ``` + oooooooooo ooooo o oo ooooo + o o oo o oo o ooo o + oooo o oo ooooooo oooo ooooo + o o ooo oo o ooo o + oooo o oo ooo oooooooo> ``` diff --git a/2020/ferguson1/spoilers.md b/2020/ferguson1/spoilers.md index 1c9dc81d1..1eb296cf6 100644 --- a/2020/ferguson1/spoilers.md +++ b/2020/ferguson1/spoilers.md @@ -17,8 +17,8 @@ already knew that so no harm there, hey? - [How does the snake movement work?](#movement) - [Drawing (manual) and computer playing (automatic) modes](#manual-automatic) - [Collision detection](#collision) - * [Cannibal collision detection](#cannibalcollision) - * [Collision detection when resizing the window of the game](#resizing) + * [Cannibal collision detection](#cannibalcollision) + * [Collision detection when resizing the window of the game](#resizing) - [Obfuscation](#obfuscation) - [Skinning the snake (i.e., decreasing the iocccsize)](#skinning) - [A few more interesting size optimisations](#size) @@ -216,11 +216,11 @@ in real life increases in size like that so suddenly? :) probably less known and either way it's not as simple as just having the code that it translates to. For example why have: - attroff(COLOR_PAIR(L)); + attroff(COLOR_PAIR(L)); When you can have instead: - attroff(m(PAIR(L))); + attroff(m(PAIR(L))); It's an extra layer of indirection. This used to be more used but when making it easier for users to change the colour pairs I no longer used it to @@ -231,12 +231,12 @@ that it translates to. For example why have: - What is this block of code? - F(MAXSIZE)g d g = f((a)((*y-2)*(y[-2]-2)),g); - F(GROW)N d - F(SIZE)A d - F(WAIT)y[-3] = (int) strtol(z,NULL,0)); - F(EVADE)W d - /* and so on */ + F(MAXSIZE)g d g = f((a)((*y-2)*(y[-2]-2)),g); + F(GROW)N d + F(SIZE)A d + F(WAIT)y[-3] = (int) strtol(z,NULL,0)); + F(EVADE)W d + /* and so on */ There are several things going on here but I'll focus on the main one here and leave the others to their own: the `F` macro and the associated `d` macro are @@ -252,7 +252,7 @@ that it translates to. For example why have: Now it might not defeat the cpp but can you tell me what this is even with the cpp? - f((a)((*y-2)*(y[-2]-2)),g); + f((a)((*y-2)*(y[-2]-2)),g); The cpp might get it closer to what you might expect in a normal program but I refer to the array offsets (below also). @@ -266,7 +266,7 @@ much more than that (that is the `F` macro). As for the Z() macro it means that I could remove `"`s; for example: - #define J Z(X:%d/%d Y:%d/%d S:%zu/%zu B:%zu\n), Y, y[-2], X,*y,A,g, c); + #define J Z(X:%d/%d Y:%d/%d S:%zu/%zu B:%zu\n), Y, y[-2], X,*y,A,g, c); Which as I have discussed elsewhere is the entire set of parameters to both `mvprintw()` and `printf()` plus the end of the function call (i.e. `);`. @@ -278,7 +278,7 @@ technique causes some beautifiers problems too. - Another use of the `Z` macro is this curious line: - static const char*s =Z( ; +<>^v); + static const char*s =Z( ; +<>^v); There are a number of curious parts. First is the Z() part makes it look like a function call. Of course that wouldn't work as such because an array @@ -302,7 +302,7 @@ technique causes some beautifiers problems too. Another example is using the `E()` function e.g.: - E(Z(YOU WIN!)); + E(Z(YOU WIN!)); Which happens to be in the same function the above char array is defined. Also it's more like a string than anything but yet it's not visibly a string. @@ -347,12 +347,12 @@ things which reduced the number of keywords needed). (besides those in e.g. environmental variable processing) that's curious: I converted this: - if (!P) P = 1; - else P = 0; + if (!P) P = 1; + else P = 0; To this: - (!P && (P = 1))||(P=0); + (!P && (P = 1))||(P=0); - Makes use of the different namespaces to have variables and labels be the @@ -371,13 +371,13 @@ it might be easy to miss. - Uses an unnamed array (compound literal) for several different game variables. The pointer to the first element is defined like `int *j`: - static int Y,X,*j = (int[8]){231,0}, *U, *V, *e, *n, Q, P,x,*y,l=4,*D; + static int Y,X,*j = (int[8]){231,0}, *U, *V, *e, *n, Q, P,x,*y,l=4,*D; Does the 231 seem familiar? It should: it's the default key delay for the `timeout()` call (which I will return to again). The rest are 0 default. But what about `j`? Is it even used? Actually in main: - y = j+3; + y = j+3; But aside from that `j` is not used. However... @@ -386,24 +386,24 @@ this in two parts: the negative offsets and then the confusing names. Can you honestly tell me that this is easy to follow? - if (Y < 1 || Y >= y[-2] || X < 2 || X >= *y || y[-2] >= y[-1] || *y >= 1[y]) - { - if (*p && !(*y>=1[y]||y[-2]>=y[-1])) - { - if (Y<1||Y>=y[-2]) - Y = Y<1?y[-2]-1:1; - if (X<2||X>=*y) - X = X<2?*y-1:2; - } - /* ... */ - } + if (Y < 1 || Y >= y[-2] || X < 2 || X >= *y || y[-2] >= y[-1] || *y >= 1[y]) + { + if (*p && !(*y>=1[y]||y[-2]>=y[-1])) + { + if (Y<1||Y>=y[-2]) + Y = Y<1?y[-2]-1:1; + if (X<2||X>=*y) + X = X<2?*y-1:2; + } + /* ... */ + } That's not the only place negative offsets occur! Observe the ternary operators there too. I'll go back to the `F()` macro and in particular what follows one of them: - g d g = f((a)((*y-2)*(y[-2]-2)),g); + g d g = f((a)((*y-2)*(y[-2]-2)),g); To parse that at the very least you have to know that `y` points to `j + 3`. Then you have to know that `j` points to the first element of an unnamed @@ -414,7 +414,7 @@ this in two parts: the negative offsets and then the confusing names. applies to the block above of course and maybe more so). Then you have to think of operator precedence etc. I mean what is: - (*y-2) * (y[-2]-2]) + (*y-2) * (y[-2]-2]) ...about? An offset of `-2` and subtract `-2` from that. Multiply that by the `*y` (which is `j[3]`) `- 2`. @@ -425,10 +425,10 @@ this in two parts: the negative offsets and then the confusing names. - On the confusing names etc.: the `getmaxyx()` function gets the maximum Y, X dimensions. Now in the first call in `main()` I have the code and tests following: - getmaxyx(v, *y, y[-2]); - --*y; --y[-2]; - if (y[-2] < 9 || *y < 9) - return E(Z(term too small)); + getmaxyx(v, *y, y[-2]); + --*y; --y[-2]; + if (y[-2] < 9 || *y < 9) + return E(Z(term too small)); Clearly the `max x` must be stored in `*y` and the `max y` must be stored in .. `y[-2]`. After all anyone knows that the coordinates are in the order `(X,Y)`! @@ -469,7 +469,7 @@ of the brain is to assume `Y` is what is really `X` and `X` is what is really `Y - More confusion with variable names: If you notice the `int *U, *V` they are also part of the compound literal: that is they point into it: - U=y+2; V=U+1; + U=y+2; V=U+1; Except that these two are done in two different places: away from the assignment of `y` to remove them further away from the contexts they are @@ -485,15 +485,15 @@ also part of the compound literal: that is they point into it: - There's another array that holds a variety of data. - static k p[5]={1,0},W=300; + static k p[5]={1,0},W=300; It holds the following information (but not necessarily in this order): - WALLS - CANNIBAL - SHED - SHEDS - EVADE + WALLS + CANNIBAL + SHED + SHEDS + EVADE But how will you know that just looking at the declaration? Many variables and they're part of collections but the many layers of indirection cause @@ -513,18 +513,18 @@ many other examples that I have already shown). - Expanding on referring to the same thing in more than one way take a look at: - case KEY_LEFT: - V[1] = l-3; - break; - case KEY_RIGHT: - V[l/l] = l/2; - break; - case KEY_UP: - V[l-3] = l-1; - break; - case KEY_DOWN: - V[l/4] = l; - break; + case KEY_LEFT: + V[1] = l-3; + break; + case KEY_RIGHT: + V[l/l] = l/2; + break; + case KEY_UP: + V[l-3] = l-1; + break; + case KEY_DOWN: + V[l/4] = l; + break; What's going on there? First of all the letter ell looks very much like the digit one but above there are only two references to the digit `1`; the @@ -551,7 +551,7 @@ many other examples that I have already shown). other places! But even after all of that you still need to do the calculations when I could simply have had: - V[1] = 1; V[1] = 2; ... + V[1] = 1; V[1] = 2; ... Etc. @@ -585,20 +585,20 @@ check if it's > than the current? - More confusion with the max x/y dimensions: Going back to max x/y dimensions and coordinates of the snake; I showed this code before: - if (Y < 1 || Y >= y[-2] || X < 2 || X >= *y || y[-2] >= y[-1] || *y >= 1[y]) - { - if (*p && !(*y>=1[y]||y[-2]>=y[-1])) - { - if (Y<1||Y>=y[-2]) - Y = Y<1?y[-2]-1:1; - if (X<2||X>=*y) - X = X<2?*y-1:2; - } - else - { - /* ... */ - } - } + if (Y < 1 || Y >= y[-2] || X < 2 || X >= *y || y[-2] >= y[-1] || *y >= 1[y]) + { + if (*p && !(*y>=1[y]||y[-2]>=y[-1])) + { + if (Y<1||Y>=y[-2]) + Y = Y<1?y[-2]-1:1; + if (X<2||X>=*y) + X = X<2?*y-1:2; + } + else + { + /* ... */ + } + } I asked if you could honestly figure that out easily. But here's a bit more elaboration. I already talked about the negative offsets - and they should @@ -630,10 +630,10 @@ there's at least one negative offset. - A note on the many `#define`s in my entry. You say you dislike them: - Doing masses of #defines to obscure the source has become 'old'. We - tend to 'see thru' masses of #defines due to our pre-processor tests - that we apply. Simply abusing #defines or -Dfoo=bar won't go as far - as a program that is more well rounded in confusion. + Doing masses of #defines to obscure the source has become 'old'. We + tend to 'see thru' masses of #defines due to our pre-processor tests + that we apply. Simply abusing #defines or -Dfoo=bar won't go as far + as a program that is more well rounded in confusion. As I have noted though many of these save quite a lot of bytes too. It's true that they might aid (but barely) in obfuscation but I think that my @@ -654,30 +654,30 @@ magical about the number 7 isn't there? I do not refer to primes although certainly one could say that primes have a magic to them. No. I'm instead referring to another property: bitwise AND. For example consider the following: - 7 & 0 - 7 & 1 - 7 & 2 - 7 & 3 - 7 & 4 - 7 & 5 - 7 & 6 - 7 & 7 + 7 & 0 + 7 & 1 + 7 & 2 + 7 & 3 + 7 & 4 + 7 & 5 + 7 & 6 + 7 & 7 What is the result of each operation? Quite simply it's the number itself! How does this relate to the `s` array though? Let me back up. Is there any place in the code that has the number 7 (by itself - 997 doesn't count)? A quick check will answer that: no. But here's a curious thing: - q X, Y, s[*D+2&(1<<3)-!Q]); + q X, Y, s[*D+2&(1<<3)-!Q]); We KNOW that at this place `Q` is 0 so the `!Q` has to be 1. Now `1 << 3` is 8. Therefore - (1 << 3) - !Q == 7 + (1 << 3) - !Q == 7 But what's `*D`? If the snake hasn't moved once yet it's 0; otherwise it's the number of the direction the snake is currently facing. Thus - *D&(1<<3)-!Q + *D&(1<<3)-!Q ...refers to `*D`. However if I were to have that be the element it wouldn't work right: I wanted the semicolon in there but the space was needed to diff --git a/2020/ferguson1/terminals.md b/2020/ferguson1/terminals.md index 5e874de99..837904d3d 100644 --- a/2020/ferguson1/terminals.md +++ b/2020/ferguson1/terminals.md @@ -8,13 +8,13 @@ sanity if it causes any problems) as well as colours (limitations etc.).
- [Capabilities support testing program](#termcaps) - [Setting the game dimensions](#dimensions) - * [The LINES and COLUMNS environmental variables](#linescolumns) - * [Terminal insanity](#insanity) - * [Restoring the terminal](#restore) - * [Terminal size abuse](#abuse) + * [The LINES and COLUMNS environmental variables](#linescolumns) + * [Terminal insanity](#insanity) + * [Restoring the terminal](#restore) + * [Terminal size abuse](#abuse) - [Terminal limitations](#termlimitations) - [Terminal colours](#colours) - * [Curses background](#background) + * [Curses background](#background) * [Monochrome terminals](#monochrome) * [Colour limitations](#colourlimitations) * [Disabling colour](#disablecolour) @@ -49,7 +49,7 @@ This compiles the program [termcaps.c](%%REPO_URL%%/2020/ferguson1/termcaps.c) a terminal cols 155 (153 playable) snake size: 997 (max size: 5776) - bugs: 199 (max size: 1155) + bugs: 199 (max size: 1155) at least 34 columns (currently 155) recommended for snake size 997 at least 37 columns (currently 155) recommended for capped snake size 5776 @@ -79,7 +79,7 @@ example: terminal cols 155 (153 playable) snake size: 5776 (max size: 5776) - bugs: 5771 (max size: 5771) + bugs: 5771 (max size: 5771) at least 37 columns (currently 155) recommended for snake size 5776 at least 37 columns (currently 155) recommended for capped snake size 5776 @@ -153,7 +153,7 @@ Say you want 55 columns: This will force curses to detect the max columns (X) of your terminal (for the game dimensions) - to be 55; it might look like this instead: - X:27/54 Y:20/41 S:5/997 B:0 + X:27/54 Y:20/41 S:5/997 B:0 But problems can arise with messing with dimensions: in my tests this held only to lines. @@ -194,10 +194,10 @@ The Linux man page says: ``` You might have to run the `reset` tool like: - reset + reset - (the line-feed character is normally control-J) to get the terminal - to work, as carriage-return may no longer work in the abnormal state. + (the line-feed character is normally control-J) to get the terminal + to work, as carriage-return may no longer work in the abnormal state. ``` If you don't have the reset utility you can try: @@ -320,7 +320,7 @@ The manpage for `init_pair()` says this: [...] - COLOR_PAIRS corresponds to the terminal database's max_pairs capability, (see terminfo(5)). + COLOR_PAIRS corresponds to the terminal database's max_pairs capability, (see terminfo(5)). ``` Based on the two as well as the fact that monochrome terminals (I've tried under @@ -332,11 +332,11 @@ confirm this I wrote the following code with the output below: int main() { - initscr(); - start_color(); - printw("COLORS: %d\nCOLOR_PAIRS: %d\n", COLORS, COLOR_PAIRS); - getch(); - endwin(); + initscr(); + start_color(); + printw("COLORS: %d\nCOLOR_PAIRS: %d\n", COLORS, COLOR_PAIRS); + getch(); + endwin(); } ``` @@ -361,17 +361,17 @@ number is out of the range? To try and figure this out I did another test: ``` int main() { - initscr(); - start_color(); + initscr(); + start_color(); - init_pair(COLOR_PAIRS+1, COLOR_WHITE, COLOR_GREEN); - bkgd(COLOR_PAIR(COLOR_PAIRS+1)); - init_pair(1, COLOR_WHITE, COLOR_BLACK); - attron(COLOR_PAIR(1)); - printw("COLORS: %d\nCOLOR_PAIRS: %d\n", COLORS, COLOR_PAIRS); + init_pair(COLOR_PAIRS+1, COLOR_WHITE, COLOR_GREEN); + bkgd(COLOR_PAIR(COLOR_PAIRS+1)); + init_pair(1, COLOR_WHITE, COLOR_BLACK); + attron(COLOR_PAIR(1)); + printw("COLORS: %d\nCOLOR_PAIRS: %d\n", COLORS, COLOR_PAIRS); - getch(); - endwin(); + getch(); + endwin(); } ``` diff --git a/2020/ferguson1/troubleshooting.md b/2020/ferguson1/troubleshooting.md index 597ec9b64..39781cac2 100644 --- a/2020/ferguson1/troubleshooting.md +++ b/2020/ferguson1/troubleshooting.md @@ -44,11 +44,11 @@ you shouldn't need it to be very wide. * **RESOLUTION #1**: open the [prog.c][] and change the line - #define J Z(X:%d/%d Y:%d/%d S:%zu/%zu B:%zu\n),Y,y[-2],X, *y, A, g, c ); + #define J Z(X:%d/%d Y:%d/%d S:%zu/%zu B:%zu\n),Y,y[-2],X, *y, A, g, c ); To be something like: - #define J Z(B:%zu\n), c); + #define J Z(B:%zu\n), c); Recompile and try again. That will then show only the number of bugs eaten. See the [HACKING.html][] file for other data you @@ -76,7 +76,7 @@ e.g. when the snake is growing. If you want to see this in action try: - SIZE=150 SHEDS=10 SHED=1 ./prog + SIZE=150 SHEDS=10 SHED=1 ./prog Once you start moving you'll see that the tail stays still for a while and when it does move you'll see it doesn't move for long. @@ -174,11 +174,11 @@ snake. See below for some tests. I removed caps in a test and then: - GROW=1 COLUMNS=30 LINES=10 CANNIBAL=1 MAXSIZE=10000 ./prog + GROW=1 COLUMNS=30 LINES=10 CANNIBAL=1 MAXSIZE=10000 ./prog It froze at this point: - X:14/29 Y:5/9 S:323/10000 B:318 + X:14/29 Y:5/9 S:323/10000 B:318 This is because there was only one place for the bug - where the snake head was to be. With these parameters the limit is actually 189! This could @@ -188,7 +188,7 @@ snake. See below for some tests. Another time I tried: - LINES=6 COLUMNS=6 + LINES=6 COLUMNS=6 And it also froze (as noted I impose a minimum of >= 10 for both LINES and COLUMNS). @@ -203,25 +203,25 @@ snake. See below for some tests. For this information and more use the termcaps utility: - make test + make test An example: - terminal supports cursor movement - terminal supports making cursor invisible - terminal supports bold - terminal supports colours + terminal supports cursor movement + terminal supports making cursor invisible + terminal supports bold + terminal supports colours - terminal rows 41 (38 playable) - terminal cols 154 (152 playable) + terminal rows 41 (38 playable) + terminal cols 154 (152 playable) - snake size: 997 (max size: 5738) - bugs: 199 (max size: 1147) + snake size: 997 (max size: 5738) + bugs: 199 (max size: 1147) - at least 34 columns (currently 154) recommended for snake size 997 - at least 37 columns (currently 154) recommended for capped snake size 5738 + at least 34 columns (currently 154) recommended for snake size 997 + at least 37 columns (currently 154) recommended for capped snake size 5738 - No problems detected. + No problems detected. Why are there only 38 playable lines for 41 rows? The first row is the score line, the second is the top wall, the last is the bottom wall. For columns @@ -230,7 +230,7 @@ snake. See below for some tests. The calculation for max size takes place after decrementing the max y/x; then it's `(maxy - 2) * (maxx - 2)`; above that would be: - (41 - 2) * (156 - 2) == 6006 + (41 - 2) * (156 - 2) == 6006 If for some reason the game were to stall for this purpose you would have to kill the game by e.g. ctrl-c since the bug placement is stuck in a loop. @@ -266,7 +266,7 @@ is 0? The head is the obvious choice so once you do get to size 1 you will still only have the head. When you get to size 2 you'll have part of the body too. Try: - SIZE=1 GROW=1 + SIZE=1 GROW=1 And you will see that at one bug you'll have size two and just as if you had two bugs with the previous invocation. @@ -299,7 +299,7 @@ so that's probably why; in CentOS I did have to install it specially. * **BOTTOM LINE**: try using a monochrome terminal for the game by e.g.: - TERM=linux-m ./prog + TERM=linux-m ./prog And then on your white background terminal the game should keep the background white and the foreground black. This will of course mean you have @@ -326,9 +326,9 @@ out if enabling brighter colours is possible. you mess up your old one. FWIW I haven't had this problem on consoles only and in my systems I have the option to enable brighter colours for bold - it was only in testing that I came across this problem. Of course you might - also try changing the colours of the game. For that see - [snake-colours.sh](%%REPO_URL%%/2020/ferguson1/snake-colours.sh) and - [play.sh](%%REPO_URL%%/2020/ferguson1/play.sh). + also try changing the colours of the game. For that see + [snake-colours.sh](%%REPO_URL%%/2020/ferguson1/snake-colours.sh) and + [play.sh](%%REPO_URL%%/2020/ferguson1/play.sh).
diff --git a/2020/ferguson2/README.md b/2020/ferguson2/README.md index 4e2d06edb..3981b59b5 100644 --- a/2020/ferguson2/README.md +++ b/2020/ferguson2/README.md @@ -107,7 +107,7 @@ This code is an [enigma](https://youtu.be/ybkkiGtJmkM). Try to decode it! There is a good deal of useful documentation that is provided with this entry: -* [enigma.1](%%REPO_URL%%/2020/ferguson2/enigma.1) - A useful man page for this entry. To render, try: +* [enigma.1](%%REPO_URL%%/2020/ferguson2/enigma.1) - A useful man page for this entry. To render, try: ``` @@ -160,7 +160,7 @@ I have more information on this entry like the testing procedure at - [IOCCC: an Enigma?](#ioccc) - [The 1992 Nathan Sidwell entry](#nathan) - [Usage](#usage) - * [Example run](#example) + * [Example run](#example) - [The recode.c configurator](#recode) - [A parser subtlety that could cause confusion](#parsersubtlety) - [On the source code layout](#layout) @@ -548,8 +548,8 @@ ended his life. (I later made a bug fix but I consider this inconsequential). As for [recode.c][] though I really love this: ``` - /\ - / This is *not* what you think: + /\ + / This is *not* what you think: ``` ...because it seems so wrong in C code at first glance. Also what does the diff --git a/2020/ferguson2/obfuscation.md b/2020/ferguson2/obfuscation.md index 67ce82fdb..da6f208a7 100644 --- a/2020/ferguson2/obfuscation.md +++ b/2020/ferguson2/obfuscation.md @@ -20,17 +20,17 @@ Y<:19:><:27:> but it's not the only example. Here the compound literal of 13 ints: ``` - int *z=(int[13]) { 0 } , *e, *g; + int *z=(int[13]) { 0 } , *e, *g; ``` Then in main: ``` - e = z + 10; - g = e + 1; + e = z + 10; + g = e + 1; - for (j=-3; j < 0; ++j) - e<:j:> = j+3; + for (j=-3; j < 0; ++j) + e<:j:> = j+3; ``` Which I think is more confusing: when one is iterating an array you don't @@ -40,31 +40,31 @@ more confusing still. There are at least two other ways that are much easier to read that could accomplish the same thing. It continues on: ``` - /* ... */ - e<:i-3:> = (j < 1 ? 1 : (j > 5 ? 5 : j))-1; + /* ... */ + e<:i-3:> = (j < 1 ? 1 : (j > 5 ? 5 : j))-1; ``` * Observe these two functions: ``` - void w(char *s, int k, int v) - { - for(e<:2:> = 0; s<:*P:>; ++e<:2:>) - { - v = s<:e<:2:>:>; - if(v > 64 && v < 91) - s<:e<:2:>:> = (((v - 65 + k) % 26) + 65); - } - } - void Q(void) - { - for(*g = 0; *g < 3; ++*g) - { - *Y<:16+e<:1:>:>=S<:e<:e<:1:>-3:>:>; - R<:e<:1:>:>=Y<:e<:-3+e<:1:>:>:>; - w(R[*g],*(e+e<:1:>-6)=q(Y<:8:>,*Y<:7:>),*g); - } - } + void w(char *s, int k, int v) + { + for(e<:2:> = 0; s<:*P:>; ++e<:2:>) + { + v = s<:e<:2:>:>; + if(v > 64 && v < 91) + s<:e<:2:>:> = (((v - 65 + k) % 26) + 65); + } + } + void Q(void) + { + for(*g = 0; *g < 3; ++*g) + { + *Y<:16+e<:1:>:>=S<:e<:e<:1:>-3:>:>; + R<:e<:1:>:>=Y<:e<:-3+e<:1:>:>:>; + w(R[*g],*(e+e<:1:>-6)=q(Y<:8:>,*Y<:7:>),*g); + } + } ``` First of all: why do I set `e[2]` to 0 and increment it for each pass in the @@ -97,14 +97,14 @@ and (2) I didn't want to risk changing all the offsets: thus I just made that address `e[1]`. Thus I also have: ``` - for (*g = 0 ; *g < 10; ++*g) - { - r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>; - if (r<:-3:> && r<:-2:> == r<:-1:>) - return r<:-3:>; - if (r<:-2:> && r<:-3:> == r<:-1:>) - return r<:-2:>; - } + for (*g = 0 ; *g < 10; ++*g) + { + r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>; + if (r<:-3:> && r<:-2:> == r<:-1:>) + return r<:-3:>; + if (r<:-2:> && r<:-3:> == r<:-1:>) + return r<:-2:>; + } ``` This `e[1]` of course is the same as `*g` as above and as you can see has @@ -118,7 +118,7 @@ which I use as the two chars to compare (this is the plugboard function). at all. Why? In fact I call it like so: ``` - k = Z(r<:-1:>=k); + k = Z(r<:-1:>=k); ``` The char is just used as a way to be able to call the function and assign to @@ -133,7 +133,7 @@ refer to the same variable in more than one way (or in some cases maybe more correct to say 'same location'). In the Z() function for example: ``` - r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>; + r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>; ``` I refer to e[1] as both: *(e+1) and 1[e]. @@ -154,7 +154,7 @@ index (sort of). reflectors in one `char [][27]`. This makes for some fun code like: ``` - (Y<:e<:-10:>+5:><:k-'A':>) && (k = Y<:e<:-10:>+5:><:k-'A':>); + (Y<:e<:-10:>+5:><:k-'A':>) && (k = Y<:e<:-10:>+5:><:k-'A':>); ``` (Of course this also removes an if statement by joining with a &&). @@ -195,7 +195,7 @@ itself. But although I have quite a few cpp directives I am not using them for obfuscation but rather to save bytes. For examples: ``` - %:define J(x) do(*x)=getchar(); while((*x)=='\n') + %:define J(x) do(*x)=getchar(); while((*x)=='\n') ``` Is used quite a number of times and although it could be a function that @@ -206,7 +206,7 @@ particular I want to bring up though because I think it's a curious one and it ties in to another point above: ``` - %:define A(y) *(&Y<:7:><:1:>+(y)) + %:define A(y) *(&Y<:7:><:1:>+(y)) ``` What is special about this one: Above I noted how I sort of refer directly @@ -214,7 +214,7 @@ to the notch settings (I think it was the notch settings anyway). Now I could have done say ``` - char a = Y[7][1], b = Y[7][3], c = Y[7][5]; + char a = Y[7][1], b = Y[7][3], c = Y[7][5]; ``` But I felt that doing instead the pointer arithmetic was worth doing. @@ -249,9 +249,9 @@ variables in recode.c, move them to prog.c, compile and expect it to work right. * Also what is this about ? ``` - /\ - / This is *not* what you think: - void D(char*x){ /* ... */ } + /\ + / This is *not* what you think: + void D(char*x){ /* ... */ } ``` diff --git a/2020/ferguson2/recode.md b/2020/ferguson2/recode.md index 06e61c3b1..997399ebb 100644 --- a/2020/ferguson2/recode.md +++ b/2020/ferguson2/recode.md @@ -9,9 +9,9 @@ have to if you don't wish to.
- [What is recode and why is it recommended?](#recode) - [Options](#options) - * [Protecting against the same I/O file](#samefile) - * [File options parser limitation](#fileoptions) - * [`-R` option validation?](#validation) + * [Protecting against the same I/O file](#samefile) + * [File options parser limitation](#fileoptions) + * [`-R` option validation?](#validation) - [Piping commands to recode](#pipingtorecode) - [Piping recode to the Enigma simulator](#pipingtoenigma) - [Manually test the recode program with the Enigma program](#manuallytest) @@ -63,11 +63,11 @@ wonderful 'challenge' for everyone. ``` ./recode -h usage: ./recode [options] - -v display selected settings - -r pseudo-randomly select settings - -f read file for Enigma input - -R init settings from settings string or file - -o write settings to file + -v display selected settings + -r pseudo-randomly select settings + -f read file for Enigma input + -R init settings from settings string or file + -o write settings to file ``` diff --git a/README.md b/README.md index 7ca0d7b3a..58f69bc30 100644 --- a/README.md +++ b/README.md @@ -68,8 +68,8 @@ is lost when a program is written in an unstructured fashion. IOCCC winning ent help do this by what I call *satirical programming*. To see why, observe one of the definitions of *satire*: -> Keen or energetic activity of the mind used for the purpose -> of exposing and discrediting vice or folly. +> Keen or energetic activity of the mind used for the purpose +> of exposing and discrediting vice or folly. The authors of the winning entries placed a great deal of thought into their programs. These programs in turn exposed and discredited what I considered to diff --git a/archive/historic/README.md b/archive/historic/README.md index e662461c7..853ed8941 100644 --- a/archive/historic/README.md +++ b/archive/historic/README.md @@ -90,8 +90,8 @@ bzip2 compressed tarball files: ``` for year in 198{4,5,6,7,8,9} 199{0,1,2,3,4,5,6,8} 200{0,1,4,5,6} 201{1,2,3,4,5,8,9} 2020; do - rm -rf "$year" - tar -jxvf "archive-$year.tar.bz2" + rm -rf "$year" + tar -jxvf "archive-$year.tar.bz2" done ``` diff --git a/author/README.md b/author/README.md index 3916eef0e..7397be72e 100644 --- a/author/README.md +++ b/author/README.md @@ -138,9 +138,9 @@ For example: ``` "winning_entry_set" : [ - { "entry_id" : "1987_somedir" }, - { "entry_id" : "2020_entrydir" }, - { "entry_id" : "2024_dirname" } + { "entry_id" : "1987_somedir" }, + { "entry_id" : "2020_entrydir" }, + { "entry_id" : "2024_dirname" } ] ``` @@ -150,26 +150,26 @@ Here is a fictitious author_handle.json example: ``` { - "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", - "author_JSON_format_version" : "1.0 2023-06-10", - "author_handle" : "first0_last0", - "full_name" : "First Middle Last", - "sort_word" : "lowercaselast", - "location_code" : "AU", - "location_name" : "Australia", - "email" : "user0@example.com", - "url" : "https://a.host0.example.com/index.html", - "alt_url" : "https://b.host0.example.com/index.html", - "deprecated_twitter_handle" : "@something", - "mastodon" : "@mastodon0@example.com", - "mastodon_url" : "https://example.org/@mastodon0", - "github" : "@github0", - "affiliation" : "an affiliation group", - "winning_entry_set" : [ - { "entry_id" : "1987_somedir" }, - { "entry_id" : "2020_entrydir" }, - { "entry_id" : "2024_dirname" } - ] + "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", + "author_JSON_format_version" : "1.0 2023-06-10", + "author_handle" : "first0_last0", + "full_name" : "First Middle Last", + "sort_word" : "lowercaselast", + "location_code" : "AU", + "location_name" : "Australia", + "email" : "user0@example.com", + "url" : "https://a.host0.example.com/index.html", + "alt_url" : "https://b.host0.example.com/index.html", + "deprecated_twitter_handle" : "@something", + "mastodon" : "@mastodon0@example.com", + "mastodon_url" : "https://example.org/@mastodon0", + "github" : "@github0", + "affiliation" : "an affiliation group", + "winning_entry_set" : [ + { "entry_id" : "1987_somedir" }, + { "entry_id" : "2020_entrydir" }, + { "entry_id" : "2024_dirname" } + ] } ``` @@ -178,26 +178,26 @@ withheld are null: ``` { - "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", - "author_JSON_format_version" : "1.0 2023-06-10", - "author_handle" : "first0_last0", - "full_name" : "First Middle Last", - "sort_word" : "lowercaselast", - "location_code" : "AU", - "location_name" : "Australia", - "email" : null, - "url" : null, - "alt_url" : null, - "deprecated_twitter_handle" : null, - "mastodon" : null, - "mastodon_url" : null, - "github" : null, - "affiliation" : null, - "winning_entry_set" : [ - { "entry_id" : "1987_somedir" }, - { "entry_id" : "2020_entrydir" }, - { "entry_id" : "2024_dirname" } - ] + "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", + "author_JSON_format_version" : "1.0 2023-06-10", + "author_handle" : "first0_last0", + "full_name" : "First Middle Last", + "sort_word" : "lowercaselast", + "location_code" : "AU", + "location_name" : "Australia", + "email" : null, + "url" : null, + "alt_url" : null, + "deprecated_twitter_handle" : null, + "mastodon" : null, + "mastodon_url" : null, + "github" : null, + "affiliation" : null, + "winning_entry_set" : [ + { "entry_id" : "1987_somedir" }, + { "entry_id" : "2020_entrydir" }, + { "entry_id" : "2024_dirname" } + ] } ``` diff --git a/bin/README.md b/bin/README.md index b2babd78a..468108f30 100644 --- a/bin/README.md +++ b/bin/README.md @@ -37,7 +37,7 @@ see what is going on with the ``` - bin/quick-readme2index.sh -v 3 + bin/quick-readme2index.sh -v 3 ``` to set the verbosity level to `3`. The default for verbosity is `0`, no @@ -51,7 +51,7 @@ For instance to see what version the [chk-entry.sh](index.html#chk-entry) tool is, you would do: ``` - bin/chk-entry.sh -V + bin/chk-entry.sh -V ``` @@ -399,8 +399,8 @@ Baggins](https://www.glyphweb.com/arda/b/bilbobaggins.html)' famous words: ``` - "Never laugh at live dragons, Bilbo you fool!" he said to himself, and it - became a favourite saying of his later, and passed into a proverb. + "Never laugh at live dragons, Bilbo you fool!" he said to himself, and it + became a favourite saying of his later, and passed into a proverb. ``` @@ -480,11 +480,11 @@ this command will only briefly pause while the Usage: ``` - # For all entries: + # For all entries: bin/all-run.sh -v 3 bin/quick-readme2index.sh -v 1 - # For an individual entry: - bin/quick-readme2index.sh -v 1 2020/ferguson2 + # For an individual entry: + bin/quick-readme2index.sh -v 1 2020/ferguson2 ``` **NOTE**: This command assumes that the relative @@ -1222,22 +1222,22 @@ instance, [2020/.year](%%REPO_URL%%/2020/.year) lists, one directory per line, the directories of the winning entries of that year. For instance, for 2020: ``` - $ cat 2020/.year - 2020/burton - 2020/carlini - 2020/endoh1 - 2020/endoh2 - 2020/endoh3 - 2020/ferguson1 - 2020/ferguson2 - 2020/giles - 2020/kurdyukov1 - 2020/kurdyukov2 - 2020/kurdyukov3 - 2020/kurdyukov4 - 2020/otterness - 2020/tsoj - 2020/yang + $ cat 2020/.year + 2020/burton + 2020/carlini + 2020/endoh1 + 2020/endoh2 + 2020/endoh3 + 2020/ferguson1 + 2020/ferguson2 + 2020/giles + 2020/kurdyukov1 + 2020/kurdyukov2 + 2020/kurdyukov3 + 2020/kurdyukov4 + 2020/otterness + 2020/tsoj + 2020/yang ``` diff --git a/bugs.md b/bugs.md index 228791f96..88a5e6b2d 100644 --- a/bugs.md +++ b/bugs.md @@ -6,13 +6,13 @@ If you are going to try and fix any bugs **PLEASE READ THE NEXT SECTIONS _FIRST_ If however you want to jump to a specific year or you have already read the below and you wish to help with a year, you can use these links: -- [1984 entries](#1984) | [1985 entries](#1985) | [1986 entries](#1986) | [1987 entries](#1987) -- [1988 entries](#1988) | [1989 entries](#1989) | [1990 entries](#1990) | [1991 entries](#1991) -- [1992 entries](#1992) | [1993 entries](#1993) | [1994 entries](#1994) | [1995 entries](#1995) -- [1996 entries](#1996) | [1998 entries](#1998) | [2000 entries](#2000) | [2001 entries](#2001) -- [2004 entries](#2004) | [2005 entries](#2005) | [2006 entries](#2006) | [2011 entries](#2011) -- [2012 entries](#2012) | [2013 entries](#2013) | [2014 entries](#2014) | [2015 entries](#2015) -- [2018 entries](#2018) | [2019 entries](#2019) | [2020 entries](#2020) +- [1984 entries](#1984) | [1985 entries](#1985) | [1986 entries](#1986) | [1987 entries](#1987) +- [1988 entries](#1988) | [1989 entries](#1989) | [1990 entries](#1990) | [1991 entries](#1991) +- [1992 entries](#1992) | [1993 entries](#1993) | [1994 entries](#1994) | [1995 entries](#1995) +- [1996 entries](#1996) | [1998 entries](#1998) | [2000 entries](#2000) | [2001 entries](#2001) +- [2004 entries](#2004) | [2005 entries](#2005) | [2006 entries](#2006) | [2011 entries](#2011) +- [2012 entries](#2012) | [2013 entries](#2013) | [2014 entries](#2014) | [2015 entries](#2015) +- [2018 entries](#2018) | [2019 entries](#2019) | [2020 entries](#2020) ## PLEASE read the next sections if you wish to help @@ -138,8 +138,8 @@ warning in [1985/applin](%%REPO_URL%%/1985/applin/applin.c) with gcc: ``` applin.c:1:78: warning: incompatible implicit declaration of built-in function 'execlp' [-Wbuiltin-declaration-mismatch] - 1 | main(v,c)char**c;{for(v[c++]=strdup("Hello, world!\n");(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);} - | ^~~~~~ + 1 | main(v,c)char**c;{for(v[c++]=strdup("Hello, world!\n");(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);} + | ^~~~~~ ``` and this reminded him of his fix to @@ -475,7 +475,7 @@ code. In particular you should see something like: ``` $ ./decot - '",x); /* + '",x); /* \ ``` @@ -642,8 +642,8 @@ bounds by the int `gnat`. For instance: ``` Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000000000401335 in main (ABBA@entry=, tang@entry=, gnat@entry=, Near@entry=) - at ver2.c:23 - 23 &&gnat!({)Near,noon,/*krelc*/)<0&&(Near= - irk[-gnat--]-2)))&&main(ABBA, + at ver2.c:23 + 23 &&gnat!({)Near,noon,/*krelc*/)<0&&(Near= - irk[-gnat--]-2)))&&main(ABBA, (gdb) p gnat $1 = -518733305 ``` @@ -669,7 +669,7 @@ becomes the first and the first line becomes the last! Now if you look at the code you'll see on the first line: ``` - /**//*/};)/**/pain(*//**/tang ,gnat/**//*/,ABBA~,0-0(avnz;)0-0,tang,raeN + /**//*/};)/**/pain(*//**/tang ,gnat/**//*/,ABBA~,0-0(avnz;)0-0,tang,raeN ``` In `ver0` it'll be the same but the others are more interesting. @@ -677,13 +677,13 @@ In `ver0` it'll be the same but the others are more interesting. In `ver1` you'll see on the last line: ``` - cnva((vag)NOON&2/*//*\\**/,gnat,tang ,NOON/**//*/(niam/**/);}/*//**/ + cnva((vag)NOON&2/*//*\\**/,gnat,tang ,NOON/**//*/(niam/**/);}/*//**/ ``` and on the first line: ``` - /**//*/};)/**/cnva(*//**/gnat ,tang/**//*/,NOON~,0-0(niam;)0-0,gnat,enrA + /**//*/};)/**/cnva(*//**/gnat ,tang/**//*/,NOON~,0-0(niam;)0-0,gnat,enrA ``` Observe that the ROT13 of `pain` is `cnva` and the ROT13 of `main` is `znva`. @@ -1038,9 +1038,9 @@ lines of code are: ``` while ( ppp->qq==48 ) { - printf("%ld\n",qqq-45); - *pp = ppp; - ppp = ppp->p; + printf("%ld\n",qqq-45); + *pp = ppp; + ppp = ppp->p; } ``` @@ -1129,34 +1129,34 @@ like: lush.c: In function 'main': lush.c:40: warning: "f" redefined 40 | main - | + | lush.c:1: note: this is the location of the previous definition - 1 | #define gets(_) fgets((_),999,stdin) - | + 1 | #define gets(_) fgets((_),999,stdin) + | lush.c:42: warning: "f" redefined 42 | #define f 001: - | + | lush.c:40: note: this is the location of the previous definition 40 | main - | + | lush.c:44: warning: "f" redefined 44 | #define f 100: - | + | lush.c:42: note: this is the location of the previous definition 42 | #define f 001: - | + | lush.c:45: warning: "f" redefined 45 | _[i-- - | + | lush.c:44: note: this is the location of the previous definition 44 | #define f 100: - | + | lush.c:46: warning: "f" redefined 46 | #define f 126: - | + | lush.c:45: note: this is the location of the previous definition 45 | _[i-- - | + | ``` Now one can use `sed` to get the `warning:` line correct but there is more to it @@ -1165,16 +1165,16 @@ than that. For instance this is what it looks like with clang: ``` lush.c:40:9: warning: 'f' macro redefined [-Wmacro-redefined] #define f 001: - ^ + ^ lush.c:1:9: note: previous definition is here #define f 000: - ^ + ^ lush.c:42:9: warning: 'f' macro redefined [-Wmacro-redefined] #define f 100: - ^ + ^ lush.c:40:9: note: previous definition is here #define f 001: - ^ + ^ ``` As you might see the part under the `warning:` line is different. @@ -1973,22 +1973,22 @@ Anyway: #include int main(void) { - printf("#!/usr/bin/env perl\nuse warnings;_:$_= <> ; defined or exit; @ARGV" - "=split; __:$_= shift;defined or goto _; chomp " - ";(m*^\\x70oO" "\\x74$*i)?(pri" "nt \"$_ w\\x" - "61s h\\145r\\x" "65!\\n\"):((m*" "^\\s\\*(-?\\d+" - "(\\.\\d+)?)\\s" "\\*$*)?(push@SS ,$1):(&{chr(((o" - "rd)%%39)+3**4)x2 } )); goto __; sub ff { @SS= (" - ")} sub __{print \"stack empty\\" "n\"} sub ss{$#" - "SS<0 and goto & __; print $SS[$" "#SS].\"\\n\"} " - "sub SS{ $#SS<0 and goto &__ ; print pop @SS}" - "sub _ { print \"divide by zer" "o\\n\"}sub ii{" - "map{ print\"$_" "\\n\" } reverse @SS} sub AUTOLO" - "AD { print\"un" "implemented\\n" "\"} sub gg{ $#" - "SS<0 and goto &__;push@SS,$SS[ $#SS]} sub uu{ " - "$#SS<1 and goto &__;$SS[ $#SS]+= $SS[$#SS-1];$SS" - "[$#SS-1]=$SS[$" "#SS]-$SS[$#SS-" "1]; $SS[$#SS]-" - "=$SS[$#SS-1]}"); + printf("#!/usr/bin/env perl\nuse warnings;_:$_= <> ; defined or exit; @ARGV" + "=split; __:$_= shift;defined or goto _; chomp " + ";(m*^\\x70oO" "\\x74$*i)?(pri" "nt \"$_ w\\x" + "61s h\\145r\\x" "65!\\n\"):((m*" "^\\s\\*(-?\\d+" + "(\\.\\d+)?)\\s" "\\*$*)?(push@SS ,$1):(&{chr(((o" + "rd)%%39)+3**4)x2 } )); goto __; sub ff { @SS= (" + ")} sub __{print \"stack empty\\" "n\"} sub ss{$#" + "SS<0 and goto & __; print $SS[$" "#SS].\"\\n\"} " + "sub SS{ $#SS<0 and goto &__ ; print pop @SS}" + "sub _ { print \"divide by zer" "o\\n\"}sub ii{" + "map{ print\"$_" "\\n\" } reverse @SS} sub AUTOLO" + "AD { print\"un" "implemented\\n" "\"} sub gg{ $#" + "SS<0 and goto &__;push@SS,$SS[ $#SS]} sub uu{ " + "$#SS<1 and goto &__;$SS[ $#SS]+= $SS[$#SS-1];$SS" + "[$#SS-1]=$SS[$" "#SS]-$SS[$#SS-" "1]; $SS[$#SS]-" + "=$SS[$#SS-1]}"); } ``` @@ -2536,8 +2536,8 @@ When trying to link `gavin.o` to produce `sh`, the linker generates: ``` Undefined symbols for architecture arm64: "start", referenced from: - -u command line option - (maybe you meant: __start) + -u command line option + (maybe you meant: __start) ld: symbol(s) not found for architecture arm64 ``` @@ -2585,36 +2585,36 @@ The original Makefile from 2004 had the following to say about this entry: # GAVIN_OPT= -O1 GAVIN_FLAGS=\ - '-DY(m)=*((int*)(m))'\ - '-DE(f,a,b,c)=((G((*)))(f))(a,b,c)'\ - '-DM=for(D=0;D<786432;D++)'\ - '-DZ=int i=0,j=0,h,n,p=393728,s=26739,C,D'\ - '-DV=0x90200'\ - '-DK=0'\ - '-DR=while((C=E(V-8,100,0,0))&3&&(D=E(V-8,96,0,0))|3){'\ - '-DL(c,d)=E(V+8,100,c,0);R}E(V+8,96,d,0);R}' + '-DY(m)=*((int*)(m))'\ + '-DE(f,a,b,c)=((G((*)))(f))(a,b,c)'\ + '-DM=for(D=0;D<786432;D++)'\ + '-DZ=int i=0,j=0,h,n,p=393728,s=26739,C,D'\ + '-DV=0x90200'\ + '-DK=0'\ + '-DR=while((C=E(V-8,100,0,0))&3&&(D=E(V-8,96,0,0))|3){'\ + '-DL(c,d)=E(V+8,100,c,0);R}E(V+8,96,d,0);R}' # ... # Best of Show # gavin: gavin.c - ${CC} ${GAVIN_OPT} -o gavin ${GAVIN_FLAGS} gavin.c - ${RM} -f kernel - ./gavin > kernel - ${CC} ${GAVIN_OPT} -c ${GAVIN_FLAGS} -DB=_start '-Dputchar(a)=' gavin.c - ${RM} -f sh - ${LD} -s -o sh gavin.o - ${RM} -f vi - ${CP} sh vi - ${RM} -f fs.tar - ${TAR} -cvf fs.tar sh vi gavin.c index.html prim + ${CC} ${GAVIN_OPT} -o gavin ${GAVIN_FLAGS} gavin.c + ${RM} -f kernel + ./gavin > kernel + ${CC} ${GAVIN_OPT} -c ${GAVIN_FLAGS} -DB=_start '-Dputchar(a)=' gavin.c + ${RM} -f sh + ${LD} -s -o sh gavin.o + ${RM} -f vi + ${CP} sh vi + ${RM} -f fs.tar + ${TAR} -cvf fs.tar sh vi gavin.c index.html prim gavin_clean: - ${RM} -f sh vi kernel gavin.o + ${RM} -f sh vi kernel gavin.o gavin_clobber: gavin_clean - ${RM} -f gavin fs.tar + ${RM} -f gavin fs.tar gavin_files: boot.b lilo.conf prim gavin_install.txt ``` @@ -3144,9 +3144,9 @@ Under macOS (with the arm64 chip) we get: UndefinedBehaviorSanitizer:DEADLYSIGNAL ==10834==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0xffffffffffffffff (pc 0x00019f446748 bp 0x00016f353100 sp 0x00016f352b90 T139066) ==10834==The signal is caused by a WRITE memory access. - #0 0x19f446748 in _platform_memmove+0xa8 (libsystem_platform.dylib:arm64e+0x3748) (BuildId: 756cd10d62a032839e57cbaa810c95ac32000000200000000100000000030d00) - #1 0x100c33c2c in main richards.c:202 - #2 0x19f0bff24 () + #0 0x19f446748 in _platform_memmove+0xa8 (libsystem_platform.dylib:arm64e+0x3748) (BuildId: 756cd10d62a032839e57cbaa810c95ac32000000200000000100000000030d00) + #1 0x100c33c2c in main richards.c:202 + #2 0x19f0bff24 () ==10834==Register values: x[0] = 0xffffffffffffffff x[1] = 0x0000000100ab18c1 x[2] = 0x00000000000000cf x[3] = 0x0000000000000000 @@ -3174,20 +3174,20 @@ Now with `address` sanitiser both linux and macOS crash at: ================================================================= ==10983==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x00016f8d5e78 at pc 0x0001005dd910 bp 0x00016f8d5cd0 sp 0x00016f8d5cc8 READ of size 8 at 0x00016f8d5e78 thread T0 - #0 0x1005dd90c in rd richards.c:132 - #1 0x1005ddf8c in re richards.c:149 - #2 0x1005110a0 in t richards.c:108 - #3 0x1005df72c in main richards.c:189 - #4 0x19f0bff24 () + #0 0x1005dd90c in rd richards.c:132 + #1 0x1005ddf8c in re richards.c:149 + #2 0x1005110a0 in t richards.c:108 + #3 0x1005df72c in main richards.c:189 + #4 0x19f0bff24 () Address 0x00016f8d5e78 is located in stack of thread T0 at offset 56 in frame - #0 0x1005dd678 in rd richards.c:129 + #0 0x1005dd678 in rd richards.c:129 This frame has 2 object(s): - [32, 36) 'v.addr' - [48, 56) 'a' (line 130) <== Memory access at offset 56 overflows this variable + [32, 36) 'v.addr' + [48, 56) 'a' (line 130) <== Memory access at offset 56 overflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork - (longjmp and C++ exceptions *are* supported) + (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-overflow richards.c:132 in rd Shadow bytes around the buggy address: 0x00702df3ab70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 @@ -3229,9 +3229,9 @@ which corresponds to the code: ``` o rd(u v) { - o *a = 0, **b = &a, **c = b + 32; - x[v] = w; - for (; b < c && (*b < (o *)w || *b > (o *) T || *b == &v); b++); /* LINE 132 */ + o *a = 0, **b = &a, **c = b + 32; + x[v] = w; + for (; b < c && (*b < (o *)w || *b > (o *) T || *b == &v); b++); /* LINE 132 */ ``` but this seems to not necessarily be relevant since without it it works in @@ -3247,19 +3247,19 @@ A warning of interest when compiling is: richards.c:170:15: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'o ()' (aka 'void ()') [-Wincompatible-pointer-types] f *lib2[] = { T, ld, lp, lx, l1 } ; - ^ + ^ richards.c:170:18: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types] f *lib2[] = { T, ld, lp, lx, l1 } ; - ^~ + ^~ richards.c:170:22: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types] f *lib2[] = { T, ld, lp, lx, l1 } ; - ^~ + ^~ richards.c:170:26: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types] f *lib2[] = { T, ld, lp, lx, l1 } ; - ^~ + ^~ richards.c:170:30: warning: incompatible pointer types initializing 'f *' (aka 'void (**)(volatile void *)') with an expression of type 'void (volatile dt)' (aka 'void (struct (unnamed at richards.c:36:3) *volatile)') [-Wincompatible-pointer-types] f *lib2[] = { T, ld, lp, lx, l1 } ; - ^~ + ^~ ``` This can be fixed easily enough however but it doesn't appear to matter in this @@ -3409,14 +3409,14 @@ The author stated: if the interpreter reaches end-of-file during program parsing, it will crash in some way. E.g. the following might dump core: - echo -n "U" | ./tromp + echo -n "U" | ./tromp Furthermore, the interpreter requires the initial encoded lambda term to be closed, that is, variable n can only appear within at least 'n' enclosing lambdas. For instance, here the term '\ 5' is not closed, causing the interpreter to crash when looking into a null-pointer environment: - echo ">Hello, world" | ./tromp + echo ">Hello, world" | ./tromp will likely dump core. ``` @@ -3848,7 +3848,7 @@ likely see: ``` >bootT5pw - ]h_ 8D3[] + ]h_ 8D3[] ``` where `[]` is the cursor. When this happens if you hit enter (this is necessary diff --git a/faq.md b/faq.md index cf66891fa..367d654cb 100644 --- a/faq.md +++ b/faq.md @@ -392,14 +392,14 @@ may copy `prog.c` to a different filename as part of the compiling/building proc all: desired_name desired_name: desired_name.c - cc desired_name.c -o $@ + cc desired_name.c -o $@ desired_name.c: prog.c - rm -f $@ - cp -f prog.c $@ + rm -f $@ + cp -f prog.c $@ clobber: - rm -f desired_name.c desired_name + rm -f desired_name.c desired_name ``` We recommend that the `make clobber` rule remove files that your entry @@ -410,8 +410,8 @@ For example: ``` different_name: prog - rm -f $@ - cp -f prog $@ + rm -f $@ + cp -f prog $@ ``` @@ -2225,11 +2225,11 @@ _Secondary files_ list. These tarballs will have the following files: -- `ioccc.css` - stylesheet for the html files -- `var.mk` - the top level Makefile included by all the other Makefiles that holds variables used by the Makefiles -- `YYYY/winner/.path` - directory path from top level directory -- `YYYY/winner/.entry.json` - entry summary and manifest in JSON -- `YYYY/winner/.gitignore` - list of files that should not be committed under git +- `ioccc.css` - stylesheet for the html files +- `var.mk` - the top level Makefile included by all the other Makefiles that holds variables used by the Makefiles +- `YYYY/winner/.path` - directory path from top level directory +- `YYYY/winner/.entry.json` - entry summary and manifest in JSON +- `YYYY/winner/.gitignore` - list of files that should not be committed under git plus the winning entry files like source code, the Makefile, supplementary data provided by the author and any other file in the winning entry, found under the @@ -2239,9 +2239,9 @@ If you downloaded `1984/mullender/1984_mullender.tar.bz2`, for instance, you mig then do: ```sh - cd 1984/mullender - make everything - ./mullender.alt + cd 1984/mullender + make everything + ./mullender.alt ``` to compile all versions and then run the alternate version (if you have @@ -2267,21 +2267,21 @@ These tarballs have, along with each entry's directory and their respective files (as if you downloaded each entry tarball of the year individually as described above), the following files: -- `.filelist` - list of files in the year that are not part of a winning entry of the year, including the `YYYY.tar.bz2` tarball -- `index.html` - the `YYYY/index.html` file rendered from the `YYYY/README.md` file -- `Makefile` - Makefile for the year to compile etc. all entries of the year -- `README.md` - the source of the `YYYY/index.html` file -- `rules.txt` - rules of the year's contest -- `.year` - text file that has a list of the winning entries' directories of the year +- `.filelist` - list of files in the year that are not part of a winning entry of the year, including the `YYYY.tar.bz2` tarball +- `index.html` - the `YYYY/index.html` file rendered from the `YYYY/README.md` file +- `Makefile` - Makefile for the year to compile etc. all entries of the year +- `README.md` - the source of the `YYYY/index.html` file +- `rules.txt` - rules of the year's contest +- `.year` - text file that has a list of the winning entries' directories of the year Additionally, some will have extra files like: -- `.gitignore` - list of files that should not be committed under git -- `guidelines.txt` - the guidelines of the year -- `iocccsize.c` - `iocccsize` tool of the year -- `iocccsize.mk` - Makefile to compile the `iocccsize` tool of the year -- `iocccsize-test.sh` - test suite for the `iocccsize` tool +- `.gitignore` - list of files that should not be committed under git +- `guidelines.txt` - the guidelines of the year +- `iocccsize.c` - `iocccsize` tool of the year +- `iocccsize.mk` - Makefile to compile the `iocccsize` tool of the year +- `iocccsize-test.sh` - test suite for the `iocccsize` tool .. and perhaps some others we have neglected to mention as well. @@ -2294,8 +2294,8 @@ extract it and then switch to the directory and compile everything of each entry: ```sh - cd 1984 - make everything + cd 1984 + make everything ``` For more help on compiling entries, see also [3.0 - What Makefile rules are @@ -2831,8 +2831,8 @@ are: [1995/heathbar/index.html](1995/heathbar/index.html) and procedure was done: ``` - touch 1995/heathbar/README.md 1995/makarios/README.md - make quick_www + touch 1995/heathbar/README.md 1995/makarios/README.md + make quick_www ``` That works because the `quick_www` rule will update the `authors.html` and @@ -3139,40 +3139,40 @@ As of _Thu Nov 30 23:51:12 UTC 2023_, the contents was as follows: ``` { - "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", - "author_JSON_format_version" : "1.0 2023-06-10", - "author_handle" : "Yusuke_Endoh", - "full_name" : "Yusuke Endoh", - "sort_word" : "endoh", - "location_code" : "JP", - "email" : "mame@ruby-lang.org", - "url" : "https://mametter.hatenablog.com", - "alt_url" : null, - "deprecated_twitter_handle" : null, - "mastodon" : "@mame@ruby.social", - "mastodon_url" : "https://ruby.social/@mame", - "github" : "@mame", - "affiliation" : null, - "winning_entry_set" : [ - { "entry_id" : "2012_endoh1" }, - { "entry_id" : "2012_endoh2" }, - { "entry_id" : "2013_endoh1" }, - { "entry_id" : "2013_endoh2" }, - { "entry_id" : "2013_endoh3" }, - { "entry_id" : "2013_endoh4" }, - { "entry_id" : "2014_endoh1" }, - { "entry_id" : "2014_endoh2" }, - { "entry_id" : "2015_endoh1" }, - { "entry_id" : "2015_endoh2" }, - { "entry_id" : "2015_endoh3" }, - { "entry_id" : "2015_endoh4" }, - { "entry_id" : "2018_endoh1" }, - { "entry_id" : "2018_endoh2" }, - { "entry_id" : "2019_endoh" }, - { "entry_id" : "2020_endoh1" }, - { "entry_id" : "2020_endoh2" }, - { "entry_id" : "2020_endoh3" } - ] + "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", + "author_JSON_format_version" : "1.0 2023-06-10", + "author_handle" : "Yusuke_Endoh", + "full_name" : "Yusuke Endoh", + "sort_word" : "endoh", + "location_code" : "JP", + "email" : "mame@ruby-lang.org", + "url" : "https://mametter.hatenablog.com", + "alt_url" : null, + "deprecated_twitter_handle" : null, + "mastodon" : "@mame@ruby.social", + "mastodon_url" : "https://ruby.social/@mame", + "github" : "@mame", + "affiliation" : null, + "winning_entry_set" : [ + { "entry_id" : "2012_endoh1" }, + { "entry_id" : "2012_endoh2" }, + { "entry_id" : "2013_endoh1" }, + { "entry_id" : "2013_endoh2" }, + { "entry_id" : "2013_endoh3" }, + { "entry_id" : "2013_endoh4" }, + { "entry_id" : "2014_endoh1" }, + { "entry_id" : "2014_endoh2" }, + { "entry_id" : "2015_endoh1" }, + { "entry_id" : "2015_endoh2" }, + { "entry_id" : "2015_endoh3" }, + { "entry_id" : "2015_endoh4" }, + { "entry_id" : "2018_endoh1" }, + { "entry_id" : "2018_endoh2" }, + { "entry_id" : "2019_endoh" }, + { "entry_id" : "2020_endoh1" }, + { "entry_id" : "2020_endoh2" }, + { "entry_id" : "2020_endoh3" } + ] } ``` @@ -3196,7 +3196,7 @@ make it easier you can do `make install` so you can run the tool from any path but in any case the syntax is: ``` - jparse foo.json + jparse foo.json ``` If the tool exits 0 (and shows no output) then the JSON is valid. If it is @@ -3204,7 +3204,7 @@ invalid you should get an error but for more details you can increase the verbosity with the `-v` flag like: ``` - jparse -v 3 foo.json + jparse -v 3 foo.json ``` If the tool is not installed then you will obviously have to specify the path of @@ -3213,7 +3213,7 @@ the tool. If you wish to validate every JSON file in `author/` then you could do so like: ``` - for auth in *.json; do jparse 2>/dev/null "$auth" || echo "$auth is invalid JSON" ; done + for auth in *.json; do jparse 2>/dev/null "$auth" || echo "$auth is invalid JSON" ; done ``` If you see any output then it will say which file or files are invalid JSON @@ -3606,9 +3606,9 @@ NOTE: The _JSON null_ is **NOT** enclosed in quotes! "winning_entry_set" : [ { "entry_id" : "2012_endoh1" }, { "entry_id" : "2012_endoh2" }, - { "entry_id" : "2013_endoh1" }, + { "entry_id" : "2013_endoh1" }, ... - { "entry_id" : "2020_endoh1" }, + { "entry_id" : "2020_endoh1" }, { "entry_id" : "2020_endoh2" }, { "entry_id" : "2020_endoh3" } ] @@ -3939,7 +3939,7 @@ This might show: remote: https://github.com/xexyl/winner/pull/new/human-snakes remote: To github.com:xexyl/winner.git - * [new branch] human-snakes -> human-snakes + * [new branch] human-snakes -> human-snakes branch 'human-snakes' set up to track 'origin/human-snakes'. ``` @@ -4177,7 +4177,7 @@ If JavaScript is disabled on any mobile device, tablet or phone, you should see the words: ``` - Please Enable JavaScript + Please Enable JavaScript ``` at the top right corner; clicking on this will take you to the [no JavaScript diff --git a/markdown.md b/markdown.md index d9496de6d..44bb56bb2 100644 --- a/markdown.md +++ b/markdown.md @@ -119,7 +119,7 @@ Please do **NOT** start code blocks at the left-hand edge. ```` ``` -This code block is NOT indented <=== no thank you +This code block is NOT indented <=== no thank you ``` ```` @@ -161,7 +161,7 @@ For example: ```` ``` - Please do **NOT** indent with ASCII tabs. <=== no thank you + Please do **NOT** indent with ASCII tabs. <=== no thank you The top level starts with a 4 ASCII space indent. @@ -180,7 +180,7 @@ We request that (fenced) markdown code blocks **NOT** specify a language. For example: ```` -```c <=== no thank you +```c <=== no thank you int main(void) {return 0;} ``` ```` diff --git a/next/guidelines.md b/next/guidelines.md index a062d1291..1660b0171 100644 --- a/next/guidelines.md +++ b/next/guidelines.md @@ -421,7 +421,7 @@ Therefore do not assume the system has a [windows.h](https://en.wikipedia.org/wiki/Windows.h) include file: ``` - #include /* we dislike this include */ + #include /* we dislike this include */ ``` Unless you are cramped for space, or unless you are entering the @@ -467,9 +467,9 @@ Don't forget that the building of your program should be done ``` prog: prog.c - #echo this next line requires data from standard input - cat > prog.c - ${CC} prog.c -o prog + #echo this next line requires data from standard input + cat > prog.c + ${CC} prog.c -o prog ``` However, you can do something cute such as making your program @@ -479,8 +479,8 @@ For example, one could use the build instructions: ``` prog: prog.c - ${CC} prog.c -DNON_HUMAN_COMPILE -o prog - @echo "See remarks section about alternate ways to compile" + ${CC} prog.c -DNON_HUMAN_COMPILE -o prog + @echo "See remarks section about alternate ways to compile" ``` and then include special notes in the program "remarks" for @@ -642,9 +642,9 @@ Instead of unescaped octets, you should use \octal or \hex escapes: ``` - /* 123456789 123456789 123456789 123456 */ + /* 123456789 123456789 123456789 123456 */ char *foo = "This string is 36 octets in length \263"; - /* This octet requires 4 octets of source ^^^^ */ + /* This octet requires 4 octets of source ^^^^ */ if (strlen(foo) == 36) printf("foo is 36 octets plus a final NUL\n"); else printf("This code should not print this message\n"); ``` @@ -707,7 +707,7 @@ to your "how to build" make compile line. For example: ``` prog: prog.c - ${CC} prog.c -arch i386 -o prog + ${CC} prog.c -arch i386 -o prog ``` Be even more creative! diff --git a/thanks-for-help.md b/thanks-for-help.md index 4da1a658c..a5bcfd28a 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -14,13 +14,13 @@ on an IOCCC entry by entry basis. ## IOCCC thank you table of contents -- [1984 entries](#1984) | [1985 entries](#1985) | [1986 entries](#1986) | [1987 entries](#1987) -- [1988 entries](#1988) | [1989 entries](#1989) | [1990 entries](#1990) | [1991 entries](#1991) -- [1992 entries](#1992) | [1993 entries](#1993) | [1994 entries](#1994) | [1995 entries](#1995) -- [1996 entries](#1996) | [1998 entries](#1998) | [2000 entries](#2000) | [2001 entries](#2001) -- [2004 entries](#2004) | [2005 entries](#2005) | [2006 entries](#2006) | [2011 entries](#2011) -- [2012 entries](#2012) | [2013 entries](#2013) | [2014 entries](#2014) | [2015 entries](#2015) -- [2018 entries](#2018) | [2019 entries](#2019) | [2020 entries](#2020) +- [1984 entries](#1984) | [1985 entries](#1985) | [1986 entries](#1986) | [1987 entries](#1987) +- [1988 entries](#1988) | [1989 entries](#1989) | [1990 entries](#1990) | [1991 entries](#1991) +- [1992 entries](#1992) | [1993 entries](#1993) | [1994 entries](#1994) | [1995 entries](#1995) +- [1996 entries](#1996) | [1998 entries](#1998) | [2000 entries](#2000) | [2001 entries](#2001) +- [2004 entries](#2004) | [2005 entries](#2005) | [2006 entries](#2006) | [2011 entries](#2011) +- [2012 entries](#2012) | [2013 entries](#2013) | [2014 entries](#2014) | [2015 entries](#2015) +- [2018 entries](#2018) | [2019 entries](#2019) | [2020 entries](#2020) - [General thanks](#general_thanks) - [Makefiles fixes and improvements](#makefiles_fixes_improvements) - [Consistency improvements](#consistency_improvements) @@ -98,7 +98,7 @@ be kept in: ``` #define char k['a'] char x {sizeof( - double(%s,%D)(*)()) + double(%s,%D)(*)()) ``` This does mean that there cannot be a second arg to `main()` @@ -138,7 +138,7 @@ Cody later discovered that the `make alt` rule does not work as the To see the diff between the original and the alternate code, try: ``` - cd 1984/decot ; make diff_orig_alt + cd 1984/decot ; make diff_orig_alt ``` @@ -295,9 +295,9 @@ were actually not what they appear: the only arg that existed in `main()` was ``` main( - /* C program. (If you don't - * understand it look it - * up.) (In the C*/ Manual) + /* C program. (If you don't + * understand it look it + * up.) (In the C*/ Manual) { ``` @@ -469,7 +469,7 @@ which gave: ``` marshall.alt.c:13:55: warning: ordered comparison between pointer and integer ('char' and 'char *') P ( a ) char a ; { a ; while( a > " B " - ~ ^ ~~~~~~~~ + ~ ^ ~~~~~~~~ 1 warning generated. ``` @@ -484,7 +484,7 @@ which gave: ``` marshall.alt.c:13:48: warning: cast to 'char *' from smaller integer type 'char' [-Wint-to-pointer-cast] P ( a ) char a ; { a ; while((char *)a > " B " - ^~~~~~~~~ + ^~~~~~~~~ 1 warning generated. ``` @@ -959,7 +959,7 @@ might end up failing to work even after changing it back. This was resolved by: --- i/1989/fubar/fubar.sh +++ w/1989/fubar/fubar.sh @@ -7,13 +7,12 @@ if [[ $# -ne 1 ]]; then - exit 1 + exit 1 fi # run/compile it @@ -1750,7 +1750,7 @@ should have been removed.
[Cody](#cody) fixed the code so that it will try opening the file the code was compiled -from (`__FILE__`), not `adgrep.c`, as the latter does not exist: `adgrep` is +from (`__FILE__`), not `adgrep.c`, as the latter does not exist: `adgrep` is simply a link to `adrian` as `adgrep` is what the program was submitted as but the entry's winning source file is `adrian.c`. @@ -3243,17 +3243,17 @@ changed. As was noted in the log at the time: program that uses SDL1 has to have the same args as their definition. This program had 'main()' so the error message was: - thadgavin.c:60:1: error: conflicting types for 'SDL_main' - main() - ^ - /opt/local/include/SDL/SDL_main.h:34:14: note: expanded from macro 'main' - #define main SDL_main - ^ - /opt/local/include/SDL/SDL_main.h:35:12: note: previous declaration is here - extern int SDL_main(int argc, char *argv[]); - ^ - 1 warning and 1 error generated. - make: *** [thadgavin_sdl] Error 1 + thadgavin.c:60:1: error: conflicting types for 'SDL_main' + main() + ^ + /opt/local/include/SDL/SDL_main.h:34:14: note: expanded from macro 'main' + #define main SDL_main + ^ + /opt/local/include/SDL/SDL_main.h:35:12: note: previous declaration is here + extern int SDL_main(int argc, char *argv[]); + ^ + 1 warning and 1 error generated. + make: *** [thadgavin_sdl] Error 1 Thus main() was changed to 'int main(int argc, char **argv)'. ``` @@ -3445,10 +3445,10 @@ support implicit int: ``` coupard.c:31:10: error: parameter 'h' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] void e(n,h){ - ^ + ^ coupard.c:31:8: error: parameter 'n' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] void e(n,h){ - ^ + ^ ``` and for some reason it was being reported as an error. @@ -3734,18 +3734,18 @@ this ended up with a number of errors like: ``` jdalbec.c:64:5: error: stray '##' in program 64 | B N##B (I) ; \ - | ^~ + | ^~ .. jdalbec.c:65:5: error: stray '##' in program 65 | V F##B (B) ; \ - | ^~ + | ^~ jdalbec.c:65:5: error: expected ';' before 'B' 65 | V F##B (B) ; \ - | ^ ~ - | ; + | ^ ~ + | ; ``` and various other problems. However there does seem to be a problem at least @@ -3842,24 +3842,24 @@ BSD?) the code failed to compile at all in Linux due to: ``` cc -E vik2_1.c > vik2_2.c In file included from vik2.c:945, - from vik2.c:959, - from vik2.c:972, - from vik2.c:1025: + from vik2.c:959, + from vik2.c:972, + from vik2.c:1025: vik2.c:383:8: error: no macro name given in #ifdef directive 383 | O \ - | ^ + | ^ In file included from vik2.c:946: vik2.c:383:8: error: no macro name given in #ifdef directive 383 | O \ - | ^ + | ^ In file included from vik2.c:947: vik2.c:383:8: error: no macro name given in #ifdef directive 383 | O \ - | ^ + | ^ In file included from vik2.c:948: vik2.c:383:8: error: no macro name given in #ifdef directive 383 | O \ - | ^ + | ^ ... @@ -3867,7 +3867,7 @@ BSD?) the code failed to compile at all in Linux due to: vik2.c:992:85: error: #include nested depth 201 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum) 992 | I - | ^ + | ^ vik2.c:1497:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum) vik2.c:1498:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum) vik2.c:1499:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum) @@ -4049,8 +4049,8 @@ unknown escape sequence, `\N`, which caused a funny compiler error: };n b[2048];int i mikeash.c: In function 'R': mikeash.c:7:1: error: '\N' not followed by '{' - 7 | ;C!='\n';A() - | ^ + 7 | ;C!='\n';A() + | ^ mikeash.c:7:1: error: incomplete universal character name \Ne ``` @@ -4981,8 +4981,8 @@ program to be used. Thus the `Makefile` rule looks like: ``` ${PROG}: ${PROG}.c - ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} - ./${PROG} | ${CC} ${CFLAGS} -xc - -o $@ ${LDFLAGS} + ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} + ./${PROG} | ${CC} ${CFLAGS} -xc - -o $@ ${LDFLAGS} ``` diff --git a/tmp/OLD_manifest/README.md b/tmp/OLD_manifest/README.md index a51b2d9bb..42db7d904 100644 --- a/tmp/OLD_manifest/README.md +++ b/tmp/OLD_manifest/README.md @@ -489,10 +489,10 @@ following fields: This field indicates if the file main program. This filed is one of: - main The main source code to display. - alt The alternative source code. - orig The original version of the source code (may be the same as main). - null Not a primary, nor alternative, nor original source code file. + main The main source code to display. + alt The alternative source code. + orig The original version of the source code (may be the same as main). + null Not a primary, nor alternative, nor original source code file. 7. filetype: @@ -516,14 +516,14 @@ following fields: A string indicating how the file is to be displayed from `winners.html`. Possible files include: - browser The file is to be displayed directly from the browser. - github The file should be linked to the GitHub repo so that - it may be rendered directly by GitHub. In the future - this may changed to allow a suitable browser to - directly display this file instead of via GitHub. - download The file is intended to be downloaded from the browser - instead of being displayed. - null This file not listed in `winners.html`. + browser The file is to be displayed directly from the browser. + github The file should be linked to the GitHub repo so that + it may be rendered directly by GitHub. In the future + this may changed to allow a suitable browser to + directly display this file instead of via GitHub. + download The file is intended to be downloaded from the browser + instead of being displayed. + null This file not listed in `winners.html`. NOTE: When display_via is null, winners_show MUST be false.