Merge pull request #167 from xexyl/oregon
Several updates to 2024/ferguson1 Lets update the commits and PRs pending and then process and X's.
This commit is contained in:
5 files changed
+87
-21
No files matched your search
@@ -9,6 +9,7 @@ addpadding
|
||||
bytecheck
|
||||
bytecount
|
||||
byteread
|
||||
bytes.txt
|
||||
bytetest
|
||||
data
|
||||
data.asc
|
||||
|
||||
+38
-10
@@ -46,18 +46,34 @@ figure out how this program actually does what it does.
|
||||
Before you set off on your adventure to decode this program's logic, make
|
||||
sure you have enough food, ammo, clothes, oxen, and programming supplies.
|
||||
You’ll be driving for 2170 miles through a wild wilderness inspired
|
||||
by Oregon, so you’ll need to be prepared for anything! Regardless of
|
||||
by [Oregon Trail](https://en.wikipedia.org/wiki/The_Oregon_Trail_(series)), so you’ll need to be prepared for anything! Regardless of
|
||||
how well prepared you are, you will have a devil of a time jumping around
|
||||
inside this C code. :-)
|
||||
|
||||
|
||||
## Author's remarks:
|
||||
|
||||
|
||||
<div id="devil">
|
||||
### A Pact With the Devil On the Oregon Trail (...and his 134 regrets of goto)
|
||||
</div>
|
||||
|
||||
<hr style="width:10%;text-align:left;margin-left:0">
|
||||
|
||||
> Fun fact: after winning this, the author played the game in gdb from start to
|
||||
finish and not counting macros but counting all function calls (not libc
|
||||
functions, functions in prog.c), there were a total of **985** (!) line jumps.
|
||||
The prog.c, counting `#include`s, `#define`s, functions and some lines that have
|
||||
only braces, as well as 14 blank lines, has only 85 lines. A very tiny fraction
|
||||
of the time a line might be repeated in a row ONCE but that does not really matter.
|
||||
|
||||
**NOTE**: I actually submitted two versions. This one is not encrypted. The
|
||||
encrypted one even encrypted emojis without having to decrypt them in order to
|
||||
print them (and everything else). I have kept references to encryption in this
|
||||
file even after publication. I do have a copy of it if anyone is interested.
|
||||
|
||||
<hr style="width:10%;text-align:left;margin-left:0">
|
||||
|
||||
|
||||
The **Go To Hell In A Handcart Travel Company** PROUDLY welcomes all sinners to
|
||||
our GREATEST destination yet, with:
|
||||
|
||||
@@ -78,7 +94,7 @@ all the way back to the 1950s, all the while taking place in the 1800s),
|
||||
**PLEASE** either read the (probably totally unnecessary)
|
||||
[disclaimer](#disclaimer) or skip this perilous journey entirely. Obviously the
|
||||
judges will have no choice in the matter :-) but it's not really for them anyway
|
||||
but rather in case this wins.
|
||||
but rather in case this wins (which, of course, it did).
|
||||
|
||||
Everyone might or might not want to look at the [commentary on the
|
||||
jokes](#jokes) as well as the [humour](#humour) section, [historical
|
||||
@@ -2954,7 +2970,7 @@ comparison):
|
||||
|
||||
and of course some of those spaces are not necessary but some are. I think you
|
||||
get the idea: my code is **FAR MORE** compact than the original game (and I do
|
||||
it with **MORE** gotos too) and I do more and even have lots of jokes even in
|
||||
it with **MORE** `goto`s too) and I do more and even have lots of jokes even in
|
||||
the code, and the code is also thematic! Now to be fair there are some things
|
||||
that my code does not do but the original does: it requires you to type some
|
||||
strings and it requires you to choose how to eat and tactics for the riders. But
|
||||
@@ -3233,18 +3249,29 @@ traits I do not even know how to describe. Perhaps they would be utterly
|
||||
ineffable.
|
||||
|
||||
Actually I wanted to see what it was like. It was VERY amusing - but only
|
||||
because I did not have to debug it. I ran out of files to include and I'm low on
|
||||
because I did not have to debug it. For the submission I included line changes
|
||||
for JUST the third prompt. It looked like:
|
||||
time (mere hours left) but to get to JUST the third prompt this is the lines it
|
||||
went in the following sequence:
|
||||
|
||||
```
|
||||
19 20 21 32 69 82 34 33 34 47 45 47 50 83 34 33 34 47 45 47 50 83 34 33 34
|
||||
```
|
||||
|
||||
The game loop is almost certainly much worse, especially those two for loops I
|
||||
mentioned, but there is much much more. If this is easier to follow then I'm a
|
||||
dragon. I'm not a dragon. I have a secret for you: dragons don't exist. Except
|
||||
on the Oregon Trail.
|
||||
I said the game loop is almost certainly much worse, especially those two for
|
||||
loops I mentioned, but there is much much more. If this is easier to follow then
|
||||
I'm a dragon. I'm not a dragon. I have a secret for you: dragons don't exist.
|
||||
Except on the Oregon Trail.
|
||||
|
||||
I was right too: the entire game is worse, far far worse. After this won I did a
|
||||
full sequence. This is from start to finish and I include it for your amusement.
|
||||
Or horror. There are a few times where the line is the same but that only shows
|
||||
how very often the line changes. It is a total of 985 changes, counting
|
||||
function calls (i.e. each call to one of the few functions is a jump); calls to
|
||||
the macros are not counted.
|
||||
|
||||
This is in a program that is JUST 85 lines! A program that has only 85 lines
|
||||
COUNTING the `#include`s, `#define`s, other functions and 14 blank lines that
|
||||
jumps 985 times is astonishing.
|
||||
|
||||
> I have yet to see a single study that supported the supposition that GOTOs are
|
||||
harmful (I presume this is not because nobody has tried). Nonetheless, people
|
||||
@@ -3263,6 +3290,7 @@ my program - or maintain it. Or write it.
|
||||
It would have been SO MUCH EASIER if I did not use 134 `goto`s. Actually, even a
|
||||
tiny portion of that would make it harder. Nobody, whether they're in their
|
||||
right mind or not, would WANT to maintain this, or something even close to it.
|
||||
Feel free to pass on judgement to me. I welcome it!
|
||||
|
||||
Even flex/bison code, which as far as I am aware uses FAR fewer `goto`s, is
|
||||
notorious for `goto`s and is quite hard to follow. It would be a nightmare to
|
||||
|
||||
+35
-11
@@ -491,13 +491,27 @@ figure out how this program actually does what it does.</p>
|
||||
<p>Before you set off on your adventure to decode this program’s logic, make
|
||||
sure you have enough food, ammo, clothes, oxen, and programming supplies.
|
||||
You’ll be driving for 2170 miles through a wild wilderness inspired
|
||||
by Oregon, so you’ll need to be prepared for anything! Regardless of
|
||||
by <a href="https://en.wikipedia.org/wiki/The_Oregon_Trail_(series)">Oregon Trail</a>, so you’ll need to be prepared for anything! Regardless of
|
||||
how well prepared you are, you will have a devil of a time jumping around
|
||||
inside this C code. :-)</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<div id="devil">
|
||||
<h3 id="a-pact-with-the-devil-on-the-oregon-trail-and-his-134-regrets-of-goto">A Pact With the Devil On the Oregon Trail (…and his 134 regrets of goto)</h3>
|
||||
</div>
|
||||
<hr style="width:10%;text-align:left;margin-left:0">
|
||||
<blockquote>
|
||||
<p>Fun fact: after winning this, the author played the game in gdb from start to
|
||||
finish and not counting macros but counting all function calls (not libc
|
||||
functions, functions in prog.c), there were a total of <strong>985</strong> (!) line jumps.
|
||||
The prog.c, counting <code>#include</code>s, <code>#define</code>s, functions and some lines that have
|
||||
only braces, as well as 14 blank lines, has only 85 lines. A very tiny fraction
|
||||
of the time a line might be repeated in a row ONCE but that does not really matter.</p>
|
||||
</blockquote>
|
||||
<p><strong>NOTE</strong>: I actually submitted two versions. This one is not encrypted. The
|
||||
encrypted one even encrypted emojis without having to decrypt them in order to
|
||||
print them (and everything else). I have kept references to encryption in this
|
||||
file even after publication. I do have a copy of it if anyone is interested.</p>
|
||||
<hr style="width:10%;text-align:left;margin-left:0">
|
||||
<p>The <strong>Go To Hell In A Handcart Travel Company</strong> PROUDLY welcomes all sinners to
|
||||
our GREATEST destination yet, with:</p>
|
||||
<p><img src="devil.png"
|
||||
@@ -514,7 +528,7 @@ all the way back to the 1950s, all the while taking place in the 1800s),
|
||||
<strong>PLEASE</strong> either read the (probably totally unnecessary)
|
||||
<a href="#disclaimer">disclaimer</a> or skip this perilous journey entirely. Obviously the
|
||||
judges will have no choice in the matter :-) but it’s not really for them anyway
|
||||
but rather in case this wins.</p>
|
||||
but rather in case this wins (which, of course, it did).</p>
|
||||
<p>Everyone might or might not want to look at the <a href="#jokes">commentary on the
|
||||
jokes</a> as well as the <a href="#humour">humour</a> section, <a href="#history">historical
|
||||
references</a> and <a href="#cultural">cultural references</a> as well. The
|
||||
@@ -2841,7 +2855,7 @@ comparison):</p>
|
||||
3826</code></pre>
|
||||
<p>and of course some of those spaces are not necessary but some are. I think you
|
||||
get the idea: my code is <strong>FAR MORE</strong> compact than the original game (and I do
|
||||
it with <strong>MORE</strong> gotos too) and I do more and even have lots of jokes even in
|
||||
it with <strong>MORE</strong> <code>goto</code>s too) and I do more and even have lots of jokes even in
|
||||
the code, and the code is also thematic! Now to be fair there are some things
|
||||
that my code does not do but the original does: it requires you to type some
|
||||
strings and it requires you to choose how to eat and tactics for the riders. But
|
||||
@@ -3070,14 +3084,23 @@ proverbial hat to them. They would have to be extremely patient - and have
|
||||
traits I do not even know how to describe. Perhaps they would be utterly
|
||||
ineffable.</p>
|
||||
<p>Actually I wanted to see what it was like. It was VERY amusing - but only
|
||||
because I did not have to debug it. I ran out of files to include and I’m low on
|
||||
time (mere hours left) but to get to JUST the third prompt this is the lines it
|
||||
went in the following sequence:</p>
|
||||
because I did not have to debug it. For the submission I included line changes
|
||||
for JUST the third prompt. It looked like:
|
||||
time (mere hours left) but to get to JUST the third prompt this is the lines it</p>
|
||||
<pre><code> 19 20 21 32 69 82 34 33 34 47 45 47 50 83 34 33 34 47 45 47 50 83 34 33 34</code></pre>
|
||||
<p>The game loop is almost certainly much worse, especially those two for loops I
|
||||
mentioned, but there is much much more. If this is easier to follow then I’m a
|
||||
dragon. I’m not a dragon. I have a secret for you: dragons don’t exist. Except
|
||||
on the Oregon Trail.</p>
|
||||
<p>I said the game loop is almost certainly much worse, especially those two for
|
||||
loops I mentioned, but there is much much more. If this is easier to follow then
|
||||
I’m a dragon. I’m not a dragon. I have a secret for you: dragons don’t exist.
|
||||
Except on the Oregon Trail.</p>
|
||||
<p>I was right too: the entire game is worse, far far worse. After this won I did a
|
||||
full sequence. This is from start to finish and I include it for your amusement.
|
||||
Or horror. There are a few times where the line is the same but that only shows
|
||||
how very often the line changes. It is a total of 985 changes, counting
|
||||
function calls (i.e. each call to one of the few functions is a jump); calls to
|
||||
the macros are not counted.</p>
|
||||
<p>This is in a program that is JUST 85 lines! A program that has only 85 lines
|
||||
COUNTING the <code>#include</code>s, <code>#define</code>s, other functions and 14 blank lines that
|
||||
jumps 985 times is astonishing.</p>
|
||||
<blockquote>
|
||||
<p>I have yet to see a single study that supported the supposition that GOTOs are
|
||||
harmful (I presume this is not because nobody has tried). Nonetheless, people
|
||||
@@ -3093,7 +3116,8 @@ sure is WRONG NOW. Anyone who thinks otherwise needs to try and debug
|
||||
my program - or maintain it. Or write it.</p>
|
||||
<p>It would have been SO MUCH EASIER if I did not use 134 <code>goto</code>s. Actually, even a
|
||||
tiny portion of that would make it harder. Nobody, whether they’re in their
|
||||
right mind or not, would WANT to maintain this, or something even close to it.</p>
|
||||
right mind or not, would WANT to maintain this, or something even close to it.
|
||||
Feel free to pass on judgement to me. I welcome it!</p>
|
||||
<p>Even flex/bison code, which as far as I am aware uses FAR fewer <code>goto</code>s, is
|
||||
notorious for <code>goto</code>s and is quite hard to follow. It would be a nightmare to
|
||||
try and maintain without the .l/.y source files.</p>
|
||||
|
||||
@@ -509,6 +509,12 @@ that many and that is ridiculous.</p>
|
||||
YES I think it’s HILARIOUS. But if it was not for the IOCCC… Well, as I
|
||||
mention in my <a href="#devil">remarks above</a>, EVEN ONE IS TOO MANY
|
||||
in real code.</p>
|
||||
<p>I dare you to run the program in a debugger from start to finish to see how many
|
||||
line jumps there truly are. After I won I did it once: in a program with just 85
|
||||
lines (14 blank, some with just a brace, <code>#include</code>s, <code>#define</code>s included) there
|
||||
were a total of 985 line changes (a tiny tiny fraction had the same line number
|
||||
repeated once). I rarely went to the fort and I only hunted once (I might not
|
||||
have hunted at all). This is obscene.</p>
|
||||
<p>The best (or worst, depending on how you look at it :-) ) part is this works. As
|
||||
I note in those concluding remarks, a company actually introduced a security
|
||||
hole from ONE <code>goto</code>. Yet I have 116/134 and it actually works? That is surely
|
||||
|
||||
@@ -67,6 +67,13 @@ YES I think it's HILARIOUS. But if it was not for the IOCCC... Well, as I
|
||||
mention in my [remarks above](#devil), EVEN ONE IS TOO MANY
|
||||
in real code.
|
||||
|
||||
I dare you to run the program in a debugger from start to finish to see how many
|
||||
line jumps there truly are. After I won I did it once: in a program with just 85
|
||||
lines (14 blank, some with just a brace, `#include`s, `#define`s included) there
|
||||
were a total of 985 line changes (a tiny tiny fraction had the same line number
|
||||
repeated once). I rarely went to the fort and I only hunted once (I might not
|
||||
have hunted at all). This is obscene.
|
||||
|
||||
The best (or worst, depending on how you look at it :-) ) part is this works. As
|
||||
I note in those concluding remarks, a company actually introduced a security
|
||||
hole from ONE `goto`. Yet I have 116/134 and it actually works? That is surely
|
||||
|
||||
Reference in new issue
Block a user