From ca8d780e70037d9876fbd48c602e23738bec42f6 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 15 Feb 2023 10:17:08 -0800 Subject: [PATCH] 2018/ferguson fixes Make test.sh +x. Formatting fixes. Typo fixes. Other things as well. I'm actually aware of some other things that could still be done including removing some text that is no longer needed (and some that probably is not needed) but this can come at a later date. --- 2018/ferguson/.gitignore | 4 ++++ 2018/ferguson/README.md | 35 +++++++++++++++++++--------- 2018/ferguson/rpm.md | 50 ++++++++++++++++++++++------------------ 2018/ferguson/test.sh | 0 4 files changed, 56 insertions(+), 33 deletions(-) create mode 100644 2018/ferguson/.gitignore mode change 100644 => 100755 2018/ferguson/test.sh diff --git a/2018/ferguson/.gitignore b/2018/ferguson/.gitignore new file mode 100644 index 000000000..736d77e0f --- /dev/null +++ b/2018/ferguson/.gitignore @@ -0,0 +1,4 @@ +prog-simple +prog.orig +weasel +weasel-simple diff --git a/2018/ferguson/README.md b/2018/ferguson/README.md index eb2309a4f..a46486ec9 100644 --- a/2018/ferguson/README.md +++ b/2018/ferguson/README.md @@ -119,7 +119,7 @@ from the infamous *UNIX-HATERS Handbook*. **[Winning thoughts](#winning):** What it means to me to win as well as some dedications and thanks. Here too I include a link to a website which will be -dedicated to this entry beyond what will be published on the IOCCC website +dedicated to this entry beyond what will be published on the IOCCC website. [FILES]: FILES [rpm.md]: rpm.md @@ -238,8 +238,14 @@ paragraph; the first sentence in fact: the answer to the judges' question and the definition. Can you get the program to search the primorial prime of 97 without passing in specially? -**On user errors:** if the generation reaches **`SIZE_MAX - 1`** I consider it a -user (or monkey) error; if the user insists on being so petulant as to try such +I was quite proud that when the next contest came the judges removed that +question. Later 2018 and all of 2019 was difficult for me so it was like I won a +second time for the same entry. + +### On user errors + +If the generation reaches **`SIZE_MAX - 1`** I consider it a +user (or monkey) error; if the user insists on being so petulant enough as to try such a ridiculous set of parameters in an attempt to make it be no more successful than a monkey typing *then it shouldn't be any more successful than a monkey; if it by chance reaches the target it's because a monkey could too!* Either way @@ -256,7 +262,7 @@ Fish Theorem*). So although the user might not be a monkey the program makes the assumption that **the user could in fact be a monkey called Eric** *although it isn't insolent enough to say the user is a monkey for certain!* -[genetic algorithm]: http://www.doc.ic.ac.uk/~nd/surprise_96/journal/vol1/hmw/article1.html +[genetic algorithm]: https://web.archive.org/web/20180308131613/http://www.doc.ic.ac.uk/~nd/surprise_96/journal/vol1/hmw/article1.html [2018 guidelines]: http://ioccc.org/2018/guidelines.txt @@ -476,32 +482,38 @@ So in this case I joined the options in the following order: 1. **`-q`** -Quiet output. + Quiet output. + 2. **`-r101`** -Mutation rate 101 (out of range). + Mutation rate 101 (out of range). + 3. **`-r5`** -Mutation rate of 5 but note that during parsing I only print invalid mutation + Mutation rate of 5 but note that during parsing I only print invalid mutation rate (only after parsing do I print the final mutation rate whatever it ends up being); so while it appears there is a bug, showing mutation rate out of range three times, this is expected (given the next one, **`-r101`**). This means here the typewriter was taken from Eric the monkey. + 4. **`-r101`** -Mutation rate to 101: this too is out of range (this is the second mutation rate + Mutation rate to 101: this too is out of range (this is the second mutation rate out of range message). The typewriter returns to Eric. + 5. **`-r1`** -Set mutation rate to 1. Take that typewriter away! + + Set mutation rate to 1. Take that typewriter away! + 6. **`-r`** -Set mutation rate to 0; when there are no valid characters passed to + Set mutation rate to 0; when there are no valid characters passed to **`strtol()`** it should return 0: this is the third message about being out of range. Note here that **`rand()`** returns an **`int`** and **`strtol()`** returns a **`long`** but I compare the return value of **`rand()`** to the @@ -509,9 +521,10 @@ mutation rate; if there are any systems where the widths differ this *shouldn't matter* because of truncation but I do in any case specifically check for **`R < 0 || R > 100`**. Either way the invalid range returns the typewriter to Eric. + 7. **`test`** -Finally I requested it find the string **`test`** (will search for **`TEST`**). + Finally I requested it find the string **`test`** (will search for **`TEST`**). Given that it was a short string it did find the answer relatively quickly, even in monkey mode. diff --git a/2018/ferguson/rpm.md b/2018/ferguson/rpm.md index 3d3dd8a99..fb5cab4f8 100644 --- a/2018/ferguson/rpm.md +++ b/2018/ferguson/rpm.md @@ -1,22 +1,26 @@ -What? Install an IOCCC entry? I realise it seems odd so why did I make a rpm -spec file and why did I hint at building RPMs for others? I can't say precisely; -**certainly I'm under no impression that anyone else will want to use it** *but -the entry was fun enough for me that I actually will* (a number of my programs -over the years are programs I actually install and I already have done so with -this entry). I already have my own RPM repository and initially after having won -I set it up so that I could host the weasel rpm (binary and source) there. At -the same time though I feel the entry belongs on the IOCCC website; that is to -say the only place the raw files should be downloadable from is the IOCCC -website itself. Simon Cooper (the judge who deals with setting up the entries on -the IOCCC website) asked me if there is any real attachment in having the RPM -built as part of the entry and the answer is 'no'. He did suggest too that if -I were to have the RPM hosted on the IOCCC website not only would it place a -burden on me to keep it up to date but it would place a burden on the judges - -in other words he himself. Even if it wasn't a burden to me I agree on the other -part and so I have instead come to the following ideas: +## An RPM: what kind of absolute MADNESS is this ? + +What kind of crazy idea is this? Install an IOCCC entry? I realise it seems odd +(at best) so why did I make a rpm spec file and why did I hint at building RPMs +for others? I can't say precisely; **certainly I'm under no impression that +anyone else will want to use it** *but the entry was fun enough for me that I +actually will* (a number of my programs over the years are programs I actually +install and I already have done so with this entry). + +I already have my own RPM repository and initially after having won I set it up +so that I could host the weasel rpm (binary and source) there. At the same time +though I feel the entry belongs on the IOCCC website; that is to say the only +place the raw files should be downloadable from is the IOCCC website itself. +Simon Cooper (the judge who at the time dealt with setting up the entries on the +IOCCC website) asked me if there is any real attachment in having the RPM built +as part of the entry and the answer is 'no'. He did suggest too that if I were +to have the RPM hosted on the IOCCC website not only would it place a burden on +me to keep it up to date (not that it ever needed to be updated) but it would +place a burden on the judges. This is no longer true with GitHub but anyway +since this was for personal reasons I decided that: -* I will not host the actual source code or scripts on my website; they will +* I would not host the actual source code or scripts on my website; they will remain on the IOCCC website. This will most likely never change; instead I would link to the entry directory so that they remain where they belong: the IOCCC website itself. I have set up an [errata page][] however should there be anything @@ -25,12 +29,14 @@ requiring a fix. * I am keeping the weasel.spec file in the entry as it was part of my submission but I do not explain here how to set up the build environment or how to build a RPM: if you know how to use **`rpmbuild`** then you should be able to -work it out. +work it out. Again that's a crazy idea but again it was there and it was part of +the judges' comments (which I liked a lot) which is yet another reason I kept +it. -* Because I strongly suspect I am the only one who has any desire for actually -installing an IOCCC entry I will not worry about setting up a repository; if I -do set up a repository in the future I will include information on it somewhere -at [https://ioccc.xexyl.net/2018/weasel][]. +* Because I strongly suspect (in other words since I know) I am the only one +who has any desire for actually installing an IOCCC entry I did not do anything +further. Nevertheless more information on my entry can be found at +[https://ioccc.xexyl.net/2018/weasel][]. [errata page]: https://ioccc.xexyl.net/2018/weasel/errata [https://ioccc.xexyl.net/2018/weasel]: https://ioccc.xexyl.net/2018/weasel diff --git a/2018/ferguson/test.sh b/2018/ferguson/test.sh old mode 100644 new mode 100755