diff --git a/2024/ferguson1/.gitignore b/2024/ferguson1/.gitignore index 8ebd65b03..e04469a91 100644 --- a/2024/ferguson1/.gitignore +++ b/2024/ferguson1/.gitignore @@ -9,6 +9,7 @@ addpadding bytecheck bytecount byteread +bytes.txt bytetest data data.asc diff --git a/2024/ferguson1/README.md b/2024/ferguson1/README.md index 25bedff5d..fef7af243 100644 --- a/2024/ferguson1/README.md +++ b/2024/ferguson1/README.md @@ -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: -
### A Pact With the Devil On the Oregon Trail (...and his 134 regrets of goto)
+
+ +> 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. + +
+ + 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 diff --git a/2024/ferguson1/index.html b/2024/ferguson1/index.html index d693e0065..8dbf8d43f 100644 --- a/2024/ferguson1/index.html +++ b/2024/ferguson1/index.html @@ -491,13 +491,27 @@ 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, 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:

A Pact With the Devil On the Oregon Trail (…and his 134 regrets of goto)

+
+
+

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 #includes, #defines, 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.

+

The Go To Hell In A Handcart Travel Company PROUDLY welcomes all sinners to our GREATEST destination yet, with:

PLEASE either read the (probably totally unnecessary) 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 as well as the humour section, historical references and cultural references as well. The @@ -2841,7 +2855,7 @@ comparison):

3826

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 gotos 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.

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:

+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

    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 #includes, #defines, 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 @@ -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.

It would have been SO MUCH EASIER if I did not use 134 gotos. 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.

+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 gotos, is notorious for gotos and is quite hard to follow. It would be a nightmare to try and maintain without the .l/.y source files.

diff --git a/2024/ferguson1/obfuscation.html b/2024/ferguson1/obfuscation.html index 60d774cf4..4b135b9fc 100644 --- a/2024/ferguson1/obfuscation.html +++ b/2024/ferguson1/obfuscation.html @@ -509,6 +509,12 @@ that many and that is ridiculous.

YES I think it’s HILARIOUS. But if it was not for the IOCCC… Well, as I mention in my remarks above, 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, #includes, #defines 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 diff --git a/2024/ferguson1/obfuscation.md b/2024/ferguson1/obfuscation.md index e5de8c05e..f05ee6cf1 100644 --- a/2024/ferguson1/obfuscation.md +++ b/2024/ferguson1/obfuscation.md @@ -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