Merge pull request #1698 from xexyl/endoh22018
This commit is contained in:
7 files changed
+147
-50
No files matched your search
+4
-15
@@ -148,22 +148,11 @@ alt: data ${ALT_TARGET}
|
|||||||
data: ${DATA}
|
data: ${DATA}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
python: ${PROG}
|
python:
|
||||||
${RM} -f ${PROG}_next.c
|
./python.sh
|
||||||
${CC} ${CFLAGS} ${PROG}.c -o ${PROG} ${LDFLAGS}
|
|
||||||
while :; do \
|
|
||||||
./${PROG} | tee ${PROG}_next.c; \
|
|
||||||
${CC} ${CFLAGS} ${PROG}_next.c -o ./${PROG} ${LDFLAGS}; \
|
|
||||||
sleep 1; \
|
|
||||||
done
|
|
||||||
|
|
||||||
python3: ${PROG}
|
python3:
|
||||||
${RM} -f ${PROG}_next.c
|
./python3.sh
|
||||||
${CC} ${CFLAGS} ${PROG}.c -o ${PROG} ${LDFLAGS}
|
|
||||||
while :; do \
|
|
||||||
./${PROG} | tee ${PROG}_next.c; \
|
|
||||||
${CC} ${CFLAGS} ${PROG}_next.c -o ./${PROG} ${LDFLAGS}; \
|
|
||||||
done
|
|
||||||
|
|
||||||
# both all and alt
|
# both all and alt
|
||||||
#
|
#
|
||||||
|
|||||||
+17
-26
@@ -15,18 +15,10 @@ make
|
|||||||
### Try:
|
### Try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./prog | tee prog_next.c
|
./try.sh
|
||||||
make prog_next
|
|
||||||
./prog_next | tee prog_next.c
|
|
||||||
make prog_next
|
|
||||||
./prog_next | tee prog_next.c
|
|
||||||
|
|
||||||
make python
|
|
||||||
|
|
||||||
make python3
|
|
||||||
```
|
```
|
||||||
|
|
||||||
NOTE: to interrupt the loop send intr (typically ctrl-C).
|
NOTE: to interrupt the loops send intr (typically ctrl-C).
|
||||||
|
|
||||||
|
|
||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
@@ -41,31 +33,30 @@ This is an EX-tremely obfuscated program!
|
|||||||
|
|
||||||
A high-context work that combines parrots that new hackers like and parrots that
|
A high-context work that combines parrots that new hackers like and parrots that
|
||||||
old hackers like. One is an internet meme called [Party
|
old hackers like. One is an internet meme called [Party
|
||||||
Parrot](https://cultofthepartyparrot.com). The other is a
|
Parrot](https://cultofthepartyparrot.com) (WARNING: has flashing lights). The other is a
|
||||||
sketch (comte) called ["Dead
|
sketch [comté](https://en.wikipedia.org/wiki/Comté_cheese) called ["Dead
|
||||||
Parrot"](https://en.wikipedia.org/wiki/Dead_Parrot_sketch) from the British
|
Parrot"](https://en.wikipedia.org/wiki/Dead_Parrot_sketch) from the British
|
||||||
comedy TV show ["Monty Python's Flying Circus"](https://en.wikipedia.org/wiki/Monty_Python%27s_Flying_Circus)
|
sitcom ["Monty Python's Flying Circus"](https://en.wikipedia.org/wiki/Monty_Python%27s_Flying_Circus)
|
||||||
The "_Python_" in the award name refers to Monty Python, **not** the
|
The "_Python_" in the award name refers to Monty Python, **not** the
|
||||||
[programming language Python (the name of the programming language Python is
|
[programming language Python](https://en.wikipedia.org/wiki/Python_(programming_language)
|
||||||
derived from Monty
|
(the name of the programming language Python is derived from Monty Python).
|
||||||
Python)](https://en.wikipedia.org/wiki/Python_(programming_language).
|
|
||||||
|
|
||||||
|
The shape of [prog.c](prog.c) is "Undead Parrot" based on "dead parrot". The
|
||||||
The shape of prog.c is "Undead Parrot" based on "dead parrot". The message that
|
message that appears in the bottom line of the output source code is the subject
|
||||||
appears in the bottom line of the output source code is the subject of the
|
of the dialogue that appears in "Dead Parrot" and explains in various
|
||||||
dialogue that appears in "Dead Parrot" and explains in various expressions that
|
expressions that the parrot died. Also, the second **__<-_Source_of_Parrots__**
|
||||||
the parrot died. Also, the second **__<-_Source_of_Parrots__** line from the bottom
|
line from the bottom of <http://cultofthepartyparrot.com/> (WARNING: has
|
||||||
<http://cultofthepartyparrot.com/> has a hidden URL (hidden by the parrot's body).
|
flashing lights) has a hidden URL (hidden by the parrot's body).
|
||||||
|
|
||||||
Although it is a boring Quine story, it is quite difficult to have 10 parrot
|
Although it is a boring Quine story, it is quite difficult to have 10 parrot
|
||||||
pictures and 10 lines of data. Only the outline data of the parrot picture is
|
pictures and 10 lines of data. Only the outline data of the parrot picture is
|
||||||
saved, and the body is filled in at runtime. These data are probably compressed
|
saved, and the body is filled in at runtime. These data are probably compressed
|
||||||
with [byte pair encoding](https://en.wikipedia.org/wiki/Byte_pair_encoding).
|
with [byte pair encoding](https://en.wikipedia.org/wiki/Byte_pair_encoding).
|
||||||
|
|
||||||
The parrot ASCII art below is the opening line of the Monty Python show. The judge's
|
The parrot ASCII art below is the opening line of the Monty Python show. The
|
||||||
comment ["And now for something completely
|
judge's comment ["And now for something completely
|
||||||
different"](https://en.wikipedia.org/wiki/And_Now_for_Something_Completely_Different) is also used in the
|
different"](https://en.wikipedia.org/wiki/And_Now_for_Something_Completely_Different)
|
||||||
opening.
|
is also used in the opening.
|
||||||
|
|
||||||
```
|
```
|
||||||
___-----__
|
___-----__
|
||||||
|
|||||||
Executable
+31
@@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# python.sh - make python rule script of 2018/endoh2 so one can use this in
|
||||||
|
# other scripts, allowing one to interrupt it but continue to the next script
|
||||||
|
#
|
||||||
|
|
||||||
|
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
|
||||||
|
# this way allows us to have the user specify a different compiler in an easy
|
||||||
|
# way.
|
||||||
|
if [[ -z "$CC" ]]; then
|
||||||
|
CC="cc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
make CC="$CC" all >/dev/null || exit 1
|
||||||
|
|
||||||
|
CFLAGS="-Wno-strict-prototypes"
|
||||||
|
LDFLAGS=
|
||||||
|
|
||||||
|
# set up trap so one can go on to next script after interrupting this one in
|
||||||
|
# case this script is being run from another
|
||||||
|
EXIT=0
|
||||||
|
trap 'EXIT=1' INT
|
||||||
|
|
||||||
|
rm -f prog_next.c prog_next
|
||||||
|
${CC} "${CFLAGS}" prog.c -o prog "${LDFLAGS}"
|
||||||
|
while [[ "$EXIT" != 1 ]]; do
|
||||||
|
./prog | tee prog_next.c;
|
||||||
|
cc prog_next.c -o ./prog "$CFLAGS" "$LDFLAGS"
|
||||||
|
sleep 1;
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
Executable
+30
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# python3.sh - make python3 rule script of 2018/endoh2 so one can use this in
|
||||||
|
# other scripts, allowing one to interrupt it but continue to the next script
|
||||||
|
#
|
||||||
|
|
||||||
|
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
|
||||||
|
# this way allows us to have the user specify a different compiler in an easy
|
||||||
|
# way.
|
||||||
|
if [[ -z "$CC" ]]; then
|
||||||
|
CC="cc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
make CC="$CC" all >/dev/null || exit 1
|
||||||
|
|
||||||
|
CFLAGS="-Wno-strict-prototypes"
|
||||||
|
LDFLAGS=
|
||||||
|
|
||||||
|
# set up trap so one can go on to next script after interrupting this one in
|
||||||
|
# case this script is being run from another
|
||||||
|
EXIT=0
|
||||||
|
trap 'EXIT=1' INT
|
||||||
|
|
||||||
|
rm -f prog_next.c prog_next
|
||||||
|
${CC} "${CFLAGS}" prog.c -o prog "${LDFLAGS}"
|
||||||
|
while [[ "$EXIT" != 1 ]]; do
|
||||||
|
./prog | tee prog_next.c;
|
||||||
|
cc prog_next.c -o ./prog "$CFLAGS" "$LDFLAGS"
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
+12
-9
@@ -1,13 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Do the compile and run loop for 10 seconds
|
#
|
||||||
|
# run.sh - run 2018/endoh2 in a loop for 20 seconds
|
||||||
|
|
||||||
transient_parrot=$(tempfile -s .c)
|
# set up trap so one can continue to next script if run from another script
|
||||||
cp prog.c "$transient_parrot"
|
EXIT=0
|
||||||
|
trap 'EXIT=1; rm -f prog_next.c prog_next' INT
|
||||||
|
|
||||||
stop_dancing_deadline=$(($(date +"%s")+10))
|
transient_parrot=prog_next.c
|
||||||
while [[ $(date +"%s") -lt "$stop_dancing_deadline" ]]; do
|
./prog | tee "$transient_parrot"
|
||||||
gcc "$transient_parrot" -o ./prog && ./prog | tee "$transient_parrot"
|
|
||||||
sleep 0.01
|
stop_dancing_deadline=$(($(date +"%s")+20))
|
||||||
|
while [[ $(date +"%s") -lt "$stop_dancing_deadline" && "$EXIT" != 1 ]]; do
|
||||||
|
cc "$transient_parrot" -o ./prog && ./prog | tee "$transient_parrot"
|
||||||
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -f "$transient_parrot"
|
|
||||||
Executable
+40
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# try.sh - demonstrate IOCCC winner 2018/endoh2
|
||||||
|
#
|
||||||
|
|
||||||
|
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
|
||||||
|
# this way allows us to have the user specify a different compiler in an easy
|
||||||
|
# way.
|
||||||
|
if [[ -z "$CC" ]]; then
|
||||||
|
CC="cc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
make CC="$CC" all >/dev/null || exit 1
|
||||||
|
|
||||||
|
# clear screen after compilation so that only the entry is shown
|
||||||
|
clear
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to continue (ctrl-c/intr = skip to next early, runs 20 seconds): "
|
||||||
|
echo 1>&2
|
||||||
|
./run.sh
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run a few times (ctrl-c/intr exits script): "
|
||||||
|
echo 1>&2
|
||||||
|
./prog | tee prog_next.c
|
||||||
|
make prog_next
|
||||||
|
./prog_next | tee prog_next.c
|
||||||
|
make prog_next
|
||||||
|
./prog_next | tee prog_next.c
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to sleep 1 sec between runs (intr/ctrl-c to exit): "
|
||||||
|
echo 1>&2
|
||||||
|
./python.sh
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key run without sleeping (intr/ctrl-c to exit): "
|
||||||
|
echo 1>&2
|
||||||
|
./python3.sh
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -3968,6 +3968,19 @@ work for Windows, based on the author's remarks.
|
|||||||
Internet Wayback Machine.
|
Internet Wayback Machine.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## <a name="2018_endoh2"></a>[2018/endoh2](/2018/endoh2/prog.c) ([README.md](/2018/endoh2/README.md))
|
||||||
|
|
||||||
|
[Cody](#cody) fixed the [run.sh](/2018/endoh2/run.sh) script (had commands that didn't
|
||||||
|
exist and also didn't work even after that was addressed) and added the
|
||||||
|
[try.sh](/2018/endoh2/try.sh), [python.sh](/2018/endoh2/python.sh) and
|
||||||
|
[python3.sh](/2018/endoh2/python3.sh) scripts. The `try.sh` script runs all
|
||||||
|
three of the other scripts but each allows one to send an interrupt in the loops
|
||||||
|
and still continue to the next script (if one does it when not in a loop it will
|
||||||
|
exit the script). The `make python` and `make python3` rules in the Makefile now
|
||||||
|
run the respective scripts.
|
||||||
|
|
||||||
|
|
||||||
## <a name="2018_ferguson"></a>[2018/ferguson](/2018/ferguson/prog.c) ([README.md](/2018/ferguson/README.md))
|
## <a name="2018_ferguson"></a>[2018/ferguson](/2018/ferguson/prog.c) ([README.md](/2018/ferguson/README.md))
|
||||||
|
|
||||||
[Cody](#cody), with irony well intended :-), fixed the [test.sh
|
[Cody](#cody), with irony well intended :-), fixed the [test.sh
|
||||||
|
|||||||
Reference in new issue
Block a user