Merge pull request #194 from xexyl/24ferg1-gotos
2024/ferguson1 bug fix, make goto complete (149)
This commit is contained in:
16 files changed
+876
-640
No files matched your search
@@ -38,12 +38,20 @@
|
||||
"entry_text" : "alternate source code"
|
||||
},
|
||||
{
|
||||
"file_path" : "prog.goto.max.c",
|
||||
"file_path" : "prog.alt2.c",
|
||||
"inventory_order" : 40,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "entry source code with maxed out gotos"
|
||||
"entry_text" : "original source code with minor bug fix"
|
||||
},
|
||||
{
|
||||
"file_path" : "prog.gotos.c",
|
||||
"inventory_order" : 90,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "prog.c with merged lines to show mass of gotos"
|
||||
},
|
||||
{
|
||||
"file_path" : "prog.orig.c",
|
||||
|
||||
@@ -17,10 +17,11 @@ data.scrnshot
|
||||
lencount
|
||||
mbcheck
|
||||
printer
|
||||
prog.alt
|
||||
prog.alt2
|
||||
prog.alt2.asc
|
||||
prog.alt2.scrnshot
|
||||
prog.alt.asc
|
||||
prog.alt.scrnshot
|
||||
prog.asc
|
||||
prog.goto.max
|
||||
prog.goto.max.asc
|
||||
prog.goto.max.scrnshot
|
||||
prog.scrnshot
|
||||
+44
-29
@@ -154,12 +154,12 @@ TARGET= ${PROG} ${PROG}.asc ${PROG}.scrnshot
|
||||
|
||||
# .alt is as above more events
|
||||
#
|
||||
ALT_OBJ= ${PROG}.alt.o ${PROG}.alt.asc.o ${PROG}.alt.scrnshot.o ${PROG}.goto.max.o \
|
||||
${PROG}.goto.max.asc.o ${PROG}.goto.max.scrnshot.o
|
||||
ALT_TARGET= ${PROG}.alt ${PROG}.alt.asc ${PROG}.alt.scrnshot ${PROG}.goto.max \
|
||||
${PROG}.goto.max.asc ${PROG}.goto.max.scrnshot
|
||||
ALT_OBJ= ${PROG}.alt.o ${PROG}.alt.asc.o ${PROG}.alt.scrnshot.o \
|
||||
${PROG}.alt2.o ${PROG}.alt2.asc.o ${PROG}.alt2.scrnshot.o
|
||||
ALT_TARGET= ${PROG}.alt ${PROG}.alt.asc ${PROG}.alt.scrnshot \
|
||||
${PROG}.alt2 ${PROG}.alt2.asc ${PROG}.alt2.scrnshot
|
||||
|
||||
# list any data files supplied with the submission
|
||||
# The following notes were provided by the author in his Makefile:
|
||||
#
|
||||
# Don't include data, data.asc or data.scrnshot.
|
||||
# The data rule (although it's better to use makedata the data rule might work -
|
||||
@@ -216,7 +216,7 @@ test: lencount mbcheck
|
||||
@./lencount -t -i data.scrnshot.src
|
||||
@./mbcheck
|
||||
|
||||
# ASCII only version of submission code, hence why the DATA macro is defined
|
||||
# ASCII only version of entry code, hence why the DATA macro is defined
|
||||
# here, not in CDEFINE.
|
||||
#
|
||||
${PROG}.asc: ${PROG}.c
|
||||
@@ -246,7 +246,7 @@ addpadding: addpadding.c
|
||||
bytecount: bytecount.c
|
||||
${CC} ${CFLAGS} -Wno-unreachable-code-break bytecount.c -o $@ ${LDFLAGS}
|
||||
|
||||
# this tool helped me verify the locations of strings were correct (locations
|
||||
# this tool helped verify the locations of strings were correct (locations
|
||||
# are based on the blocksize). The bytecount also helped.
|
||||
#
|
||||
bytetest: bytetest.c
|
||||
@@ -258,17 +258,18 @@ bytetest: bytetest.c
|
||||
byteread: byteread.c
|
||||
${CC} ${CFLAGS} byteread.c -o $@ ${LDFLAGS}
|
||||
|
||||
# this tool was helpful to help identify if any emojis in the ASCII only version
|
||||
# slipped through (however, mbcheck is a better one: this tool is still
|
||||
# useful however). Probably only the judges will find this interesting just like
|
||||
# most of the tools I have provided.
|
||||
# this tool was earlier used to help in identifying any emojis in the ASCII only
|
||||
# version that might have slipped through (however, mbcheck is a better one: this tool is still
|
||||
# useful however). Mostly provided for the judges but I, the author, included
|
||||
# most of the tools (most of which are meant only for the judges as well).
|
||||
#
|
||||
bytecheck: bytecheck.c
|
||||
${CC} ${CFLAGS} -Wno-unreachable-code-break bytecheck.c -o $@ ${LDFLAGS}
|
||||
|
||||
# by default this checks for multibyte characters (well 2, 3, 4) in the ASCII
|
||||
# data source file, reporting if any are found. If any are found it will report
|
||||
# which string so it can be fixed.
|
||||
# which string so it can be fixed. This is used as part of the build process,
|
||||
# and if any are found it will fail to compile (or it should).
|
||||
#
|
||||
mbcheck: mbcheck.c
|
||||
${CC} ${CFLAGS} -Wno-unreachable-code-break mbcheck.c -o $@ ${LDFLAGS}
|
||||
@@ -290,7 +291,8 @@ printer: printer.c
|
||||
lencount: lencount.c
|
||||
${CC} ${CFLAGS} -Wno-unreachable-code-break lencount.c -o $@ ${LDFLAGS}
|
||||
|
||||
|
||||
# The author provided these notes in his Makefile:
|
||||
#
|
||||
# IMPORTANT NOTES FOR THE JUDGES.
|
||||
#
|
||||
# The makedata.sh script will generate files that are needed by some of the
|
||||
@@ -320,9 +322,13 @@ padding: addpadding test
|
||||
./addpadding
|
||||
@echo "Done."
|
||||
|
||||
# The author provided these remarks in his Makefile:
|
||||
#
|
||||
# see remarks.md for more details. This script is mostly useful for the some of
|
||||
# the other tools but it can be used for prog.c and prog.alt.c indirectly as it
|
||||
# also does build the data files from the source files.
|
||||
# the other tools but it can be used for prog.c and prog.alt.c (and prog.alt2.c
|
||||
# which is the originally submitted code but with a minor bug fix - prog.alt.c
|
||||
# was already taken) indirectly as it also does build the data files from the
|
||||
# source files.
|
||||
#
|
||||
# An example use of when I personally use this rule: when I actually make an
|
||||
# edit to the data source files. As you will probably have noticed the printer.c
|
||||
@@ -345,6 +351,7 @@ ${PROG}.alt: ${PROG}.alt.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data"' ${PROG}.alt.c -o $@ ${LDFLAGS}
|
||||
|
||||
|
||||
# ASCII only version of alt code (Devil's Cut above). This is why indeed the
|
||||
# DATA variable is not in the CDEFINE - the .asc versions use the data.asc file.
|
||||
#
|
||||
@@ -352,17 +359,6 @@ ${PROG}.alt.asc: ${PROG}.alt.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data.asc"' ${PROG}.alt.c -o $@ ${LDFLAGS}
|
||||
|
||||
# goto maxed out - regular data file
|
||||
#
|
||||
${PROG}.goto.max: ${PROG}.goto.max.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data"' ${PROG}.goto.max.c -o $@ ${LDFLAGS}
|
||||
|
||||
# goto maxed out - ASCII only data file
|
||||
#
|
||||
${PROG}.goto.max.asc: ${PROG}.goto.max.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data.asc"' ${PROG}.goto.max.c -o $@ ${LDFLAGS}
|
||||
|
||||
# screenshot friendly version of alt code
|
||||
#
|
||||
@@ -370,11 +366,30 @@ ${PROG}.alt.scrnshot: ${PROG}.alt.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data.scrnshot"' ${PROG}.alt.c -o $@ ${LDFLAGS}
|
||||
|
||||
# goto maxed out - screenshot friendly version
|
||||
# For practical reasons, the author submitted code that was not as full of gotos
|
||||
# as he had in mind. After the win he decided to add it to the repo. But since
|
||||
# there was already an alt.c file this original code, which has a minor bug fix,
|
||||
# is in .alt2.c.
|
||||
#
|
||||
${PROG}.goto.max.scrnshot: ${PROG}.goto.max.c
|
||||
|
||||
# Original submitted code with a minor bug fix
|
||||
#
|
||||
${PROG}.alt2: ${PROG}.alt2.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data.scrnshot"' ${PROG}.goto.max.c -o $@ ${LDFLAGS}
|
||||
${CC} ${CFLAGS} -DDATA='"data"' ${PROG}.alt2.c -o $@ ${LDFLAGS}
|
||||
|
||||
# Original submitted code with a minor bug fix - ASCII only version
|
||||
#
|
||||
${PROG}.alt2.asc: ${PROG}.alt2.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data.asc"' ${PROG}.alt2.c -o $@ ${LDFLAGS}
|
||||
|
||||
# Original submitted code with a minor bug fix - screenshot friendly version
|
||||
#
|
||||
${PROG}.alt2.scrnshot: ${PROG}.alt2.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data.scrnshot"' ${PROG}.alt2.c -o $@ ${LDFLAGS}
|
||||
|
||||
|
||||
# data files
|
||||
#
|
||||
|
||||
+135
-110
@@ -29,8 +29,11 @@ YouTube show for this entry:
|
||||
|
||||
## Alternate code:
|
||||
|
||||
The author provided two alternate versions, one which has more events and far
|
||||
fewer `goto`s and the other which maxed out the `goto`s at 149 (up from 134)!
|
||||
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
|
||||
practical reasons.
|
||||
|
||||
|
||||
### Alternate build:
|
||||
@@ -44,43 +47,52 @@ fewer `goto`s and the other which maxed out the `goto`s at 149 (up from 134)!
|
||||
|
||||
``` <!---sh-->
|
||||
./prog.alt
|
||||
|
||||
./prog.alt2
|
||||
```
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
You will have to go to "Fun-Damentals" to understand the logic flow of
|
||||
this game. While you jump as many as 134 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.
|
||||
You will have to go to "Fun-Damentals" to understand the logic flow of this
|
||||
game. While you goto as many as 149 times and jump hundreds if not over one
|
||||
thousand 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.
|
||||
|
||||
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 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. :-)
|
||||
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:
|
||||
|
||||
> 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 just the few functions in prog.c), there were a total of **985** (!)
|
||||
line jumps. Skipping prog.c function calls and it was still **776** jumps! The
|
||||
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, **has just 59 (!) lines of code**. A very tiny
|
||||
lines that have only variables, **has just 58 (!) 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. The [maxed out goto
|
||||
version](%%REPO_URL%%/2024/ferguson1/prog.goto.max.c) is far worse.
|
||||
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.
|
||||
|
||||
**SUGGESTION**: if you dare, try opening
|
||||
[prog.gotos.c](%%REPO_URL%%/2024/ferguson1/prog.gotos.c) in an editor with
|
||||
syntax highlighting and then highlight `goto`. Alternatively, try it with `grep`
|
||||
if your grep has colours enabled (probably easier).
|
||||
|
||||
|
||||
<div id="devil">
|
||||
### A Pact With the Devil On the Oregon Trail (...and his 134 regrets of goto)
|
||||
### A Pact With the Devil On the Oregon Trail (...and his <del>134</del> 149 regrets of goto)
|
||||
</div>
|
||||
|
||||
The _Go To Hell In A Handcart Travel Company_ **PROUDLY** welcomes all sinners to
|
||||
@@ -2161,8 +2173,9 @@ features versus problems, though possibly more exist.
|
||||
|
||||
Obviously since you can buy oxen at the forts (something not possible in the
|
||||
original game for some reason) then even if you ran out (and perhaps you ate
|
||||
one) it could happen again. Remember you might end up eating an ox just because
|
||||
he looks at you funny, not just because you are out of food.
|
||||
one, which of course is not in the original either) it could happen again.
|
||||
Remember you might end up eating an ox just because he looks at you funny, not
|
||||
just because you are out of food!
|
||||
|
||||
If you don't have an ox and you are out of food you die from starvation. But
|
||||
what happens when you die of starvation? Well it says:
|
||||
@@ -2193,31 +2206,32 @@ to do much at all unless you had a great amount of it; which of course the
|
||||
player character (PC) does not.
|
||||
|
||||
Actually the only reason: for the amusing rhyme that fits with the jokes,
|
||||
nothing else (it makes it more interesting and amusing than 'You ran out of food
|
||||
and starved to death', doesn't it?).
|
||||
nothing else (but it *does* make it more interesting and amusing than 'You ran
|
||||
out of food and starved to death', doesn't it?).
|
||||
|
||||
The fact the original game does not have you decide on drinking water (and see
|
||||
section on other differences for the subject of decision making) means I could
|
||||
take some liberty with it. Besides, didn't I say you would learn by what did not
|
||||
happen? They certainly did drink water and unsafe water (I'm sure) too, so my
|
||||
joke is all the more appropriate (even if it's inappropriate in some company
|
||||
:-), perhaps your grandparents - although depending on your age now maybe not).
|
||||
:-), perhaps your grandparents - although depending on your age now maybe not.
|
||||
May my grandparents rest in peace, hopefully not with the devil).
|
||||
|
||||
Sometimes it is suggested an ox is lost/whatever (not lost as in it wanders off
|
||||
but rather in the sense that you have fewer oxen) even if you don't have one. It
|
||||
does this in a number of ways like referring to the famous 'spared no expense'
|
||||
from Jurassic Park. It also is a nod the IOCCC guidelines that talk about a fish
|
||||
Eric that might or might not exist.
|
||||
but rather in the sense that you have fewer oxen, for instance getting stuck in
|
||||
a river) even if you don't have one. It does this in a number of ways like
|
||||
referring to the famous 'spared no expense' from Jurassic Park. It also is a nod
|
||||
the IOCCC guidelines that talk about a fish Eric that might or might not exist.
|
||||
|
||||
I decided to not call him Eric because there is potential for more than one ox
|
||||
(you'll note in other messages I got past this issue by making it like in real
|
||||
life - wagon trains and large groups - though again some times wagon for the
|
||||
life - wagon trains and large groups - though again sometimes wagon for the
|
||||
joke - plus being ambiguous). Of course the narrator as the Devil is telling all
|
||||
sorts of lies too so that hardly matters.
|
||||
|
||||
As for whether this could happen: in theory it could but if you run out of oxen
|
||||
you're not going to get very far anyway. In other cases, like eating an oxen,
|
||||
the check is in place, although in retrospect it would be very amusing if it did
|
||||
you're not going to get very far anyway. In other cases, like eating an ox, the
|
||||
check is in place, although in retrospect it would be very amusing if it did
|
||||
not. But that would still not be realistic and some of this has to be at least
|
||||
somewhat realistic.
|
||||
|
||||
@@ -2467,10 +2481,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
|
||||
134 after pre-processing! One of the alt versions I supplied is 131 before the
|
||||
cpp and 149 after. I did not submit that for practical reasons but I kind of
|
||||
wish I had, now that it won. Nonetheless 134 is already way too many. 149 is
|
||||
much worse.
|
||||
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
|
||||
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.
|
||||
|
||||
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
|
||||
@@ -2597,8 +2613,8 @@ It is **NOT** a bug when an ox kicks a bucket message that no oxen is decreased
|
||||
as it's a joke and merely a possible foreshadowing of what is to come. The
|
||||
message that they shouldn't try telling the narrator they don't have one (if
|
||||
they can even count) because it just kicked the bucket cleverly sidesteps (or
|
||||
does it sidekick?) that issue - it's not even meant to eliminate one as it was
|
||||
kicking a bucket physically, not kicking the bucket figuratively (or in this
|
||||
does it sidekick?) that issue - it's not even meant to eliminate one as if it
|
||||
was kicking a bucket physically, not kicking the bucket figuratively (or in this
|
||||
case it might also be literally - although paradoxically also not).
|
||||
|
||||
It is **NOT** a bug that when you get dysentery you jump past the mountains
|
||||
@@ -2609,7 +2625,12 @@ turn. Also this does mean that they 'lose a turn' which seems plausible. Look at
|
||||
it this way: those other events could also happen in the mountains, so it's not
|
||||
really an illogical choice anyway; the separation is there because they were not
|
||||
at the mountains immediately (obviously). I believe (not sure but I think) you
|
||||
can survive with dysentery if you have enough hp.
|
||||
can survive with dysentery if you have enough hp and turns. Now one might say
|
||||
that not going straight to the doctor might make more sense or rather one should
|
||||
go to the doctor (at the mountains, if they were there), and then back to the
|
||||
mountains. But this would cause other problems: for instance if one does not
|
||||
have enough money to pay for the doctor: say for instance seeing the message
|
||||
twice and also losing even more hp/mileage. That would be a broken design.
|
||||
|
||||
On occasion an event might not fire (or rather it fires but nothing seems to
|
||||
happen). This is **NOT** a bug when it does. In fact it can be a lifesaver due
|
||||
@@ -2627,7 +2648,7 @@ so that it directly assigns to `q` the value 11 (at least I think it was case 11
|
||||
\- it appears so). There are other ways to trigger this though, if you were to
|
||||
modify the code. Note that this does **NOT** mean that no events would fire. It
|
||||
just means you'll see what I mean more easily. Some events are triggered
|
||||
indirectly and others happen once you reach the mountains, for example.
|
||||
indirectly and others happen once you reach the mountains, for examples.
|
||||
|
||||
Another one. In case you noticed the code:
|
||||
|
||||
@@ -2688,10 +2709,11 @@ wanted so THERE SIMPLY IS NO FLOW CONTROL ERROR.
|
||||
|
||||
Of course not all the jokes are equal although they're almost all absurd in some
|
||||
way or another. Sometimes I manipulated the joke to fit into the code itself and
|
||||
vice versa. This was done numerous times in fact. The fact though that the
|
||||
narrator is the devil means that some of that was not even necessary, given that
|
||||
he (as I have shown in this file) cannot be trusted and says things that are
|
||||
totally bogus and many that make absolutely no sense.
|
||||
vice versa. This was done numerous times in fact. The fact that the narrator is
|
||||
the devil means that some of that was not even necessary, given that he (as I
|
||||
have shown in this file) cannot be trusted and says things that are totally
|
||||
bogus and many that make absolutely no sense...kind of like the entire theme of
|
||||
the game, but that only makes it more fun.
|
||||
|
||||
The fact he refers to himself as if he's someone else is ludicrous on its own
|
||||
but there are so many other things. Those things I changed were good to change
|
||||
@@ -3030,17 +3052,21 @@ 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 116 `goto`s, more than the BASIC game. 134 when pre-processed. But
|
||||
let's be honest, or 134 for a small C program is too many but to be only six
|
||||
fewer than a larger BASIC program? That is hard to fathom. Not that 116 is not
|
||||
too many for larger programs...or one goto, for that matter. As noted elsewhere,
|
||||
an alt version has 131/149 gotos, before/after the cpp. I did not make it the
|
||||
main version when submitting because I did not want to make the judges weep and
|
||||
curse any more than they already had to (besides, it can't be 4666 bytes with
|
||||
the extra `goto`s) but now that it's in I have no qualms about providing it as
|
||||
alt code: if I am going to ruin `goto`s I might as well do it properly.
|
||||
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.
|
||||
|
||||
Some things are clear about the program from visual inspection:
|
||||
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,
|
||||
who might easily be mistaken for the Devil) a little bit less. But really, if I
|
||||
am going to ruin `goto`s like I did: why should I not do it properly? So it's
|
||||
now maxed out with all the other [obfuscation](obfuscation.html) and the many
|
||||
events and fun gameplay.
|
||||
|
||||
Anyway, some things are clear about the program from visual inspection:
|
||||
|
||||
- it is clear the program does print SOME THINGS (but it is **NOT clear WHAT**
|
||||
is printed).
|
||||
@@ -3157,23 +3183,24 @@ 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 116 (or 134) `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 [1987/hines](https://www.ioccc.org/1987/hines/index.html)
|
||||
had the crown. It no longer does. I should be ashamed. I'm not.
|
||||
But above all I would not have used <del>116</del> 131 (or <del>134</del> 149)
|
||||
`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
|
||||
[1987/hines](https://www.ioccc.org/1987/hines/index.html) had the crown. It no
|
||||
longer does. I should be ashamed. I'm not. Devils feel no shame.
|
||||
|
||||
But even if I were to abuse `goto` I would not normally use it in the ways I did, as
|
||||
noted earlier and in [obfuscation.html](obfuscation.html)!
|
||||
|
||||
If I am ever dethroned, assuming I now have the crown as I think I do (and I
|
||||
hope I do because if I do not there is something very wrong), I will be
|
||||
absolutely horrified.
|
||||
hope and guess I do, even outside the IOCCC, because if I do not there is
|
||||
something very wrong), I will be absolutely horrified.
|
||||
|
||||
Okay I'll be kind of amused too but I would be horrified. Still I guess in the
|
||||
context of the IOCCC I really have reached the logical conclusion of `goto`s
|
||||
(which, as you'll see, the 1987/hines one, was thought to be by the judges the
|
||||
logical conclusion - see below for more information on THAT and an exercise in
|
||||
'logical conclusion' - see below for more information on THAT and an exercise in
|
||||
absurdity), or at least I hope so.
|
||||
|
||||
It's about time either way. Hopefully the judges will take `goto` and throw it
|
||||
@@ -3231,10 +3258,12 @@ 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 134 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.
|
||||
isn't <del>134</del> 149 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
|
||||
funnier. But it would have sacrificed the rest of the game and that would be a
|
||||
tragedy.
|
||||
|
||||
But it really is that extreme.
|
||||
|
||||
@@ -3263,7 +3292,9 @@ ineffable.
|
||||
|
||||
Actually I wanted to see what it was like. It was VERY amusing - but only
|
||||
because I did not have to debug it. For the submission I included line changes
|
||||
for JUST the third prompt. Yes, what would only take a few seconds of play. It
|
||||
for JUST the third prompt (this means the prog.orig.c file: as noted I made the
|
||||
prog.c the complete version instead, and made prog.c as submitted the
|
||||
prog.alt2.c, after the win). Yes, what would only take a few seconds of play. It
|
||||
looked like this (I only did the third prompt as I had mere hours left to
|
||||
finish):
|
||||
|
||||
@@ -3281,14 +3312,14 @@ full sequence. This is from start to finish and I include it for your amusement
|
||||
(see [jumps.txt](jumps.txt) for the line changes including calls to prog.c
|
||||
functions). 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, and **776** (!) excluding
|
||||
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 59 (!) lines.
|
||||
`#include`s and only variables, has a mere 58 (!) lines.
|
||||
|
||||
A program that has only 59 lines of code that jumps 985 (counting functions) or
|
||||
776 (just in main()) times is astonishing. Of course that's not the
|
||||
A program that has only 58 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
|
||||
as well); the [obfuscation.html](obfuscation.html) shows even more on this - and
|
||||
@@ -3308,14 +3339,14 @@ 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 134 `goto`s (and I could have
|
||||
fit more in). 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 to be mad and
|
||||
embrace it to do this. I went full out and I could have fit more `goto`s in: not
|
||||
only is the iocccsize not 2503 but I could have removed some events if I really
|
||||
wanted more `goto`s.
|
||||
It would have been SO MUCH EASIER if I did not use <del>134</del> 149 `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
|
||||
to be mad and embrace it to do this. I went full out and I could have fit more
|
||||
`goto`s in: not only is the iocccsize not 2503 (although it's close now) but I
|
||||
could have removed some events if I really wanted more `goto`s. That would be
|
||||
less fun.
|
||||
|
||||
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
|
||||
@@ -3352,7 +3383,7 @@ made even a few more commits. As it is it took a full two months and I BARELY
|
||||
finished this. In fact I finished it within hours of the contest closing! It was
|
||||
not even 12 hours before closing time. I barely made it. Part of that is I added
|
||||
even more `goto`s, despite the fact I had reached 2503 in size, with careful
|
||||
size optimisation.
|
||||
size optimisation, though it got below that.
|
||||
|
||||
Countless times I came up with ways to do more, at least where it was possible,
|
||||
such as freeing space so I could change some `break;`s to a `goto Z;` as `Z:`
|
||||
@@ -3360,23 +3391,15 @@ was already there. The only other times this happened is before I had changed
|
||||
the code so much that you can no longer trust what a block of code is. Like I
|
||||
said, I could not really move any more code if I wanted to, even if I had more
|
||||
space free. Those very few places where the code could in theory be moved are
|
||||
already controlled by goto.
|
||||
|
||||
In fact I could have done more `goto`s in this version but I wanted to help the
|
||||
judges out in judging - that and it was easier to verify things are correct.
|
||||
`iocccsize` reports on prog.c 2457 and after I won this I kind of wish I did
|
||||
take it even further just to mess with everyone even more.
|
||||
already controlled by goto. The current `prog.c` has even more of this as it's
|
||||
the goto complete version.
|
||||
|
||||
But as I said elsewhere basically everything is in the wrong place so what even
|
||||
would be the point in doing that? It would probably not make it harder to follow
|
||||
would be the point if I had more space? It would probably not make it harder to follow
|
||||
(well it would but still would there be a point in it?); it would just make it
|
||||
even more absurd: the amount of spaghetti code makes it nigh impossible to
|
||||
follow and I'm happy to have smashed the record of 24 by 110 `goto`s, even if I
|
||||
now wish I had gone even further.
|
||||
|
||||
Nonetheless the 134 is what won so that's what I'll live by (and I doubt it'll
|
||||
be broken as this kind of trick will, as the general remarks about the entries
|
||||
note, not be as worthy, even if `goto`s are alas, not banned outright).
|
||||
follow and I'm happy to have smashed the record of 24 by <del>110</del> 125
|
||||
`goto`s.
|
||||
|
||||
Anyway, as I noted in [obfuscation.html](obfuscation.html), no initialisation is
|
||||
skipped in my jumps and that is what causes `goto` to invoke UB.
|
||||
@@ -3456,8 +3479,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 134 (with the cpp, 116 without). That is
|
||||
obscene. I did not fail. At all.
|
||||
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.
|
||||
|
||||
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
|
||||
@@ -3501,12 +3524,12 @@ 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 116 `goto`s with 134 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 deeper just like Alice found. When
|
||||
there's no **NEED** for it it's much worse.
|
||||
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
|
||||
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
|
||||
deeper just like Alice found. When there's no **NEED** for it it's much worse.
|
||||
|
||||
`goto`s are harmful and destroy flow control. I have shown a fair few obscure
|
||||
things about C, some which SEEM ILLEGAL but are not, but above all I have shown
|
||||
@@ -3558,26 +3581,28 @@ 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 134 angels. YES I condemned 134 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 in a handcart, you should still
|
||||
regret it. But they do. Okay so I don't really believe that but there is no
|
||||
denying there is goto hell here.
|
||||
killed <del>134</del> 149 angels. YES I condemned <del>134</del> 149 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
|
||||
in a handcart, you should still regret it. But they do. Okay so I don't really
|
||||
believe that but there is no denying there is goto hell here.
|
||||
|
||||
I found my abuse of `goto` hilarious. It was good intentions - the contest. But
|
||||
sadly sometimes the worst things that happen start with good intentions; and
|
||||
some of the best things strangely start with horrible intentions. It might be
|
||||
that I did this with good intentions for the contest but it would not be good
|
||||
anywhere else. I would be beyond angry if I had to maintain this code. I would
|
||||
not blame anyone if they cursed me. I probably would be too. Not cursing you. I
|
||||
mean cursing me.
|
||||
I <del>found</del> find my abuse of `goto` hilarious. It was good intentions -
|
||||
the contest. But sadly sometimes the worst things that happen start with good
|
||||
intentions; and some of the best things strangely start with horrible
|
||||
intentions. It might be that I did this with good intentions for the contest but
|
||||
it would not be good anywhere else. I would be beyond angry if I had to maintain
|
||||
this code. I would not blame anyone if they cursed me. I probably would be too.
|
||||
Not cursing you. I mean cursing me.
|
||||
|
||||
Don't write code like this. Except for the IOCCC. Unless of course the judges
|
||||
decide they want no more `goto`s. I would not put that past them after what I
|
||||
have done. I can imagine them screaming and crying. Hopefully they're laughing
|
||||
at more than the jokes but I hope they laugh at this too. Well we'll see I
|
||||
guess...
|
||||
guess... (it appears that, based on the general remarks by the judges, of the
|
||||
winning entries, that `goto` will no longer hold nearly as much water, and that
|
||||
makes me happy).
|
||||
|
||||
Frankly THIS PROGRAM SHOULD NOT WORK! But it does and it works well even if the
|
||||
flow-control is a horrible nightmare from hell. Perhaps the Devil truly has
|
||||
|
||||
@@ -7,11 +7,16 @@
|
||||
* Please note that the order of events (the q = x(0,23)) might be in a
|
||||
* different order than the prog.c as some were added quite late and I just
|
||||
* pushed them in in prog.c without much thinking (which actually caused some
|
||||
* problems that had to be fixed). I am not sure if that actually happened and
|
||||
* there might even be some missing events but just as a note.
|
||||
* problems that had to be fixed). In prog.c the event numbers are 0,22 (a bug
|
||||
* in the submitted code was fixed - the switch was x(0,23) but there is no case
|
||||
* 23 there) but here you see it's 0,23 and the order is different. The son
|
||||
* mocking you if you eat his frozen body is not tied to an event in prog.c but
|
||||
* it is here.
|
||||
*
|
||||
* You might notice that the prog.alt.c has some additional events but those are
|
||||
* not here.
|
||||
* Actually this is closer to prog.alt.c in the sense that event 23 there also
|
||||
* has the son ghost mocking the PC. The difference is prog.alt.c has an event
|
||||
* 24 and that is not here. This almost certainly has fewer gotos in code (if we
|
||||
* count the comments probably not).
|
||||
*
|
||||
* Finally this code is from an earlier version so some of it might be missing,
|
||||
* not just the events, and not just the gotos, but potentially other things
|
||||
@@ -21,7 +26,8 @@
|
||||
*
|
||||
* WARNING: this code and its comments are not up to date. I wrote 116 before
|
||||
* filtered through the cpp and 134 after the cpp and I didn't wish to
|
||||
* repeatedly revisit this file trying to explain everything.
|
||||
* repeatedly revisit this file trying to explain everything. As it is I barely
|
||||
* finished this in time.
|
||||
*/
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
|
||||
+120
-123
@@ -1,134 +1,131 @@
|
||||
goto hell; \
|
||||
goto M; \
|
||||
goto A;
|
||||
goto f;
|
||||
goto PP;
|
||||
goto hell;
|
||||
goto M;
|
||||
goto hell;
|
||||
goto M;
|
||||
goto G;
|
||||
goto hell;
|
||||
goto M;
|
||||
goto hell;
|
||||
goto M;
|
||||
goto S;
|
||||
goto hell;
|
||||
goto M;
|
||||
goto OO;
|
||||
goto L;
|
||||
goto i;
|
||||
goto kk;
|
||||
goto HA;
|
||||
goto at;
|
||||
goto I;
|
||||
goto r;
|
||||
goto II;
|
||||
goto F;
|
||||
goto c;
|
||||
goto zz;
|
||||
goto qq;
|
||||
goto C;
|
||||
goto N;
|
||||
goto dd;
|
||||
goto jj;
|
||||
goto oo;
|
||||
goto ee;
|
||||
goto x;
|
||||
goto heaven;
|
||||
goto XT;
|
||||
goto ET;
|
||||
goto v;
|
||||
goto x;
|
||||
goto v;
|
||||
goto ZZ;
|
||||
goto bb;
|
||||
goto s;
|
||||
goto X;
|
||||
goto v;
|
||||
goto T;
|
||||
goto y;
|
||||
goto E;
|
||||
goto d;
|
||||
goto P;
|
||||
goto to;
|
||||
goto y;
|
||||
goto TA;
|
||||
goto BB;
|
||||
goto LL;
|
||||
goto uu;
|
||||
goto JJ;
|
||||
goto B;
|
||||
goto h;
|
||||
goto l;
|
||||
goto e;
|
||||
goto hell;
|
||||
goto M;
|
||||
goto Y;
|
||||
goto P;
|
||||
goto K;
|
||||
goto tt;
|
||||
goto Z;
|
||||
goto W;
|
||||
goto ha;
|
||||
goto D;
|
||||
goto m;
|
||||
goto Z;
|
||||
goto H;
|
||||
goto Z;
|
||||
goto g;
|
||||
goto Z;
|
||||
goto Z;
|
||||
goto Z;
|
||||
goto Y;
|
||||
goto MM;
|
||||
goto hell;
|
||||
goto M;
|
||||
goto J;
|
||||
goto Q;
|
||||
goto k;
|
||||
goto W;
|
||||
goto hell;
|
||||
goto M;
|
||||
goto q;
|
||||
goto TT;
|
||||
goto P;
|
||||
goto U;
|
||||
goto hell;
|
||||
goto M;
|
||||
goto QQ;
|
||||
goto KK;
|
||||
goto z;
|
||||
w(40) PP : goto G;
|
||||
w(41) w(45) g : goto S;
|
||||
goto CC;
|
||||
goto _;
|
||||
goto L;
|
||||
goto i;
|
||||
goto kk;
|
||||
goto HA;
|
||||
goto at;
|
||||
goto I;
|
||||
goto r;
|
||||
goto II;
|
||||
goto F;
|
||||
goto c;
|
||||
goto zz;
|
||||
goto qq;
|
||||
goto C;
|
||||
goto N;
|
||||
goto dd;
|
||||
goto jj;
|
||||
goto oo;
|
||||
goto ee;
|
||||
goto x;
|
||||
goto heaven;
|
||||
goto XT;
|
||||
goto ET;
|
||||
goto v;
|
||||
goto x;
|
||||
goto v;
|
||||
goto ZZ;
|
||||
goto bb;
|
||||
goto s;
|
||||
goto X;
|
||||
goto v;
|
||||
goto T;
|
||||
goto y;
|
||||
goto E;
|
||||
goto d;
|
||||
goto vv;
|
||||
goto P;
|
||||
goto to;
|
||||
goto y;
|
||||
goto TA;
|
||||
goto BB;
|
||||
goto LL;
|
||||
goto uu;
|
||||
goto JJ;
|
||||
goto B;
|
||||
goto h;
|
||||
goto l;
|
||||
goto C;
|
||||
goto u;
|
||||
goto e;
|
||||
goto Y;
|
||||
goto P;
|
||||
goto K;
|
||||
goto tt;
|
||||
goto Z;
|
||||
goto Z;
|
||||
goto Z;
|
||||
goto Z;
|
||||
goto W;
|
||||
goto Z;
|
||||
goto ha;
|
||||
goto D;
|
||||
goto OO;
|
||||
goto m;
|
||||
goto Z;
|
||||
goto H;
|
||||
goto Z;
|
||||
goto Z;
|
||||
goto Z;
|
||||
goto g;
|
||||
goto Z;
|
||||
goto Z;
|
||||
goto Z;
|
||||
goto Y;
|
||||
goto MM;
|
||||
goto J;
|
||||
N : goto Q;
|
||||
goto k;
|
||||
goto W;
|
||||
goto xx;
|
||||
goto mm;
|
||||
goto TT;
|
||||
goto P;
|
||||
goto U;
|
||||
goto QQ;
|
||||
goto KK;
|
||||
goto z;
|
||||
goto k;
|
||||
goto k;
|
||||
goto k;
|
||||
goto k;
|
||||
goto hell;
|
||||
goto M;
|
||||
goto M;
|
||||
goto yy;
|
||||
goto Z;
|
||||
goto rr;
|
||||
goto hell;
|
||||
goto M;
|
||||
goto a;
|
||||
goto Z;
|
||||
w(99) goto M;
|
||||
goto yy;
|
||||
goto Z;
|
||||
goto rr;
|
||||
w(27) I : goto a;
|
||||
goto Z;
|
||||
goto go;
|
||||
goto ii;
|
||||
goto o;
|
||||
goto V;
|
||||
goto Z;
|
||||
goto Y;
|
||||
goto O;
|
||||
goto W;
|
||||
goto b;
|
||||
goto n;
|
||||
goto p;
|
||||
goto x;
|
||||
goto j;
|
||||
goto Z;
|
||||
goto Z;
|
||||
goto Z;
|
||||
goto go;
|
||||
goto ii;
|
||||
goto o;
|
||||
goto V;
|
||||
goto Z;
|
||||
goto Y;
|
||||
goto O;
|
||||
goto q;
|
||||
goto W;
|
||||
goto b;
|
||||
goto n;
|
||||
goto R;
|
||||
goto t;
|
||||
goto n;
|
||||
goto u;
|
||||
goto w;
|
||||
goto p;
|
||||
goto x;
|
||||
goto j;
|
||||
goto n;
|
||||
goto R;
|
||||
goto t;
|
||||
goto n;
|
||||
goto DD;
|
||||
goto w;
|
||||
goto yy;
|
||||
goto _;
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 223 KiB After Width: | Height: | Size: 220 KiB |
+135
-110
@@ -486,41 +486,51 @@ YouTube show for this entry:</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<pre><code> ./try.sh</code></pre>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>The author provided two alternate versions, one which has more events and far
|
||||
fewer <code>goto</code>s and the other which maxed out the <code>goto</code>s at 149 (up from 134)!</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
|
||||
practical reasons.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<pre><code> make alt</code></pre>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<pre><code> ./prog.alt</code></pre>
|
||||
<pre><code> ./prog.alt
|
||||
|
||||
./prog.alt2</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 you jump as many as 134 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.</p>
|
||||
<p>You will have to go to “Fun-Damentals” to understand the logic flow of this
|
||||
game. While you goto as many as 149 times and jump hundreds if not over one
|
||||
thousand 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.</p>
|
||||
<p>Before you set off on your adventure to decode this program’s logic, make
|
||||
sure you have enough food, ammo, clothes, oxen, and programming supplies.
|
||||
You’ll be driving for 2170 miles through a wild wilderness inspired
|
||||
by <a href="https://en.wikipedia.org/wiki/The_Oregon_Trail_(series)">Oregon Trail</a>, so you’ll need to be prepared for anything! Regardless of
|
||||
how well prepared you are, you will have a devil of a time jumping around
|
||||
inside this C code. :-)</p>
|
||||
by <a href="https://en.wikipedia.org/wiki/The_Oregon_Trail_(series)">Oregon
|
||||
Trail</a>, so
|
||||
you’ll need to be prepared for anything! Regardless of how well prepared you
|
||||
are, you will have a devil of a time jumping around inside this C code. :-)</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<blockquote>
|
||||
<p>Fun fact: after winning this, the author played the game in gdb from start to
|
||||
finish and not counting macros but counting all function calls (not libc
|
||||
functions just the few functions in prog.c), there were a total of <strong>985</strong> (!)
|
||||
line jumps. Skipping prog.c function calls and it was still <strong>776</strong> jumps! The
|
||||
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>has just 59 (!) lines of code</strong>. A very tiny
|
||||
lines that have only variables, <strong>has just 58 (!) 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. The <a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/prog.goto.max.c">maxed out goto
|
||||
version</a> is far worse.</p>
|
||||
really matter.</p>
|
||||
</blockquote>
|
||||
<p><strong>NOTE</strong>: I actually submitted two versions. This one is not encrypted. The
|
||||
encrypted one even encrypted emojis without having to decrypt them in order to
|
||||
print them (and everything else). I have kept references to encryption in this
|
||||
file even after publication. I do have a copy of it if anyone is interested.</p>
|
||||
<p><strong>SUGGESTION</strong>: if you dare, try opening
|
||||
<a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/prog.gotos.c">prog.gotos.c</a> in an editor with
|
||||
syntax highlighting and then highlight <code>goto</code>. Alternatively, try it with <code>grep</code>
|
||||
if your grep has colours enabled (probably easier).</p>
|
||||
<div id="devil">
|
||||
<h3 id="a-pact-with-the-devil-on-the-oregon-trail-and-his-134-regrets-of-goto">A Pact With the Devil On the Oregon Trail (…and his 134 regrets of goto)</h3>
|
||||
<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>
|
||||
</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>
|
||||
@@ -2201,8 +2211,9 @@ features versus problems, though possibly more exist.</p>
|
||||
</div>
|
||||
<p>Obviously since you can buy oxen at the forts (something not possible in the
|
||||
original game for some reason) then even if you ran out (and perhaps you ate
|
||||
one) it could happen again. Remember you might end up eating an ox just because
|
||||
he looks at you funny, not just because you are out of food.</p>
|
||||
one, which of course is not in the original either) it could happen again.
|
||||
Remember you might end up eating an ox just because he looks at you funny, not
|
||||
just because you are out of food!</p>
|
||||
<p>If you don’t have an ox and you are out of food you die from starvation. But
|
||||
what happens when you die of starvation? Well it says:</p>
|
||||
<pre><code> 🪦🪦🪦🪦🪦🪦🪦🪦🪦🪦🪦🪦🪦🪦🪦🪦🪦
|
||||
@@ -2227,27 +2238,28 @@ trail) almost certainly eat it first; and not only that but bread is not going
|
||||
to do much at all unless you had a great amount of it; which of course the
|
||||
player character (PC) does not.</p>
|
||||
<p>Actually the only reason: for the amusing rhyme that fits with the jokes,
|
||||
nothing else (it makes it more interesting and amusing than ‘You ran out of food
|
||||
and starved to death’, doesn’t it?).</p>
|
||||
nothing else (but it <em>does</em> make it more interesting and amusing than ‘You ran
|
||||
out of food and starved to death’, doesn’t it?).</p>
|
||||
<p>The fact the original game does not have you decide on drinking water (and see
|
||||
section on other differences for the subject of decision making) means I could
|
||||
take some liberty with it. Besides, didn’t I say you would learn by what did not
|
||||
happen? They certainly did drink water and unsafe water (I’m sure) too, so my
|
||||
joke is all the more appropriate (even if it’s inappropriate in some company
|
||||
:-), perhaps your grandparents - although depending on your age now maybe not).</p>
|
||||
:-), perhaps your grandparents - although depending on your age now maybe not.
|
||||
May my grandparents rest in peace, hopefully not with the devil).</p>
|
||||
<p>Sometimes it is suggested an ox is lost/whatever (not lost as in it wanders off
|
||||
but rather in the sense that you have fewer oxen) even if you don’t have one. It
|
||||
does this in a number of ways like referring to the famous ‘spared no expense’
|
||||
from Jurassic Park. It also is a nod the IOCCC guidelines that talk about a fish
|
||||
Eric that might or might not exist.</p>
|
||||
but rather in the sense that you have fewer oxen, for instance getting stuck in
|
||||
a river) even if you don’t have one. It does this in a number of ways like
|
||||
referring to the famous ‘spared no expense’ from Jurassic Park. It also is a nod
|
||||
the IOCCC guidelines that talk about a fish Eric that might or might not exist.</p>
|
||||
<p>I decided to not call him Eric because there is potential for more than one ox
|
||||
(you’ll note in other messages I got past this issue by making it like in real
|
||||
life - wagon trains and large groups - though again some times wagon for the
|
||||
life - wagon trains and large groups - though again sometimes wagon for the
|
||||
joke - plus being ambiguous). Of course the narrator as the Devil is telling all
|
||||
sorts of lies too so that hardly matters.</p>
|
||||
<p>As for whether this could happen: in theory it could but if you run out of oxen
|
||||
you’re not going to get very far anyway. In other cases, like eating an oxen,
|
||||
the check is in place, although in retrospect it would be very amusing if it did
|
||||
you’re not going to get very far anyway. In other cases, like eating an ox, the
|
||||
check is in place, although in retrospect it would be very amusing if it did
|
||||
not. But that would still not be realistic and some of this has to be at least
|
||||
somewhat realistic.</p>
|
||||
<p>Of course even if one runs out of oxen that would not mean they couldn’t make it
|
||||
@@ -2460,10 +2472,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
|
||||
134 after pre-processing! One of the alt versions I supplied is 131 before the
|
||||
cpp and 149 after. I did not submit that for practical reasons but I kind of
|
||||
wish I had, now that it won. Nonetheless 134 is already way too many. 149 is
|
||||
much worse.</p>
|
||||
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
|
||||
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>
|
||||
<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
|
||||
@@ -2570,8 +2584,8 @@ that much in one turn I think.</p>
|
||||
as it’s a joke and merely a possible foreshadowing of what is to come. The
|
||||
message that they shouldn’t try telling the narrator they don’t have one (if
|
||||
they can even count) because it just kicked the bucket cleverly sidesteps (or
|
||||
does it sidekick?) that issue - it’s not even meant to eliminate one as it was
|
||||
kicking a bucket physically, not kicking the bucket figuratively (or in this
|
||||
does it sidekick?) that issue - it’s not even meant to eliminate one as if it
|
||||
was kicking a bucket physically, not kicking the bucket figuratively (or in this
|
||||
case it might also be literally - although paradoxically also not).</p>
|
||||
<p>It is <strong>NOT</strong> a bug that when you get dysentery you jump past the mountains
|
||||
event and go straight to the doctor. This not only plays in the theme (wait and
|
||||
@@ -2581,7 +2595,12 @@ turn. Also this does mean that they ‘lose a turn’ which seems plausible. Loo
|
||||
it this way: those other events could also happen in the mountains, so it’s not
|
||||
really an illogical choice anyway; the separation is there because they were not
|
||||
at the mountains immediately (obviously). I believe (not sure but I think) you
|
||||
can survive with dysentery if you have enough hp.</p>
|
||||
can survive with dysentery if you have enough hp and turns. Now one might say
|
||||
that not going straight to the doctor might make more sense or rather one should
|
||||
go to the doctor (at the mountains, if they were there), and then back to the
|
||||
mountains. But this would cause other problems: for instance if one does not
|
||||
have enough money to pay for the doctor: say for instance seeing the message
|
||||
twice and also losing even more hp/mileage. That would be a broken design.</p>
|
||||
<p>On occasion an event might not fire (or rather it fires but nothing seems to
|
||||
happen). This is <strong>NOT</strong> a bug when it does. In fact it can be a lifesaver due
|
||||
to all the hazards and especially as this has primarily to do with case 11 which
|
||||
@@ -2594,7 +2613,7 @@ what I mean you can change the code:</p>
|
||||
- it appears so). There are other ways to trigger this though, if you were to
|
||||
modify the code. Note that this does <strong>NOT</strong> mean that no events would fire. It
|
||||
just means you’ll see what I mean more easily. Some events are triggered
|
||||
indirectly and others happen once you reach the mountains, for example.</p>
|
||||
indirectly and others happen once you reach the mountains, for examples.</p>
|
||||
<p>Another one. In case you noticed the code:</p>
|
||||
<pre><code> case 4:i=17; } } case 2: V(5); } goto k;</code></pre>
|
||||
<p>You might think this is a bug but this is actually hilarious. Here is what will
|
||||
@@ -2643,10 +2662,11 @@ is ENTIRELY unclear how the author is not confused. All I know is
|
||||
wanted so THERE SIMPLY IS NO FLOW CONTROL ERROR.</p>
|
||||
<p>Of course not all the jokes are equal although they’re almost all absurd in some
|
||||
way or another. Sometimes I manipulated the joke to fit into the code itself and
|
||||
vice versa. This was done numerous times in fact. The fact though that the
|
||||
narrator is the devil means that some of that was not even necessary, given that
|
||||
he (as I have shown in this file) cannot be trusted and says things that are
|
||||
totally bogus and many that make absolutely no sense.</p>
|
||||
vice versa. This was done numerous times in fact. The fact that the narrator is
|
||||
the devil means that some of that was not even necessary, given that he (as I
|
||||
have shown in this file) cannot be trusted and says things that are totally
|
||||
bogus and many that make absolutely no sense…kind of like the entire theme of
|
||||
the game, but that only makes it more fun.</p>
|
||||
<p>The fact he refers to himself as if he’s someone else is ludicrous on its own
|
||||
but there are so many other things. Those things I changed were good to change
|
||||
but the others did not have to change. Some did change anyway but some did not,
|
||||
@@ -2907,16 +2927,19 @@ 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 116 <code>goto</code>s, more than the BASIC game. 134 when pre-processed. But
|
||||
let’s be honest, or 134 for a small C program is too many but to be only six
|
||||
fewer than a larger BASIC program? That is hard to fathom. Not that 116 is not
|
||||
too many for larger programs…or one goto, for that matter. As noted elsewhere,
|
||||
an alt version has 131/149 gotos, before/after the cpp. I did not make it the
|
||||
main version when submitting because I did not want to make the judges weep and
|
||||
curse any more than they already had to (besides, it can’t be 4666 bytes with
|
||||
the extra <code>goto</code>s) but now that it’s in I have no qualms about providing it as
|
||||
alt code: if I am going to ruin <code>goto</code>s I might as well do it properly.</p>
|
||||
<p>Some things are clear about the program from visual inspection:</p>
|
||||
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>
|
||||
<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,
|
||||
who might easily be mistaken for the Devil) a little bit less. But really, if I
|
||||
am going to ruin <code>goto</code>s like I did: why should I not do it properly? So it’s
|
||||
now maxed out with all the other <a href="obfuscation.html">obfuscation</a> and the many
|
||||
events and fun gameplay.</p>
|
||||
<p>Anyway, some things are clear about the program from visual inspection:</p>
|
||||
<ul>
|
||||
<li>it is clear the program does print SOME THINGS (but it is <strong>NOT clear WHAT</strong>
|
||||
is printed).</li>
|
||||
@@ -3013,20 +3036,21 @@ 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 116 (or 134) <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 <a href="https://www.ioccc.org/1987/hines/index.html">1987/hines</a>
|
||||
had the crown. It no longer does. I should be ashamed. I’m not.</p>
|
||||
<p>But above all I would not have used <del>116</del> 131 (or <del>134</del> 149)
|
||||
<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
|
||||
<a href="https://www.ioccc.org/1987/hines/index.html">1987/hines</a> had the crown. It no
|
||||
longer does. I should be ashamed. I’m not. Devils feel no shame.</p>
|
||||
<p>But even if I were to abuse <code>goto</code> I would not normally use it in the ways I did, as
|
||||
noted earlier and in <a href="obfuscation.html">obfuscation.html</a>!</p>
|
||||
<p>If I am ever dethroned, assuming I now have the crown as I think I do (and I
|
||||
hope I do because if I do not there is something very wrong), I will be
|
||||
absolutely horrified.</p>
|
||||
hope and guess I do, even outside the IOCCC, because if I do not there is
|
||||
something very wrong), I will be absolutely horrified.</p>
|
||||
<p>Okay I’ll be kind of amused too but I would be horrified. Still I guess in the
|
||||
context of the IOCCC I really have reached the logical conclusion of <code>goto</code>s
|
||||
(which, as you’ll see, the 1987/hines one, was thought to be by the judges the
|
||||
logical conclusion - see below for more information on THAT and an exercise in
|
||||
‘logical conclusion’ - see below for more information on THAT and an exercise in
|
||||
absurdity), or at least I hope so.</p>
|
||||
<p>It’s about time either way. Hopefully the judges will take <code>goto</code> and throw it
|
||||
into the deepest bowels of the Earth.</p>
|
||||
@@ -3074,10 +3098,12 @@ 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 134 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.</p>
|
||||
isn’t <del>134</del> 149 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
|
||||
funnier. But it would have sacrificed the rest of the game and that would be a
|
||||
tragedy.</p>
|
||||
<p>But it really is that extreme.</p>
|
||||
<p>Here are some things Frank wrote:</p>
|
||||
<blockquote>
|
||||
@@ -3099,7 +3125,9 @@ traits I do not even know how to describe. Perhaps they would be utterly
|
||||
ineffable.</p>
|
||||
<p>Actually I wanted to see what it was like. It was VERY amusing - but only
|
||||
because I did not have to debug it. For the submission I included line changes
|
||||
for JUST the third prompt. Yes, what would only take a few seconds of play. It
|
||||
for JUST the third prompt (this means the prog.orig.c file: as noted I made the
|
||||
prog.c the complete version instead, and made prog.c as submitted the
|
||||
prog.alt2.c, after the win). Yes, what would only take a few seconds of play. It
|
||||
looked like this (I only did the third prompt as I had mere hours left to
|
||||
finish):</p>
|
||||
<pre><code> 19 20 21 32 69 82 34 33 34 47 45 47 50 83 34 33 34 47 45 47 50 83 34 33 34</code></pre>
|
||||
@@ -3112,12 +3140,12 @@ full sequence. This is from start to finish and I include it for your amusement
|
||||
(see <a href="jumps.txt">jumps.txt</a> for the line changes including calls to prog.c
|
||||
functions). 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 <strong>985</strong> (!) changes, counting function calls, and <strong>776</strong> (!) excluding
|
||||
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 59 (!) lines.</p>
|
||||
<p>A program that has only 59 lines of code that jumps 985 (counting functions) or
|
||||
776 (just in main()) times is astonishing. Of course that’s not the
|
||||
<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
|
||||
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
|
||||
as well); the <a href="obfuscation.html">obfuscation.html</a> shows even more on this - and
|
||||
@@ -3135,14 +3163,14 @@ 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 134 <code>goto</code>s (and I could have
|
||||
fit more in). 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 to be mad and
|
||||
embrace it to do this. I went full out and I could have fit more <code>goto</code>s in: not
|
||||
only is the iocccsize not 2503 but I could have removed some events if I really
|
||||
wanted more <code>goto</code>s.</p>
|
||||
<p>It would have been SO MUCH EASIER if I did not use <del>134</del> 149 <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
|
||||
to be mad and embrace it to do this. I went full out and I could have fit more
|
||||
<code>goto</code>s in: not only is the iocccsize not 2503 (although it’s close now) but I
|
||||
could have removed some events if I really wanted more <code>goto</code>s. That would be
|
||||
less fun.</p>
|
||||
<p>Even flex/bison code, which as far as I am aware uses FAR fewer <code>goto</code>s, is
|
||||
notorious for <code>goto</code>s and is quite hard to follow. It would be a nightmare to
|
||||
try and maintain without the .l/.y source files.</p>
|
||||
@@ -3172,27 +3200,21 @@ made even a few more commits. As it is it took a full two months and I BARELY
|
||||
finished this. In fact I finished it within hours of the contest closing! It was
|
||||
not even 12 hours before closing time. I barely made it. Part of that is I added
|
||||
even more <code>goto</code>s, despite the fact I had reached 2503 in size, with careful
|
||||
size optimisation.</p>
|
||||
size optimisation, though it got below that.</p>
|
||||
<p>Countless times I came up with ways to do more, at least where it was possible,
|
||||
such as freeing space so I could change some <code>break;</code>s to a <code>goto Z;</code> as <code>Z:</code>
|
||||
was already there. The only other times this happened is before I had changed
|
||||
the code so much that you can no longer trust what a block of code is. Like I
|
||||
said, I could not really move any more code if I wanted to, even if I had more
|
||||
space free. Those very few places where the code could in theory be moved are
|
||||
already controlled by goto.</p>
|
||||
<p>In fact I could have done more <code>goto</code>s in this version but I wanted to help the
|
||||
judges out in judging - that and it was easier to verify things are correct.
|
||||
<code>iocccsize</code> reports on prog.c 2457 and after I won this I kind of wish I did
|
||||
take it even further just to mess with everyone even more.</p>
|
||||
already controlled by goto. The current <code>prog.c</code> has even more of this as it’s
|
||||
the goto complete version.</p>
|
||||
<p>But as I said elsewhere basically everything is in the wrong place so what even
|
||||
would be the point in doing that? It would probably not make it harder to follow
|
||||
would be the point if I had more space? It would probably not make it harder to follow
|
||||
(well it would but still would there be a point in it?); it would just make it
|
||||
even more absurd: the amount of spaghetti code makes it nigh impossible to
|
||||
follow and I’m happy to have smashed the record of 24 by 110 <code>goto</code>s, even if I
|
||||
now wish I had gone even further.</p>
|
||||
<p>Nonetheless the 134 is what won so that’s what I’ll live by (and I doubt it’ll
|
||||
be broken as this kind of trick will, as the general remarks about the entries
|
||||
note, not be as worthy, even if <code>goto</code>s are alas, not banned outright).</p>
|
||||
follow and I’m happy to have smashed the record of 24 by <del>110</del> 125
|
||||
<code>goto</code>s.</p>
|
||||
<p>Anyway, as I noted in <a href="obfuscation.html">obfuscation.html</a>, no initialisation is
|
||||
skipped in my jumps and that is what causes <code>goto</code> to invoke UB.</p>
|
||||
<p>Everything is file scope. And in any case, when I do jump to a place, everything
|
||||
@@ -3257,8 +3279,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 134 (with the cpp, 116 without). That is
|
||||
obscene. I did not fail. At all.</p>
|
||||
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>
|
||||
<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
|
||||
@@ -3294,12 +3316,12 @@ 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 116 <code>goto</code>s with 134 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 deeper just like Alice found. When
|
||||
there’s no <strong>NEED</strong> for it it’s much worse.</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
|
||||
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
|
||||
deeper just like Alice found. When there’s no <strong>NEED</strong> for it it’s much worse.</p>
|
||||
<p><code>goto</code>s are harmful and destroy flow control. I have shown a fair few obscure
|
||||
things about C, some which SEEM ILLEGAL but are not, but above all I have shown
|
||||
how much is lost with <code>goto</code>s (okay, I have shown this with other things too).
|
||||
@@ -3342,24 +3364,26 @@ 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 134 angels. YES I condemned 134 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 in a handcart, you should still
|
||||
regret it. But they do. Okay so I don’t really believe that but there is no
|
||||
denying there is goto hell here.</p>
|
||||
<p>I found my abuse of <code>goto</code> hilarious. It was good intentions - the contest. But
|
||||
sadly sometimes the worst things that happen start with good intentions; and
|
||||
some of the best things strangely start with horrible intentions. It might be
|
||||
that I did this with good intentions for the contest but it would not be good
|
||||
anywhere else. I would be beyond angry if I had to maintain this code. I would
|
||||
not blame anyone if they cursed me. I probably would be too. Not cursing you. I
|
||||
mean cursing me.</p>
|
||||
killed <del>134</del> 149 angels. YES I condemned <del>134</del> 149 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
|
||||
in a handcart, you should still regret it. But they do. Okay so I don’t really
|
||||
believe that but there is no denying there is goto hell here.</p>
|
||||
<p>I <del>found</del> find my abuse of <code>goto</code> hilarious. It was good intentions -
|
||||
the contest. But sadly sometimes the worst things that happen start with good
|
||||
intentions; and some of the best things strangely start with horrible
|
||||
intentions. It might be that I did this with good intentions for the contest but
|
||||
it would not be good anywhere else. I would be beyond angry if I had to maintain
|
||||
this code. I would not blame anyone if they cursed me. I probably would be too.
|
||||
Not cursing you. I mean cursing me.</p>
|
||||
<p>Don’t write code like this. Except for the IOCCC. Unless of course the judges
|
||||
decide they want no more <code>goto</code>s. I would not put that past them after what I
|
||||
have done. I can imagine them screaming and crying. Hopefully they’re laughing
|
||||
at more than the jokes but I hope they laugh at this too. Well we’ll see I
|
||||
guess…</p>
|
||||
guess… (it appears that, based on the general remarks by the judges, of the
|
||||
winning entries, that <code>goto</code> will no longer hold nearly as much water, and that
|
||||
makes me happy).</p>
|
||||
<p>Frankly THIS PROGRAM SHOULD NOT WORK! But it does and it works well even if the
|
||||
flow-control is a horrible nightmare from hell. Perhaps the Devil truly has
|
||||
possessed it. Hell, he might have possessed me. Why else would I send C straight
|
||||
@@ -3725,10 +3749,11 @@ helps you appreciate the careful design even more.<a href="#fnref2" class="footn
|
||||
<ul>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/prog.c">prog.c</a> - entry source code</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/prog.alt2.c">prog.alt2.c</a> - original source code with minor bug fix</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/prog.alt.c">prog.alt.c</a> - alternate source code</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/prog.goto.max.c">prog.goto.max.c</a> - entry source code with maxed out gotos</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/prog.orig.c">prog.orig.c</a> - original source code</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/commented.c">commented.c</a> - commented version of the game</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/prog.gotos.c">prog.gotos.c</a> - prog.c with merged lines to show mass of gotos</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/addpadding.c">addpadding.c</a> - add padding from data source files</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/bytecheck.c">bytecheck.c</a> - read data.src and print out single-byte chars</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/bytecount.c">bytecount.c</a> - print each string with locations</li>
|
||||
|
||||
+57
-40
@@ -1,40 +1,57 @@
|
||||
19 20 21 32 15 13 15 68 81 34 33 15 13 15 34 13 49 47 49 52 82 34 33 15 13
|
||||
15 34 13 49 47 49 52 82 34 33 15 13 15 34 13 49 47 49 52 82 34 33 15 13 15
|
||||
34 13 49 47 49 52 82 34 33 15 13 15 34 13 49 47 49 52 82 18 19 13 19 21 78
|
||||
27 54 29 55 52 55 52 55 52 55 52 55 52 30 13 30 78 63 82 15 13 15 13 53 56
|
||||
30 16 32 27 15 13 15 27 32 57 59 57 58 57 59 81 15 13 15 81 71 74 72 74 76
|
||||
27 54 29 55 52 55 52 55 52 55 52 55 52 30 13 30 78 63 82 15 13 15 13 52 57
|
||||
59 57 58 57 59 64 15 13 15 19 64 81 71 74 72 74 76 27 54 29 55 52 55 52 55
|
||||
52 55 52 55 52 30 13 30 15 13 15 13 52 57 59 57 58 57 59 64 15 13 15 19 64
|
||||
81 71 74 72 74 76 27 54 29 55 52 55 52 55 52 55 52 55 52 30 13 30 15 13 15
|
||||
13 68 81 34 33 15 13 15 34 13 36 39 41 39 39 41 39 41 39 41 39 41 39 41 39
|
||||
41 43 52 82 34 33 15 13 15 34 13 36 39 41 39 39 41 39 41 39 41 39 41 39 41
|
||||
39 41 43 52 82 34 33 15 13 15 34 13 36 39 41 39 39 41 39 41 39 41 39 41 39
|
||||
41 39 41 43 52 82 34 33 15 13 15 34 13 36 39 41 39 39 41 39 41 39 41 39 41
|
||||
39 41 39 41 43 52 82 34 33 15 13 15 34 13 36 39 41 39 39 41 39 41 39 41 39
|
||||
41 39 41 39 41 43 52 82 18 55 29 55 29 29 55 29 29 55 29 29 55 29 29 55 29
|
||||
19 13 19 57 59 57 58 57 59 81 71 74 72 74 76 27 54 29 55 52 55 52 55 52 55
|
||||
52 55 52 30 13 30 15 13 15 13 52 57 59 57 58 57 59 60 15 13 15 60 81 71 74
|
||||
72 74 76 27 54 29 55 52 55 52 55 52 55 52 55 52 30 13 30 15 13 15 13 52 57
|
||||
59 57 58 57 59 64 15 13 15 19 64 81 71 74 72 74 76 27 54 29 55 52 55 52 55
|
||||
52 55 52 55 52 30 13 30 78 63 82 15 13 15 13 52 57 59 57 58 57 59 64 15 13
|
||||
15 19 64 81 54 15 13 15 54 15 13 15 15 13 15 83 15 13 15 27 54 29 55 52 55
|
||||
52 55 52 55 52 55 52 30 13 30 78 63 82 15 13 15 13 52 57 59 57 58 57 59 64
|
||||
15 13 15 64 81 83 68 71 15 13 15 74 72 74 76 27 54 29 55 52 55 52 55 52 55
|
||||
52 55 52 30 13 30 78 63 82 15 13 15 13 52 57 59 57 58 57 59 64 15 13 15 64
|
||||
81 83 68 71 74 72 74 76 27 54 29 55 52 55 52 55 52 55 52 55 52 30 13 30 78
|
||||
63 82 15 13 15 13 52 57 59 57 58 57 59 61 15 13 15 61 81 83 68 71 15 13 15
|
||||
74 72 74 76 27 54 29 55 52 55 52 55 52 55 52 55 52 30 13 30 15 13 15 13 68
|
||||
81 34 33 15 13 15 34 13 36 39 41 39 39 41 39 41 39 41 39 41 39 41 39 41 43
|
||||
52 82 34 33 15 13 15 34 13 36 39 41 39 39 41 39 41 39 41 39 41 39 41 39 41
|
||||
43 52 82 34 33 15 13 15 34 13 36 39 41 39 39 41 39 41 39 41 39 41 39 41 39
|
||||
41 43 52 82 34 33 15 13 15 34 13 36 39 41 39 39 41 39 41 39 41 39 41 39 41
|
||||
39 41 43 52 82 34 33 15 13 15 34 13 36 39 41 39 39 41 39 41 39 41 39 41 39
|
||||
41 39 41 43 52 82 18 55 29 55 29 29 55 29 29 55 29 29 55 29 29 55 29 19 13
|
||||
19 57 59 57 58 57 59 81 15 13 15 81 83 68 71 74 72 74 76 27 54 29 55 52 55
|
||||
52 55 52 55 52 55 52 30 13 30 15 13 15 13 52 57 59 57 58 57 59 65 15 13 15
|
||||
65 81 83 68 71 74 72 74 76 27 54 29 55 52 55 52 55 52 55 52 55 52 30 13 30
|
||||
15 13 15 13 52 57 59 57 58 57 59 60 15 13 15 60 81 83 68 69 70 71 15 13 15
|
||||
74 72 74 76 27 54 29 55 52 55 52 55 52 55 52 55 52 30 13 30 15 13 15 13 52
|
||||
57 59 57 58 57 59 64 15 13 15 19 64 81 83 68 71 15 13 15 74 72 74 76 27 83
|
||||
26 21 15 13 15 15 13 15 24 85
|
||||
19 20 21 29 15 13 15 5 55 65 31 30 15 13 15 31 13 37 36 37 39 66 31 30 15
|
||||
13 15 31 13 37 36 37 39 66 31 30 15 13 15 31 13 37 36 37 39 66 31 30 15 13
|
||||
15 31 13 37 36 37 39 66 31 30 15 13 15 31 13 37 36 37 39 66 18 19 13 19 21
|
||||
62 26 41 58 41 27 42 39 42 39 42 39 42 39 42 39 28 13 28 62 50 66 15 13 15
|
||||
13 55 65 31 30 15 13 15 31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34
|
||||
35 39 66 31 30 15 13 15 31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34
|
||||
35 39 66 31 30 15 13 15 31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34
|
||||
35 39 66 31 30 15 13 15 31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34
|
||||
35 39 66 31 30 15 13 15 31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34
|
||||
35 39 66 18 42 27 42 27 27 42 27 27 42 27 27 42 27 27 42 27 19 13 19 44 46
|
||||
44 45 44 46 51 15 13 15 51 65 58 60 59 60 61 26 41 58 41 27 42 39 42 39 42
|
||||
39 42 39 42 39 28 13 28 62 50 66 15 13 15 13 55 65 31 30 15 13 15 31 13 33
|
||||
34 33 33 34 33 34 33 34 33 34 33 34 33 34 35 15 13 15 55 65 31 30 15 13 15
|
||||
31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34 35 39 66 31 30 15 13 15
|
||||
31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34 35 39 66 31 30 15 13 15
|
||||
31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34 35 39 66 31 30 15 13 15
|
||||
31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34 35 39 66 31 30 15 13 15
|
||||
31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34 35 39 66 18 42 27 42 27
|
||||
27 42 27 27 42 27 27 42 27 27 42 27 19 13 19 44 46 44 45 44 46 51 15 13 15
|
||||
51 65 41 15 13 15 41 58 15 13 15 60 59 60 61 26 41 58 41 27 42 39 42 39 42
|
||||
39 42 39 42 39 28 13 28 15 13 15 13 40 43 28 16 15 13 15 10 43 44 46 44 45
|
||||
44 46 64 53 62 58 15 13 15 60 59 60 61 26 41 58 41 27 42 39 42 39 42 39 42
|
||||
39 42 39 28 13 28 15 13 15 13 39 44 46 44 45 44 46 47 15 13 15 47 65 58 60
|
||||
59 60 61 26 41 58 41 27 42 39 42 39 42 39 42 39 42 39 28 13 28 15 13 15 13
|
||||
39 44 46 44 45 44 46 48 15 13 15 48 65 58 15 13 15 60 59 60 61 26 41 58 41
|
||||
27 42 39 42 39 42 39 42 39 42 39 28 13 28 62 50 66 15 13 15 13 55 65 31 30
|
||||
15 13 15 31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34 35 39 66 31 30
|
||||
15 13 15 31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34 35 39 66 31 30
|
||||
15 13 15 31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34 35 39 66 31 30
|
||||
15 13 15 31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34 35 39 66 31 30
|
||||
15 13 15 31 13 33 34 33 33 34 33 34 33 34 33 34 33 34 33 34 35 39 66 18 42
|
||||
27 42 27 27 42 27 27 42 27 27 42 27 27 42 27 19 13 19 44 46 44 45 44 46 64
|
||||
53 62 58 15 13 15 60 59 60 61 26 41 58 41 27 42 39 42 39 42 39 42 39 42 39
|
||||
28 13 28 62 50 66 15 13 15 13 39 44 46 44 45 44 46 48 15 13 15 48 65 15 13
|
||||
15 15 13 15 67 15 13 15 26 41 58 41 27 42 39 42 39 42 39 42 39 42 39 28 13
|
||||
28 62 50 66 15 13 15 13 55 65 31 30 15 13 15 31 13 33 34 33 33 34 33 34 33
|
||||
34 33 34 33 34 33 34 35 39 66 31 30 15 13 15 31 13 33 34 33 33 34 33 34 33
|
||||
34 33 34 33 34 33 34 35 39 66 31 30 15 13 15 31 13 33 34 33 33 34 33 34 33
|
||||
34 33 34 33 34 33 34 35 39 66 31 30 15 13 15 31 13 33 34 33 33 34 33 34 33
|
||||
34 33 34 33 34 33 34 35 39 66 31 30 15 13 15 31 13 33 34 33 33 34 33 34 33
|
||||
34 33 34 33 34 33 34 35 39 66 18 42 27 42 27 27 42 27 27 42 27 27 42 27 27
|
||||
42 27 19 13 19 44 46 44 45 44 46 49 50 49 15 13 15 49 30 16 30 50 15 13 15
|
||||
50 65 58 59 42 15 13 15 42 60 59 60 61 26 41 58 41 27 42 39 42 39 42 39 42
|
||||
39 42 39 28 13 28 62 50 66 15 13 15 13 39 44 46 44 45 44 46 48 15 13 15 48
|
||||
65 15 13 15 67 15 13 15 67 43 55 58 60 59 60 61 26 41 58 41 27 42 39 42 39
|
||||
42 39 42 39 42 39 28 13 28 15 13 15 13 39 44 46 44 45 44 46 63 15 13 15 63
|
||||
65 67 43 55 58 60 59 60 61 26 41 58 41 27 42 39 42 39 42 39 42 39 42 39 28
|
||||
13 28 62 50 66 15 13 15 13 39 44 46 44 45 44 46 64 53 55 61 15 13 15 61 58
|
||||
60 59 60 61 26 41 58 41 27 42 39 42 39 42 39 42 39 42 39 28 13 28 62 50 66
|
||||
15 13 15 13 39 44 46 44 45 44 46 52 15 13 15 52 53 62 15 13 15 65 67 43 55
|
||||
58 60 59 60 61 26 41 58 41 27 42 39 42 39 42 39 42 39 42 39 28 13 28 62 50
|
||||
66 15 13 15 13 39 44 46 44 45 44 46 51 15 13 15 51 65 67 43 55 58 15 13 15
|
||||
60 59 60 61 26 41 58 41 27 42 39 42 39 42 39 42 39 42 39 28 13 28 62 50 66
|
||||
15 13 15 13 39 44 46 44 45 44 46 52 15 13 15 52 53 62 15 13 15 65 67 43 55
|
||||
58 60 59 60 61 26 41 58 41 27 42 39 42 39 42 39 42 39 42 39 28 13 28 62 50
|
||||
66 15 13 15 13 39 44 46 44 45 44 46 51 15 13 15 51 65 67 43 55 56 57 58 60
|
||||
59 60 61 26 62 25 49 21 15 13 15 15 13 15 24 68
|
||||
@@ -9,7 +9,7 @@
|
||||
* data.src to see which strings have emojis.
|
||||
*
|
||||
* It reads one 'string' at a time; it does not read in the whole file at once.
|
||||
* option it allows for another file.
|
||||
* The -i option allows for another file.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
+129
-69
@@ -494,42 +494,45 @@ counter-example for that letter but oh is everyone in for a HUGE SHOCK!</p>
|
||||
<p>24 is peanuts compared to what I did. And let’s be honest - 24 is ALREADY WAY
|
||||
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 92 MORE, <strong>BEFORE</strong> the
|
||||
cpp at 116 and after the cpp is through I beat it by <strong>110</strong> MORE (!!), <strong>AT
|
||||
134!</strong> Yes, you read that right. 134 <code>goto</code>s! I even went further in an alt
|
||||
version, where before the cpp it was 131 <code>goto</code>s and after the cpp 149 (!!)
|
||||
<code>goto</code>s. I didn’t do this in the main entry for practical reasons but I wish I
|
||||
had.</p>
|
||||
<p>Even removing what I think are the only dead <code>goto</code>s, 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 cpp, at 123!</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>
|
||||
<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
|
||||
cpp, at 123! But of course it’s more now…</p>
|
||||
<p>Did I forget to mention the original Oregon Trail in <strong>BASIC</strong> from 1978 HAS A
|
||||
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
|
||||
116/134 <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
|
||||
<del>116/134</del> 131/149 <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
|
||||
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 59 lines and in a single run there were a
|
||||
total of <strong>985</strong> (!) line changes, counting function calls. In <code>main()</code> itself
|
||||
the line changed a total of <strong>776</strong> (!) times!</p>
|
||||
lines of code) the program has just 58 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">famous company</a>
|
||||
actually introduced a security hole from ONE <code>goto</code>. Yet I have 116/134 and it
|
||||
actually works? That is surely obscene. And beautiful.</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 <strong>7</strong> more <code>goto</code>s at 116 before the cpp and <strong>25 MORE</strong> after the
|
||||
cpp, at 134!</p>
|
||||
<p>It’s almost impossible to add more <code>goto</code>s. You’ll see why soon. But even if
|
||||
that was not the case I wanted room for the other things I did, some of which
|
||||
are quite cool and I believe unique as well.</p>
|
||||
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
|
||||
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>
|
||||
<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
|
||||
which are quite cool and I believe unique as well.</p>
|
||||
<p>And yes, I agree: the idea of <code>goto</code>s considered harmful considered harmful is
|
||||
ludicrous, and as you just found out (probably in horror), I have taken it far
|
||||
further.</p>
|
||||
@@ -537,10 +540,11 @@ further.</p>
|
||||
know about C when it comes to things like: loops, if/else, switch/case, blocks
|
||||
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 134 <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>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
|
||||
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>
|
||||
<p>This program took two months, to the day, to develop and it was totally worth
|
||||
it. But I was almost strangled by the spaghetti, kind of like the Devil, which
|
||||
@@ -590,17 +594,19 @@ 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 116 <code>goto</code>s or more when filtered through <code>cc -E</code> (134!), wouldn’t you say? If that’s NOT too many, then I ask you WHAT IS?</p>
|
||||
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
|
||||
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.</p>
|
||||
<p>I discuss this some in my concluding <a href="#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 the contest AND also pointing out the
|
||||
folly of <code>goto</code>.</p>
|
||||
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
|
||||
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
|
||||
the contest AND also pointing out the folly of <code>goto</code>.</p>
|
||||
<p>In this file I will discuss how some events actually are polymorphic, in a
|
||||
sense, having at least two different events.</p>
|
||||
<p>THIS IS ALL OBSCENE.</p>
|
||||
@@ -634,7 +640,58 @@ 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
|
||||
143 colons
|
||||
51 if
|
||||
11 else
|
||||
3 while
|
||||
4 for
|
||||
0 do
|
||||
6 switch
|
||||
32 case
|
||||
2 sizeof
|
||||
0 break
|
||||
0 continue
|
||||
2 default
|
||||
8 long
|
||||
3 unsigned
|
||||
4 return
|
||||
1 void
|
||||
1 int
|
||||
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
|
||||
143 colons
|
||||
51 if
|
||||
11 else
|
||||
7 while
|
||||
4 for
|
||||
0 do
|
||||
6 switch
|
||||
32 case
|
||||
2 sizeof
|
||||
0 break
|
||||
0 continue
|
||||
2 default
|
||||
8 long
|
||||
3 unsigned
|
||||
4 return
|
||||
1 void
|
||||
1 int
|
||||
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>
|
||||
<pre><code> 116 goto
|
||||
294 semicolon
|
||||
138 colons
|
||||
50 if
|
||||
11 else
|
||||
4 while
|
||||
@@ -653,11 +710,12 @@ horrified, if you’re not already:</p>
|
||||
1 int
|
||||
1 char
|
||||
1 size_t
|
||||
1 FILE
|
||||
|
||||
Ratio: 0.83 gotos per keyword</code></pre>
|
||||
<p>And the pre-processed one:</p>
|
||||
<pre><code> 134 goto
|
||||
332 semicolon
|
||||
138 colons
|
||||
50 if
|
||||
11 else
|
||||
8 while
|
||||
@@ -676,13 +734,9 @@ horrified, if you’re not already:</p>
|
||||
1 int
|
||||
1 char
|
||||
1 size_t
|
||||
1 FILE
|
||||
|
||||
Ratio: 0.93 gotos per keyword</code></pre>
|
||||
<p>LOOK AT THAT RATIO! And we could even suggest that <code>FILE</code> might not be a
|
||||
keyword, but rather a struct.</p>
|
||||
<p>Whether data types are keywords for this is also something to consider but we’ll
|
||||
include them as keywords anyway. I don’t believe I use any others in any case.</p>
|
||||
Ratio: 0.94 gotos per keyword</code></pre>
|
||||
<p>Look at those ratios. This is not right.</p>
|
||||
<p>This program is as cursed as the PC (player character) if not much more cursed.
|
||||
It is totally bonkers and it was really hard to find places for labels even
|
||||
after I put them in bizarre and unusual places. But I get into that in more
|
||||
@@ -783,7 +837,8 @@ 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 116 before the cpp and 134 (!!) after the cpp.</p>
|
||||
<code>goto</code>s. Yet I have <del>116</del> 131 before the cpp and <del>134</del> 149
|
||||
(!!) 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
|
||||
itself is worth something or some things - including curses.</p>
|
||||
@@ -940,6 +995,8 @@ one question their sanity even more. Yes I’m probably a sociopath.</p>
|
||||
* WARNING: this code and its comments are not up to date. I wrote 116 before
|
||||
* 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>
|
||||
<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
|
||||
@@ -1716,30 +1773,33 @@ padding?</p>
|
||||
<h3 id="conclusions">Conclusions</h3>
|
||||
<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 (116 or 1134 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 code being swapped in location
|
||||
(or moved to other parts of the code, even in what would otherwise be dead code,
|
||||
including possibly this for for loops), the fall through of a label to a goto
|
||||
that jumps back to right before that fall through just to exit the game (isn’t
|
||||
that so cute?), the fact I had to write all those tools to verify things are
|
||||
okay (showing how messed up it is), different blocks that have code that simply
|
||||
should not be there, the nested ternary operators…</p>
|
||||
<p>As for the <code>goto</code>s: yes I technically have more space. But it became almost
|
||||
impossible to add more spaghetti to the pot without it overflowing, and I do not
|
||||
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
|
||||
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
|
||||
code being swapped in location (or moved to other parts of the code, even in
|
||||
what would otherwise be dead code, including possibly this for for loops), the
|
||||
fall through of a label to a goto that jumps back to right before that fall
|
||||
through just to exit the game (isn’t that so cute?), the fact I had to write all
|
||||
those tools to verify things are okay (showing how messed up it is), different
|
||||
blocks that have code that simply should not be there, the nested ternary
|
||||
operators…</p>
|
||||
<p>As for the <code>goto</code>s: yes I technically had more space. But it became almost
|
||||
impossible to add more spaghetti to the pot without it overflowing, and I didn’t
|
||||
want to waste perfectly good spaghetti. There comes a point when there’s just so
|
||||
much spaghetti that it’s wasted, if it can even be cooked. I believe I have
|
||||
reached the latter.</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).</p>
|
||||
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>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
|
||||
|
||||
+140
-72
@@ -48,16 +48,17 @@ counter-example for that letter but oh is everyone in for a HUGE SHOCK!
|
||||
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 92 MORE, **BEFORE** the
|
||||
cpp at 116 and after the cpp is through I beat it by **110** MORE (!!), **AT
|
||||
134!** Yes, you read that right. 134 `goto`s! I even went further in an alt
|
||||
version, where before the cpp it was 131 `goto`s and after the cpp 149 (!!)
|
||||
`goto`s. I didn't do this in the main entry for practical reasons but I wish I
|
||||
had.
|
||||
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.
|
||||
|
||||
Even removing what I think are the only dead `goto`s, two of them, including one
|
||||
that is in the `w()` macro that would be translated into more, I beat it by 90
|
||||
more, at 114 before the cpp, and 99 more after the cpp, at 123!
|
||||
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
|
||||
into more, I beat it by 90 more, at 114 before the cpp, and 99 more after the
|
||||
cpp, at 123! But of course it's more now...
|
||||
|
||||
Did I forget to mention the original Oregon Trail in **BASIC** from 1978 HAS A
|
||||
MEASLY 109? THIS SHOULD NOT HAPPEN. Well it did happen and this HAS to be a
|
||||
@@ -65,32 +66,34 @@ 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
|
||||
116/134 `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
|
||||
<del>116/134</del> 131/149 `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
|
||||
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 59 lines and in a single run there were a
|
||||
total of **985** (!) line changes, counting function calls. In `main()` itself
|
||||
the line changed a total of **776** (!) times!
|
||||
lines of code) the program has just 58 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 [famous company](https://www.apple.com)
|
||||
actually introduced a security hole from ONE `goto`. Yet I have 116/134 and it
|
||||
actually works? That is surely obscene. And beautiful.
|
||||
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
|
||||
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 **7** more `goto`s at 116 before the cpp and **25 MORE** after the
|
||||
cpp, at 134!
|
||||
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!
|
||||
|
||||
It's almost impossible to add more `goto`s. You'll see why soon. But even if
|
||||
that was not the case I wanted room for the other things I did, some of which
|
||||
are quite cool and I believe unique as well.
|
||||
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
|
||||
even if that was not the case I wanted room for the other things I did, some of
|
||||
which are quite cool and I believe unique as well.
|
||||
|
||||
And yes, I agree: the idea of `goto`s considered harmful considered harmful is
|
||||
ludicrous, and as you just found out (probably in horror), I have taken it far
|
||||
@@ -101,11 +104,12 @@ know about C when it comes to things like: loops, if/else, switch/case, blocks
|
||||
in general, where code can be, where labels can be, really everything: the code
|
||||
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 134 `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.
|
||||
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
|
||||
not a `char *[]`. It's a single `char *`, which is the contents of the data
|
||||
file.
|
||||
|
||||
There are other things I have done, of course.
|
||||
|
||||
@@ -167,20 +171,21 @@ 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 116 `goto`s or more when filtered through `cc
|
||||
-E` (134!), wouldn't you say? If that's NOT too many, then I ask you WHAT IS?
|
||||
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
|
||||
too many, then I ask you WHAT IS?
|
||||
|
||||
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.
|
||||
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 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 the contest AND also pointing out the
|
||||
folly of `goto`.
|
||||
I discuss this some in my concluding [remarks above](#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
|
||||
the contest AND also pointing out the folly of `goto`.
|
||||
|
||||
In this file I will discuss how some events actually are polymorphic, in a
|
||||
sense, having at least two different events.
|
||||
@@ -223,8 +228,68 @@ Here are some fun statistics from a somewhat rudimentary program on both the
|
||||
prog.c and after filtered through `cc -E`. First prog.c. Prepare to be
|
||||
horrified, if you're not already:
|
||||
|
||||
```
|
||||
131 goto
|
||||
301 semicolon
|
||||
143 colons
|
||||
51 if
|
||||
11 else
|
||||
3 while
|
||||
4 for
|
||||
0 do
|
||||
6 switch
|
||||
32 case
|
||||
2 sizeof
|
||||
0 break
|
||||
0 continue
|
||||
2 default
|
||||
8 long
|
||||
3 unsigned
|
||||
4 return
|
||||
1 void
|
||||
1 int
|
||||
1 char
|
||||
1 size_t
|
||||
|
||||
Ratio: 1.01 gotos per keyword
|
||||
```
|
||||
|
||||
1.01 goto per keyword? But then there's the cpp filtered code...
|
||||
|
||||
```
|
||||
149 goto
|
||||
339 semicolon
|
||||
143 colons
|
||||
51 if
|
||||
11 else
|
||||
7 while
|
||||
4 for
|
||||
0 do
|
||||
6 switch
|
||||
32 case
|
||||
2 sizeof
|
||||
0 break
|
||||
0 continue
|
||||
2 default
|
||||
8 long
|
||||
3 unsigned
|
||||
4 return
|
||||
1 void
|
||||
1 int
|
||||
1 char
|
||||
1 size_t
|
||||
|
||||
Ratio: 1.11 gotos per keyword
|
||||
```
|
||||
|
||||
1.11!
|
||||
|
||||
For comparison, here is the original version:
|
||||
|
||||
```
|
||||
116 goto
|
||||
294 semicolon
|
||||
138 colons
|
||||
50 if
|
||||
11 else
|
||||
4 while
|
||||
@@ -243,7 +308,6 @@ horrified, if you're not already:
|
||||
1 int
|
||||
1 char
|
||||
1 size_t
|
||||
1 FILE
|
||||
|
||||
Ratio: 0.83 gotos per keyword
|
||||
```
|
||||
@@ -252,6 +316,8 @@ And the pre-processed one:
|
||||
|
||||
```
|
||||
134 goto
|
||||
332 semicolon
|
||||
138 colons
|
||||
50 if
|
||||
11 else
|
||||
8 while
|
||||
@@ -270,16 +336,11 @@ And the pre-processed one:
|
||||
1 int
|
||||
1 char
|
||||
1 size_t
|
||||
1 FILE
|
||||
|
||||
Ratio: 0.93 gotos per keyword
|
||||
Ratio: 0.94 gotos per keyword
|
||||
```
|
||||
|
||||
LOOK AT THAT RATIO! And we could even suggest that `FILE` might not be a
|
||||
keyword, but rather a struct.
|
||||
|
||||
Whether data types are keywords for this is also something to consider but we'll
|
||||
include them as keywords anyway. I don't believe I use any others in any case.
|
||||
Look at those ratios. This is not right.
|
||||
|
||||
This program is as cursed as the PC (player character) if not much more cursed.
|
||||
It is totally bonkers and it was really hard to find places for labels even
|
||||
@@ -414,7 +475,8 @@ 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 116 before the cpp and 134 (!!) after the cpp.
|
||||
`goto`s. Yet I have <del>116</del> 131 before the cpp and <del>134</del> 149
|
||||
(!!) after the cpp.
|
||||
|
||||
And unfortunately for you dear reader I have done other things that also are
|
||||
quite different and totally unrelated to `goto`s. Even so the `goto` madness by
|
||||
@@ -600,6 +662,9 @@ As I commented in the commented.c:
|
||||
* repeatedly revisit this file trying to explain everything.
|
||||
```
|
||||
|
||||
...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.
|
||||
|
||||
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
|
||||
@@ -1620,32 +1685,35 @@ padding?
|
||||
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 (116 or 1134 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 code being swapped in location
|
||||
(or moved to other parts of the code, even in what would otherwise be dead code,
|
||||
including possibly this for for loops), the fall through of a label to a goto
|
||||
that jumps back to right before that fall through just to exit the game (isn't
|
||||
that so cute?), the fact I had to write all those tools to verify things are
|
||||
okay (showing how messed up it is), different blocks that have code that simply
|
||||
should not be there, the nested ternary operators...
|
||||
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
|
||||
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
|
||||
code being swapped in location (or moved to other parts of the code, even in
|
||||
what would otherwise be dead code, including possibly this for for loops), the
|
||||
fall through of a label to a goto that jumps back to right before that fall
|
||||
through just to exit the game (isn't that so cute?), the fact I had to write all
|
||||
those tools to verify things are okay (showing how messed up it is), different
|
||||
blocks that have code that simply should not be there, the nested ternary
|
||||
operators...
|
||||
|
||||
As for the `goto`s: yes I technically have more space. But it became almost
|
||||
impossible to add more spaghetti to the pot without it overflowing, and I do not
|
||||
As for the `goto`s: yes I technically had more space. But it became almost
|
||||
impossible to add more spaghetti to the pot without it overflowing, and I didn't
|
||||
want to waste perfectly good spaghetti. There comes a point when there's just so
|
||||
much spaghetti that it's wasted, if it can even be cooked. I believe I have
|
||||
reached the latter.
|
||||
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.
|
||||
|
||||
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).
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
@@ -9,16 +9,6 @@
|
||||
* Using the macro (identical except it uses puts() on some of the strings that
|
||||
* are unencrypted) from prog.c we will print out every string
|
||||
* at every location in the order it occurs.
|
||||
*
|
||||
* IMPORTANT NOTE: as some strings have a marker that indicates to not be
|
||||
* encrypted but the marker is not in the data file itself, the bytecount.c
|
||||
* might be better in that it uses the data source file. However for my own
|
||||
* purposes I have this tool too. This tool, to prevent display problems, checks
|
||||
* for specific known locations where it should not decrypt anything due to not
|
||||
* being encrypted (the '%' ones notwithstanding), and if it is that number it
|
||||
* will print it out with puts() instead (can't be printf() as it has %
|
||||
* conversions). A BEL byte also is unencrypted (if it's the first character of
|
||||
* the string it's skipped and printed without encrypting it).
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@@ -32,7 +22,6 @@
|
||||
*/
|
||||
#define Z(x) (x)*BLOCKSIZE
|
||||
#define V(x) puts(&y[Z(x)]);
|
||||
static char *p;
|
||||
static char *y;
|
||||
static char *filename = "data";
|
||||
static size_t len;
|
||||
|
||||
@@ -18,13 +18,13 @@ 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)
|
||||
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;
|
||||
goto OO; yy:
|
||||
do{ if(b<1||M<0||M>2169){ break; 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);
|
||||
@@ -49,37 +49,37 @@ t[X])if(t[X]<0||t[X]>
|
||||
*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;
|
||||
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;
|
||||
O:{ V(e = 19); O -= 40; R+=40; } goto E; i:if(O<1){ goto d; } else { v=0; } 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); } 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,23))
|
||||
{ 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
|
||||
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; break; case 18:V(26); goto Z; case 13:V(28); break;
|
||||
case 2:O-=40; V(71); break; case 3:V(a=76); b-=70; goto W; case 4:V(77); N-=7; M-=7; break; case 5:case
|
||||
10:if(q<6) { goto ha; m: V(56); goto D; 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 9:case 19:V(30); goto Z; case 20:V(32); break; case 21 :V(31); break; 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
|
||||
if(!x(0,3)){ w(x(0,4)?84:x(0,4)?33:34) e:if(O>39){ V(e=x(0,1)?18:19); O -= 40; goto q; 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);
|
||||
} M-=17; goto Z; case 14: V(74); break; 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 _;
|
||||
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; 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 u; } m=1; if (x(0,9) > 5) goto w; V(23); z:; } while (A++<21); goto _;
|
||||
}
|
||||
}
|
||||
+30
-47
@@ -18,68 +18,51 @@ 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)
|
||||
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 OO; yy:
|
||||
do{ if(b<1||M<0||M>2169){ break; F:V(51); R+=18; goto L; } goto i;
|
||||
|
||||
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
|
||||
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
|
||||
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(
|
||||
|
||||
=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;
|
||||
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 { v=0; } 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); } C: l=0; f:z=0;
|
||||
X:if(R<1){ goto e; U: w(24) K:R-=R
|
||||
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,23))
|
||||
{ case 1:V(95); R+=5; break; case 18:V(26); goto Z; case 13:V(28); break;
|
||||
case 2:O-=40; V(71); break; case 3:V(a=76); b-=70; goto W; case 4:V(77); N-=7; M-=7; break; case 5:case
|
||||
10:if(q<6) { goto ha; m: V(56); goto D; o:; } else
|
||||
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); break; case 21 :V(31); break; case 6:goto g; case 16: case 22:V(49); goto Z; case 17:V(72); goto Z;
|
||||
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
|
||||
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){ V(e=x(0,1)?18:19); O -= 40; goto q; 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
|
||||
|
||||
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
|
||||
|
||||
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); break; 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; 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 u; } m=1; if (x(0,9) > 5) goto w; V(23); z:; } while (A++<21); goto _;
|
||||
}
|
||||
}
|
||||
} 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 _;
|
||||
} }
|
||||
@@ -0,0 +1,42 @@
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<time.h>
|
||||
#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;
|
||||
#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;}
|
||||
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 _;}}
|
||||
Reference in new issue
Block a user