Fixes and updates to 2018/ferguson/index.html
This commit is contained in:
1 parent
76b55c8607
commit
e4d9d517fe
2 files changed
+261
-129
No files matched your search
+144
-70
@@ -114,23 +114,32 @@ If you find yourself in an evolutionary dead end, try:
|
|||||||
|
|
||||||
## Author's remarks:
|
## Author's remarks:
|
||||||
|
|
||||||
0. Preface
|
|
||||||
1. What it is
|
|
||||||
2. How it works
|
|
||||||
3. Hints (Keyboards, Options, Easter egg, Example Invocations)
|
|
||||||
4. Obfuscation (Techniques, Beauty)
|
|
||||||
5. How to build (S and N Constants, Compilation, Portability, Installing)
|
|
||||||
6. Final thoughts
|
|
||||||
7. Winning comments, thanks, dedications, links, etc.
|
|
||||||
|
|
||||||
## **0. Preface**
|
<div id="toc">
|
||||||
|
### Table of Contents
|
||||||
|
</div>
|
||||||
|
|
||||||
**OBFUSCATION NOTES: A great deal of this document and the man page is full of
|
- [Preface](#preface)
|
||||||
obfuscation information of different types; as such I would recommend that you try running the
|
- [What it is](#what)
|
||||||
judges suggested invocations as well as running `make test` before you get into
|
- [How it works](#how)
|
||||||
the document or the man page, unless you don't mind reading obfuscation information. I don't reveal
|
- [Hints (Keyboards, Options, Easter egg, Example Invocations)](#hints)
|
||||||
much in the way of obfuscation however so if you just want documentation on the
|
- [Obfuscation (Techniques, Beauty)](#obfuscation)
|
||||||
program, how to compile, etc. then there isn't need to heed this note.**
|
- [How to build (S and N Constants, Compilation, Portability, Bugs, Installing)](#build)
|
||||||
|
- [Final thoughts](#thoughts)
|
||||||
|
- [Winning comments, thanks, dedications, links, etc.](#winning)
|
||||||
|
- [Update on the Infinite Monkey Theorem, 2024](#monkey2024)
|
||||||
|
|
||||||
|
<div id="preface">
|
||||||
|
### Preface
|
||||||
|
</div>
|
||||||
|
|
||||||
|
**OBFUSCATION NOTES**: a great deal of this document and the man page is full of
|
||||||
|
obfuscation information of different types; as such I would recommend that you
|
||||||
|
try running the judges suggested invocations as well as running `make test`
|
||||||
|
before you get into the document or the man page, unless you don't mind reading
|
||||||
|
obfuscation information. I don't reveal much in the way of obfuscation however
|
||||||
|
so if you just want documentation on the program, how to compile, etc. then
|
||||||
|
there isn't need to heed this note.
|
||||||
|
|
||||||
I was at a loss on how to present my remarks; on the one hand I wanted to give
|
I was at a loss on how to present my remarks; on the one hand I wanted to give
|
||||||
everything to the judges so they didn't miss anything. But on the other hand I
|
everything to the judges so they didn't miss anything. But on the other hand I
|
||||||
@@ -146,60 +155,66 @@ page (it explains all the options and describes the program briefly):
|
|||||||
If that isn't sufficient **I would recommend reading this section** *(and
|
If that isn't sufficient **I would recommend reading this section** *(and
|
||||||
possibly the next)* where I attempt to give a brief explanation of the sections
|
possibly the next)* where I attempt to give a brief explanation of the sections
|
||||||
to make reading it easier and faster. In addition I want to point out a few
|
to make reading it easier and faster. In addition I want to point out a few
|
||||||
things. *If you want more details read this document more thoroughly (or just
|
things. _If you want more details read this document more thoroughly (or just
|
||||||
the sections that seem relevant to what you're after).* The [FILES][] file is a
|
the sections that seem relevant to what you're after)._ Because several
|
||||||
quick list of files and respective summaries in this entry. Because several
|
|
||||||
sections are quite long I have added a skip to link to skip to the next
|
sections are quite long I have added a skip to link to skip to the next
|
||||||
subsection or section at the beginning of each section (and subsection).
|
subsection or section at the beginning of each section (and subsection).
|
||||||
|
|
||||||
**[What it is](#what):** This is a brief summary of the program; the man page is
|
[What it is](#what): this is a brief summary of the program; the man page is
|
||||||
more thorough than this.
|
more thorough than this.
|
||||||
|
|
||||||
**[How it works](#how):** Explain some of the basic concepts and terms of the
|
[How it works](#how): explains some of the basic concepts and terms of the
|
||||||
program; if you're familiar with genetic algorithms there won't be any problem
|
program; if you're familiar with genetic algorithms there won't be any problem
|
||||||
following this section but it might be of some value to read anyway. There is a
|
following this section but it might be of some value to read anyway. There is a
|
||||||
randomised mode that doesn't use a genetic algorithm; it can be triggered a
|
randomised mode that doesn't use a genetic algorithm; it can be triggered a
|
||||||
number of ways but the `-m` option enables it specially (I discuss this
|
number of ways but the `-m` option enables it specially (I discuss this
|
||||||
thoroughly in **[Hints](#hints)**).
|
thoroughly in [Hints](#hints)).
|
||||||
|
|
||||||
**[Hints](#hints):** Perhaps the longest part of this document because in it I
|
[Hints](#hints): perhaps the longest part of this document because in it I
|
||||||
document the [keyboards](#keyboards), [options](#options), subtleties, including
|
document the [keyboards](#keyboards), [options](#options), subtleties, including
|
||||||
features that might appear to be bugs but aren't - including an
|
features that might appear to be bugs but aren't - including an
|
||||||
[input error](#error), an [Easter egg obfuscation](#obfuscation) and quite a few
|
[input error](#error), an [Easter egg obfuscation](#obfuscation) and quite a few
|
||||||
[example invocations](#invocations). If you've read the man page you probably
|
[example invocations](#invocations). If you've read the man page you probably
|
||||||
don't need this unless there is something specific you're after.
|
don't need this unless there is something specific you're after.
|
||||||
|
|
||||||
**[Obfuscation](#obfuscation):** Some of the techniques that might not be used.
|
[Obfuscation](#obfuscation): some of the techniques that might not be used.
|
||||||
|
|
||||||
**[How to build](#build):** Here I describe briefly
|
[How to build](#build): here I describe briefly
|
||||||
[the constants that can be redefined](#constants) `S`, `M` and `N`: the
|
[the constants that can be redefined](#constants) `S`, `M` and `N`: the
|
||||||
maximum size of the chromosome (target string; the maximum length is `S - 1`
|
maximum size of the chromosome (target string; the maximum length is `S - 1`
|
||||||
but it must be >= the default 38), the number of maximum attempts before giving
|
but it must be >= the default 38), the number of maximum attempts before giving
|
||||||
up and the number of offspring, respectively. I
|
up and the number of offspring, respectively. I
|
||||||
also give [example compiler invocations](#compiling), [portability
|
also give [example compiler invocations](#compiling), [portability
|
||||||
notes](#portability), an [more portability notes](#bugs) and a [note on
|
notes](#portability), an [more portability notes](#bugs) and a [note on
|
||||||
rpm.html](rpm.html).
|
rpm.html](rpm.html); I obviously **DO NOT** recommend installing it any more than
|
||||||
|
the Judges would, but it was part of my entry for personal reasons and since the
|
||||||
|
Judges remarked about it I have kept it in place.
|
||||||
|
|
||||||
On the subject of `S` and `N`: As the judges' suggested runs imply you
|
On the subject of `S` and `N`: as the judges' suggested runs imply you
|
||||||
can change the target string at runtime; `make test` runs a script
|
can change the target string at runtime; `make test` runs a script
|
||||||
`test.sh` which reads from the file `test-strings.txt`, running the program
|
`test.sh` which reads from the file `test-strings.txt`, running the program
|
||||||
for each string in the file, waiting approximately two seconds before
|
for each string in the file, waiting approximately two seconds before
|
||||||
continuing. I explain how to pass options to the script in part of
|
continuing. I explain how to pass options to the script in part of
|
||||||
**[Hints](#test)**.
|
[Hints](#test).
|
||||||
|
|
||||||
**[Final thoughts](#thoughts):** You might enjoy what I included; they're
|
[Final thoughts](#thoughts): you might enjoy what I included; they're
|
||||||
humorous pieces by [Dennis Ritchie](#dmr) and [Ken Thompson](#ken) themselves
|
humorous pieces by [Dennis Ritchie](#dmr) and [Ken Thompson](#ken) themselves
|
||||||
from the infamous *UNIX-HATERS Handbook*.
|
from the infamous *UNIX-HATERS Handbook*.
|
||||||
|
|
||||||
**[Winning thoughts](#winning):** What it means to me to win as well as some
|
[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
|
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.
|
||||||
|
|
||||||
|
In 2024 I saw a fun article claiming that a monkey could not in the lifetime of
|
||||||
|
the universe type up even just Hamlet. This, with my brief foray into the Weasel
|
||||||
|
program, was fun and amusing to read, as well as interesting. I give my comments
|
||||||
|
at [my 2024 update](#monkey2024).
|
||||||
|
|
||||||
[FILES]: FILES
|
[FILES]: FILES
|
||||||
[rpm.html]: rpm.html
|
[rpm.html]: rpm.html
|
||||||
|
|
||||||
<div id="what">
|
<div id="what">
|
||||||
## **1. What it is**
|
### What it is
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Skip to [How it works](#how).
|
Skip to [How it works](#how).
|
||||||
@@ -239,7 +254,7 @@ comparison and output will always be capitalised).
|
|||||||
[The Blind Watchmaker]: https://en.wikipedia.org/wiki/The_Blind_Watchmaker
|
[The Blind Watchmaker]: https://en.wikipedia.org/wiki/The_Blind_Watchmaker
|
||||||
|
|
||||||
<div id="how">
|
<div id="how">
|
||||||
## **2. How it works**
|
### How it works
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Skip to [Hints](#hints).
|
Skip to [Hints](#hints).
|
||||||
@@ -323,7 +338,7 @@ question. Later 2018 and all of 2019 was difficult for me so it was like I won a
|
|||||||
second time for the same entry.
|
second time for the same entry.
|
||||||
|
|
||||||
|
|
||||||
### On <del>user</del> monkey errors
|
#### On <del>user</del> monkey errors
|
||||||
|
|
||||||
If the generation reaches `SIZE_MAX - 1` I consider it a monkey (or if you
|
If the generation reaches `SIZE_MAX - 1` I consider it a monkey (or if you
|
||||||
insist: user) error; if the user insists on being so petulant enough as to try
|
insist: user) error; if the user insists on being so petulant enough as to try
|
||||||
@@ -348,7 +363,7 @@ isn't insolent enough to say the user is a monkey for certain!*
|
|||||||
|
|
||||||
|
|
||||||
<div id="hints">
|
<div id="hints">
|
||||||
## **3. Hints**
|
### Hints
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Skip to [Obfuscation](#obfuscation).
|
Skip to [Obfuscation](#obfuscation).
|
||||||
@@ -357,7 +372,7 @@ I noted that there are a number of additional features and here I will document
|
|||||||
some of them.
|
some of them.
|
||||||
|
|
||||||
<div id="keyboards">
|
<div id="keyboards">
|
||||||
### Keyboards
|
#### Keyboards
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Skip to [Options](#options).
|
Skip to [Options](#options).
|
||||||
@@ -383,7 +398,7 @@ can actually produce but there is a certain type of input error that might
|
|||||||
|
|
||||||
|
|
||||||
<div id="options">
|
<div id="options">
|
||||||
### Options
|
#### Options
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Skip to the [obfuscation section](#obfuscation).
|
Skip to the [obfuscation section](#obfuscation).
|
||||||
@@ -393,7 +408,10 @@ string; some I will document here (the summary being in the man page). You can
|
|||||||
join options but there is a caveat with spaces and `-r` option as well as
|
join options but there is a caveat with spaces and `-r` option as well as
|
||||||
the target string (see below).
|
the target string (see below).
|
||||||
|
|
||||||
|
<div id="quiet-mode">
|
||||||
#### Enable quiet output:
|
#### Enable quiet output:
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
-q
|
-q
|
||||||
@@ -559,7 +577,7 @@ the `-` - *in an earlier element of `argv`. This is not a bug!*
|
|||||||
|
|
||||||
|
|
||||||
<div id="easter-egg">
|
<div id="easter-egg">
|
||||||
### Easter egg
|
#### Easter egg
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Skip to [Example Invocations](#invocations).
|
Skip to [Example Invocations](#invocations).
|
||||||
@@ -576,7 +594,7 @@ character in the keyboard. If you want to enable this specially you can use the
|
|||||||
`-m` option (*-m for monkey*).
|
`-m` option (*-m for monkey*).
|
||||||
|
|
||||||
<div id="invocations">
|
<div id="invocations">
|
||||||
### Example Invocations
|
#### Example Invocations
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Skip to [Input Error Example](#error).
|
Skip to [Input Error Example](#error).
|
||||||
@@ -834,7 +852,7 @@ example shows (but the strings will still only be read from the
|
|||||||
`test-strings.txt` file).
|
`test-strings.txt` file).
|
||||||
|
|
||||||
<div id="error">
|
<div id="error">
|
||||||
### Input Error Example
|
#### Input Error Example
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Skip to [Obfuscation](#obfuscation).
|
Skip to [Obfuscation](#obfuscation).
|
||||||
@@ -868,19 +886,19 @@ isspace('\n') == 1`. You can add these characters but the output will be
|
|||||||
rather confusing and hard to read.
|
rather confusing and hard to read.
|
||||||
|
|
||||||
<div id="obfuscation">
|
<div id="obfuscation">
|
||||||
## **4. Obfuscation**
|
### Obfuscation
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
### Techniques
|
#### Techniques
|
||||||
|
|
||||||
Skip to [Beauty](#beauty).
|
Skip to [Beauty](#beauty).
|
||||||
|
|
||||||
The following might be some of the techniques used in this entry:
|
The following might be some of the techniques used in this entry:
|
||||||
|
|
||||||
1. Helpful and descriptive names for all variables and constants (like `S`)
|
0. Helpful and descriptive names for all variables and constants (like `S`)
|
||||||
as well as some C keywords.
|
as well as some C keywords.
|
||||||
|
|
||||||
2. The way `main()` is declared is:
|
1. The way `main()` is declared is:
|
||||||
|
|
||||||
``` <!---c-->
|
``` <!---c-->
|
||||||
/* Special C main() handler (encapsulation): */
|
/* Special C main() handler (encapsulation): */
|
||||||
@@ -895,33 +913,33 @@ encapsulation and executing code is it actually nothing? And if it's nothing why
|
|||||||
is it there? If it is something what is it doing? Could it be both? Or maybe it
|
is it there? If it is something what is it doing? Could it be both? Or maybe it
|
||||||
really isn't nothing or nothing? :)
|
really isn't nothing or nothing? :)
|
||||||
|
|
||||||
3. A special C parser called `H()`. It might help to observe that there
|
2. A special C parser called `H()`. It might help to observe that there
|
||||||
might be recursive calls and much of the program might use it. Or so it seems.
|
might be recursive calls and much of the program might use it. Or so it seems.
|
||||||
Then again it might not help to not notice it.
|
Then again it might not help to not notice it.
|
||||||
|
|
||||||
4. Digraphs. In their simplest form it's probably not a big deal but consider:
|
3. Digraphs. In their simplest form it's probably not a big deal but consider:
|
||||||
some source code formatters don't like them at all (neither, incidentally, does
|
some source code formatters don't like them at all (neither, incidentally, does
|
||||||
`splint`, which completely baulks). There also is a trick; if you try
|
`splint`, which completely baulks). There also is a trick; if you try
|
||||||
translating them then depending upon how you do it there can be functional
|
translating them then depending upon how you do it there can be functional
|
||||||
changes in the program!
|
changes in the program!
|
||||||
|
|
||||||
5. The fact the program can by default print the primorial prime of 97 (*but that
|
4. The fact the program can by default print the primorial prime of 97 (_but that
|
||||||
default isn't the default - except when it IS the default!*) and yet that number
|
default isn't the default - except when it IS the default!_) and yet that number
|
||||||
isn't seen at all. See also technique #7.
|
isn't seen at all. See also technique #7.
|
||||||
|
|
||||||
6. Another usual suspect: the source is formatted in a beautiful design that
|
5. Another usual suspect: the source is formatted in a beautiful design that
|
||||||
could be described artistic; on the other hand some might suggest it's just a
|
could be described artistic; on the other hand some might suggest it's just a
|
||||||
blob of octets *but I disprove this when discussing beauty later on in the next
|
blob of octets *but I disprove this when discussing beauty later on in the next
|
||||||
section.*
|
section.*
|
||||||
|
|
||||||
7. The string **METHINKS IT IS LIKE A WEASEL** is searched for by default
|
6. The string **METHINKS IT IS LIKE A WEASEL** is searched for by default
|
||||||
(except when it's not searched by default) but it's nowhere to be found in the
|
(except when it's not searched by default) but it's nowhere to be found in the
|
||||||
source file in that form. Why? Because anyone familiar with the Weasel program
|
source file in that form. Why? Because anyone familiar with the Weasel program
|
||||||
won't recognise the string and put together what it is by looking at the source
|
won't recognise the string and put together what it is by looking at the source
|
||||||
code.
|
code.
|
||||||
|
|
||||||
In case you wondered deciphering #5 won't decipher #7 (neither will
|
In case you wondered deciphering #4 won't decipher #6 (neither will
|
||||||
deciphering #7 help you decipher #5).
|
deciphering #6 help you decipher #4).
|
||||||
|
|
||||||
<div id="beauty">
|
<div id="beauty">
|
||||||
### Beauty
|
### Beauty
|
||||||
@@ -949,11 +967,11 @@ this is clearly false; *as all good programmers know if something is potentially
|
|||||||
confusing or misleading it should be made clear in the comments! :)*
|
confusing or misleading it should be made clear in the comments! :)*
|
||||||
|
|
||||||
<div id="build">
|
<div id="build">
|
||||||
## **5. How to build**
|
### 5. How to build
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="constants">
|
<div id="constants">
|
||||||
### S, M and N Constants
|
#### S, M and N Constants
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Skip to [Compilation](#compiling).
|
Skip to [Compilation](#compiling).
|
||||||
@@ -1062,7 +1080,7 @@ If you wanted to change the maximum number attempts to 100 you could do:
|
|||||||
### Portability
|
### Portability
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Skip to [An aside on bugs](#bugs).
|
Skip to [Bugs](#bugs).
|
||||||
|
|
||||||
This entry requires at least C99 even if you translate digraphs. The program
|
This entry requires at least C99 even if you translate digraphs. The program
|
||||||
doesn't require third-party libraries and should work on any Unix based system.
|
doesn't require third-party libraries and should work on any Unix based system.
|
||||||
@@ -1127,7 +1145,7 @@ Kernel Version: Darwin 17.5.0
|
|||||||
```
|
```
|
||||||
|
|
||||||
<div id="bugs">
|
<div id="bugs">
|
||||||
#### An aside
|
#### Bugs
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Skip to [Installing](#rpm).
|
Skip to [Installing](#rpm).
|
||||||
@@ -1154,27 +1172,29 @@ Skip to [Final thoughts](#thoughts).
|
|||||||
I have included a RPM spec file for those with a Red Hat based Linux
|
I have included a RPM spec file for those with a Red Hat based Linux
|
||||||
distribution; see [rpm.html](rpm.html) for details (including why I implemented
|
distribution; see [rpm.html](rpm.html) for details (including why I implemented
|
||||||
this) if for some (strange or maybe even mad) reason you're interested, which
|
this) if for some (strange or maybe even mad) reason you're interested, which
|
||||||
basically means nobody but me.
|
I fully realise and always realised means nobody but me. Indeed not only do I
|
||||||
|
know nobody else would use it but I would recommend against it as well. It was a
|
||||||
|
personal thing and since the Judges remarked about it I kept it in.
|
||||||
|
|
||||||
[rpm.html]: rpm.html
|
[rpm.html]: rpm.html
|
||||||
|
|
||||||
<div id="thoughts">
|
<div id="thoughts">
|
||||||
## **6. Final thoughts**
|
### Final thoughts
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Skip to [Winning comments](#winning).
|
Skip to [Winning comments](#winning).
|
||||||
|
|
||||||
The judges suggested that making them laugh helps entries chance of winning.
|
The judges suggested that making them laugh helps entries chance of winning.
|
||||||
Well *laughter helps everything* so in case you haven't seen - and *even if you
|
Well _laughter helps everything_ so in case you haven't seen - and _even if you
|
||||||
have seen* - Dennis Ritchie's anti-foreword to the ghastly *UNIX-HATERS
|
have seen_ - Dennis Ritchie's anti-foreword to the ghastly _UNIX-HATERS
|
||||||
Handbook* or Ken Thompson's revelation that C and Unix are a hoax (at the end of
|
Handbook_ or Ken Thompson's revelation that C and Unix are a hoax (at the end of
|
||||||
that book) I include it below; because I agree that looking at a lot of twisted
|
that book) I include it below; because I agree that looking at a lot of twisted
|
||||||
code must be quite difficult (though maybe not as much as if you were to have to
|
code must be quite difficult (though maybe not as much as if you were to have to
|
||||||
look at Microsoft Windows code or code for Windows in any case ? :)) and these
|
look at Microsoft Windows code or code for Windows in any case ? :)) and these
|
||||||
two things I think are rather amusing (in order of least to most):
|
two things I think are rather amusing (in order of least to most):
|
||||||
|
|
||||||
<div id="dmr">
|
<div id="dmr">
|
||||||
Dennis Ritchie's Anti-Foreword:
|
#### Dennis Ritchie's Anti-Foreword:
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
> Anti-Foreword
|
> Anti-Foreword
|
||||||
@@ -1226,7 +1246,7 @@ albeit not very much (and it still *'compiles'!*); and isn't that what this
|
|||||||
contest is about? :)
|
contest is about? :)
|
||||||
|
|
||||||
<div id="ken">
|
<div id="ken">
|
||||||
Ken Thompson's ending:
|
#### Ken Thompson's ending:
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
> Creators Admit C, Unix Were Hoax
|
> Creators Admit C, Unix Were Hoax
|
||||||
@@ -1255,10 +1275,11 @@ parody of Multics, as well as other more risque allusions.
|
|||||||
added additional cryptic features and evolved into B, BCPL, and finally C. We
|
added additional cryptic features and evolved into B, BCPL, and finally C. We
|
||||||
stopped when we got a clean compile on the following syntax:
|
stopped when we got a clean compile on the following syntax:
|
||||||
>
|
>
|
||||||
> `for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/`<br>
|
``` <!---c-->
|
||||||
> `8)%2))P("|"+(*u/4)%2);`
|
for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/
|
||||||
>
|
8)%2))P("|"+(*u/4)%2);
|
||||||
>
|
```
|
||||||
|
|
||||||
> "To think that modern programmers would try to use a language that allowed
|
> "To think that modern programmers would try to use a language that allowed
|
||||||
such a statement was beyond our comprehension! We actually thought of selling
|
such a statement was beyond our comprehension! We actually thought of selling
|
||||||
this to the Soviets to set their computer science progress back 20 or more
|
this to the Soviets to set their computer science progress back 20 or more
|
||||||
@@ -1289,12 +1310,12 @@ Barnum was correct.
|
|||||||
|
|
||||||
So is it a hoax about a non-hoax, a non-hoax about a hoax, a non-hoax about a
|
So is it a hoax about a non-hoax, a non-hoax about a hoax, a non-hoax about a
|
||||||
non-hoax or is it a hoax about a hoax ? :) And if it's any of those what does it
|
non-hoax or is it a hoax about a hoax ? :) And if it's any of those what does it
|
||||||
mean about Unix and C?** And if a hoax is involved *what is the hoax?* The pedant
|
mean about Unix and C? And if a hoax is involved _what is the hoax?_ The pedant
|
||||||
and Tolkienist that I am has to state that **Tolkien didn't consider The Lord of
|
and Tolkienist that I am has to state that **Tolkien didn't consider The Lord of
|
||||||
the Rings a trilogy** *(and he made that very clear)* but that doesn't take away
|
the Rings a trilogy** _(and he made that very clear)_ but that doesn't take away
|
||||||
from the humour by any stretch (*if anyone wants me to elaborate or debate the
|
from the humour by any stretch (_if anyone wants me to elaborate or debate the
|
||||||
matter do send me an email - I love Tolkien's Legendarium and having another
|
matter do send me an email - I love Tolkien's Legendarium and having another
|
||||||
person to talk about it with is more than welcome!*). Ken suggested that there
|
person to talk about it with is more than welcome!_). Ken suggested that there
|
||||||
is a lack of common sense but since he was part of its creation I don't think
|
is a lack of common sense but since he was part of its creation I don't think
|
||||||
it's a bad thing; **on the contrary it makes all of us C programmers even more
|
it's a bad thing; **on the contrary it makes all of us C programmers even more
|
||||||
talented! :)** I do wonder if he tested that bit of C code though:
|
talented! :)** I do wonder if he tested that bit of C code though:
|
||||||
@@ -1311,7 +1332,7 @@ for the contest but decided for the message by itself in the end). I would
|
|||||||
prefer believing that whether true or not.
|
prefer believing that whether true or not.
|
||||||
|
|
||||||
<div id="winning">
|
<div id="winning">
|
||||||
## **7. Winning comments, thanks, dedications, links, etc.**
|
### Winning comments, thanks, dedications, links, etc.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
I feel incredibly honoured, privileged and I am extremely happy and proud to
|
I feel incredibly honoured, privileged and I am extremely happy and proud to
|
||||||
@@ -1379,6 +1400,59 @@ winning entries as well.
|
|||||||
If you wish to contact me please do so. Please contact via mastodon. You can try
|
If you wish to contact me please do so. Please contact via mastodon. You can try
|
||||||
email but I'm more likely to respond to mastodon messages.
|
email but I'm more likely to respond to mastodon messages.
|
||||||
|
|
||||||
|
<div id="monkey2024">
|
||||||
|
### Update on the Infinite Monkey Theorem, 2024
|
||||||
|
</div>
|
||||||
|
|
||||||
|
On 1 November 2024 I saw an article called [Typing monkey would be unable to
|
||||||
|
produce 'Hamlet' within the lifetime of the universe, study
|
||||||
|
finds](https://phys.org/news/2024-10-monkey-unable-hamlet-lifetime-universe.html).
|
||||||
|
This interested me greatly given my foray into the Infinite Monkey Theorem, for
|
||||||
|
this entry, and I'd like to briefly comment on it.
|
||||||
|
|
||||||
|
What I found interesting is the beginning where it says that it would take far
|
||||||
|
longer than the lifetime of our universe as they say it's still technically true
|
||||||
|
that Eric the monkey could type out the complete works of Shakespeare given
|
||||||
|
enough time, it is misleading.
|
||||||
|
|
||||||
|
With what I did I believe that I have shown how very hard it is and what's more
|
||||||
|
is that something ignored is that even if this was true the monkey would not
|
||||||
|
live long enough. There is one possible exception.
|
||||||
|
|
||||||
|
If Eric was taught to type and to read then it would be possible. But then that
|
||||||
|
would not be the Infinite Monkey Theorem as it says specifically typing at
|
||||||
|
random.
|
||||||
|
|
||||||
|
Another thing that interested me in this article is a quote from the
|
||||||
|
mathematicians:
|
||||||
|
|
||||||
|
> 'The Infinite Monkey Theorem only considers the infinite limit, with either an
|
||||||
|
infinite number of monkeys or an infinite time period of monkey labour,' said
|
||||||
|
Associate Professor Woodcock.
|
||||||
|
|
||||||
|
Yes, this is why it's called the '**Infinite** Monkey Theorem'. It's a fun study
|
||||||
|
to consider, maybe, but it's likely just as silly as the original theorem and
|
||||||
|
even the difference of the Weasel program and the original theory (I believe
|
||||||
|
there are some minor differences as described below).
|
||||||
|
|
||||||
|
A difference from the Weasel program, which is what my entry is, is that the
|
||||||
|
monkey has an easier time by making the keyboard the 26 capital letters and the
|
||||||
|
space bar. I am not sure how exactly this diverges from the Infinite Monkey
|
||||||
|
Theorem, however. They did in this study include punctuation and the letters
|
||||||
|
whereas I also diverged slightly from the Weasel program, namely by including
|
||||||
|
more than just space and the 26 English capital letters, though the alternate
|
||||||
|
version has a simpler keyboard.
|
||||||
|
|
||||||
|
This was both interesting and amusing:
|
||||||
|
|
||||||
|
> The results reveal that it is possible (around a 5% chance) for a single chimp
|
||||||
|
to type the word 'bananas' in its own lifetime.
|
||||||
|
|
||||||
|
My question would be: will Eric be given bananas for typing '_bananas_'? Well
|
||||||
|
we'll probably never know. Still, a silly study for a silly theorem but all in
|
||||||
|
good fun, I suppose.
|
||||||
|
|
||||||
|
|
||||||
[https://ioccc.xexyl.net/2018/weasel]: https://ioccc.xexyl.net/2018/weasel
|
[https://ioccc.xexyl.net/2018/weasel]: https://ioccc.xexyl.net/2018/weasel
|
||||||
[errata page]: https://ioccc.xexyl.net/2018/weasel/errata
|
[errata page]: https://ioccc.xexyl.net/2018/weasel/errata
|
||||||
|
|
||||||
|
|||||||
+117
-59
@@ -509,23 +509,28 @@ while using more Cenozoic minded code migration, read <a href="rpm.html">rpm.htm
|
|||||||
<p>If you find yourself in an evolutionary dead end, try:</p>
|
<p>If you find yourself in an evolutionary dead end, try:</p>
|
||||||
<pre><code> man ./weasel.1</code></pre>
|
<pre><code> man ./weasel.1</code></pre>
|
||||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||||
<ol start="0" type="1">
|
<div id="toc">
|
||||||
<li>Preface</li>
|
<h3 id="table-of-contents">Table of Contents</h3>
|
||||||
<li>What it is</li>
|
</div>
|
||||||
<li>How it works</li>
|
<ul>
|
||||||
<li>Hints (Keyboards, Options, Easter egg, Example Invocations)</li>
|
<li><a href="#preface">Preface</a></li>
|
||||||
<li>Obfuscation (Techniques, Beauty)</li>
|
<li><a href="#what">What it is</a></li>
|
||||||
<li>How to build (S and N Constants, Compilation, Portability, Installing)</li>
|
<li><a href="#how">How it works</a></li>
|
||||||
<li>Final thoughts</li>
|
<li><a href="#hints">Hints (Keyboards, Options, Easter egg, Example Invocations)</a></li>
|
||||||
<li>Winning comments, thanks, dedications, links, etc.</li>
|
<li><a href="#obfuscation">Obfuscation (Techniques, Beauty)</a></li>
|
||||||
</ol>
|
<li><a href="#build">How to build (S and N Constants, Compilation, Portability, Bugs, Installing)</a></li>
|
||||||
<h2 id="preface"><strong>0. Preface</strong></h2>
|
<li><a href="#thoughts">Final thoughts</a></li>
|
||||||
<p><strong>OBFUSCATION NOTES: A great deal of this document and the man page is full of
|
<li><a href="#winning">Winning comments, thanks, dedications, links, etc.</a></li>
|
||||||
obfuscation information of different types; as such I would recommend that you try running the
|
<li><a href="#monkey2024">Update on the Infinite Monkey Theorem, 2024</a></li>
|
||||||
judges suggested invocations as well as running <code>make test</code> before you get into
|
</ul>
|
||||||
the document or the man page, unless you don’t mind reading obfuscation information. I don’t reveal
|
<h3 id="preface">Preface</h3>
|
||||||
much in the way of obfuscation however so if you just want documentation on the
|
<p><strong>OBFUSCATION NOTES</strong>: a great deal of this document and the man page is full of
|
||||||
program, how to compile, etc. then there isn’t need to heed this note.</strong></p>
|
obfuscation information of different types; as such I would recommend that you
|
||||||
|
try running the judges suggested invocations as well as running <code>make test</code>
|
||||||
|
before you get into the document or the man page, unless you don’t mind reading
|
||||||
|
obfuscation information. I don’t reveal much in the way of obfuscation however
|
||||||
|
so if you just want documentation on the program, how to compile, etc. then
|
||||||
|
there isn’t need to heed this note.</p>
|
||||||
<p>I was at a loss on how to present my remarks; on the one hand I wanted to give
|
<p>I was at a loss on how to present my remarks; on the one hand I wanted to give
|
||||||
everything to the judges so they didn’t miss anything. But on the other hand I
|
everything to the judges so they didn’t miss anything. But on the other hand I
|
||||||
didn’t want to reveal as much publicly and many people don’t like to read long
|
didn’t want to reveal as much publicly and many people don’t like to read long
|
||||||
@@ -537,47 +542,52 @@ page (it explains all the options and describes the program briefly):</p>
|
|||||||
possibly the next)</em> where I attempt to give a brief explanation of the sections
|
possibly the next)</em> where I attempt to give a brief explanation of the sections
|
||||||
to make reading it easier and faster. In addition I want to point out a few
|
to make reading it easier and faster. In addition I want to point out a few
|
||||||
things. <em>If you want more details read this document more thoroughly (or just
|
things. <em>If you want more details read this document more thoroughly (or just
|
||||||
the sections that seem relevant to what you’re after).</em> The <a href="FILES">FILES</a> file is a
|
the sections that seem relevant to what you’re after).</em> Because several
|
||||||
quick list of files and respective summaries in this entry. Because several
|
|
||||||
sections are quite long I have added a skip to link to skip to the next
|
sections are quite long I have added a skip to link to skip to the next
|
||||||
subsection or section at the beginning of each section (and subsection).</p>
|
subsection or section at the beginning of each section (and subsection).</p>
|
||||||
<p><strong><a href="#what">What it is</a>:</strong> This is a brief summary of the program; the man page is
|
<p><a href="#what">What it is</a>: this is a brief summary of the program; the man page is
|
||||||
more thorough than this.</p>
|
more thorough than this.</p>
|
||||||
<p><strong><a href="#how">How it works</a>:</strong> Explain some of the basic concepts and terms of the
|
<p><a href="#how">How it works</a>: explains some of the basic concepts and terms of the
|
||||||
program; if you’re familiar with genetic algorithms there won’t be any problem
|
program; if you’re familiar with genetic algorithms there won’t be any problem
|
||||||
following this section but it might be of some value to read anyway. There is a
|
following this section but it might be of some value to read anyway. There is a
|
||||||
randomised mode that doesn’t use a genetic algorithm; it can be triggered a
|
randomised mode that doesn’t use a genetic algorithm; it can be triggered a
|
||||||
number of ways but the <code>-m</code> option enables it specially (I discuss this
|
number of ways but the <code>-m</code> option enables it specially (I discuss this
|
||||||
thoroughly in <strong><a href="#hints">Hints</a></strong>).</p>
|
thoroughly in <a href="#hints">Hints</a>).</p>
|
||||||
<p><strong><a href="#hints">Hints</a>:</strong> Perhaps the longest part of this document because in it I
|
<p><a href="#hints">Hints</a>: perhaps the longest part of this document because in it I
|
||||||
document the <a href="#keyboards">keyboards</a>, <a href="#options">options</a>, subtleties, including
|
document the <a href="#keyboards">keyboards</a>, <a href="#options">options</a>, subtleties, including
|
||||||
features that might appear to be bugs but aren’t - including an
|
features that might appear to be bugs but aren’t - including an
|
||||||
<a href="#error">input error</a>, an <a href="#obfuscation">Easter egg obfuscation</a> and quite a few
|
<a href="#error">input error</a>, an <a href="#obfuscation">Easter egg obfuscation</a> and quite a few
|
||||||
<a href="#invocations">example invocations</a>. If you’ve read the man page you probably
|
<a href="#invocations">example invocations</a>. If you’ve read the man page you probably
|
||||||
don’t need this unless there is something specific you’re after.</p>
|
don’t need this unless there is something specific you’re after.</p>
|
||||||
<p><strong><a href="#obfuscation">Obfuscation</a>:</strong> Some of the techniques that might not be used.</p>
|
<p><a href="#obfuscation">Obfuscation</a>: some of the techniques that might not be used.</p>
|
||||||
<p><strong><a href="#build">How to build</a>:</strong> Here I describe briefly
|
<p><a href="#build">How to build</a>: here I describe briefly
|
||||||
<a href="#constants">the constants that can be redefined</a> <code>S</code>, <code>M</code> and <code>N</code>: the
|
<a href="#constants">the constants that can be redefined</a> <code>S</code>, <code>M</code> and <code>N</code>: the
|
||||||
maximum size of the chromosome (target string; the maximum length is <code>S - 1</code>
|
maximum size of the chromosome (target string; the maximum length is <code>S - 1</code>
|
||||||
but it must be >= the default 38), the number of maximum attempts before giving
|
but it must be >= the default 38), the number of maximum attempts before giving
|
||||||
up and the number of offspring, respectively. I
|
up and the number of offspring, respectively. I
|
||||||
also give <a href="#compiling">example compiler invocations</a>, <a href="#portability">portability
|
also give <a href="#compiling">example compiler invocations</a>, <a href="#portability">portability
|
||||||
notes</a>, an <a href="#bugs">more portability notes</a> and a <a href="rpm.html">note on
|
notes</a>, an <a href="#bugs">more portability notes</a> and a <a href="rpm.html">note on
|
||||||
rpm.html</a>.</p>
|
rpm.html</a>; I obviously <strong>DO NOT</strong> recommend installing it any more than
|
||||||
<p>On the subject of <code>S</code> and <code>N</code>: As the judges’ suggested runs imply you
|
the Judges would, but it was part of my entry for personal reasons and since the
|
||||||
|
Judges remarked about it I have kept it in place.</p>
|
||||||
|
<p>On the subject of <code>S</code> and <code>N</code>: as the judges’ suggested runs imply you
|
||||||
can change the target string at runtime; <code>make test</code> runs a script
|
can change the target string at runtime; <code>make test</code> runs a script
|
||||||
<code>test.sh</code> which reads from the file <code>test-strings.txt</code>, running the program
|
<code>test.sh</code> which reads from the file <code>test-strings.txt</code>, running the program
|
||||||
for each string in the file, waiting approximately two seconds before
|
for each string in the file, waiting approximately two seconds before
|
||||||
continuing. I explain how to pass options to the script in part of
|
continuing. I explain how to pass options to the script in part of
|
||||||
<strong><a href="#test">Hints</a></strong>.</p>
|
<a href="#test">Hints</a>.</p>
|
||||||
<p><strong><a href="#thoughts">Final thoughts</a>:</strong> You might enjoy what I included; they’re
|
<p><a href="#thoughts">Final thoughts</a>: you might enjoy what I included; they’re
|
||||||
humorous pieces by <a href="#dmr">Dennis Ritchie</a> and <a href="#ken">Ken Thompson</a> themselves
|
humorous pieces by <a href="#dmr">Dennis Ritchie</a> and <a href="#ken">Ken Thompson</a> themselves
|
||||||
from the infamous <em>UNIX-HATERS Handbook</em>.</p>
|
from the infamous <em>UNIX-HATERS Handbook</em>.</p>
|
||||||
<p><strong><a href="#winning">Winning thoughts</a>:</strong> What it means to me to win as well as some
|
<p><a href="#winning">Winning thoughts</a>: 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
|
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.</p>
|
dedicated to this entry beyond what will be published on the IOCCC website.</p>
|
||||||
|
<p>In 2024 I saw a fun article claiming that a monkey could not in the lifetime of
|
||||||
|
the universe type up even just Hamlet. This, with my brief foray into the Weasel
|
||||||
|
program, was fun and amusing to read, as well as interesting. I give my comments
|
||||||
|
at <a href="#monkey2024">my 2024 update</a>.</p>
|
||||||
<div id="what">
|
<div id="what">
|
||||||
<h2 id="what-it-is"><strong>1. What it is</strong></h2>
|
<h3 id="what-it-is">What it is</h3>
|
||||||
</div>
|
</div>
|
||||||
<p>Skip to <a href="#how">How it works</a>.</p>
|
<p>Skip to <a href="#how">How it works</a>.</p>
|
||||||
<p>It is an implementation of Richard Dawkins’ <a href="https://en.wikipedia.org/wiki/Weasel_program">Weasel program</a> (Wikipedia).
|
<p>It is an implementation of Richard Dawkins’ <a href="https://en.wikipedia.org/wiki/Weasel_program">Weasel program</a> (Wikipedia).
|
||||||
@@ -609,7 +619,7 @@ algorithm) towards the solution of the string <code>METHINKS IT IS LIKE A WEASEL
|
|||||||
(note that I use <code>toupper()</code> so it doesn’t matter what case the input is the
|
(note that I use <code>toupper()</code> so it doesn’t matter what case the input is the
|
||||||
comparison and output will always be capitalised).</p>
|
comparison and output will always be capitalised).</p>
|
||||||
<div id="how">
|
<div id="how">
|
||||||
<h2 id="how-it-works"><strong>2. How it works</strong></h2>
|
<h3 id="how-it-works">How it works</h3>
|
||||||
</div>
|
</div>
|
||||||
<p>Skip to <a href="#hints">Hints</a>.</p>
|
<p>Skip to <a href="#hints">Hints</a>.</p>
|
||||||
<p>Here you can find a general explanation of a <em><a href="https://web.archive.org/web/20180308131613/http://www.doc.ic.ac.uk/~nd/surprise_96/journal/vol1/hmw/article1.html">genetic algorithm</a></em> as well as a
|
<p>Here you can find a general explanation of a <em><a href="https://web.archive.org/web/20180308131613/http://www.doc.ic.ac.uk/~nd/surprise_96/journal/vol1/hmw/article1.html">genetic algorithm</a></em> as well as a
|
||||||
@@ -684,7 +694,7 @@ without passing in specially?</p>
|
|||||||
<p>I was quite proud that when the next contest came the judges removed that
|
<p>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
|
question. Later 2018 and all of 2019 was difficult for me so it was like I won a
|
||||||
second time for the same entry.</p>
|
second time for the same entry.</p>
|
||||||
<h3 id="on-user-monkey-errors">On <del>user</del> monkey errors</h3>
|
<h4 id="on-user-monkey-errors">On <del>user</del> monkey errors</h4>
|
||||||
<p>If the generation reaches <code>SIZE_MAX - 1</code> I consider it a monkey (or if you
|
<p>If the generation reaches <code>SIZE_MAX - 1</code> I consider it a monkey (or if you
|
||||||
insist: user) error; if the user insists on being so petulant enough as to try
|
insist: user) 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
|
such a ridiculous set of parameters in an attempt to make it be no more
|
||||||
@@ -702,11 +712,11 @@ such a monkey isn’t typing or even doesn’t exist (because it’s not the <em
|
|||||||
Fish Theorem</em>). So although the user might not be a monkey the program makes the
|
Fish Theorem</em>). So although the user might not be a monkey the program makes the
|
||||||
assumption that <strong>the user could in fact be a monkey called Eric</strong> <em>although it
|
assumption that <strong>the user could in fact be a monkey called Eric</strong> <em>although it
|
||||||
isn’t insolent enough to say the user is a monkey for certain!</em></p>
|
isn’t insolent enough to say the user is a monkey for certain!</em></p>
|
||||||
<h2 id="hints"><strong>3. Hints</strong></h2>
|
<h3 id="hints">Hints</h3>
|
||||||
<p>Skip to <a href="#obfuscation">Obfuscation</a>.</p>
|
<p>Skip to <a href="#obfuscation">Obfuscation</a>.</p>
|
||||||
<p>I noted that there are a number of additional features and here I will document
|
<p>I noted that there are a number of additional features and here I will document
|
||||||
some of them.</p>
|
some of them.</p>
|
||||||
<h3 id="keyboards">Keyboards</h3>
|
<h4 id="keyboards">Keyboards</h4>
|
||||||
<p>Skip to <a href="#options">Options</a>.</p>
|
<p>Skip to <a href="#options">Options</a>.</p>
|
||||||
<p>The keyboard, as noted, has more than just the alphabet and space. To be
|
<p>The keyboard, as noted, has more than just the alphabet and space. To be
|
||||||
precise the following characters are acceptable; it equates to this in C (note
|
precise the following characters are acceptable; it equates to this in C (note
|
||||||
@@ -718,13 +728,15 @@ it includes a literal space <code>' '</code> but it doesn’t include other
|
|||||||
<p>The program makes sure that the target string only has characters the keyboard
|
<p>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
|
can actually produce but there is a certain type of input error that might
|
||||||
<em>appear</em> to be a bug; see specifically <a href="#error">Input Error Example</a>.</p>
|
<em>appear</em> to be a bug; see specifically <a href="#error">Input Error Example</a>.</p>
|
||||||
<h3 id="options">Options</h3>
|
<h4 id="options">Options</h4>
|
||||||
<p>Skip to the <a href="#obfuscation">obfuscation section</a>.</p>
|
<p>Skip to the <a href="#obfuscation">obfuscation section</a>.</p>
|
||||||
<p>There are a number of options you can pass to the program besides the target
|
<p>There are a number of options you can pass to the program besides the target
|
||||||
string; some I will document here (the summary being in the man page). You can
|
string; some I will document here (the summary being in the man page). You can
|
||||||
join options but there is a caveat with spaces and <code>-r</code> option as well as
|
join options but there is a caveat with spaces and <code>-r</code> option as well as
|
||||||
the target string (see below).</p>
|
the target string (see below).</p>
|
||||||
|
<div id="quiet-mode">
|
||||||
<h4 id="enable-quiet-output">Enable quiet output:</h4>
|
<h4 id="enable-quiet-output">Enable quiet output:</h4>
|
||||||
|
</div>
|
||||||
<pre><code> -q</code></pre>
|
<pre><code> -q</code></pre>
|
||||||
<p>This means don’t print the generation and offspring output; only print (some) of
|
<p>This means don’t print the generation and offspring output; only print (some) of
|
||||||
the options set (this is always done but wouldn’t usually be seen due to verbose
|
the options set (this is always done but wouldn’t usually be seen due to verbose
|
||||||
@@ -825,7 +837,7 @@ itself) and then the target string would <em>literally</em> be set to <code>-r</
|
|||||||
it no longer cares about the <code>-</code> for option parsing. In other words options
|
it no longer cares about the <code>-</code> for option parsing. In other words options
|
||||||
are only parsed if the first character is <code>-</code> and if the parser hasn’t seen
|
are only parsed if the first character is <code>-</code> and if the parser hasn’t seen
|
||||||
the <code>-</code> - <em>in an earlier element of <code>argv</code>. This is not a bug!</em></p>
|
the <code>-</code> - <em>in an earlier element of <code>argv</code>. This is not a bug!</em></p>
|
||||||
<h3 id="easter-egg">Easter egg</h3>
|
<h4 id="easter-egg">Easter egg</h4>
|
||||||
<p>Skip to <a href="#invocations">Example Invocations</a>.</p>
|
<p>Skip to <a href="#invocations">Example Invocations</a>.</p>
|
||||||
<p>The Easter egg: since Dawkins references the <a href="https://en.wikipedia.org/wiki/Infinite_monkey_theorem">Infinite Monkey Theorem</a> it
|
<p>The Easter egg: since Dawkins references the <a href="https://en.wikipedia.org/wiki/Infinite_monkey_theorem">Infinite Monkey Theorem</a> it
|
||||||
simulates a monkey using a typewriter! This mode has the following changes:</p>
|
simulates a monkey using a typewriter! This mode has the following changes:</p>
|
||||||
@@ -837,7 +849,7 @@ offspring of each generation will be assigned a pseudo-randomly positioned
|
|||||||
character in the keyboard. If you want to enable this specially you can use the
|
character in the keyboard. If you want to enable this specially you can use the
|
||||||
<code>-m</code> option (<em>-m for monkey</em>).</p>
|
<code>-m</code> option (<em>-m for monkey</em>).</p>
|
||||||
<div id="invocations">
|
<div id="invocations">
|
||||||
<h3 id="example-invocations">Example Invocations</h3>
|
<h4 id="example-invocations">Example Invocations</h4>
|
||||||
</div>
|
</div>
|
||||||
<p>Skip to <a href="#error">Input Error Example</a>.</p>
|
<p>Skip to <a href="#error">Input Error Example</a>.</p>
|
||||||
<p>The following examples are used to demonstrate better the command line parsing.
|
<p>The following examples are used to demonstrate better the command line parsing.
|
||||||
@@ -1023,7 +1035,7 @@ script you will have to directly pass the options to the script</strong> like th
|
|||||||
example shows (but the strings will still only be read from the
|
example shows (but the strings will still only be read from the
|
||||||
<code>test-strings.txt</code> file).</p>
|
<code>test-strings.txt</code> file).</p>
|
||||||
<div id="error">
|
<div id="error">
|
||||||
<h3 id="input-error-example">Input Error Example</h3>
|
<h4 id="input-error-example">Input Error Example</h4>
|
||||||
</div>
|
</div>
|
||||||
<p>Skip to <a href="#obfuscation">Obfuscation</a>.</p>
|
<p>Skip to <a href="#obfuscation">Obfuscation</a>.</p>
|
||||||
<p>There is a type of input error, as I said, that might appear to be a bug. What
|
<p>There is a type of input error, as I said, that might appear to be a bug. What
|
||||||
@@ -1048,11 +1060,11 @@ invalid character (<code>'\n'</code> itself which means another line break) and
|
|||||||
finally the closing <code>'</code>. Specifically <code>isspace()</code> characters aren’t
|
finally the closing <code>'</code>. Specifically <code>isspace()</code> characters aren’t
|
||||||
distinctly seen like a letter, digit or symbol is: <code>isprint('\n') == 0 && isspace('\n') == 1</code>. You can add these characters but the output will be
|
distinctly seen like a letter, digit or symbol is: <code>isprint('\n') == 0 && isspace('\n') == 1</code>. You can add these characters but the output will be
|
||||||
rather confusing and hard to read.</p>
|
rather confusing and hard to read.</p>
|
||||||
<h2 id="obfuscation"><strong>4. Obfuscation</strong></h2>
|
<h3 id="obfuscation">Obfuscation</h3>
|
||||||
<h3 id="techniques">Techniques</h3>
|
<h4 id="techniques">Techniques</h4>
|
||||||
<p>Skip to <a href="#beauty">Beauty</a>.</p>
|
<p>Skip to <a href="#beauty">Beauty</a>.</p>
|
||||||
<p>The following might be some of the techniques used in this entry:</p>
|
<p>The following might be some of the techniques used in this entry:</p>
|
||||||
<ol type="1">
|
<ol start="0" type="1">
|
||||||
<li><p>Helpful and descriptive names for all variables and constants (like <code>S</code>)
|
<li><p>Helpful and descriptive names for all variables and constants (like <code>S</code>)
|
||||||
as well as some C keywords.</p></li>
|
as well as some C keywords.</p></li>
|
||||||
<li><p>The way <code>main()</code> is declared is:</p></li>
|
<li><p>The way <code>main()</code> is declared is:</p></li>
|
||||||
@@ -1066,7 +1078,7 @@ isn’t encapsulation and also isn’t executing code but assuming it’s
|
|||||||
encapsulation and executing code is it actually nothing? And if it’s nothing why
|
encapsulation and executing code is it actually nothing? And if it’s nothing why
|
||||||
is it there? If it is something what is it doing? Could it be both? Or maybe it
|
is it there? If it is something what is it doing? Could it be both? Or maybe it
|
||||||
really isn’t nothing or nothing? :)</p>
|
really isn’t nothing or nothing? :)</p>
|
||||||
<ol start="3" type="1">
|
<ol start="2" type="1">
|
||||||
<li><p>A special C parser called <code>H()</code>. It might help to observe that there
|
<li><p>A special C parser called <code>H()</code>. It might help to observe that there
|
||||||
might be recursive calls and much of the program might use it. Or so it seems.
|
might be recursive calls and much of the program might use it. Or so it seems.
|
||||||
Then again it might not help to not notice it.</p></li>
|
Then again it might not help to not notice it.</p></li>
|
||||||
@@ -1088,8 +1100,8 @@ source file in that form. Why? Because anyone familiar with the Weasel program
|
|||||||
won’t recognise the string and put together what it is by looking at the source
|
won’t recognise the string and put together what it is by looking at the source
|
||||||
code.</p></li>
|
code.</p></li>
|
||||||
</ol>
|
</ol>
|
||||||
<p>In case you wondered deciphering #5 won’t decipher #7 (neither will
|
<p>In case you wondered deciphering #4 won’t decipher #6 (neither will
|
||||||
deciphering #7 help you decipher #5).</p>
|
deciphering #6 help you decipher #4).</p>
|
||||||
<h3 id="beauty">Beauty</h3>
|
<h3 id="beauty">Beauty</h3>
|
||||||
<p>Skip to <a href="#build">How to build</a>.</p>
|
<p>Skip to <a href="#build">How to build</a>.</p>
|
||||||
<p>On the subject of beauty: the judges stated in the guidelines the following:</p>
|
<p>On the subject of beauty: the judges stated in the guidelines the following:</p>
|
||||||
@@ -1110,10 +1122,10 @@ some of it might look like a blob (for certain definitions of ‘blob’ :) ) bu
|
|||||||
this is clearly false; <em>as all good programmers know if something is potentially
|
this is clearly false; <em>as all good programmers know if something is potentially
|
||||||
confusing or misleading it should be made clear in the comments! :)</em></p>
|
confusing or misleading it should be made clear in the comments! :)</em></p>
|
||||||
<div id="build">
|
<div id="build">
|
||||||
<h2 id="how-to-build"><strong>5. How to build</strong></h2>
|
<h3 id="how-to-build">5. How to build</h3>
|
||||||
</div>
|
</div>
|
||||||
<div id="constants">
|
<div id="constants">
|
||||||
<h3 id="s-m-and-n-constants">S, M and N Constants</h3>
|
<h4 id="s-m-and-n-constants">S, M and N Constants</h4>
|
||||||
</div>
|
</div>
|
||||||
<p>Skip to <a href="#compiling">Compilation</a>.</p>
|
<p>Skip to <a href="#compiling">Compilation</a>.</p>
|
||||||
<p>There are three <code>#define</code>d constants that can be redefined at compilation to modify the
|
<p>There are three <code>#define</code>d constants that can be redefined at compilation to modify the
|
||||||
@@ -1174,7 +1186,7 @@ result. Remember too that <code>S</code> (<code>MAX_SIZE</code>) cannot be less
|
|||||||
<p>If you wanted to change the maximum number attempts to 100 you could do:</p>
|
<p>If you wanted to change the maximum number attempts to 100 you could do:</p>
|
||||||
<pre><code> make clobber MAX_ATTEMPTS=100 everything</code></pre>
|
<pre><code> make clobber MAX_ATTEMPTS=100 everything</code></pre>
|
||||||
<h3 id="portability">Portability</h3>
|
<h3 id="portability">Portability</h3>
|
||||||
<p>Skip to <a href="#bugs">An aside on bugs</a>.</p>
|
<p>Skip to <a href="#bugs">Bugs</a>.</p>
|
||||||
<p>This entry requires at least C99 even if you translate digraphs. The program
|
<p>This entry requires at least C99 even if you translate digraphs. The program
|
||||||
doesn’t require third-party libraries and should work on any Unix based system.
|
doesn’t require third-party libraries and should work on any Unix based system.
|
||||||
It works on both 64-bit and 32-bit (but inevitably some data type sizes will be
|
It works on both 64-bit and 32-bit (but inevitably some data type sizes will be
|
||||||
@@ -1219,9 +1231,7 @@ Kernel Version: Darwin 17.5.0</p>
|
|||||||
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
|
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
|
||||||
$ uname -srmv
|
$ uname -srmv
|
||||||
Darwin 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar 5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64</code></pre>
|
Darwin 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar 5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64</code></pre>
|
||||||
<div id="bugs">
|
<h4 id="bugs">Bugs</h4>
|
||||||
<h4 id="an-aside">An aside</h4>
|
|
||||||
</div>
|
|
||||||
<p>Skip to <a href="#rpm">Installing</a>.</p>
|
<p>Skip to <a href="#rpm">Installing</a>.</p>
|
||||||
<p>Any undocumented bugs are the result of insolent monkeys tampering with any
|
<p>Any undocumented bugs are the result of insolent monkeys tampering with any
|
||||||
number of things. That includes but is not limited to running the program on a
|
number of things. That includes but is not limited to running the program on a
|
||||||
@@ -1242,9 +1252,11 @@ however leaving it as it is because this is what won.</p>
|
|||||||
<p>I have included a RPM spec file for those with a Red Hat based Linux
|
<p>I have included a RPM spec file for those with a Red Hat based Linux
|
||||||
distribution; see <a href="rpm.html">rpm.html</a> for details (including why I implemented
|
distribution; see <a href="rpm.html">rpm.html</a> for details (including why I implemented
|
||||||
this) if for some (strange or maybe even mad) reason you’re interested, which
|
this) if for some (strange or maybe even mad) reason you’re interested, which
|
||||||
basically means nobody but me.</p>
|
I fully realise and always realised means nobody but me. Indeed not only do I
|
||||||
|
know nobody else would use it but I would recommend against it as well. It was a
|
||||||
|
personal thing and since the Judges remarked about it I kept it in.</p>
|
||||||
<div id="thoughts">
|
<div id="thoughts">
|
||||||
<h2 id="final-thoughts"><strong>6. Final thoughts</strong></h2>
|
<h3 id="final-thoughts">Final thoughts</h3>
|
||||||
</div>
|
</div>
|
||||||
<p>Skip to <a href="#winning">Winning comments</a>.</p>
|
<p>Skip to <a href="#winning">Winning comments</a>.</p>
|
||||||
<p>The judges suggested that making them laugh helps entries chance of winning.
|
<p>The judges suggested that making them laugh helps entries chance of winning.
|
||||||
@@ -1256,7 +1268,7 @@ code must be quite difficult (though maybe not as much as if you were to have to
|
|||||||
look at Microsoft Windows code or code for Windows in any case ? :)) and these
|
look at Microsoft Windows code or code for Windows in any case ? :)) and these
|
||||||
two things I think are rather amusing (in order of least to most):</p>
|
two things I think are rather amusing (in order of least to most):</p>
|
||||||
<div id="dmr">
|
<div id="dmr">
|
||||||
<p>Dennis Ritchie’s Anti-Foreword:</p>
|
<h4 id="dennis-ritchies-anti-foreword">Dennis Ritchie’s Anti-Foreword:</h4>
|
||||||
</div>
|
</div>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p>Anti-Foreword</p>
|
<p>Anti-Foreword</p>
|
||||||
@@ -1299,7 +1311,7 @@ and since it doesn’t break his message it’s not broken - it’s just obfusca
|
|||||||
albeit not very much (and it still <em>‘compiles’!</em>); and isn’t that what this
|
albeit not very much (and it still <em>‘compiles’!</em>); and isn’t that what this
|
||||||
contest is about? :)</p>
|
contest is about? :)</p>
|
||||||
<div id="ken">
|
<div id="ken">
|
||||||
<p>Ken Thompson’s ending:</p>
|
<h4 id="ken-thompsons-ending">Ken Thompson’s ending:</h4>
|
||||||
</div>
|
</div>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p>Creators Admit C, Unix Were Hoax</p>
|
<p>Creators Admit C, Unix Were Hoax</p>
|
||||||
@@ -1322,8 +1334,10 @@ parody of Multics, as well as other more risque allusions.</p>
|
|||||||
<p>“Then Dennis and Brian worked on a truly warped version of Pascal, called”A.” When we found others were actually trying to programs with A, we quickly
|
<p>“Then Dennis and Brian worked on a truly warped version of Pascal, called”A.” When we found others were actually trying to programs with A, we quickly
|
||||||
added additional cryptic features and evolved into B, BCPL, and finally C. We
|
added additional cryptic features and evolved into B, BCPL, and finally C. We
|
||||||
stopped when we got a clean compile on the following syntax:</p>
|
stopped when we got a clean compile on the following syntax:</p>
|
||||||
<p><code>for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/</code><br>
|
</blockquote>
|
||||||
<code>8)%2))P("|"+(*u/4)%2);</code></p>
|
<pre><code> for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/
|
||||||
|
8)%2))P("|"+(*u/4)%2);</code></pre>
|
||||||
|
<blockquote>
|
||||||
<p>“To think that modern programmers would try to use a language that allowed
|
<p>“To think that modern programmers would try to use a language that allowed
|
||||||
such a statement was beyond our comprehension! We actually thought of selling
|
such a statement was beyond our comprehension! We actually thought of selling
|
||||||
this to the Soviets to set their computer science progress back 20 or more
|
this to the Soviets to set their computer science progress back 20 or more
|
||||||
@@ -1351,7 +1365,7 @@ Barnum was correct.</p>
|
|||||||
<hr>
|
<hr>
|
||||||
<p>So is it a hoax about a non-hoax, a non-hoax about a hoax, a non-hoax about a
|
<p>So is it a hoax about a non-hoax, a non-hoax about a hoax, a non-hoax about a
|
||||||
non-hoax or is it a hoax about a hoax ? :) And if it’s any of those what does it
|
non-hoax or is it a hoax about a hoax ? :) And if it’s any of those what does it
|
||||||
mean about Unix and C?** And if a hoax is involved <em>what is the hoax?</em> The pedant
|
mean about Unix and C? And if a hoax is involved <em>what is the hoax?</em> The pedant
|
||||||
and Tolkienist that I am has to state that <strong>Tolkien didn’t consider The Lord of
|
and Tolkienist that I am has to state that <strong>Tolkien didn’t consider The Lord of
|
||||||
the Rings a trilogy</strong> <em>(and he made that very clear)</em> but that doesn’t take away
|
the Rings a trilogy</strong> <em>(and he made that very clear)</em> but that doesn’t take away
|
||||||
from the humour by any stretch (<em>if anyone wants me to elaborate or debate the
|
from the humour by any stretch (<em>if anyone wants me to elaborate or debate the
|
||||||
@@ -1368,7 +1382,7 @@ I’m missing but either way it’s a funny piece. It could also be for irony it
|
|||||||
for the contest but decided for the message by itself in the end). I would
|
for the contest but decided for the message by itself in the end). I would
|
||||||
prefer believing that whether true or not.</p>
|
prefer believing that whether true or not.</p>
|
||||||
<div id="winning">
|
<div id="winning">
|
||||||
<h2 id="winning-comments-thanks-dedications-links-etc."><strong>7. Winning comments, thanks, dedications, links, etc.</strong></h2>
|
<h3 id="winning-comments-thanks-dedications-links-etc.">Winning comments, thanks, dedications, links, etc.</h3>
|
||||||
</div>
|
</div>
|
||||||
<p>I feel incredibly honoured, privileged and I am extremely happy and proud to
|
<p>I feel incredibly honoured, privileged and I am extremely happy and proud to
|
||||||
have won! I am more proud and happy about this than anything I have ever done in
|
have won! I am more proud and happy about this than anything I have ever done in
|
||||||
@@ -1424,6 +1438,50 @@ what’s already published on the IOCCC website). I have commentary on the other
|
|||||||
winning entries as well.</p>
|
winning entries as well.</p>
|
||||||
<p>If you wish to contact me please do so. Please contact via mastodon. You can try
|
<p>If you wish to contact me please do so. Please contact via mastodon. You can try
|
||||||
email but I’m more likely to respond to mastodon messages.</p>
|
email but I’m more likely to respond to mastodon messages.</p>
|
||||||
|
<div id="monkey2024">
|
||||||
|
<h3 id="update-on-the-infinite-monkey-theorem-2024">Update on the Infinite Monkey Theorem, 2024</h3>
|
||||||
|
</div>
|
||||||
|
<p>On 1 November 2024 I saw an article called <a href="https://phys.org/news/2024-10-monkey-unable-hamlet-lifetime-universe.html">Typing monkey would be unable to
|
||||||
|
produce ‘Hamlet’ within the lifetime of the universe, study
|
||||||
|
finds</a>.
|
||||||
|
This interested me greatly given my foray into the Infinite Monkey Theorem, for
|
||||||
|
this entry, and I’d like to briefly comment on it.</p>
|
||||||
|
<p>What I found interesting is the beginning where it says that it would take far
|
||||||
|
longer than the lifetime of our universe as they say it’s still technically true
|
||||||
|
that Eric the monkey could type out the complete works of Shakespeare given
|
||||||
|
enough time, it is misleading.</p>
|
||||||
|
<p>With what I did I believe that I have shown how very hard it is and what’s more
|
||||||
|
is that something ignored is that even if this was true the monkey would not
|
||||||
|
live long enough. There is one possible exception.</p>
|
||||||
|
<p>If Eric was taught to type and to read then it would be possible. But then that
|
||||||
|
would not be the Infinite Monkey Theorem as it says specifically typing at
|
||||||
|
random.</p>
|
||||||
|
<p>Another thing that interested me in this article is a quote from the
|
||||||
|
mathematicians:</p>
|
||||||
|
<blockquote>
|
||||||
|
<p>‘The Infinite Monkey Theorem only considers the infinite limit, with either an
|
||||||
|
infinite number of monkeys or an infinite time period of monkey labour,’ said
|
||||||
|
Associate Professor Woodcock.</p>
|
||||||
|
</blockquote>
|
||||||
|
<p>Yes, this is why it’s called the ‘<strong>Infinite</strong> Monkey Theorem’. It’s a fun study
|
||||||
|
to consider, maybe, but it’s likely just as silly as the original theorem and
|
||||||
|
even the difference of the Weasel program and the original theory (I believe
|
||||||
|
there are some minor differences as described below).</p>
|
||||||
|
<p>A difference from the Weasel program, which is what my entry is, is that the
|
||||||
|
monkey has an easier time by making the keyboard the 26 capital letters and the
|
||||||
|
space bar. I am not sure how exactly this diverges from the Infinite Monkey
|
||||||
|
Theorem, however. They did in this study include punctuation and the letters
|
||||||
|
whereas I also diverged slightly from the Weasel program, namely by including
|
||||||
|
more than just space and the 26 English capital letters, though the alternate
|
||||||
|
version has a simpler keyboard.</p>
|
||||||
|
<p>This was both interesting and amusing:</p>
|
||||||
|
<blockquote>
|
||||||
|
<p>The results reveal that it is possible (around a 5% chance) for a single chimp
|
||||||
|
to type the word ‘bananas’ in its own lifetime.</p>
|
||||||
|
</blockquote>
|
||||||
|
<p>My question would be: will Eric be given bananas for typing ‘<em>bananas</em>’? Well
|
||||||
|
we’ll probably never know. Still, a silly study for a silly theorem but all in
|
||||||
|
good fun, I suppose.</p>
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
|
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
|
||||||
|
|||||||
Reference in new issue
Block a user