From 44f311c91c6353b58d3015c7248a61254a307f0f Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 22 Nov 2023 05:00:20 -0800 Subject: [PATCH 1/9] Slight clarification in 1985/lycklama I believe that entries that alt versions are recommended to try first should say what it looks like in modern systems so much as what it looked like with systems of the time it was published. Other entries with this have to be located as well so I've put it in the todo.md file too. --- 1985/lycklama/README.md | 6 +++--- todo.md | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/1985/lycklama/README.md b/1985/lycklama/README.md index 61b3d8e32..984b319fd 100644 --- a/1985/lycklama/README.md +++ b/1985/lycklama/README.md @@ -18,9 +18,9 @@ see below and the [original code](#original-code) section. ### Try: This alternate version, which we recommend you you try first, prior to the -original, so that you can see what it does in modern systems, slows down the -output which will provide more fun output. It is slowed down by the `usleep(3)` -library call with a configurable time to sleep. The default is 500 but you can +original, so that you can see what it did back in 1985, slows down the output +which will provide more fun output. It is slowed down by the `usleep(3)` library +call with a configurable time to sleep. The default is 500 but you can reconfigure it like: diff --git a/todo.md b/todo.md index 0438d0d07..70d4ece3c 100644 --- a/todo.md +++ b/todo.md @@ -1,5 +1,5 @@ # A todo list of known things to check and/or do -*Last updated: Thu 16 Nov 2023 11:20:54 UTC** +*Last updated: Wed 22 Nov 2023 13:02:04 UTC* This document is primarily for [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) as he (that is I :-) ) wanted a way @@ -152,3 +152,8 @@ that it might be that `S` will work in all cases (currently?) though one has two values so the second would could be changed to `SS` (which is convenient as it's for SDL). This is low priority but it would be nice to have done as it would make it consistent and easy to remember. + +- With the entries that we recommend the alt code first when it comes to it +going too fast we should say not what it looks like in modern systems but rather +what it LOOKED LIKE AT THE TIME. At Wed 22 Nov 2023 13:02:04 UTC the only entry +that has had this done is [1985/lycklama](1985/lycklama/README.md). From 499bb21fc7175b69a5097bddc3c28b3a314a6aed Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 22 Nov 2023 05:05:57 -0800 Subject: [PATCH 2/9] Add missing line break in 1994/dodsond2/README.md --- 1994/dodsond2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/1994/dodsond2/README.md b/1994/dodsond2/README.md index 1284155da..a05a34cf0 100644 --- a/1994/dodsond2/README.md +++ b/1994/dodsond2/README.md @@ -45,6 +45,7 @@ say to 5, try: make clobber CDEFINE="-DW=5" alt ``` + ### Alternate use: ```sh From a42fc7e12aff8e5f3f27ba7b6532355410c5d49c Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 22 Nov 2023 05:07:40 -0800 Subject: [PATCH 3/9] Slight improvements in 1990/jaw/try.sh chmod +x the scripts so that one needn't use 'sh' (this also helps with shell completion for those who use it). --- 1990/jaw/try.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/1990/jaw/try.sh b/1990/jaw/try.sh index 8bfbd1966..84e6591ae 100755 --- a/1990/jaw/try.sh +++ b/1990/jaw/try.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash echo "Running shark.sh:" -sh shark.sh shark.sh README.md jaw.c try.sh > receive || exit 1 +./shark.sh shark.sh README.md jaw.c try.sh > receive || exit 1 echo "Done." @@ -13,9 +13,10 @@ mkdir -p test || exit 0 # make sure we can cd to the new directory cd test || exit +chmod +x ../receive # run the script echo "Attempting to extract files:" -sh ../receive +../receive echo 1>&2 echo "$ ls -al" 1>&2 From cefc45f6354d87dbd76ff390aeab73dcb4bd9592 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 22 Nov 2023 07:03:46 -0800 Subject: [PATCH 4/9] Add alt code to 2005/persano + format/typo checks The alt code should (though untested) work in Windows which distinguishes between text and binary. It uses the Windows functions _fileno() and _setmode() to set binary mode on stdout. The README.md file has been format/typo checked. --- 2005/persano/Makefile | 7 +- 2005/persano/README.md | 38 +++++++++- 2005/persano/persano.alt.c | 142 +++++++++++++++++++++++++++++++++++++ thanks-for-fixes.md | 8 +++ 4 files changed, 192 insertions(+), 3 deletions(-) create mode 100644 2005/persano/persano.alt.c diff --git a/2005/persano/Makefile b/2005/persano/Makefile index 02bf83de3..28f619b87 100644 --- a/2005/persano/Makefile +++ b/2005/persano/Makefile @@ -114,8 +114,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# @@ -138,6 +138,9 @@ ${PROG}: ${PROG}.c alt: data ${ALT_TARGET} @${TRUE} +${PROG}.alt: ${PROG}.alt.c + ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} + # data files # data: ${DATA} diff --git a/2005/persano/README.md b/2005/persano/README.md index 2ef3394f3..4e302eb35 100644 --- a/2005/persano/README.md +++ b/2005/persano/README.md @@ -4,6 +4,9 @@ make ``` +There is an alternate version of this entry which should work for Windows by +setting binary mode on `stdout`. See [alternate code](#alternate-code) below. + ## To use: @@ -25,6 +28,34 @@ manipulate animated GIFs - to slow down the animation and to compress the GIFs generated by the entry). +## Alternate code: + +This (untested as we have no Windows system) version uses the Windows API +functions `_setmode()` and `_fileno(3)` to set binary mode on `stdout` which should +let it work with Windows. + + +### Alternate build: + +``` +make alt +``` + +### Alternate use: + +Use `persano.alt` as you would `persano` above. + + +### Alternate try: + +```sh +./persano.alt 3 16 > knot3-16.gif +``` + +Follow the same instructions, using different tools if necessary, as the above +try section. + + ## Judges' remarks: If your system is one of those that distinguish between text and binary @@ -52,9 +83,10 @@ knots](https://en.wikipedia.org/wiki/Torus_knot) to standard output. ./persano p q [num frames] ``` + ### DESCRIPTION -A (p,q)-[torus knot](https://en.wikipedia.org/wiki/Torus_knot) is a closed, +A `(p,q)`-[torus knot](https://en.wikipedia.org/wiki/Torus_knot) is a closed, non-intersecting curve on the surface of a [torus](https://en.wikipedia.org/wiki/Torus) in R3 that winds `p` times around one cycle of the torus and `q` times around the other. `p` and `q` should be @@ -83,6 +115,7 @@ output; since the number of frames is not specified, an animation with Please view the code with 8-character tabs! + ### OUTPUT FORMAT The program writes fully valid GIF 89 streams. @@ -98,6 +131,7 @@ to GIF overhead. The GIF format supports only a limited number of bits per pixel, so the program uses ordered dithering to emulate full RGB output. + ### PORTABILITY The program was tested on Linux, with gcc 3.1; Cygwin, with gcc 3.3; and @@ -109,6 +143,7 @@ It should also be mentioned that the program won't work on systems that distinguish between text and binary streams; however, since hardly anyone uses such systems in this day and age, this is a minor issue. [4] + ### EXERCISES FOR THE READER 1. (1 point) The surface is composed of many small polygons. Try to make it @@ -119,6 +154,7 @@ smoother by increasing the number of polygons. 3. (5 points) Locate the famous transcendental constant [π](https://en.wikipedia.org/wiki/Pi) in the code. + ### FOOTNOTES [1] You can call such a transformation an "ambient isotopy" if you want to diff --git a/2005/persano/persano.alt.c b/2005/persano/persano.alt.c new file mode 100644 index 000000000..f6f0c107d --- /dev/null +++ b/2005/persano/persano.alt.c @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include + +#define H 20 + +#define X for +#define F(v,b) X(k = 0; k < 3; k++) v[k] = b; + +typedef double R, V[3], U[4], (*J)(R); +typedef void Z; +typedef int _; + +V o, d, v; +R (*q)[H][6], C[4*H][H][6], sr = 15, br = 25, A, s, t; +_ P, Q, g, S, k, e = 256, (*u)(_) = putchar, D[64]; +J f = cos, Y = sin; +char B[256]; + +Z +T(_ *p, _ k, _ n) +{ + _ g; + + *p = n; + + X(g = 0; k && g < 4; g++) + T(p + (9 & (g * 4|g))*(1< e-2 || c==129) && (*B = S, S = fwrite(B, S+1, 1, stdout) - 1); +} + + + + + + + Z N + (R*v){R w=sqrt + (*v**v +1[v]*v[1] + +v[2]*2[v]);F(v,v[k] + /w)}Z K(_ j){V + n,p ;R*b=(* + q) [j],w=f + (A),x= + Y(A); + F(p, + br*o[ + k]+sr + * (n[ k] =f(t)*k[v]+ + Y(t)*(v[(k+1)%3]* d[( k+2)%3]-v[(k+2)% + 3]*d[(k+1)%3])))*b++=p[1 ]+e/ 2,*b++=-*p*x+ + p[2]*w-e*e,*b++=(*p*w+p[2]*x)+e/2;F( b,fabs(*n + *!!k+n[1]*( k<2)+n[2])/sqrt(2+ !(k-1))) + }Z M(R*a,_ s,Z(*m)(_)){_ i;R d= + pow(25/log (36),4)/s/ 377;X( + *a=i=0;i + 97)));}Z E(_ z){R + *r,*a,*b;U*q,l,x,d + ,I[256];_ i,j,m,c,y, + w,h,Y=sizeof l;fputc( + 46,stderr),M(&s,4*H,G), + W("ibcbcbbbbb,"),g=130, + O(e/2);X(y=0;yC[i /H][i%H][1 + ]&&( memcpy(*q, + x,Y),* *q=C[i/H][ + i%H][1 ]),h=1;h< + 4;h++)x [h]+=h[d]; + memcpy(l ,x,Y);}X( + i=0;iD[(y*8&56)+(i&7) + ]), c<<=k/4+2,c|=(m|-(m>k))& + k;} O(129);u(0);}_ + + + +main(_ c, char **v) +{ + if (c < 3) + return fprintf(stderr, "Usage: %s P Q [F]\n", *v), 1; + + _setmode(_fileno(stdout), _O_BINARY); + + P = atoi(v[1]), + Q = atoi(v[2]), + + T(D, 3, 0); + + W("bb\346cbcba98FIG"); + + X(; k < 384; k++) + u(k / 3<<("gdb"[k%3] - 97) | 31 | (k % 3!=1)<<5); + + W("bbbce0.2EPACSTEN\x0b\xff!"), + + M(&A, c > 3 ? atoi(v[3]) : 40, E), + + u(59); + + return 0; +} + +/* vi:set ts=8: */ diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 4c3dc6598..774ac3de8 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -3023,6 +3023,14 @@ how https is set up, in which case just enjoy it for what it was. But there might be some command line that will let it work that way. +## [2005/persano](2005/persano/persano.c) ([README.md](2005/persano/README.md])) + +Cody added the (untested) [alternate +code](2005/persano/README.md#alternate-code) which should work for Windows as it +sets binary mode on `stdout`. It is untested as Cody has no Windows system to +test it on. + + ## [2005/sykes](2005/sykes/sykes.c) ([README.md](2005/sykes/README.md])) Cody added the saved (with the `SAVE` command) BASIC program `PET` which was: From 4e4c67112bbb6e6e507569f7af758cc56f40ed50 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 22 Nov 2023 07:43:51 -0800 Subject: [PATCH 5/9] Add 2005/klausler/try.sh + format/typo check --- 2005/klausler/README.md | 4 ++-- 2005/klausler/try.sh | 49 +++++++++++++++++++++++++++++++++++++++++ thanks-for-fixes.md | 6 +++++ 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100755 2005/klausler/try.sh diff --git a/2005/klausler/README.md b/2005/klausler/README.md index bc8bbf8a4..4766cfa7b 100644 --- a/2005/klausler/README.md +++ b/2005/klausler/README.md @@ -15,7 +15,7 @@ make ### Try: ```sh -./klausler peter klausler | head +./try.sh ``` @@ -33,7 +33,7 @@ Rules might have to be changed! ## Author's remarks: A useful tool to help one appear extra smart and witty when -[IRC](https://en.wikipedia.org/wiki/Internet_Relay_Chat)ing, or even +[IRCing](https://en.wikipedia.org/wiki/Internet_Relay_Chat), or even to just be highly annoying. Finds best anagrams for word or phrase given as program arguments. Use only diff --git a/2005/klausler/try.sh b/2005/klausler/try.sh new file mode 100755 index 000000000..393143297 --- /dev/null +++ b/2005/klausler/try.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2005/klausler +# + +# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it +# this way allows us to have the user specify a different compiler in an easy +# way. +if [[ -z "$CC" ]]; then + CC="cc" +fi + +make CC="$CC" all >/dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear + +echo "$ ./klausler peter klausler | head -n 10" 1>&2 +./klausler peter klausler | head -n 10 + +echo "$ ./klausler abc def ghi jkl mno | head -n 10" 1>&2 +./klausler abc def ghi jkl mno | head -n 10 + +echo "$ ./klausler foo bar baz | head -n 10" 1>&2 +./klausler foo bar baz | head -n 10 + +echo "$ ./klausler zebra elephant bear fox | head -n 10" 1>&2 +./klausler zebra elephant bear fox | head -n 10 + +echo "$ ./klausler the lion king | head -n 10" 1>&2 +./klausler the lion king | head -n 10 + +echo "$ ./klausler fire breathing dragon | head -n 10" 1>&2 +./klausler fire breathing dragon | head -n 10 + +echo "$ ./klausler lord of the rings | head -n 10" 1>&2 +./klausler lord of the rings | head -n 10 + +echo "$ ./klausler fawlty towers | head -n 10" 1>&2 +./klausler fawlty towers | head -n 10 + +echo "$ ./klausler carriown fowl | head -n 10" 1>&2 +./klausler carriown fowl | head -n 10 + +echo "$ ./klausler werewolf vampire dragon | head -n 10" 1>&2 +./klausler werewolf vampire dragon | head -n 10 + +echo "$ ./klausler werewolf vampire | head -n 10" 1>&2 +./klausler werewolf vampire | head -n 10 diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 774ac3de8..0bf2ed2f9 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -2989,6 +2989,12 @@ Cody added explicit linking of libm (`-lm`) for systems like linux that seem to not do it implicitly (like macOS does). + +## [2005/klausler](2005/klausler/klausler.c) ([README.md](2005/klausler/README.md)) + +Cody added the [try.sh](2005/klausler/try.sh) script. + + ## [2005/mikeash](2005/mikeash/mikeash.c) ([README.md](2005/mikeash/README.md)) Cody fixed this to work in linux. The problem was an unknown escape sequence, From 6ad8c4cb54671db64639bce580cc35ee0c902c92 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 22 Nov 2023 08:19:10 -0800 Subject: [PATCH 6/9] Add 2005/mikeash/try.sh, update bugs, typo/format --- 2005/mikeash/README.md | 37 +++++++++++++++++++++++----------- 2005/mikeash/try.sh | 42 +++++++++++++++++++++++++++++++++++++++ bugs.md | 45 ++++++++++++++++++++++++++++++++++++++++++ thanks-for-fixes.md | 9 +++++++++ 4 files changed, 122 insertions(+), 11 deletions(-) create mode 100755 2005/mikeash/try.sh diff --git a/2005/mikeash/README.md b/2005/mikeash/README.md index ba11ce52b..b2da23d02 100644 --- a/2005/mikeash/README.md +++ b/2005/mikeash/README.md @@ -5,22 +5,33 @@ make ``` +### Bugs and (Mis)features: + +The current status of this entry is: + +``` +STATUS: INABIAF - please **DO NOT** fix +``` + +For more detailed information see [2005 mikeash in bugs.md](/bugs.md#2005-mikeash). + + ## To use: ```sh ./mikeash ``` +NOTE: the author stated that they tested this under i386 machines but this works +under 64-bit (x86_64, arm64) machines too. + ### Try: ```sh -./mikeash < mikeash.c -./mikeash < mikeash.c | diff - mikeash.c +./try.sh ``` -NOTE: the author stated that they tested this under i386 machines but this works -under 64-bit (x86_64, arm64) machines too. ## Judges' remarks: @@ -46,7 +57,7 @@ interpreter for an extremely limited and highly broken subset of [Common Lisp](https://en.wikipedia.org/wiki/Common_Lisp). It requires C99 because of `C99`'s ability to declare variables in the -initializer of a for loop. Unfortunately, C99 mode typically warns about +initializer of a `for` loop. Unfortunately, C99 mode typically warns about implicitly declared functions, and preprocessor directives prevent the program from being valid [Common Lisp](https://en.wikipedia.org/wiki/Common_Lisp). As a result, several warnings will be printed about implicit declarations of @@ -70,9 +81,10 @@ used: echo '(format t "~s" (* (+ 2 2 ) (- 5 (/ 9 3 ))))' | ./mikeash ``` -This evaluates the expression `(2+2) * (5 - 9/3)` giving the correct -result, 8. Note that due to the highly ad-hoc nature of the tokenizer, -the spaces before the closing parentheses are mandatory. +This evaluates the expression `(2+2) * (5 - 9/3)` giving the correct result, +`8"` (with the same issue of no newline after the `"`). Note that due to the +highly ad-hoc nature of the tokenizer, the spaces before the closing parentheses +are mandatory. The program can also be run in an interactive mode, by simply executing `./mikeash` and then typing lisp expressions, but this is difficult due to the @@ -104,8 +116,8 @@ constants such as `#\x`. * The `char-upcase` function will give strange results if passed something other than a lowercase character. -* The format function takes exactly three parameters. The first parameter is -ignored; output always goes to stdout. The second parameter must have exactly +* The `format` function takes exactly three parameters. The first parameter is +ignored; output always goes to `stdout`. The second parameter must have exactly one `~s` format specifier in it, and no other format specifiers are permitted. * The arithmetic functions take exactly two parameters. @@ -126,7 +138,7 @@ diff mikeash.c mikeash2.c The program can also be run from an implementation of [common lisp](https://en.wikipedia.org/wiki/Common_Lisp). To do -this, run the [common lisp compiler and then type the following command: +this, run the common lisp compiler and then type the following command: ``` (load "mikeash.c") @@ -134,6 +146,9 @@ this, run the [common lisp compiler and then type the following command: The source code of [mikeash.c](mikeash.c) will be printed. + +### Obfuscation + `Lispob` is obfuscated in several ways. First, it's actually two programs in one, which actually share a small amount of code. Running a C code beautifier will destroy the [LISP][] program contained within. Second and diff --git a/2005/mikeash/try.sh b/2005/mikeash/try.sh new file mode 100755 index 000000000..3d5f1c5d4 --- /dev/null +++ b/2005/mikeash/try.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2005/mikeash +# + +# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it +# this way allows us to have the user specify a different compiler in an easy +# way. +if [[ -z "$CC" ]]; then + CC="cc" +fi + +make CC="$CC" all >/dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear + + +echo "$ ./mikeash < mikeash.c" 1>&2 +./mikeash < mikeash.c + +echo 1>&2 +echo "The next command should print nothing." 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo "$ ./mikeash < mikeash.c | diff - mikeash.c" 1>&2 +./mikeash < mikeash.c | diff - mikeash.c + +echo 1>&2 +echo "For the next two commands we will add a newline after the command's output" 1>&2 +echo "for your convenience as they will not print a newline themselves." 1>&2 +echo 1>&2 +echo "The next command should show: \"4." 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo "$ echo '(format t "~s" (+ 2 2 ))' | ./mikeash" 1>&2 +echo '(format t "~s" (+ 2 2 ))' | ./mikeash +echo 1>&2 + +echo "The next command will evaluate the expression: (2+2) * (5 - 9/3), giving 8\"." 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo "$ echo '(format t "~s" (* (+ 2 2 ) (- 5 (/ 9 3 ))))' | ./mikeash" 1>&2 +echo '(format t "~s" (* (+ 2 2 ) (- 5 (/ 9 3 ))))' | ./mikeash +echo 1>&2 diff --git a/bugs.md b/bugs.md index 07ef7a244..a5e042c88 100644 --- a/bugs.md +++ b/bugs.md @@ -2209,6 +2209,51 @@ does not exist. This entry requires that `sed` and `make` are in the path. +## 2005 mikeash + +### STATUS: INABIAF - please **DO NOT** fix +### Source code: [2005/mikeash/mikeash.c](2005/mikeash/mikeash.c) +### Information: [2005/mikeash/README.md](2005/mikeash/README.md) + +The author states: + +* The only built-in functions are `defvar`, `format`, `substitute`, +`char-upcase`, `+`, `-`, `*`, and `/`. + +* Only one variable is available. This variable is called `q`, although any +symbol name starting with the letter `q` will be mapped to this variable. + +* Only the first letter of a function name is significant. For example, +`format`, `f`, `farm`, and various other words starting with `f` will all map to +the `format` function. + +* The `defvar` function completely ignores its first parameter. It will always +store the result of evaluating its second parameter in `q`. Unlike in [Common +Lisp](https://en.wikipedia.org/wiki/Common_Lisp), multiple invocations of +`defvar` on the same variable will overwrite old values. + +* Character constants are limited to `#\Newline` and single-character +constants such as `#\x`. + +* The `char-upcase` function will give strange results if passed something +other than a lowercase character. + +* The `format` function takes exactly three parameters. The first parameter is +ignored; output always goes to `stdout`. The second parameter must have exactly +one `~s` format specifier in it, and no other format specifiers are permitted. + +* The arithmetic functions take exactly two parameters. + +* All tokens must be separated from a following `)` by whitespace. + +* A lot of other things. Notably, the language which this program interprets is +nowhere near +[Turing-complete](https://en.wikipedia.org/wiki/Turing_completeness). + +Basically, the [LISP][] interpreter is good for some basic math operations, and +for running itself. + + ## 2005 mynx ### STATUS: INABIAF - please **DO NOT** fix diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 0bf2ed2f9..de6fa774d 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -3017,6 +3017,15 @@ updated in both the string and the code to be `'n'`. The array size of `c` was updated by 1 out of caution just in case as the array is used to store at least part of the string. +It might be worth noting that the author stated that the reason for the `\N` is +due to LISP having different escape sequences. The code was modified so that +feeding the program itself will print itself, showing no difference, which is +what is supposed to happen. It is not known, however, if having to change the +`\N` to `\n` ended up breaking any LISP. The other examples given by the author +also show correct output though. + +Cody also added the [try.sh](2005/mikeash/try.sh) script. + ## [2005/mynx](2005/mynx/mynx.c) ([README.md](2005/mynx/README.md])) From cdc75eecec09c70c5e8d3dbabe50d62b5096693e Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 22 Nov 2023 08:31:52 -0800 Subject: [PATCH 7/9] Format/typo check 2005/mynx The bugs.md file was updated slightly and so was the thanks file, namely suggesting that it might be possible for further code to be added to the alt code to make it set up https (they already stated that there might be a command line that could get it to work). --- 2005/mynx/README.md | 56 ++++++++++++++++++++++++++------------------- bugs.md | 9 ++++---- thanks-for-fixes.md | 3 ++- 3 files changed, 40 insertions(+), 28 deletions(-) diff --git a/2005/mynx/README.md b/2005/mynx/README.md index 1c74c1863..348442bb7 100644 --- a/2005/mynx/README.md +++ b/2005/mynx/README.md @@ -4,6 +4,9 @@ make ``` +There is an alternate version that scans for (_ONLY_ scans) the string `https` +as a starting point. See [alternate code](#alternate-code) below. + ### Bugs and (Mis)features: @@ -30,32 +33,39 @@ the issue of https. ```sh ./mynx http://www.textfiles.com + +./mynx manual.html ``` -Some have pointed out that this will not work for https initially -for two reasons. For a starting point see the alternate code section below. - - ## Alternate code: -As noted this will not work for https. This is because it does not scan for -https but also a secure connection needs to be set up before http commands can -be sent. One would also have to specify a port in the URL. Fortunately or -unfortunately many more websites use https nowadays so this entry will not work -as well as it used to. If one were to try and connect to `https://www.ioccc.org` -with this entry they'll just get a 301 error. +Obviously this will not work with `https` as it only scans for `http` in the URL +(if not specified it tries to open it as a local file). But even if it scanned +for `https` one would need to do more work as it would have to set up a secure +connection before http commands could be sent. Fortunately or unfortunately +many more websites use https so this entry will not work as well as it used to. +If one were to try and connect to with this entry they'll +just get a 301 error. -In case someone can come up with a clever pipeline or some other hack or -workaround (perhaps [stunnel](https://www.stunnel.org)), +The alternate code is a starting point that scans for `https` too (note you have +to specify the port in this case) but that is all it does. It will not work with +https websites as it does not set up a secure connection. But should anyone wish +to either come up with a pipeline (or some other command line) that allows it to +work with https or to update the code to support https they may. Otherwise you +must just appreciate the entry for what it once was. -To compile: + +### Alternate build: ```sh make alt ``` + +### Alternate use: + Use `mynx.alt` as you would `mynx`. You'd have to specify a port at the end of the URL like: @@ -84,13 +94,13 @@ it inspired me to try my hand at writing the client side complement. A typical build command would be: ```sh -cc -omynx mynx.c +cc -o mynx mynx.c ``` While some others like to be a little different: ```sh -cc -omynx mynx.c -lnsl -lsocket +cc -o mynx mynx.c -lnsl -lsocket ``` I even managed to figure out a basic configure script, given last year's @@ -111,14 +121,14 @@ After which, the rest of the documentation can be read by saying: Manifest: ``` - mynx.c - makefile pre-built generic Unix - README.TXT - manual.html - makefile.in makefile template - entities.txt ISO 8859-1 entites - configure.in configure script description - configure pre-built configure script +mynx.c +makefile pre-built generic Unix +README.md +manual.html +makefile.in makefile template +entities.txt ISO 8859-1 entites +configure.in configure script description +configure pre-built configure script ``` diff --git a/bugs.md b/bugs.md index a5e042c88..fcacb2039 100644 --- a/bugs.md +++ b/bugs.md @@ -2263,10 +2263,11 @@ for running itself. [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) notes that, though probably obvious, this entry will not work with https. He added an alt version that scans for https in case someone wants to set up a pipeline or other -workaround (perhaps with stunnel) but the problem otherwise is a secure -connection has to first be set up in order to give http commands. This is not a -bug but it's worth pointing out as it won't work on as many websites as it used -to including the [IOCCC website](https://www.ioccc.org) itself. +workaround (perhaps with stunnel) or even add additional code to it to make it +work with https but the problem otherwise is a secure connection has to first be +set up in order to give http commands. This is not a bug but it's worth pointing +out as it won't work on as many websites as it used to including the [IOCCC +website](https://www.ioccc.org) itself. ## 2005 sykes diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index de6fa774d..c97709f5f 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -3035,7 +3035,8 @@ needed but part of the entry) would work with compilers that have by default Cody also added the alt code which does scan for https. Futile, maybe, based on how https is set up, in which case just enjoy it for what it was. But there -might be some command line that will let it work that way. +might be some command line that will let it work that way or perhaps someone +wants to add the necessary code. ## [2005/persano](2005/persano/persano.c) ([README.md](2005/persano/README.md])) From 3cd20c503864bcd0d068bf3ee6cd99eadf9417e8 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 22 Nov 2023 08:47:45 -0800 Subject: [PATCH 8/9] Add input.txt to 2005/boutines + format/typo check The input.txt file is what the author included in their remarks as input to try out. This has been integrated into one of the commands to try in the try section (which did not even have a command to try out - it just referred to the command in the to use section). BTW: the author mentioned the Mersenne prime. Did you know that Landon Curt Noll has held eight world records related to large primes? --- 2005/boutines/.gitignore | 1 + 2005/boutines/README.md | 44 +++++++++++++++++++++++++++++----------- 2005/boutines/input.txt | 5 +++++ thanks-for-fixes.md | 6 ++++++ 4 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 2005/boutines/input.txt diff --git a/2005/boutines/.gitignore b/2005/boutines/.gitignore index 020c11364..7d028a28a 100644 --- a/2005/boutines/.gitignore +++ b/2005/boutines/.gitignore @@ -3,3 +3,4 @@ test.svg test.png boutines.orig prog.orig +result.svg diff --git a/2005/boutines/README.md b/2005/boutines/README.md index f05a3d5b4..f0a38f043 100644 --- a/2005/boutines/README.md +++ b/2005/boutines/README.md @@ -20,11 +20,18 @@ ruby -e '20.times{puts "#{rand} #{rand}"}' | ./boutines > test.svg ### Try: -After running the above, use [ImageMagick](https://imagemagick.org/index.php)'s -`convert` tool to convert the image to a png file: + +```sh +./boutines < input.txt > result.svg +``` + +After running the above commands, use [ImageMagick](https://imagemagick.org/index.php)'s +`convert` tool to convert the images to a png file: ```sh convert test.svg test.png + +convert result.svg result.png ``` and then open it with your preferred graphics viewer or editor. @@ -47,13 +54,17 @@ their name suggests"? _In memory of my father Pierre Boutines-Vignard._ + ### Walk-through My program works as follows: + #### Input -A list of 2D points in the unit square. +A list of 2D points in the [unit +square](https://en.wikipedia.org/wiki/Unit_square). + #### Output @@ -63,7 +74,7 @@ an [SVG](https://www.w3.org/TR/SVG11/expanded-toc.html) stream. This will possibly save a compressed SVG file and may be useful: ```sh -./boutines | gzip > result.svgz +./boutines | gzip > result.svg.gz ``` Input consists of a list of floating points values separated by whitespaces @@ -72,11 +83,11 @@ whitespace then the other coordinate (pointing downwards in the resulting graph) and a newline will just go fine: ``` - 0 0 - 0 1 - 1 0 - 1 1 - .5 .5 +0 0 +0 1 +1 0 +1 1 +.5 .5 ``` Strictly speaking, you have to provide a **set** of points. If there are @@ -84,6 +95,7 @@ duplicates in the list, there is no guarantee on the one to be shown (in addition their labels will overlap) in the resulting colored [Voronoi diagram](https://en.wikipedia.org/wiki/Voronoi_diagram). + ### Caution This program might have been a lot shorter, but nearly impractical even for @@ -113,8 +125,10 @@ for most devices (including many inkjet printers). If you ever miss precision on a particular dataset or peripheral, you may want to dive in and let `U` be the next power of `__LINE__`. -NOTE: bad inputs will be sanctioned by the production of the 42nd Mersenne -prime (ie. 2^25964951 -1); memory will be kept. +NOTE: bad inputs will be sanctioned by the production of the 42nd [Mersenne +prime](https://en.wikipedia.org/wiki/Mersenne_prime) (i.e. 2^25964951 -1); +memory will be kept. + ### Why I think this code is Obfuscated ? @@ -129,34 +143,40 @@ complicated output statements. Be sure to check the antepenultimate line of code. + ### Missing Features + #### Color control Cell colors are chosen randomly (with a questionable rejection scheme). It might have been useful to input them along with sites coordinates, turning the application into a puzzling graphics engine. + #### Site labelling The points are implicitly numbered in the order they were entered (starting at one). This can be overridden however, via a simple XSL transformation. + #### Site radius -The site radius is hardwired in the code, I still wonder why I did not +The site radius is hardcoded in the code, I still wonder why I did not design it as a function of the underlying cell's area (which can be averaged for free) or at least a command line parameter. Same with the char set, the viewport and potentially every [SVG](https://www.w3.org/TR/SVG11/expanded-toc.html) property. + ### See Also - [Voronoi at Wikipedia](http://en.wikipedia.org/wiki/Voronoi_diagram), - [An Excerpt from The Algorithm Design Manual](http://www2.toki.or.id/book/AlgDesignManual/BOOK/BOOK4/NODE187.HTM), - [Voronoi and Art](http://www.snibbe.com/scott/bf) + ### Example Output > ![Voronoi diagram of two regular pentagon vertices](Voronoi.png) diff --git a/2005/boutines/input.txt b/2005/boutines/input.txt new file mode 100644 index 000000000..deab279d0 --- /dev/null +++ b/2005/boutines/input.txt @@ -0,0 +1,5 @@ +0 0 +0 1 +1 0 +1 1 +.5 .5 diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index c97709f5f..5d109fb36 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -2915,6 +2915,12 @@ Cody added the [alt code](2005/anon/README.md#alternate-code) with vi(m) like movements. +## [2005/boutines](2005/boutines/boutines.c) ([README.md](2005/boutines/README.md])) + +Cody added the [input.txt](2005/boutines/input.txt) data file based on suggested +input from the author, adapting it to a command to try out. + + ## [2005/giljade](2005/giljade/giljade.c) ([README.md](2005/giljade/README.md])) After Landon fixed the entry to compile with clang Cody noticed this does not From ed383df280af660edb67db42d84801fbecc50e78 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:18:04 -0800 Subject: [PATCH 9/9] Update 2006/monge bugs status There was an inconsistency between the README.md and the bugs.md file that has been fixed. As well the program requires one be able to read, write and execute memory. This is not allowed in macOS with the silicon chip so I have added the status of it not working with some platforms. A few minor formatting fixes were made in the README.md file but I didn't go through the file so it can't be considered done. --- 2006/monge/README.md | 12 ++++++++---- bugs.md | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/2006/monge/README.md b/2006/monge/README.md index b722d8d31..b1616c263 100644 --- a/2006/monge/README.md +++ b/2006/monge/README.md @@ -12,7 +12,8 @@ make The current status of this entry is: ``` -STATUS: known bug - please help us fix +STATUS: doesn't work with some platforms - please help us fix +STATUS: INABIAF - please **DO NOT** fix ``` For more detailed information see [2006 monge in bugs.md](/bugs.md#2006-monge). @@ -63,11 +64,13 @@ effort to work on both `i386` and `x86_64`. Portable it is! :) 0. Compile using the Makefile, or just run: - gcc monge.c -o monge -O3 `sdl-config --libs --cflags` +```sh +gcc monge.c -o monge -O3 `sdl-config --libs --cflags` +``` 1. Run: -``` +```sh ./monge "z = 0" "z = z*z + c; Abs2(z) < 4" ``` @@ -113,7 +116,7 @@ Operation | Description `Im` | Extract the imaginary part, i.e.: `Im(a+b*i) is b+0*i`. `Exp` | Calculates the complex exponential, i.e. `Exp(a+b*i)` is | `e^a*(cos(b)+sin(b)*i)` -Ln | Calculates the principal value of the natural logarithm, i.e. +`Ln` | Calculates the principal value of the natural logarithm, i.e. `Ln(a+b*i)` is `ln(a*a+b*b)/2` + `atan(b/a)*i` Here are a few examples of fractals you can draw: @@ -175,6 +178,7 @@ If you want you can change the window width and height, or the default number of iterations (that one can be tweaked at runtime, anyway) by changing the definitions of `W`, `H` and `I` at the beginning of the code. + ### Caveats (I just a selected few of them!) - The zooming speed depends on the speed of the computer. diff --git a/bugs.md b/bugs.md index fcacb2039..ac1797aba 100644 --- a/bugs.md +++ b/bugs.md @@ -2307,14 +2307,18 @@ used decimal mode, or any of the "undocumented" instructions. ## 2006 monge -### STATUS: known bug - please help us fix +### STATUS: doesn't work with some platforms - please help us fix ### Source code: [2006/monge/monge.c](2006/monge/monge.c) ### Information: [2006/monge/README.md](2006/monge/README.md) -Incorrect formulas will ungracefully crash the program. +This program requires being able to read, write and execute memory. With the +Apple silicon chips this is not allowed. Fixing this might be quite challenging +but you are welcome to try and fix it. -Fixing the (Mis)feature is likely to be a difficult challenge. -You are welcome to try and fix it if you can! + +### STATUS: INABIAF - please **DO NOT** fix + +Incorrect formulas will ungracefully crash the program. ## 2006 toledo2