Truly complete 2024/ferguson1 and litmus test
The truly complete part is a reference to commit
ad622a5354. This also means that prog.c
need never be updated again, which was the entire point of that commit
that fell just short of the mark.
Fixed links in obfuscation.html.
Added litmus test to explain how I actually tested the program with all
the jumps.
Fixed typo in data file that I discovered during the above litmus test.
Fixed other files as well.
The .entry.json had a minor mod too, to better reflect what a file
actually is.
Rebuilt obfuscation.html and index.html.
Added target to Makefile which was also used during testing (this might
be explained in the obfuscation.html).
This commit is contained in:
1 parent
7bd60f26ac
commit
5455784566
14 files changed
+401
-197
No files matched your search
@@ -123,7 +123,7 @@
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "text",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "text file showing only the gotos in the entry code"
|
||||
"entry_text" : "text file showing only gotos in the entry code pre cpp"
|
||||
},
|
||||
{
|
||||
"file_path" : "jumps.txt",
|
||||
|
||||
@@ -24,4 +24,5 @@ prog.alt2.scrnshot
|
||||
prog.alt.asc
|
||||
prog.alt.scrnshot
|
||||
prog.asc
|
||||
prog.gotos
|
||||
prog.scrnshot
|
||||
@@ -229,6 +229,14 @@ ${PROG}.scrnshot: ${PROG}.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data.scrnshot"' ${PROG}.c -o $@ ${LDFLAGS}
|
||||
|
||||
|
||||
# for testing purposes of prog.gotos.c - part of the enhanced litmus test
|
||||
${PROG}.gotos: ${PROG}.gotos.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data"' ${PROG}.gotos.c -o $@ ${LDFLAGS}
|
||||
|
||||
|
||||
|
||||
# this tool creates the data files (emoji and ASCII only versions).
|
||||
#
|
||||
# The warnings disabled are unfortunate. One is actually an extra sanity check
|
||||
|
||||
+31
-27
@@ -32,7 +32,7 @@ YouTube show for this entry:
|
||||
The author provided two alt versions: one submitted with more events, though not
|
||||
many more, along with a few other functional differences, and after winning, the
|
||||
prog.c was made the prog.alt2.c code and the prog.c was made the complete
|
||||
version (149 `goto`s up from 134) that was not made prog.c during submission for
|
||||
version (152 `goto`s up from 134) that was not made prog.c during submission for
|
||||
practical reasons.
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ practical reasons.
|
||||
## Judges' remarks:
|
||||
|
||||
You will have to go to "Fun-Damentals" to understand the logic flow of this
|
||||
game. While the code might goto as many as 149 times to travel from `main()` to
|
||||
game. While the code might goto as many as 152 times to travel from `main()` to
|
||||
a successful `exit(666)` you may have a devil of a time trying to figure out how
|
||||
this program actually does what it does as it jumps hundreds if not thousands of
|
||||
times.
|
||||
@@ -78,7 +78,7 @@ finish and not counting macros but counting all function calls (not libc
|
||||
functions just the few functions in prog.c), there were a total of **1416** (!)
|
||||
line jumps. Skipping prog.c function calls and it was still **1131** jumps! The
|
||||
prog.c, if you remove `#include`s, blank lines, lines with just a brace and
|
||||
lines that have only variables, **only has 58 (!) lines of code**. A very tiny
|
||||
lines that have only variables, **only has 55 (!) lines of code**. A very tiny
|
||||
fraction of the time a line might be repeated in a row ONCE but that does not
|
||||
really matter, as it is still technically a jump.
|
||||
|
||||
@@ -99,7 +99,7 @@ depend on what you're doing):
|
||||
/heaven\|goto\|666\|hell
|
||||
```
|
||||
|
||||
Read it and <del>weep</del> and scream (or curse :-) )!
|
||||
Read it and <del>weep</del> scream (or curse :-) )!
|
||||
|
||||
**NOTE**: I actually submitted two versions, one encrypted (even emojis); any
|
||||
document mentioning encryption is left <del>for personal reasons</del> out of
|
||||
@@ -112,7 +112,7 @@ extended power cut or something else goes wrong.
|
||||
|
||||
|
||||
<div id="devil">
|
||||
### A Pact With the Devil On the Oregon Trail (...and his <del>134</del> 149 regrets of goto)
|
||||
### A Pact With the Devil On the Oregon Trail (...and his <del>134</del> 152 regrets of goto)
|
||||
</div>
|
||||
|
||||
The _Go To Hell In A Handcart Travel Company_ **PROUDLY** welcomes all sinners to
|
||||
@@ -192,13 +192,17 @@ things I have done - and some are really quite unique and cool, or at least I
|
||||
think they are unique (I have never seen these things before nor have I even
|
||||
seen any suggestion of them before, one because it's absolutely contrary to how
|
||||
it works in C, namely near 200 NUL terminated `char *`s in a single flat `char
|
||||
*` - no, not an array of `char *[]`).
|
||||
*` - no, not an array of `char *[]` and not a `char **`!).
|
||||
|
||||
See [obfuscation.html](obfuscation.html) and my [concluding
|
||||
remarks](#conclusions) for
|
||||
more details on just how many `goto`s I have but beware of monsters. But be careful
|
||||
if you have a heart condition. And if you're a computer scientist make sure
|
||||
you're not at risk of stroke.
|
||||
you're not at risk of stroke. The [obfuscation.html](obfuscation.html) file has
|
||||
a [litmus test](obfuscation.html#litmus) I devised to make sure everything is
|
||||
working right, although you have to know the program code well in order to
|
||||
really be sure of it, especially as there are some things that seem like flow
|
||||
control errors but are intentional.
|
||||
|
||||
The [obfuscation.html](obfuscation.html) file discusses those other cool things as
|
||||
well of course, and they might be briefly brought up in my concluding remarks as
|
||||
@@ -2501,12 +2505,12 @@ really does not seem to be dead (it's quite sneaky).
|
||||
|
||||
I could be wrong on whether this is one the compiler missed though: it's hard to
|
||||
follow all the `goto`s. As you find out in [obfuscation.html](obfuscation.html) it's
|
||||
149 after pre-processing! The second alt code is what I originally submitted as
|
||||
prog.c but after winning I made the more complete (149 gotos post cpp, 131 prior
|
||||
152 after pre-processing! The second alt code is what I originally submitted as
|
||||
prog.c but after winning I made the more complete (152 gotos post cpp, 134 prior
|
||||
to cpp) version (that was not submitted for practical reasons) the prog.c.
|
||||
Nonetheless 134 is already way too many. 149 is much worse. Even 116 which was
|
||||
the original prog.c before cpp is too many; that's 7 more than the 1978 BASIC
|
||||
game (!). But it's actually 131 which is 22 more.
|
||||
Nonetheless 109, what the 1978 BASIC game had, is already way too many, but that
|
||||
at least has the excuse of being in BASIC. Being in a smaller program and in C,
|
||||
having 134/152 `goto`s is far worse.
|
||||
|
||||
Yes I might be mad. But then again I might just be the Devil. Who knows? What I
|
||||
do know is code that is meant to be reached is reached! Yes I've played it many
|
||||
@@ -3072,11 +3076,11 @@ what this is. And even then it shouldn't be easy to follow the code, for reasons
|
||||
I mentioned in [obfuscation.html](obfuscation.html) (and some briefly below).
|
||||
|
||||
In general I think it's extremely hard to follow the flow of this program due to
|
||||
the abuse of <del>116</del> 131 `goto`s, more than the BASIC game.
|
||||
<del>134</del> 149 when pre-processed. But
|
||||
let's be honest, or 131 for a small C program is too many but to be seven more
|
||||
than the larger BASIC program? That is hard to fathom. Not that <del>116</del>
|
||||
131/149 is not too many for larger programs...or one goto, for that matter.
|
||||
the abuse of <del>116</del> 134 `goto`s, more than the BASIC game.
|
||||
<del>134</del> 152 when pre-processed. But let's be honest, 134 for a small C
|
||||
program is too many but to be 25 (or 43 pre-processed) more than the larger
|
||||
BASIC program? That is hard to fathom. Not that <del>116</del> 131/149 is not
|
||||
too many for larger programs...or one goto, for that matter.
|
||||
|
||||
As noted elsewhere, I originally submitted a slightly less goto complete
|
||||
version, with 116/134 gotos, before/after the cpp, which was due to practical
|
||||
@@ -3203,7 +3207,7 @@ I probably wouldn't have written code that looks illegal like the
|
||||
if not most contexts it IS illegal). The bastardised Duff's device I would not
|
||||
do. I would not put the entire function in a switch.
|
||||
|
||||
But above all I would not have used <del>116</del> 131 (or <del>134</del> 149)
|
||||
But above all I would not have used <del>116</del> 134 (or <del>134</del> 152)
|
||||
`goto`s. Or ten. Or five. Or even one. Better to let code generators like
|
||||
flex/bison take the crown. I have dethroned them though (at least from what I
|
||||
have seen before) - by a huge amount. But perhaps
|
||||
@@ -3278,7 +3282,7 @@ mean many `goto`s.
|
||||
There are so many `goto`s that to try and move code to add more `goto`s is
|
||||
basically pointless, unless as a joke. In this program it would really not do
|
||||
anything. I essentially ran out of code to move. Even if I had more though,
|
||||
isn't <del>134</del> 149 enough, especially in a program that, counting spaces,
|
||||
isn't <del>134</del> 152 enough, especially in a program that, counting spaces,
|
||||
including unnecessary spaces to add to the size, is only 4666 bytes? It would be
|
||||
smaller except to stay on theme. Doing more would no longer be funny. Enough is
|
||||
enough. Or at least I hope. Okay...actually I take that back. More would be
|
||||
@@ -3336,9 +3340,9 @@ of **1416** (!) changes, counting function calls, and **1131** (!) excluding
|
||||
function calls. Macros are not counted of course.
|
||||
|
||||
This program, if you remove blank lines and lines with just a brace,
|
||||
`#include`s and only variables, has a mere 58 (!) lines.
|
||||
`#include`s and only variables, has a mere 55 (!) lines.
|
||||
|
||||
A program that has only 58 lines of code that jumps 1416 (counting functions) or
|
||||
A program that has only 55 lines of code that jumps 1416 (counting functions) or
|
||||
1131 (just in main()) times is astonishing. Of course that's not the
|
||||
only technique but the title of the award and the judges' remarks are rather
|
||||
fitting as it is diabolical to follow this code (and the theme of the game fits
|
||||
@@ -3359,7 +3363,7 @@ It is not about not trying. But even IF he WAS right, he
|
||||
sure as hell 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 <del>134</del> 149 `goto`s.
|
||||
It would have been SO MUCH EASIER if I did not use <del>134</del> 152 `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! You have
|
||||
@@ -3499,8 +3503,8 @@ Anyway, I am reminded of Apple's **SINGLE** misplaced `goto` that caused a
|
||||
That's all it takes: **JUST ONE `goto` led to a CVE**!
|
||||
|
||||
It is ironic, perfect and hilarious that it was `goto fail;` as it was actually
|
||||
a failure in using `goto`! My code has <del>134</del> 149 (with the cpp,
|
||||
<del>116</del> 131 without). That is obscene. I did not fail. At all.
|
||||
a failure in using `goto`! My code has 134/152 (pre-pre-processed,
|
||||
pre-processed). That is obscene. I did not fail. At all.
|
||||
|
||||
On the contrary I have made a point. Okay, that is not the only reason I did it
|
||||
but when I got started I couldn't help it...I thought it was (and still do think
|
||||
@@ -3544,8 +3548,8 @@ In BASIC and asm and some other languages jumps are a core part of the language.
|
||||
And those languages can be harder to maintain partly because of jumps. C is not
|
||||
one of those languages. Or it wasn't until now.
|
||||
|
||||
Yes, yes...I know, I **KNOW** I put in <del>116</del> 131 `goto`s with
|
||||
<del>134</del> 149 when pre-processed and that is probably more extreme than any
|
||||
Yes, yes...I know, I **KNOW** I put in <del>116</del> 134 `goto`s with
|
||||
<del>134</del> 152 when pre-processed and that is probably more extreme than any
|
||||
other C program, especially in such a small program (and I REALLY hope I'm right
|
||||
there!). But **this does NOT matter**! Even if one or two were not harmful (but
|
||||
they are) it's jumping down a rabbit hole that can very easily get deeper and
|
||||
@@ -3601,7 +3605,7 @@ recognise what I mean - and yes it's in the game).
|
||||
On a lighter note (or maybe this is darker?): did you know that every time a
|
||||
`goto` is used an angel (whatever you consider an angel) **DIES** and goes
|
||||
straight to HELL? You don't really want that do you? I didn't think so. Yes I
|
||||
killed <del>134</del> 149 angels. YES I condemned <del>134</del> 149 angels to
|
||||
killed <del>134</del> 152 angels. YES I condemned <del>134</del> 152 angels to
|
||||
eternal torment. I **HAD** to. I don't regret it - but you should, if you
|
||||
**ever** write something like this outside the IOCCC. In fact you should regret
|
||||
a single <del>goto</del> angel dying. Even if they did not go straight to hell
|
||||
|
||||
Binary file not shown.
@@ -503,8 +503,8 @@ flood of the message each turn).</li>
|
||||
<li>h: I believe this is if you were injured and could afford the doctor.</li>
|
||||
<li>c: hit blizzard.</li>
|
||||
<li>X: passed South Pass.</li>
|
||||
<li>i: been poisoned; you will be dead shortly (sorry - that’s what happens when
|
||||
you have a pact with the devil!).</li>
|
||||
<li>i: about to be strangled to death by the Flying Spaghetti Monster after
|
||||
indulging in too much spaghetti.</li>
|
||||
<li>g: how many limbs you’ve had to cut off (surgeon’s cut edition)</li>
|
||||
<li>t: temporary array for purchasing at forts.</li>
|
||||
<li>u: temporary unsigned int to iterate through array <code>t</code> (and maybe other
|
||||
|
||||
@@ -50,8 +50,8 @@ flood of the message each turn).
|
||||
- h: I believe this is if you were injured and could afford the doctor.
|
||||
- c: hit blizzard.
|
||||
- X: passed South Pass.
|
||||
- i: been poisoned; you will be dead shortly (sorry - that's what happens when
|
||||
you have a pact with the devil!).
|
||||
- i: about to be strangled to death by the Flying Spaghetti Monster after
|
||||
indulging in too much spaghetti.
|
||||
- g: how many limbs you've had to cut off (surgeon's cut edition)
|
||||
- t: temporary array for purchasing at forts.
|
||||
- u: temporary unsigned int to iterate through array `t` (and maybe other
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
goto TT;
|
||||
goto P;
|
||||
goto U;
|
||||
w(i) goto _;
|
||||
goto QQ;
|
||||
goto KK;
|
||||
goto z;
|
||||
@@ -102,7 +103,9 @@
|
||||
goto yy;
|
||||
goto Z;
|
||||
goto rr;
|
||||
w(27) I : goto a;
|
||||
goto _;
|
||||
w(27) goto _;
|
||||
goto a;
|
||||
goto Z;
|
||||
goto Z;
|
||||
goto Z;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 220 KiB After Width: | Height: | Size: 220 KiB |
+32
-28
@@ -489,7 +489,7 @@ YouTube show for this entry:</p>
|
||||
<p>The author provided two alt versions: one submitted with more events, though not
|
||||
many more, along with a few other functional differences, and after winning, the
|
||||
prog.c was made the prog.alt2.c code and the prog.c was made the complete
|
||||
version (149 <code>goto</code>s up from 134) that was not made prog.c during submission for
|
||||
version (152 <code>goto</code>s up from 134) that was not made prog.c during submission for
|
||||
practical reasons.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<pre><code> make alt</code></pre>
|
||||
@@ -501,7 +501,7 @@ practical reasons.</p>
|
||||
./prog.alt2 # submitted code with bug fix</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>You will have to go to “Fun-Damentals” to understand the logic flow of this
|
||||
game. While the code might goto as many as 149 times to travel from <code>main()</code> to
|
||||
game. While the code might goto as many as 152 times to travel from <code>main()</code> to
|
||||
a successful <code>exit(666)</code> you may have a devil of a time trying to figure out how
|
||||
this program actually does what it does as it jumps hundreds if not thousands of
|
||||
times.</p>
|
||||
@@ -519,7 +519,7 @@ finish and not counting macros but counting all function calls (not libc
|
||||
functions just the few functions in prog.c), there were a total of <strong>1416</strong> (!)
|
||||
line jumps. Skipping prog.c function calls and it was still <strong>1131</strong> jumps! The
|
||||
prog.c, if you remove <code>#include</code>s, blank lines, lines with just a brace and
|
||||
lines that have only variables, <strong>only has 58 (!) lines of code</strong>. A very tiny
|
||||
lines that have only variables, <strong>only has 55 (!) lines of code</strong>. A very tiny
|
||||
fraction of the time a line might be repeated in a row ONCE but that does not
|
||||
really matter, as it is still technically a jump.</p>
|
||||
</blockquote>
|
||||
@@ -532,7 +532,7 @@ if your grep has colours enabled (probably easier). This is a nice one to try:</
|
||||
(hit ESC if you don’t know - if that doesn’t work try hitting it again as it can
|
||||
depend on what you’re doing):</p>
|
||||
<pre><code> /heaven\|goto\|666\|hell</code></pre>
|
||||
<p>Read it and <del>weep</del> and scream (or curse :-) )!</p>
|
||||
<p>Read it and <del>weep</del> scream (or curse :-) )!</p>
|
||||
<p><strong>NOTE</strong>: I actually submitted two versions, one encrypted (even emojis); any
|
||||
document mentioning encryption is left <del>for personal reasons</del> out of
|
||||
laziness and exhaustion from working on improving the presentation even after it
|
||||
@@ -542,7 +542,7 @@ can be found <a href="https://ioccc.xexyl.net/2024/oregon/">here</a> or else in
|
||||
markdown files in the tarball), if anyone is interested, assuming there’s not an
|
||||
extended power cut or something else goes wrong.</p>
|
||||
<div id="devil">
|
||||
<h3 id="a-pact-with-the-devil-on-the-oregon-trail-and-his-134-149-regrets-of-goto">A Pact With the Devil On the Oregon Trail (…and his <del>134</del> 149 regrets of goto)</h3>
|
||||
<h3 id="a-pact-with-the-devil-on-the-oregon-trail-and-his-134-152-regrets-of-goto">A Pact With the Devil On the Oregon Trail (…and his <del>134</del> 152 regrets of goto)</h3>
|
||||
</div>
|
||||
<p>The <em>Go To Hell In A Handcart Travel Company</em> <strong>PROUDLY</strong> welcomes all sinners to
|
||||
our <strong>GREATEST</strong> destination yet, with:</p>
|
||||
@@ -607,12 +607,16 @@ have personally never seen anything close to it. But that’s only one of the ma
|
||||
things I have done - and some are really quite unique and cool, or at least I
|
||||
think they are unique (I have never seen these things before nor have I even
|
||||
seen any suggestion of them before, one because it’s absolutely contrary to how
|
||||
it works in C, namely near 200 NUL terminated <code>char *</code>s in a single flat <code>char *</code> - no, not an array of <code>char *[]</code>).</p>
|
||||
it works in C, namely near 200 NUL terminated <code>char *</code>s in a single flat <code>char *</code> - no, not an array of <code>char *[]</code> and not a <code>char **</code>!).</p>
|
||||
<p>See <a href="obfuscation.html">obfuscation.html</a> and my <a href="#conclusions">concluding
|
||||
remarks</a> for
|
||||
more details on just how many <code>goto</code>s I have but beware of monsters. But be careful
|
||||
if you have a heart condition. And if you’re a computer scientist make sure
|
||||
you’re not at risk of stroke.</p>
|
||||
you’re not at risk of stroke. The <a href="obfuscation.html">obfuscation.html</a> file has
|
||||
a <a href="obfuscation.html#litmus">litmus test</a> I devised to make sure everything is
|
||||
working right, although you have to know the program code well in order to
|
||||
really be sure of it, especially as there are some things that seem like flow
|
||||
control errors but are intentional.</p>
|
||||
<p>The <a href="obfuscation.html">obfuscation.html</a> file discusses those other cool things as
|
||||
well of course, and they might be briefly brought up in my concluding remarks as
|
||||
well.</p>
|
||||
@@ -2484,12 +2488,12 @@ might be one that the compiler does not trigger a dead code warning on. It
|
||||
really does not seem to be dead (it’s quite sneaky).</p>
|
||||
<p>I could be wrong on whether this is one the compiler missed though: it’s hard to
|
||||
follow all the <code>goto</code>s. As you find out in <a href="obfuscation.html">obfuscation.html</a> it’s
|
||||
149 after pre-processing! The second alt code is what I originally submitted as
|
||||
prog.c but after winning I made the more complete (149 gotos post cpp, 131 prior
|
||||
152 after pre-processing! The second alt code is what I originally submitted as
|
||||
prog.c but after winning I made the more complete (152 gotos post cpp, 134 prior
|
||||
to cpp) version (that was not submitted for practical reasons) the prog.c.
|
||||
Nonetheless 134 is already way too many. 149 is much worse. Even 116 which was
|
||||
the original prog.c before cpp is too many; that’s 7 more than the 1978 BASIC
|
||||
game (!). But it’s actually 131 which is 22 more.</p>
|
||||
Nonetheless 109, what the 1978 BASIC game had, is already way too many, but that
|
||||
at least has the excuse of being in BASIC. Being in a smaller program and in C,
|
||||
having 134/152 <code>goto</code>s is far worse.</p>
|
||||
<p>Yes I might be mad. But then again I might just be the Devil. Who knows? What I
|
||||
do know is code that is meant to be reached is reached! Yes I’ve played it many
|
||||
times. Some code I made dead seemed totally useless but why not add to
|
||||
@@ -2939,11 +2943,11 @@ reading the strings/data files they would have to run the program to confirm
|
||||
what this is. And even then it shouldn’t be easy to follow the code, for reasons
|
||||
I mentioned in <a href="obfuscation.html">obfuscation.html</a> (and some briefly below).</p>
|
||||
<p>In general I think it’s extremely hard to follow the flow of this program due to
|
||||
the abuse of <del>116</del> 131 <code>goto</code>s, more than the BASIC game.
|
||||
<del>134</del> 149 when pre-processed. But
|
||||
let’s be honest, or 131 for a small C program is too many but to be seven more
|
||||
than the larger BASIC program? That is hard to fathom. Not that <del>116</del>
|
||||
131/149 is not too many for larger programs…or one goto, for that matter.</p>
|
||||
the abuse of <del>116</del> 134 <code>goto</code>s, more than the BASIC game.
|
||||
<del>134</del> 152 when pre-processed. But let’s be honest, 134 for a small C
|
||||
program is too many but to be 25 (or 43 pre-processed) more than the larger
|
||||
BASIC program? That is hard to fathom. Not that <del>116</del> 131/149 is not
|
||||
too many for larger programs…or one goto, for that matter.</p>
|
||||
<p>As noted elsewhere, I originally submitted a slightly less goto complete
|
||||
version, with 116/134 gotos, before/after the cpp, which was due to practical
|
||||
reasons, and to make the judges weep (and probably curse the Devil - and author,
|
||||
@@ -3048,7 +3052,7 @@ a single flat <code>char *</code>, although I do think that’s pretty cool and
|
||||
<code>+--</code> I talked about in <a href="obfuscation.html">obfuscation.html</a> (in fact in some
|
||||
if not most contexts it IS illegal). The bastardised Duff’s device I would not
|
||||
do. I would not put the entire function in a switch.</p>
|
||||
<p>But above all I would not have used <del>116</del> 131 (or <del>134</del> 149)
|
||||
<p>But above all I would not have used <del>116</del> 134 (or <del>134</del> 152)
|
||||
<code>goto</code>s. Or ten. Or five. Or even one. Better to let code generators like
|
||||
flex/bison take the crown. I have dethroned them though (at least from what I
|
||||
have seen before) - by a huge amount. But perhaps
|
||||
@@ -3110,7 +3114,7 @@ mean many <code>goto</code>s.</p>
|
||||
<p>There are so many <code>goto</code>s that to try and move code to add more <code>goto</code>s is
|
||||
basically pointless, unless as a joke. In this program it would really not do
|
||||
anything. I essentially ran out of code to move. Even if I had more though,
|
||||
isn’t <del>134</del> 149 enough, especially in a program that, counting spaces,
|
||||
isn’t <del>134</del> 152 enough, especially in a program that, counting spaces,
|
||||
including unnecessary spaces to add to the size, is only 4666 bytes? It would be
|
||||
smaller except to stay on theme. Doing more would no longer be funny. Enough is
|
||||
enough. Or at least I hope. Okay…actually I take that back. More would be
|
||||
@@ -3155,8 +3159,8 @@ is the same but that only shows how very often the line changes. It is a total
|
||||
of <strong>1416</strong> (!) changes, counting function calls, and <strong>1131</strong> (!) excluding
|
||||
function calls. Macros are not counted of course.</p>
|
||||
<p>This program, if you remove blank lines and lines with just a brace,
|
||||
<code>#include</code>s and only variables, has a mere 58 (!) lines.</p>
|
||||
<p>A program that has only 58 lines of code that jumps 1416 (counting functions) or
|
||||
<code>#include</code>s and only variables, has a mere 55 (!) lines.</p>
|
||||
<p>A program that has only 55 lines of code that jumps 1416 (counting functions) or
|
||||
1131 (just in main()) times is astonishing. Of course that’s not the
|
||||
only technique but the title of the award and the judges’ remarks are rather
|
||||
fitting as it is diabolical to follow this code (and the theme of the game fits
|
||||
@@ -3175,7 +3179,7 @@ he was wrong.</p>
|
||||
<p>It is not about not trying. But even IF he WAS right, he
|
||||
sure as hell 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 <del>134</del> 149 <code>goto</code>s.
|
||||
<p>It would have been SO MUCH EASIER if I did not use <del>134</del> 152 <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. Feel free to pass on judgement to me. I welcome it! You have
|
||||
@@ -3291,8 +3295,8 @@ that they aren’t harmful, mostly to show just how extreme this program went.</
|
||||
<a href="https://www.blackduck.com/blog/understanding-apple-goto-fail-vulnerability-2.html" class="uri">https://www.blackduck.com/blog/understanding-apple-goto-fail-vulnerability-2.html</a>.
|
||||
That’s all it takes: <strong>JUST ONE <code>goto</code> led to a CVE</strong>!</p>
|
||||
<p>It is ironic, perfect and hilarious that it was <code>goto fail;</code> as it was actually
|
||||
a failure in using <code>goto</code>! My code has <del>134</del> 149 (with the cpp,
|
||||
<del>116</del> 131 without). That is obscene. I did not fail. At all.</p>
|
||||
a failure in using <code>goto</code>! My code has 134/152 (pre-pre-processed,
|
||||
pre-processed). That is obscene. I did not fail. At all.</p>
|
||||
<p>On the contrary I have made a point. Okay, that is not the only reason I did it
|
||||
but when I got started I couldn’t help it…I thought it was (and still do think
|
||||
it is) hilarious. But only for satirical programming like the contest. I would
|
||||
@@ -3328,8 +3332,8 @@ Yes, in the IOCCC, but outside that?</p>
|
||||
<p>In BASIC and asm and some other languages jumps are a core part of the language.
|
||||
And those languages can be harder to maintain partly because of jumps. C is not
|
||||
one of those languages. Or it wasn’t until now.</p>
|
||||
<p>Yes, yes…I know, I <strong>KNOW</strong> I put in <del>116</del> 131 <code>goto</code>s with
|
||||
<del>134</del> 149 when pre-processed and that is probably more extreme than any
|
||||
<p>Yes, yes…I know, I <strong>KNOW</strong> I put in <del>116</del> 134 <code>goto</code>s with
|
||||
<del>134</del> 152 when pre-processed and that is probably more extreme than any
|
||||
other C program, especially in such a small program (and I REALLY hope I’m right
|
||||
there!). But <strong>this does NOT matter</strong>! Even if one or two were not harmful (but
|
||||
they are) it’s jumping down a rabbit hole that can very easily get deeper and
|
||||
@@ -3376,7 +3380,7 @@ recognise what I mean - and yes it’s in the game).</p>
|
||||
<p>On a lighter note (or maybe this is darker?): did you know that every time a
|
||||
<code>goto</code> is used an angel (whatever you consider an angel) <strong>DIES</strong> and goes
|
||||
straight to HELL? You don’t really want that do you? I didn’t think so. Yes I
|
||||
killed <del>134</del> 149 angels. YES I condemned <del>134</del> 149 angels to
|
||||
killed <del>134</del> 152 angels. YES I condemned <del>134</del> 152 angels to
|
||||
eternal torment. I <strong>HAD</strong> to. I don’t regret it - but you should, if you
|
||||
<strong>ever</strong> write something like this outside the IOCCC. In fact you should regret
|
||||
a single <del>goto</del> angel dying. Even if they did not go straight to hell
|
||||
@@ -3772,7 +3776,7 @@ helps you appreciate the careful design even more.<a href="#fnref2" class="footn
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/byteread.c">byteread.c</a> - prints out the strings without locations</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/bytetest.c">bytetest.c</a> - prints every string extracted from data</li>
|
||||
<li><a href="deobfuscation.html">deobfuscation.html</a> - hints on how to deobfuscate</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/gotos.c.txt">gotos.c.txt</a> - text file showing only the gotos in the entry code</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/gotos.c.txt">gotos.c.txt</a> - text file showing only gotos in the entry code pre cpp</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/jumps.txt">jumps.txt</a> - text file showing all the line changes in a single run</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/lencount.c">lencount.c</a> - counts strings and reports longest one</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/mbcheck.c">mbcheck.c</a> - show location of multibyte characters</li>
|
||||
|
||||
+133
-49
@@ -486,7 +486,7 @@ Harmful”</a></em>.
|
||||
See the Communications of the ACM, March 1987, Page 195-196.</p>
|
||||
</blockquote>
|
||||
<p>(I refute some things in my program that directly contradicts Frank’s
|
||||
letter in amusing or at least instructional ways in my <a href="#devil">remarks above</a>.</p>
|
||||
letter in amusing or at least instructional ways in my <a href="index.html#devil">remarks</a>.</p>
|
||||
<p>I added bold to logical conclusion because I wanted to stress this. I’m afraid
|
||||
they were wrong, oh so very VERY <strong>VERY</strong> WRONG. 24 <code>goto</code>s, according to
|
||||
<code>hines</code> itself, is not the <code>goto</code> logical conclusion. I agree it’s a beautiful
|
||||
@@ -495,11 +495,11 @@ counter-example for that letter but oh is everyone in for a HUGE SHOCK!</p>
|
||||
too many, even in a large program, let alone a small one. Even one <code>goto</code> is too
|
||||
many. Unless I am very much mistaken, I have broken the record by a huge margin.</p>
|
||||
<p>Here’s the horrifying and hilarious truth: I beat it out by <del>92</del> 107
|
||||
MORE, <strong>BEFORE</strong> the cpp at <del>116</del> 131 and after the cpp is through I
|
||||
beat it by <strong>125</strong> MORE (!!), <strong>AT 149!</strong> Yes, you read that right.
|
||||
<del>134</del> 149 <code>goto</code>s! The originally submitted prog.c, submitted for
|
||||
practical reasons only, had it at, as might be guessed, 116/134 before and after
|
||||
the cpp.</p>
|
||||
MORE, <strong>BEFORE</strong> the cpp at <del>116</del> 134 and after the cpp is through I
|
||||
beat it by <strong>128</strong> MORE (!!), <strong>AT 152!</strong> Yes, you read that right.
|
||||
<del>134</del> 152 <code>goto</code>s! The originally submitted prog.c, submitted for
|
||||
practical reasons only, had it at, as might be guessed from above, 116/134
|
||||
before and after the cpp.</p>
|
||||
<p>Even removing what I think were the only dead <code>goto</code>s in the incomplete version,
|
||||
two of them, including one that is in the <code>w()</code> macro that would be translated
|
||||
into more, I beat it by 90 more, at 114 before the cpp, and 99 more after the
|
||||
@@ -509,26 +509,26 @@ MEASLY 109? THIS SHOULD NOT HAPPEN. Well it did happen and this HAS to be a
|
||||
joke, right? I’m sorry but it is NOT a joke. I am for real. There REALLY are
|
||||
that many and that is ridiculous.</p>
|
||||
<p>Okay so it’s a joke in another way but nonetheless YES I <strong>REALLY DID</strong> put in
|
||||
<del>116/134</del> 131/149 <code>goto</code>s, depending on if you pre-process it or not!
|
||||
<del>116/134</del> 134/152 <code>goto</code>s, depending on if you pre-process it or not!
|
||||
YES I might be mad. 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
|
||||
IOCCC… Well, as I mention in my <a href="index.html#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: removing the <code>#include</code>s,
|
||||
blank lines, lines with only variables and lines with just braces (i.e. only
|
||||
lines of code) the program has just 58 lines and in a single run there were a
|
||||
lines of code) the program has just 55 lines and in a single run there were a
|
||||
total of <strong>1416</strong> (!) line changes, counting function calls. In <code>main()</code> itself
|
||||
the line changed a total of <strong>1131</strong> (!) times!</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 <a href="https://www.apple.com">nameless company</a>
|
||||
actually introduced a security hole from ONE <code>goto</code>. Yet I have
|
||||
<del>116/134</del> 131/149 and it actually works? That is surely obscene. And
|
||||
<del>116/134</del> 134/152 and it actually works? That is surely obscene. And
|
||||
beautiful. But wrong.</p>
|
||||
<p>Oh and BTW: it appears that <code>hines</code> is a bit confused about my entry, though I’m
|
||||
not really sure why. In any case, I not only have dethroned <code>hines</code> (sorry
|
||||
…but also not sorry!) but I have, as noted already, beaten the original BASIC
|
||||
game by <del>7</del> 22 more <code>goto</code>s at <del>116</del> 131 before the cpp
|
||||
and <del><strong>18 MORE</strong></del> <strong>40 MORE</strong> after the cpp, at 149!</p>
|
||||
game by <del>7</del> 25 more <code>goto</code>s at <del>116</del> 134 before the cpp
|
||||
and <del><strong>18 MORE</strong></del> <strong>43 MORE</strong> after the cpp, at 152!</p>
|
||||
<p>It’s almost impossible to add more <code>goto</code>s. With the iocccsize it is impossible,
|
||||
if I don’t want to sacrifice the rest of the program. You’ll see why soon. But
|
||||
even if that was not the case I wanted room for the other things I did, some of
|
||||
@@ -542,7 +542,7 @@ in general, where code can be, where labels can be, really everything: the code
|
||||
is in all the wrong places.</p>
|
||||
<p>This is not counting other cool things like a single <code>char *</code> holding near 200
|
||||
<code>char *</code>s. No. I do not mean an array of <code>char *</code>s! I mean a single flat <code>char *</code>! Yet in the code I index it AS IF it’s a <code>char *[]</code>, just to add to the
|
||||
confusion (as if the <del>134</del> 149 <code>goto</code>s are not bad enough). But it’s
|
||||
confusion (as if the <del>134</del> 152 <code>goto</code>s are not bad enough). But it’s
|
||||
not a <code>char *[]</code>. It’s a single <code>char *</code>, which is the contents of the data
|
||||
file.</p>
|
||||
<p>There are other things I have done, of course.</p>
|
||||
@@ -594,15 +594,15 @@ have lost my mind this program sure as hell lost its mind! And it’s my fault.
|
||||
Hilarious.</p>
|
||||
<p>Counting whitespace this program is only 4666 bytes according to <code>wc -c</code> (macOS
|
||||
at the least, maybe others): quite intentionally to be on theme. That’s a
|
||||
relatively short program to have <del>116</del> 131 <code>goto</code>s or more when
|
||||
filtered through <code>cc -E</code> (<del>134</del> 149!), wouldn’t you say? If that’s NOT
|
||||
relatively short program to have <del>116</del> 134 <code>goto</code>s or more when
|
||||
filtered through <code>cc -E</code> (<del>134</del> 152!), wouldn’t you say? If that’s NOT
|
||||
too many, then I ask you WHAT IS?</p>
|
||||
<p>As said in numerous places, IT IS MUCH SMALLER than the BASIC file I included
|
||||
even after stripping it of much of it. My program also has more events. I think
|
||||
the BASIC one has 16 not counting the mountains code and mine is 23 not counting
|
||||
the mountains code, which obviously I also include and has more events (if we
|
||||
count the doctor visits an event then even more).</p>
|
||||
<p>I discuss this some in my concluding <a href="#devil">remarks above</a>, as well as
|
||||
<p>I discuss this some in my concluding <a href="index.html#devil">remarks above</a>, as well as
|
||||
mentioning that there are other events besides those 23. I certainly will not
|
||||
reveal all though. The humour and jokes sections of that file says more but the
|
||||
concluding remarks are for a summary and why I think that this code is worthy of
|
||||
@@ -631,7 +631,7 @@ code, as this program also shows. It’s just that the amount of <code>goto</cod
|
||||
the worst of it as you never know where the program will be next, and that’s
|
||||
putting it in a simpler way. Much, much, MUCH simpler way, in fact, as you’ll
|
||||
see.</p>
|
||||
<p>Either way this program, and I mention this in my <a href="#devil">remarks above</a> in an
|
||||
<p>Either way this program, and I mention this in my <a href="index.html#devil">remarks above</a> in an
|
||||
admittedly long editorial plea (although it does it by going over what I have
|
||||
done in simpler terms than this file), serves as a public service, warning about
|
||||
<code>goto</code>. The article about goto considered harmful has nothing against this, or
|
||||
@@ -640,8 +640,8 @@ been mad enough to do what I have done.</p>
|
||||
<p>Here are some fun statistics from a somewhat rudimentary program on both the
|
||||
prog.c and after filtered through <code>cc -E</code>. First prog.c. Prepare to be
|
||||
horrified, if you’re not already:</p>
|
||||
<pre><code> 131 goto
|
||||
301 semicolon
|
||||
<pre><code> 134 goto
|
||||
304 semicolon
|
||||
143 colon
|
||||
51 if
|
||||
11 else
|
||||
@@ -662,10 +662,10 @@ horrified, if you’re not already:</p>
|
||||
1 char
|
||||
1 size_t
|
||||
|
||||
Ratio: 1.01 gotos per keyword</code></pre>
|
||||
<p>1.01 goto per keyword? But then there’s the cpp filtered code…</p>
|
||||
<pre><code> 149 goto
|
||||
339 semicolon
|
||||
Ratio: 1.03 gotos per keyword</code></pre>
|
||||
<p>1.03 goto per keyword? But then there’s the cpp filtered code…</p>
|
||||
<pre><code> 152 goto
|
||||
342 semicolon
|
||||
143 colon
|
||||
51 if
|
||||
11 else
|
||||
@@ -686,9 +686,13 @@ horrified, if you’re not already:</p>
|
||||
1 char
|
||||
1 size_t
|
||||
|
||||
Ratio: 1.11 gotos per keyword</code></pre>
|
||||
<p>1.11!</p>
|
||||
<p>For comparison, here is the original version:</p>
|
||||
Ratio: 1.13 gotos per keyword</code></pre>
|
||||
<p>1.13! Did you also notice that despite there being 32 <code>case</code> statements there
|
||||
are <strong>0</strong> <code>break</code>s? See the label <code>Z</code> for how that one works, although as you’ll
|
||||
notice one event actually flows right into it only to move on to the next part
|
||||
of the code. Additionally there are many <code>goto</code>s and labels in the <code>switch()</code>s
|
||||
that don’t belong there in normal code, or for that matter in any code.</p>
|
||||
<p>Anyway for comparison, here is the original version’s stats:</p>
|
||||
<pre><code> 116 goto
|
||||
294 semicolon
|
||||
138 colon
|
||||
@@ -837,7 +841,7 @@ it.</p>
|
||||
<p>There are a lot of ways to obscure code and I don’t believe anyone has taken
|
||||
<code>goto</code> to this obscenity in C. I believe the one with the most <code>goto</code>s is
|
||||
1987/hines and, as noted earlier, it reports on itself as having only 24
|
||||
<code>goto</code>s. Yet I have <del>116</del> 131 before the cpp and <del>134</del> 149
|
||||
<code>goto</code>s. Yet I have <del>116</del> 134 before the cpp and <del>134</del> 152
|
||||
(!!) after the cpp.</p>
|
||||
<p>And unfortunately for you dear reader I have done other things that also are
|
||||
quite different and totally unrelated to <code>goto</code>s. Even so the <code>goto</code> madness by
|
||||
@@ -996,7 +1000,8 @@ one question their sanity even more. Yes I’m probably a sociopath.</p>
|
||||
* filtered through the cpp and 134 after the cpp and I didn't wish to
|
||||
* repeatedly revisit this file trying to explain everything.</code></pre>
|
||||
<p>…and of course now the count, prog.c being the full version and prog.alt2.c
|
||||
being the practical version, have the count at 131/149.</p>
|
||||
being the practical version, have the count at 131/149 (actually, prog.alt2.c
|
||||
has the 116/134).</p>
|
||||
<p>I hope you understand but I do believe it’s a gain not a loss. It is good enough
|
||||
especially as it’s only for educational value - or to examine my head (though
|
||||
prog.c might be better for that?). As noted the code (and jokes) took a couple
|
||||
@@ -1065,7 +1070,7 @@ is? In some ways it is actually polymorphic, doing drastically different things,
|
||||
depending on the pRNG and which event it is.</p>
|
||||
<p>At one point I was <strong>DEAD CERTAIN</strong> that part of this that should not be dead
|
||||
was dead. But every part of it that is meant to be live is. There was a part
|
||||
that was broken but that was fixed. As I noted in my <a href="#devil">remarks above</a>,
|
||||
that was broken but that was fixed. As I noted in my <a href="index.html#devil">remarks above</a>,
|
||||
this event (11 in particular, under <code>V</code>), will not necessarily do anything, as
|
||||
it depends on another call to the pRNG. This is good because otherwise every
|
||||
time it triggered it would cause severe illness.</p>
|
||||
@@ -1495,7 +1500,7 @@ well-rounded in obfuscation.</p>
|
||||
</div>
|
||||
<p><strong>IMPORTANT NOTE TO THE JUDGES</strong>: if any problems in the data file exist,
|
||||
remember to regenerate it as described in the Judges section and/or the
|
||||
Troubleshooting section in the <a href="#devil">remarks above</a>. It is greatly
|
||||
Troubleshooting section in the <a href="index.html#devil">remarks above</a>. It is greatly
|
||||
appreciated that if by some chance you do run into a problem that you do this
|
||||
quick procedure (the addpadding <code>-d</code> option can also be used to reveal what the
|
||||
program is doing for those who wish to see more, although trying to play the
|
||||
@@ -1511,7 +1516,7 @@ does (unless I missed it in a rule) <strong>BUT EVEN IF</strong> that’s all go
|
||||
are <strong>ANY</strong> issues <strong>PLEASE</strong> run the <code>addpadding</code> tool manually (or better yet
|
||||
<code>make makedata</code>).</p>
|
||||
<p>The data file key is part of the obfuscation both in code and in data; it also
|
||||
stays on theme. As noted in my <a href="#devil">remarks above</a>, I have bypassed the
|
||||
stays on theme. As noted in my <a href="index.html#devil">remarks above</a>, I have bypassed the
|
||||
concern of SUS portability by including my own tools, much like previous winning
|
||||
entries did with POSIX compatibility.</p>
|
||||
<p>I finally added the test rule to the Makefile to be sure things are sane too,
|
||||
@@ -1709,7 +1714,8 @@ instructional either. I have included everything that is needed, however.</p>
|
||||
<code>data.scrnshot.src</code> are created/used by <code>addpadding</code> and are vital to the game
|
||||
(for the .asc data files it is for the non-emoji version, <code>prog.asc</code>, but used
|
||||
by the same code, hence the <code>DATA</code> macro and the same applies to the screenshot
|
||||
friendly one, as I discussed in the data files versions in my <a href="#devil">remarks above</a>).</p>
|
||||
friendly one, as I discussed in the data files versions in my <a href="index.html#devil">remarks
|
||||
above</a>).</p>
|
||||
<p>The <code>data*.src</code> files are included for the purpose of allowing the files to be
|
||||
created prior to running the game as they are vital, just like previous entries
|
||||
with their data files.</p>
|
||||
@@ -1770,11 +1776,85 @@ near 200 <code>char *</code>s in a single <code>char *</code> (NOT a <code>char
|
||||
interesting and it’s one of the reasons I’m quite proud of it.</p>
|
||||
<p>Interesting thing to ponder: what happens if a string is too long for the
|
||||
padding?</p>
|
||||
<div id="litmus">
|
||||
<h3 id="litmus-test">Litmus test</h3>
|
||||
</div>
|
||||
<p>I did not write about this as much in my submission but since I made some
|
||||
updates post winning I figured I would write about the litmus test that I
|
||||
devised, to know that everything is working right.</p>
|
||||
<p>It should be noted however that unless you know the code <strong>EXTREMELY</strong> well
|
||||
(which probably only means me :-) and this will probably get less true as time
|
||||
goes by) it might be hard to perform this and be 100% certain it is okay. This
|
||||
especially goes because there are things that most people would think are logic
|
||||
flow errors but are very intentional. I mentioned some in my
|
||||
<a href="index.html">remarks</a>.</p>
|
||||
<p>I did briefly mention this in my <a href="index.html">remarks</a> but here is a bit more
|
||||
detail. It seems fitting here as the obfuscation talks about <code>goto</code>s more.</p>
|
||||
<p>The key here is the events switch. If every event can fire without, for
|
||||
instance, running through the game until you die, and you can also get sick, get
|
||||
hurt (both of which can happen with different events or rather will) and also
|
||||
make sure to have the right amount of (for instance) ammo for one event, right
|
||||
amount (> 666 and < 666) money for when you need the doctor, and also trying to
|
||||
spend too much money (as in you don’t have that much money as well as > 666) at
|
||||
the fort (this can also be done in the beginning of the game before you go on
|
||||
the trail because it’s actually the same code reused) along with some things
|
||||
only I might know (but perhaps not? You decide! :-) ) then <del>you</del> I can
|
||||
be sure the code works as intended.</p>
|
||||
<p>One of the above things actually did go wrong earlier on but fortunately it was
|
||||
caught early on as it required rolling back a commit; if I had done many commits
|
||||
after the problematic commit I would have lost a lot of time I kept adding more
|
||||
events and more <code>goto</code>s.</p>
|
||||
<p>Here is how to test every event in the event loop, though as some are chances
|
||||
based on which event fires, you might have to run it multiple times. But since
|
||||
one should go through the game or at least a few turns (at least!) per event,
|
||||
this is not a problem. I should remind you that there are times where an event
|
||||
might fire but might not do anything. This happens to do with event 11 and where
|
||||
it goes and what it does.</p>
|
||||
<p>To really test it well the last time I did this was in the
|
||||
<a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/prog.gotos.c">prog.gotos.c</a> file as it’s the code
|
||||
merged close together, taking it WAY BEYOND rule 2b limit (due to <code>;</code>, <code>{</code>
|
||||
and <code>}</code> not being followed by spaces and the prog.c being at the max already).
|
||||
This benefited me as I could also verify that the formatting did not get messed
|
||||
up i.e. the code did not get mangled when merging lines.</p>
|
||||
<p>The event switch is the following code (from prog.c):</p>
|
||||
<pre><code> Y:switch(q=x(0,22))
|
||||
</code></pre>
|
||||
<p>so what you do is change the <code>x(0,22)</code> to go from 0 to 22, meaning that you have
|
||||
to compile the code 23 times. If one wants to check the <code>heaven</code> label they need
|
||||
to modify <code>i</code> to be <code>17</code> at a specific spot (well - or end up triggering a
|
||||
certain piece of code, which I think is in event 11, though it’s not as
|
||||
straight-forward as just testing that, although you could just set <code>i=17;</code> in
|
||||
the right spot).</p>
|
||||
<p>One should also try hunting and also going to the fort, at random times, but it
|
||||
should not be needed in every run. The same applies to the other checks that
|
||||
aren’t event specific.</p>
|
||||
<p>One more thing about events: some events can be a different message per instance
|
||||
so just because the same message does not repeat every time for a specific event
|
||||
does not mean it is not correct; not only is this the case for event 11 but it’s
|
||||
also the case for some others too. Another example is event 15 but it’s not the
|
||||
only one (well, it might be, but there are various other events - events are not
|
||||
just in the event switch! - that have different messages depending on the pRNG
|
||||
and other circumstances).</p>
|
||||
<p>One other thing is that it is good to test having no oxen and also having enough
|
||||
oxen where you will eat one (this can depend on the event and also if you’re out
|
||||
of food so this also varies).</p>
|
||||
<p>As you can see there is a lot to test but doing this, assuming I’ve not left
|
||||
anything out, allows one to verify the code is correct. This is one of the
|
||||
reasons I took extreme care when developing and why it required constant
|
||||
testing! In fact the bug I mentioned where it took me from an event all the way
|
||||
to the end of the game, was only for one event, so if that didn’t fire I might
|
||||
have missed it until I checked every event. This is how perilous it is with
|
||||
<code>goto</code>s but as I noted even though I have (pre-processed) 152 <code>goto</code>s it works.
|
||||
Of course it shouldn’t but it does.</p>
|
||||
<div id="conclusions">
|
||||
<div id="conclusion">
|
||||
<h3 id="conclusions">Conclusions</h3>
|
||||
</div>
|
||||
</div>
|
||||
<p>A question: is this well-rounded in obfuscation as the judges like? Definitely.</p>
|
||||
<p>The fact that close to 200 NUL terminated strings are in a single <code>char *</code> (!!),
|
||||
the odd looking compound literal, the maze of <code>goto</code>s (<del>116</del> 131 or
|
||||
<del>134</del> 149 depending on if you pre-process the code), the bastardised
|
||||
the odd looking compound literal, the maze of <code>goto</code>s (<del>116</del> 134 or
|
||||
<del>134</del> 152 depending on if you pre-process the code), the bastardised
|
||||
Duff’s device, the strange labels inside <code>switch()</code>s, the jumping into and out
|
||||
of <code>switch()</code>s only to jump back in (or out), the for loops split across several
|
||||
parts of the code (one making it look like variables are uninitialised), if/else
|
||||
@@ -1791,27 +1871,31 @@ want to waste perfectly good spaghetti. There comes a point when there’s just
|
||||
much spaghetti that it’s wasted, if it can even be cooked. I believed I reached
|
||||
the latter. But of course that was a practical choice - and not my complete
|
||||
version. It was just easier to test as I had another version to contend to.</p>
|
||||
<p>But let’s say I had more space with iocccsize: do you REALLY expect me to add
|
||||
more spaghetti? There isn’t anything that could be done, even if it was possible
|
||||
to maintain this huge platter of delicious spaghetti without gaining fifty
|
||||
kilograms. Besides, I don’t want to see spaghetti EVER AGAIN!! I’ve had enough
|
||||
of it for a lifetime! Okay, that’s not really true…it DOES sound good but I
|
||||
won’t likely be having it for a while. Can you actually blame me though? This
|
||||
spaghetti almost strangled me to death, like it did the Devil (I provided
|
||||
photographic proof of this earlier if you missed that). Still…now that things
|
||||
have settled a bit, I rather desire very much a platter of spaghetti.</p>
|
||||
<p>Do you REALLY expect me to add more spaghetti? There isn’t anything that could
|
||||
be done, even if it was possible to maintain this huge platter of delicious
|
||||
spaghetti without gaining fifty kilograms. Besides, I don’t want to see
|
||||
spaghetti EVER AGAIN!! I’ve had enough of it for a lifetime! Okay, that’s not
|
||||
really true…it DOES sound good but I won’t likely be having it for a while.
|
||||
Can you actually blame me though? This spaghetti almost strangled me to death,
|
||||
like it did the Devil (I provided photographic proof of this earlier if you
|
||||
missed that). Still…now that things have settled a bit, I rather desire very
|
||||
much a platter of spaghetti.</p>
|
||||
<p>Okay so I <strong>did</strong> it after the win for the ‘full version’ but that only makes it
|
||||
even more ludicrous doesn’t it?</p>
|
||||
<p>I have already demonstrated several other subtle and unique things but the
|
||||
<code>goto</code>s are what really makes it hard to parse; the other things are REALLY cool
|
||||
(unlike the spaghetti, at least hopefully) and interesting, and unique (or so I
|
||||
think), but those would be much less tasty without the HUGE pot of spaghetti
|
||||
(okay, once some of it is put on a plate).</p>
|
||||
<p>If I added more <code>goto</code>s it would be meaningless. A large family might not even
|
||||
be able to eat it all without some of it going to waste. The <code>goto</code>s and how
|
||||
they’re used make it hard to follow this code, in fact making it very
|
||||
unpredictable. It is constantly jumping to unusual places and doing things that
|
||||
seem downright illegal. It should not work.</p>
|
||||
<p>If I added more <code>goto</code>s it would be meaningless (does that mean that the fact I
|
||||
did it it’s meaningless? In a strange way the answer is it’s not actually
|
||||
meaningless :-) ). A large family might not even be able to eat it all without
|
||||
some of it going to waste. The <code>goto</code>s and how they’re used make it hard to
|
||||
follow this code, in fact making it very unpredictable. It is constantly jumping
|
||||
to unusual places and doing things that seem downright illegal. It should not
|
||||
work.</p>
|
||||
<p>But it <strong>DOES</strong> work. Exactly as I meant. As noted in my concluding remarks in
|
||||
my <a href="#devil">remarks above</a>, I started introducing bugs. It was extremely hard to
|
||||
my <a href="index.html#devil">remarks above</a>, I started introducing bugs. It was extremely hard to
|
||||
find ways to make the spaghetti even more twisted. How is that even POSSIBLE? I
|
||||
don’t think you could manage that with ACTUAL spaghetti!</p>
|
||||
<p>On top of all this: I kept it thematic, in code <strong>and</strong> data, and the code even
|
||||
|
||||
+151
-49
@@ -37,7 +37,7 @@ Harmful"](https://web.archive.org/web/20090320002214/http://www.ecn.purdue.edu/P
|
||||
See the Communications of the ACM, March 1987, Page 195-196.
|
||||
|
||||
(I refute some things in my program that directly contradicts Frank's
|
||||
letter in amusing or at least instructional ways in my [remarks above](#devil).
|
||||
letter in amusing or at least instructional ways in my [remarks](index.html#devil).
|
||||
|
||||
I added bold to logical conclusion because I wanted to stress this. I'm afraid
|
||||
they were wrong, oh so very VERY **VERY** WRONG. 24 `goto`s, according to
|
||||
@@ -49,11 +49,11 @@ too many, even in a large program, let alone a small one. Even one `goto` is too
|
||||
many. Unless I am very much mistaken, I have broken the record by a huge margin.
|
||||
|
||||
Here's the horrifying and hilarious truth: I beat it out by <del>92</del> 107
|
||||
MORE, **BEFORE** the cpp at <del>116</del> 131 and after the cpp is through I
|
||||
beat it by **125** MORE (!!), **AT 149!** Yes, you read that right.
|
||||
<del>134</del> 149 `goto`s! The originally submitted prog.c, submitted for
|
||||
practical reasons only, had it at, as might be guessed, 116/134 before and after
|
||||
the cpp.
|
||||
MORE, **BEFORE** the cpp at <del>116</del> 134 and after the cpp is through I
|
||||
beat it by **128** MORE (!!), **AT 152!** Yes, you read that right.
|
||||
<del>134</del> 152 `goto`s! The originally submitted prog.c, submitted for
|
||||
practical reasons only, had it at, as might be guessed from above, 116/134
|
||||
before and after the cpp.
|
||||
|
||||
Even removing what I think were the only dead `goto`s in the incomplete version,
|
||||
two of them, including one that is in the `w()` macro that would be translated
|
||||
@@ -66,29 +66,29 @@ joke, right? I'm sorry but it is NOT a joke. I am for real. There REALLY are
|
||||
that many and that is ridiculous.
|
||||
|
||||
Okay so it's a joke in another way but nonetheless YES I **REALLY DID** put in
|
||||
<del>116/134</del> 131/149 `goto`s, depending on if you pre-process it or not!
|
||||
<del>116/134</del> 134/152 `goto`s, depending on if you pre-process it or not!
|
||||
YES I might be mad. 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
|
||||
IOCCC... Well, as I mention in my [remarks above](index.html#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: removing the `#include`s,
|
||||
blank lines, lines with only variables and lines with just braces (i.e. only
|
||||
lines of code) the program has just 58 lines and in a single run there were a
|
||||
lines of code) the program has just 55 lines and in a single run there were a
|
||||
total of **1416** (!) line changes, counting function calls. In `main()` itself
|
||||
the line changed a total of **1131** (!) times!
|
||||
|
||||
The best (or worst, depending on how you look at it :-) ) part is this works. As
|
||||
I note in those concluding remarks, a [nameless company](https://www.apple.com)
|
||||
actually introduced a security hole from ONE `goto`. Yet I have
|
||||
<del>116/134</del> 131/149 and it actually works? That is surely obscene. And
|
||||
<del>116/134</del> 134/152 and it actually works? That is surely obscene. And
|
||||
beautiful. But wrong.
|
||||
|
||||
Oh and BTW: it appears that `hines` is a bit confused about my entry, though I'm
|
||||
not really sure why. In any case, I not only have dethroned `hines` (sorry
|
||||
...but also not sorry!) but I have, as noted already, beaten the original BASIC
|
||||
game by <del>7</del> 22 more `goto`s at <del>116</del> 131 before the cpp
|
||||
and <del>**18 MORE**</del> **40 MORE** after the cpp, at 149!
|
||||
game by <del>7</del> 25 more `goto`s at <del>116</del> 134 before the cpp
|
||||
and <del>**18 MORE**</del> **43 MORE** after the cpp, at 152!
|
||||
|
||||
It's almost impossible to add more `goto`s. With the iocccsize it is impossible,
|
||||
if I don't want to sacrifice the rest of the program. You'll see why soon. But
|
||||
@@ -107,7 +107,7 @@ is in all the wrong places.
|
||||
This is not counting other cool things like a single `char *` holding near 200
|
||||
`char *`s. No. I do not mean an array of `char *`s! I mean a single flat `char
|
||||
*`! Yet in the code I index it AS IF it's a `char *[]`, just to add to the
|
||||
confusion (as if the <del>134</del> 149 `goto`s are not bad enough). But it's
|
||||
confusion (as if the <del>134</del> 152 `goto`s are not bad enough). But it's
|
||||
not a `char *[]`. It's a single `char *`, which is the contents of the data
|
||||
file.
|
||||
|
||||
@@ -171,8 +171,8 @@ Hilarious.
|
||||
|
||||
Counting whitespace this program is only 4666 bytes according to `wc -c` (macOS
|
||||
at the least, maybe others): quite intentionally to be on theme. That's a
|
||||
relatively short program to have <del>116</del> 131 `goto`s or more when
|
||||
filtered through `cc -E` (<del>134</del> 149!), wouldn't you say? If that's NOT
|
||||
relatively short program to have <del>116</del> 134 `goto`s or more when
|
||||
filtered through `cc -E` (<del>134</del> 152!), wouldn't you say? If that's NOT
|
||||
too many, then I ask you WHAT IS?
|
||||
|
||||
As said in numerous places, IT IS MUCH SMALLER than the BASIC file I included
|
||||
@@ -181,7 +181,7 @@ the BASIC one has 16 not counting the mountains code and mine is 23 not counting
|
||||
the mountains code, which obviously I also include and has more events (if we
|
||||
count the doctor visits an event then even more).
|
||||
|
||||
I discuss this some in my concluding [remarks above](#devil), as well as
|
||||
I discuss this some in my concluding [remarks above](index.html#devil), as well as
|
||||
mentioning that there are other events besides those 23. I certainly will not
|
||||
reveal all though. The humour and jokes sections of that file says more but the
|
||||
concluding remarks are for a summary and why I think that this code is worthy of
|
||||
@@ -217,7 +217,7 @@ the worst of it as you never know where the program will be next, and that's
|
||||
putting it in a simpler way. Much, much, MUCH simpler way, in fact, as you'll
|
||||
see.
|
||||
|
||||
Either way this program, and I mention this in my [remarks above](#devil) in an
|
||||
Either way this program, and I mention this in my [remarks above](index.html#devil) in an
|
||||
admittedly long editorial plea (although it does it by going over what I have
|
||||
done in simpler terms than this file), serves as a public service, warning about
|
||||
`goto`. The article about goto considered harmful has nothing against this, or
|
||||
@@ -229,8 +229,8 @@ prog.c and after filtered through `cc -E`. First prog.c. Prepare to be
|
||||
horrified, if you're not already:
|
||||
|
||||
```
|
||||
131 goto
|
||||
301 semicolon
|
||||
134 goto
|
||||
304 semicolon
|
||||
143 colon
|
||||
51 if
|
||||
11 else
|
||||
@@ -251,14 +251,14 @@ horrified, if you're not already:
|
||||
1 char
|
||||
1 size_t
|
||||
|
||||
Ratio: 1.01 gotos per keyword
|
||||
Ratio: 1.03 gotos per keyword
|
||||
```
|
||||
|
||||
1.01 goto per keyword? But then there's the cpp filtered code...
|
||||
1.03 goto per keyword? But then there's the cpp filtered code...
|
||||
|
||||
```
|
||||
149 goto
|
||||
339 semicolon
|
||||
152 goto
|
||||
342 semicolon
|
||||
143 colon
|
||||
51 if
|
||||
11 else
|
||||
@@ -279,12 +279,16 @@ horrified, if you're not already:
|
||||
1 char
|
||||
1 size_t
|
||||
|
||||
Ratio: 1.11 gotos per keyword
|
||||
Ratio: 1.13 gotos per keyword
|
||||
```
|
||||
|
||||
1.11!
|
||||
1.13! Did you also notice that despite there being 32 `case` statements there
|
||||
are **0** `break`s? See the label `Z` for how that one works, although as you'll
|
||||
notice one event actually flows right into it only to move on to the next part
|
||||
of the code. Additionally there are many `goto`s and labels in the `switch()`s
|
||||
that don't belong there in normal code, or for that matter in any code.
|
||||
|
||||
For comparison, here is the original version:
|
||||
Anyway for comparison, here is the original version's stats:
|
||||
|
||||
```
|
||||
116 goto
|
||||
@@ -475,7 +479,7 @@ it.
|
||||
There are a lot of ways to obscure code and I don't believe anyone has taken
|
||||
`goto` to this obscenity in C. I believe the one with the most `goto`s is
|
||||
1987/hines and, as noted earlier, it reports on itself as having only 24
|
||||
`goto`s. Yet I have <del>116</del> 131 before the cpp and <del>134</del> 149
|
||||
`goto`s. Yet I have <del>116</del> 134 before the cpp and <del>134</del> 152
|
||||
(!!) after the cpp.
|
||||
|
||||
And unfortunately for you dear reader I have done other things that also are
|
||||
@@ -663,7 +667,8 @@ As I commented in the commented.c:
|
||||
```
|
||||
|
||||
...and of course now the count, prog.c being the full version and prog.alt2.c
|
||||
being the practical version, have the count at 131/149.
|
||||
being the practical version, have the count at 131/149 (actually, prog.alt2.c
|
||||
has the 116/134).
|
||||
|
||||
I hope you understand but I do believe it's a gain not a loss. It is good enough
|
||||
especially as it's only for educational value - or to examine my head (though
|
||||
@@ -746,7 +751,7 @@ depending on the pRNG and which event it is.
|
||||
|
||||
At one point I was **DEAD CERTAIN** that part of this that should not be dead
|
||||
was dead. But every part of it that is meant to be live is. There was a part
|
||||
that was broken but that was fixed. As I noted in my [remarks above](#devil),
|
||||
that was broken but that was fixed. As I noted in my [remarks above](index.html#devil),
|
||||
this event (11 in particular, under `V`), will not necessarily do anything, as
|
||||
it depends on another call to the pRNG. This is good because otherwise every
|
||||
time it triggered it would cause severe illness.
|
||||
@@ -1328,7 +1333,7 @@ well-rounded in obfuscation.
|
||||
|
||||
**IMPORTANT NOTE TO THE JUDGES**: if any problems in the data file exist,
|
||||
remember to regenerate it as described in the Judges section and/or the
|
||||
Troubleshooting section in the [remarks above](#devil). It is greatly
|
||||
Troubleshooting section in the [remarks above](index.html#devil). It is greatly
|
||||
appreciated that if by some chance you do run into a problem that you do this
|
||||
quick procedure (the addpadding `-d` option can also be used to reveal what the
|
||||
program is doing for those who wish to see more, although trying to play the
|
||||
@@ -1347,7 +1352,7 @@ are **ANY** issues **PLEASE** run the `addpadding` tool manually (or better yet
|
||||
`make makedata`).
|
||||
|
||||
The data file key is part of the obfuscation both in code and in data; it also
|
||||
stays on theme. As noted in my [remarks above](#devil), I have bypassed the
|
||||
stays on theme. As noted in my [remarks above](index.html#devil), I have bypassed the
|
||||
concern of SUS portability by including my own tools, much like previous winning
|
||||
entries did with POSIX compatibility.
|
||||
|
||||
@@ -1603,7 +1608,8 @@ The files `data`, `data.src`, `data.asc`, `data.asc.src`, `data.scrnshot` and
|
||||
`data.scrnshot.src` are created/used by `addpadding` and are vital to the game
|
||||
(for the .asc data files it is for the non-emoji version, `prog.asc`, but used
|
||||
by the same code, hence the `DATA` macro and the same applies to the screenshot
|
||||
friendly one, as I discussed in the data files versions in my [remarks above](#devil)).
|
||||
friendly one, as I discussed in the data files versions in my [remarks
|
||||
above](index.html#devil)).
|
||||
|
||||
The `data*.src` files are included for the purpose of allowing the files to be
|
||||
created prior to running the game as they are vital, just like previous entries
|
||||
@@ -1679,14 +1685,105 @@ interesting and it's one of the reasons I'm quite proud of it.
|
||||
Interesting thing to ponder: what happens if a string is too long for the
|
||||
padding?
|
||||
|
||||
<div id="litmus">
|
||||
### Litmus test
|
||||
</div>
|
||||
|
||||
I did not write about this as much in my submission but since I made some
|
||||
updates post winning I figured I would write about the litmus test that I
|
||||
devised, to know that everything is working right.
|
||||
|
||||
It should be noted however that unless you know the code **EXTREMELY** well
|
||||
(which probably only means me :-) and this will probably get less true as time
|
||||
goes by) it might be hard to perform this and be 100% certain it is okay. This
|
||||
especially goes because there are things that most people would think are logic
|
||||
flow errors but are very intentional. I mentioned some in my
|
||||
[remarks](index.html).
|
||||
|
||||
I did briefly mention this in my [remarks](index.html) but here is a bit more
|
||||
detail. It seems fitting here as the obfuscation talks about `goto`s more.
|
||||
|
||||
The key here is the events switch. If every event can fire without, for
|
||||
instance, running through the game until you die, and you can also get sick, get
|
||||
hurt (both of which can happen with different events or rather will) and also
|
||||
make sure to have the right amount of (for instance) ammo for one event, right
|
||||
amount (> 666 and < 666) money for when you need the doctor, and also trying to
|
||||
spend too much money (as in you don't have that much money as well as > 666) at
|
||||
the fort (this can also be done in the beginning of the game before you go on
|
||||
the trail because it's actually the same code reused) along with some things
|
||||
only I might know (but perhaps not? You decide! :-) ) then <del>you</del> I can
|
||||
be sure the code works as intended.
|
||||
|
||||
One of the above things actually did go wrong earlier on but fortunately it was
|
||||
caught early on as it required rolling back a commit; if I had done many commits
|
||||
after the problematic commit I would have lost a lot of time I kept adding more
|
||||
events and more `goto`s.
|
||||
|
||||
Here is how to test every event in the event loop, though as some are chances
|
||||
based on which event fires, you might have to run it multiple times. But since
|
||||
one should go through the game or at least a few turns (at least!) per event,
|
||||
this is not a problem. I should remind you that there are times where an event
|
||||
might fire but might not do anything. This happens to do with event 11 and where
|
||||
it goes and what it does.
|
||||
|
||||
To really test it well the last time I did this was in the
|
||||
[prog.gotos.c](%%REPO_URL%%/2024/ferguson1/prog.gotos.c) file as it's the code
|
||||
merged close together, taking it WAY BEYOND rule 2b limit (due to `;`, `{`
|
||||
and `}` not being followed by spaces and the prog.c being at the max already).
|
||||
This benefited me as I could also verify that the formatting did not get messed
|
||||
up i.e. the code did not get mangled when merging lines.
|
||||
|
||||
The event switch is the following code (from prog.c):
|
||||
|
||||
``` <!---c-->
|
||||
Y:switch(q=x(0,22))
|
||||
|
||||
```
|
||||
|
||||
so what you do is change the `x(0,22)` to go from 0 to 22, meaning that you have
|
||||
to compile the code 23 times. If one wants to check the `heaven` label they need
|
||||
to modify `i` to be `17` at a specific spot (well - or end up triggering a
|
||||
certain piece of code, which I think is in event 11, though it's not as
|
||||
straight-forward as just testing that, although you could just set `i=17;` in
|
||||
the right spot).
|
||||
|
||||
One should also try hunting and also going to the fort, at random times, but it
|
||||
should not be needed in every run. The same applies to the other checks that
|
||||
aren't event specific.
|
||||
|
||||
One more thing about events: some events can be a different message per instance
|
||||
so just because the same message does not repeat every time for a specific event
|
||||
does not mean it is not correct; not only is this the case for event 11 but it's
|
||||
also the case for some others too. Another example is event 15 but it's not the
|
||||
only one (well, it might be, but there are various other events - events are not
|
||||
just in the event switch! - that have different messages depending on the pRNG
|
||||
and other circumstances).
|
||||
|
||||
One other thing is that it is good to test having no oxen and also having enough
|
||||
oxen where you will eat one (this can depend on the event and also if you're out
|
||||
of food so this also varies).
|
||||
|
||||
As you can see there is a lot to test but doing this, assuming I've not left
|
||||
anything out, allows one to verify the code is correct. This is one of the
|
||||
reasons I took extreme care when developing and why it required constant
|
||||
testing! In fact the bug I mentioned where it took me from an event all the way
|
||||
to the end of the game, was only for one event, so if that didn't fire I might
|
||||
have missed it until I checked every event. This is how perilous it is with
|
||||
`goto`s but as I noted even though I have (pre-processed) 152 `goto`s it works.
|
||||
Of course it shouldn't but it does.
|
||||
|
||||
|
||||
<div id="conclusions">
|
||||
<div id="conclusion">
|
||||
### Conclusions
|
||||
</div>
|
||||
</div>
|
||||
|
||||
A question: is this well-rounded in obfuscation as the judges like? Definitely.
|
||||
|
||||
The fact that close to 200 NUL terminated strings are in a single `char *` (!!),
|
||||
the odd looking compound literal, the maze of `goto`s (<del>116</del> 131 or
|
||||
<del>134</del> 149 depending on if you pre-process the code), the bastardised
|
||||
the odd looking compound literal, the maze of `goto`s (<del>116</del> 134 or
|
||||
<del>134</del> 152 depending on if you pre-process the code), the bastardised
|
||||
Duff's device, the strange labels inside `switch()`s, the jumping into and out
|
||||
of `switch()`s only to jump back in (or out), the for loops split across several
|
||||
parts of the code (one making it look like variables are uninitialised), if/else
|
||||
@@ -1705,15 +1802,18 @@ much spaghetti that it's wasted, if it can even be cooked. I believed I reached
|
||||
the latter. But of course that was a practical choice - and not my complete
|
||||
version. It was just easier to test as I had another version to contend to.
|
||||
|
||||
But let's say I had more space with iocccsize: do you REALLY expect me to add
|
||||
more spaghetti? There isn't anything that could be done, even if it was possible
|
||||
to maintain this huge platter of delicious spaghetti without gaining fifty
|
||||
kilograms. Besides, I don't want to see spaghetti EVER AGAIN!! I've had enough
|
||||
of it for a lifetime! Okay, that's not really true...it DOES sound good but I
|
||||
won't likely be having it for a while. Can you actually blame me though? This
|
||||
spaghetti almost strangled me to death, like it did the Devil (I provided
|
||||
photographic proof of this earlier if you missed that). Still...now that things
|
||||
have settled a bit, I rather desire very much a platter of spaghetti.
|
||||
Do you REALLY expect me to add more spaghetti? There isn't anything that could
|
||||
be done, even if it was possible to maintain this huge platter of delicious
|
||||
spaghetti without gaining fifty kilograms. Besides, I don't want to see
|
||||
spaghetti EVER AGAIN!! I've had enough of it for a lifetime! Okay, that's not
|
||||
really true...it DOES sound good but I won't likely be having it for a while.
|
||||
Can you actually blame me though? This spaghetti almost strangled me to death,
|
||||
like it did the Devil (I provided photographic proof of this earlier if you
|
||||
missed that). Still...now that things have settled a bit, I rather desire very
|
||||
much a platter of spaghetti.
|
||||
|
||||
Okay so I **did** it after the win for the 'full version' but that only makes it
|
||||
even more ludicrous doesn't it?
|
||||
|
||||
I have already demonstrated several other subtle and unique things but the
|
||||
`goto`s are what really makes it hard to parse; the other things are REALLY cool
|
||||
@@ -1721,14 +1821,16 @@ I have already demonstrated several other subtle and unique things but the
|
||||
think), but those would be much less tasty without the HUGE pot of spaghetti
|
||||
(okay, once some of it is put on a plate).
|
||||
|
||||
If I added more `goto`s it would be meaningless. A large family might not even
|
||||
be able to eat it all without some of it going to waste. The `goto`s and how
|
||||
they're used make it hard to follow this code, in fact making it very
|
||||
unpredictable. It is constantly jumping to unusual places and doing things that
|
||||
seem downright illegal. It should not work.
|
||||
If I added more `goto`s it would be meaningless (does that mean that the fact I
|
||||
did it it's meaningless? In a strange way the answer is it's not actually
|
||||
meaningless :-) ). A large family might not even be able to eat it all without
|
||||
some of it going to waste. The `goto`s and how they're used make it hard to
|
||||
follow this code, in fact making it very unpredictable. It is constantly jumping
|
||||
to unusual places and doing things that seem downright illegal. It should not
|
||||
work.
|
||||
|
||||
But it **DOES** work. Exactly as I meant. As noted in my concluding remarks in
|
||||
my [remarks above](#devil), I started introducing bugs. It was extremely hard to
|
||||
my [remarks above](index.html#devil), I started introducing bugs. It was extremely hard to
|
||||
find ways to make the spaghetti even more twisted. How is that even POSSIBLE? I
|
||||
don't think you could manage that with ACTUAL spaghetti!
|
||||
|
||||
|
||||
@@ -14,15 +14,13 @@ long Z(long x){ return x * 1663; }
|
||||
#define S(x,z) while(scanf(&y[Z(x)],&z)!=1)while(getchar()!='\n');
|
||||
void V(long x){ printf("%s",&y[Z(x)]); }
|
||||
long k() { return E>0?x(0,99)>49:0; } int main() {
|
||||
switch(1)
|
||||
{ j:if(z)goto A; E*=5; B:
|
||||
switch(1) { j:if(z)goto A; E*=5; B:
|
||||
printf(&y[Z(12)],T); if(z) { goto f; } goto PP; default: srand(time(0));
|
||||
K=fopen(DATA,"r"); if(!K||getdelim(&y,&J,EOF,K)<0)
|
||||
goto hell; goto M; OO:if(b<1) { if(a){ w(40) PP:goto G; } if(f) w(41) w(45) g:goto S; } w(M>2169?47:45)
|
||||
hell:
|
||||
return
|
||||
666; rr:;
|
||||
goto CC; yy:
|
||||
666; rr:; goto CC; yy:
|
||||
{ if(b<1||M<0||M>2169){ goto _; F:V(51); R+=18; goto L; } goto i;
|
||||
P:for(X=1; X<--(unsigned){ 7 } ; ){ goto kk; BB:*o[X]+=(X==2?t[X]*5:t[X]); goto HA; TA:++X; goto at; ZZ:; }
|
||||
printf(&y[Z(11)],R,E,G,O,N,T,b,M); if(x(0,1))goto I; R:if(R<14)V(37); if(z) { z=0; l:{ if (k()) { if (x(0,9) > 4) { V(52);
|
||||
@@ -55,11 +53,11 @@ case 7:V(83); M-=10; goto Z; case 8:V(86); R-=30; G-=20; O-=40; V
|
||||
case 3:goto J; N:goto Q; case 4:i=17; } } case 2:V(5); } goto k; u:if(M<1951||W){ goto
|
||||
W; } W=1;
|
||||
if(!d&&!x(0,4)){ V(75); d=1; R+= 50; }
|
||||
if(!x(0,3)){ w(x(0,4)?84:x(0,4)?33:34) e:if(O>39){ goto xx; vv:v=0; goto mm; d:{ if(!v)goto TT; goto P; } } goto U; } if (x(0,9) < 5) w:V(35); c=1; M-=101; ++E; k:M-=10; W:if(x(0,1)){ if (d) V(39); if(e)V(25); } while(i)heaven:{ w(i) } if (!B&&(f||
|
||||
if(!x(0,3)){ w(x(0,4)?84:x(0,4)?33:34) e:if(O>39){ goto xx; vv:v=0; goto mm; d:{ if(!v)goto TT; goto P; } } goto U; } if (x(0,9) < 5) w:V(35); c=1; M-=101; ++E; k:M-=10; W:if(x(0,1)){ if (d) V(39); if(e)V(25); } while(i)heaven:{ w(i) goto _; } if (!B&&(f||
|
||||
a)){ if(d&&a) V(91); if(T<666){ goto QQ; KK:Q=a?1:Q; h=f?1:h; f=a=0; V(93); T-=666; } else{ goto KK; } JJ:; } b-=f?15
|
||||
:h?5:0; b-=a?5:Q?15:0; M+=170; M+=O> 99 ? 30:- 99;
|
||||
b-=10; goto z; J:V(a=54); } goto k; MM
|
||||
:goto k; default: if(q>10) { goto k; } if(q>7) { if(N<5) { w(99) goto M; G:goto yy; } V(13); N-=5; } goto Z; _:goto rr; S:if (E>1999){ w(27) I:goto a; } V(82); M-=9; N-=5; R-=20; goto Z;
|
||||
:goto k; default: if(q>10) { goto k; } if(q>7) { if(N<5) { w(99) goto M; G:goto yy; } V(13); N-=5; } goto Z; _:goto rr; goto _; S:if (E>1999){ w(27) goto _; I:goto a; } V(82); M-=9; N-=5; R-=20; goto Z;
|
||||
} M-=17; goto Z; case 14:V(74); goto Z; case 15:V(x(0,1)?69:68);
|
||||
goto Z; ha:V(78); if(k()){ goto go; to:; } else { goto ii; jj:; } goto o; case 11:goto V; case
|
||||
12:V(94); M-=5; b-=19; N -= 5; goto Z; tt:goto Y; case 0:V(20); Z:; } if(O>39&&!x(0,9)){goto O; xx:V(e=x(0,1)?18:19); O -= 40; goto q; } E:if(M<951) goto W; if (G < 36){ goto b; } if (x(0,9) > 2) goto n; V(96); if (x(0,1)) { goto p; Q:for (X=
|
||||
|
||||
+32
-32
@@ -4,39 +4,39 @@
|
||||
#include<stdlib.h>
|
||||
#include<unistd.h>
|
||||
long x(long y, long z){ return rand()%(z-y+1)+y; }
|
||||
unsigned m,D,Q,v,l,f,X,z,B,i,h,
|
||||
r,u,d,e; long
|
||||
O,R,E,G,O,N, T,R,A,I,L,*o[]={ &O,&R,&E,&G,&O,&N} ,a,t[7],q,M, b=666,c,W; char *y,*p; FILE*K; size_t J;
|
||||
unsigned m,D,Q,v,l,f,X,z,B,i,h, r,u,d,e; long
|
||||
O,R,E,G,O,N, T,R,A,I,L,*o[]={ &O,&R,&E,&G,&O,&N} ,a,t[7],q,M, b=666,c,W; char *y; FILE*K; size_t J;
|
||||
#define w(i) { V(i); V(4); goto hell; goto M; }
|
||||
long Z(long x){ return x * 1663; }
|
||||
#define S(x,z) while(scanf(&y[Z(x)],&z)!=1)while(getchar()!='\n');
|
||||
void V(long x){printf("%s",&y[Z(x)]);}long k(){return E>0?x(0,99)>49:0;}int main(){switch(1){j:if(z)goto A;E*=5;B:
|
||||
printf(&y[Z(12)],T);if(z){goto f;}goto PP;default:srand(time(0));K=fopen(DATA,"r");if(!K||getdelim(&y,&J,EOF,K)<0)goto
|
||||
hell; goto M;OO:if(b<1){if(a){w(40)PP:goto G;}if(f)w(41)w(45)g:goto S;}w(M>2169?47:45)
|
||||
hell:return
|
||||
666;rr:;goto CC;yy:{if(b<1||M<0||M>2169){goto _;F:V(51);R+=18;goto L;}goto i;P:for(X=1;X<--(unsigned){7};){goto kk;
|
||||
BB:*o[X]+=(X==2?t[X]*5:t[X]);goto HA;TA:++X;goto at;ZZ:;}printf(&y[Z(11)],R,E,G,O,N,T,b,M);if(x(0,1))goto I;R:if(R<14)V(37);
|
||||
if(z){z=0;l:{if(k()){if(x(0,9)>4){V(52);R+=23;if(!x(0,9)){goto r;L:goto II;}c:;}else{goto F;r:goto c;qq:{V(53);goto zz;}II:;}}
|
||||
else{goto qq;}zz:E-=9;M-=45;}goto C;y:V(42);S(2,r)switch(r){M:V(1);v:memset(&t,0,sizeof t);goto N;D:{if(k()){goto dd;ii:V(f=79);
|
||||
b-=80;T/=4;goto jj;ee:;}else{goto oo;dd:V(a=29);T+=70;goto ee;x:V(X+--(unsigned){6});if(z){S(3,t[X])if(t[X]<0||t[X]>
|
||||
666 ){V(14); goto x; goto
|
||||
heaven ;ET:L-=t[u]; goto XT;}L=T;for(u=0;u<6;++u){goto ET;XT:;}if(L<0){V(46);memset(&t,0,sizeof t);goto v;}}
|
||||
else{S(3,*(o[X]))if(*o[X]<0||*o[X]>
|
||||
666) {V(14);goto x;}
|
||||
void V(long x){printf("%s",&y[Z(x)]);}long k(){return E>0?x(0,99)>49:0;}int main(){switch(1){j:if(z)goto A;E*=5;B:printf(&y[Z(12)],
|
||||
T);if(z){goto f;}goto PP;default:srand(time(0));K=fopen(DATA,"r");if(!K||getdelim(&y,&J,EOF,K)<0)
|
||||
goto hell;goto M;OO:if(b<1){if(a){w(40)PP:goto G;}if(f)w(41)w(45)g:goto S;}w(M>2169?47:45)hell:return
|
||||
666;rr:;goto CC; yy:{if(b<1||M<0||M>2169){goto _;F:V(51);R+=18;goto L;}goto i;P:for(X=1;X<--(unsigned){7};){goto kk;BB:*o[X]+=
|
||||
(X==2?t[X]*5:t[X]);goto HA;TA:++X;goto at;ZZ:;}printf(&y[Z(11)],R,E,G,O,N,T,b,M);if(x(0,1))goto I;R:if(R<14)V(37);if(z){z=0;l:{
|
||||
if(k()){if(x(0,9)>4){V(52);R+=23;if(!x(0,9)){goto r;L:goto II;}c:;}else{goto F;r:goto c;qq:{V(53);goto zz;}II:;}}else{goto qq;}zz:
|
||||
E-=9;M-=45;}goto C;y:V(42);S(2,r)switch(r){M:V(1);v:memset(&t,0,sizeof t);goto N;D:{if(k()){goto dd;ii:V(f=79);b-=80;T/=4;goto jj;
|
||||
ee:;}else{goto oo;dd:V(a=29);T+=70;goto ee;x:V(X+--(unsigned){6});if(z){S(3,t[X])if(t[X]<0||t[X]>
|
||||
666){V(14);goto x;goto
|
||||
heaven;ET:L-=t[u];goto XT;}L=T;for(u=0;u<6;++u){goto ET;XT:;}if(L<0){V(46);memset(&t,0,sizeof t);goto v;}}else{S(3,*(o[X]))if(*o[X]
|
||||
<0||*o[X]>
|
||||
666){V(14);goto x;}
|
||||
T=1666-O-R-E-G-0-N;if(T<0){V(46);O=R=E=G=N=0;goto v;LL:*o[X]=0;uu:++X;goto ZZ;}}goto bb;}}goto s;case 3:goto X;case 1:z=1;M-=45;
|
||||
goto v;case 2:goto T;}goto y;O:{V(e=19);O-=40;R+=40;}goto E;i:if(O<1){goto d;}else{goto vv;mm:;}goto P;go:V(81);R+=9;N+=3;goto
|
||||
to;}else{goto y;HA:T-=X[t];goto TA;A:for(X=1;X<6;){goto BB;kk:if(*o[X]<0)goto LL;goto uu;QQ:V(B=38);goto JJ;at:;}goto B;}T:l=1;
|
||||
if(E<9){goto h;}else{goto l;h:V(16);goto C;DD:goto u;}C:l=0;f:z=0;X:if(R<1){goto e;U:w(24)K:R-=R>23?23:R>18?18:R>13?13:R;goto Y;
|
||||
TT:V(v=15);O=0;goto P;}else{goto K;}goto tt;Y:switch(q=x(0,22)){case 1:V(95);R+=5;goto Z;case 18:V(26);goto Z;case 13:V(28);goto Z;
|
||||
case 2:O-=40;V(71);goto Z;case 3:V(a=76);b-=70;goto W;case 4:V(77);N-=7;M-=7;goto Z;case 5:case 10:if(q<6){goto ha;m:V(56);goto D;
|
||||
CC:goto OO;o:;}else{goto m;oo:V(f=62);M-=50;b-=35;s:;}goto Z;a:goto H;case 9:case 19:V(30);goto Z;case 20:V(32);goto Z;case 21:V(31);goto Z;case 6:goto g;case 16:case 22:V(49);goto Z;case 17:V(72);goto Z;case 7:V(83);M-=10;goto Z;case 8:V(86);R-=30;G-=20;O-=40;V
|
||||
:switch(x(1,9)){case 2:if(q>9){switch(x(1,2)){q:R+=40;goto Y;case 1:{switch(x(2,5)){case 2:V(a=54);goto MM;b:w(48)case 3:goto J;N:
|
||||
goto Q;case 4:i=17;}}case 2:V(5);}goto k;u:if(M<1951||W){goto W;}W=1;if(!d&&!x(0,4)){V(75);d=1;R+= 50;}if(!x(0,3)){w(x(0,4)?84:x(0,4)?33:34)e:if(O>39){goto xx;vv:v=0;goto mm;d:{if(!v)goto TT;goto P;}}goto U;}if(x(0,9)<5)w:V(35);c=1;M-=101;++E;k:M-=10;W:if(x(0,1)){
|
||||
if(d)V(39);if(e)V(25);}while(i)heaven:{w(i)}if(!B&&(f||a)){if(d&&a)V(91);if(T<666){goto QQ;KK:Q=a?1:Q;h=f?1:h;f=a=0;V(93);T-=666;}
|
||||
else{goto KK;}JJ:;}b-=f?15:h?5:0;b-=a?5:Q?15:0;M+=170;M+=O>99?30:-99;b-=10;goto z;J:V(a=54);}goto k;MM:goto k;default:if(q>10){
|
||||
goto k;}if(q>7){if(N<5){w(99)goto M;G:goto yy;}V(13);N-=5;}goto Z;_:goto rr;S:if(E>1999){w(27)I:goto a;}V(82);M-=9;N-=5;R-=20;goto Z;
|
||||
}M-=17;goto Z;case 14:V(74);goto Z;case 15:V(x(0,1)?69:68);goto Z;ha:V(78);if(k()){goto go;to:;}else{goto ii;jj:;}goto o;case 11:
|
||||
goto V;case 12:V(94);M-=5;b-=19;N-=5;goto Z;tt:goto Y;case 0:V(20);Z:;}if(O>39&&!x(0,9)){goto O;xx:V(e=x(0,1)?18:19);O-=40;goto q;}
|
||||
E:if(M<951)goto W;if(G<36){goto b;}if(x(0,9)>2)goto n;V(96);if(x(0,1)){goto p;Q:for(X=1;X<6;++X){goto x;bb:;}goto j;}V(97);M-=60;
|
||||
goto n;H:goto R;p:if(x(0,9)<3)goto t;V(21);M-=99;goto n;t:V(22);M-=85;n:if(m){goto DD;}m=1;if(x(0,9)>5)goto w;V(23);z:;}if(A++<21)
|
||||
goto yy;goto _;}}
|
||||
goto v;case 2:goto T;}goto y;O:{V(e=19);O-=40;R+=40;}goto E;i:if(O<1){goto d;}else{goto vv;mm:;}goto P;go:V(81);R+=9;N+=3;goto to;
|
||||
}else{goto y;HA:T-=X[t];goto TA;A:for(X=1;X<6;){goto BB;kk:if(*o[X]<0)goto LL;goto uu;QQ:V(B=38);goto JJ;at:;}goto B;}T:l=1;if(E<9)
|
||||
{goto h;}else{goto l;h:V(16);goto C;DD:goto u;}C:l=0;f:z=0;X:if(R<1){goto e;U:w(24)K:R-=R>23?23:R>18?18:R>13?13:R;goto Y;TT:V(v=15);
|
||||
O=0;goto P;}else{goto K;}goto tt;Y:switch(q=x(0,22)){case 1:V(95);R+=5;goto Z;case 18:V(26);goto Z;case 13:V(28);goto Z;case 2:O-=40;
|
||||
V(71);goto Z;case 3:V(a=76);b-=70;goto W;case 4:V(77);N-=7;M-=7;goto Z;case 5:case 10:if(q<6){goto ha;m:V(56);goto D;CC:goto OO;o:;}
|
||||
else{goto m;oo:V(f=62);M-=50;b-=35;s:;}goto Z;a:goto H;case 9:case 19:V(30);goto Z;case 20:V(32);goto Z;case 21:V(31);goto Z;case 6:
|
||||
goto g;case 16:case 22:V(49);goto Z;case 17:V(72);goto Z;case 7:V(83);M-=10;goto Z;case 8:V(86);R-=30;G-=20;O-=40;V:switch(x(1,9)){
|
||||
case 2:if(q>9){switch(x(1,2)){q:R+=40;goto Y;case 1:{switch(x(2,5)){case 2:V(a=54);goto MM;b:w(48)case 3:goto J;N:goto Q;case 4:i=17;
|
||||
}}case 2:V(5);}goto k;u:if(M<1951||W){goto W;}W=1;if(!d&&!x(0,4)){V(75);d=1;R+=50;}if(!x(0,3)){w(x(0,4)?84:x(0,4)?33:34)e:if(O>39){
|
||||
goto xx;vv:v=0;goto mm;d:{if(!v)goto TT;goto P;}}goto U;}if(x(0,9)<5)w:V(35);c=1;M-=101;++E;k:M-=10;W:if(x(0,1)){if(d)V(39);if(e)V(25)
|
||||
;}while(i)heaven:{w(i)goto _;}if(!B&&(f||a)){if(d&&a)V(91);if(T<666){goto QQ;KK:Q=a?1:Q;h=f?1:h;f=a=0;V(93);T-=
|
||||
666;}else{goto KK;}JJ:;}b-=f?15:h?5:0;b-=a?5:Q?15:0;M+=170;M+=O>99?30:-99;b-=10;goto z;J:V(a=54);}goto k;MM:goto k;default:if(q>10)
|
||||
{goto k;}if(q>7){if(N<5){w(99)goto M;G:goto yy;}V(13);N-=5;}goto Z;_:goto rr;goto _;S:if(E>1999){w(27)goto _;I:goto a;}V(82);M-=9;
|
||||
N-=5;R-=20;goto Z;}M-=17;goto Z;case 14:V(74);goto Z;case 15:V(x(0,1)?69:68);goto Z;ha:V(78);if(k()){goto go;to:;}else{goto ii;jj:;}
|
||||
goto o;case 11:goto V;case 12:V(94);M-=5;b-=19;N-=5;goto Z;tt:goto Y;case 0:V(20);Z:;}if(O>39&&!x(0,9)){goto O;xx:V(e=x(0,1)?18:19);
|
||||
O-=40;goto q;}E:if(M<951)goto W;if(G<36){goto b;}if(x(0,9)>2)goto n;V(96);if(x(0,1)){goto p;Q:for(X=1;X<6;++X){goto x;bb:;}goto j;}
|
||||
V(97);M-=60;goto n;H:goto R;p:if(x(0,9)<3)goto t;V(21);M-=99;goto n;t:V(22);M-=85;n:if(m){goto DD;}m=1;if(x(0,9)>5)goto w;V(23);z:;}
|
||||
if(A++<21)goto yy;goto _;}}
|
||||
Reference in new issue
Block a user