Add 2018/hou/try.sh + format/typo checks
This commit is contained in:
1 parent
1959925eda
commit
26c4717ad4
3 files changed
+47
-9
No files matched your search
+4
-9
@@ -28,15 +28,10 @@ View `output.html` in a browser.
|
|||||||
### Try:
|
### Try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
grep -e '[-?+*/^&|.<>=]' prog.c
|
./try.sh
|
||||||
|
|
||||||
(cd ..; ls -lS */prog.c) | \
|
|
||||||
awk 'BEGIN { print "["; } { print "{\"winner\":\"",$9,"\", \"size\":",$5,"},"} END { print "]"}' \
|
|
||||||
> ioccc.json
|
|
||||||
./prog < ioccc.json > ioccc.html
|
|
||||||
```
|
```
|
||||||
|
|
||||||
View `output.html` in a browser.
|
As the script says, open `output.html` in a browser.
|
||||||
|
|
||||||
What's not right with the output? How can one fix it?
|
What's not right with the output? How can one fix it?
|
||||||
|
|
||||||
@@ -44,7 +39,7 @@ What's not right with the output? How can one fix it?
|
|||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
|
|
||||||
This entry exhibits a way of obfuscation we haven't seen before, we think.
|
This entry exhibits a way of obfuscation we haven't seen before, we think.
|
||||||
The rulez of programming in an imperative language are violated, aren't they?
|
The `rulez` of programming in an imperative language are violated, aren't they?
|
||||||
|
|
||||||
Try figuring out how to increase the number of different colors, if you can.
|
Try figuring out how to increase the number of different colors, if you can.
|
||||||
|
|
||||||
@@ -58,7 +53,7 @@ to generate an HTML page from a JSON feed.
|
|||||||
This entry takes such decadence to an extreme. It just calls a bunch of
|
This entry takes such decadence to an extreme. It just calls a bunch of
|
||||||
libraries to generate an HTML page from a JSON feed, literally. There is no
|
libraries to generate an HTML page from a JSON feed, literally. There is no
|
||||||
variable (function parameters included), no operator, no flow control statements
|
variable (function parameters included), no operator, no flow control statements
|
||||||
except a few decorative returns. In compliance to production coding standards,
|
except a few decorative `return`s. In compliance to production coding standards,
|
||||||
the code is littered with fashionable jargon, doxygen comment, and license text.
|
the code is littered with fashionable jargon, doxygen comment, and license text.
|
||||||
|
|
||||||
As one would expect from such an approach, this program is much more resource
|
As one would expect from such an approach, this program is much more resource
|
||||||
|
|||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# try.sh - demonstrate IOCCC winner 2018/hou
|
||||||
|
#
|
||||||
|
|
||||||
|
# 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 run: grep -e '[-?+*/^&|.<>=]' prog.c (space = next page, q = quit): "
|
||||||
|
echo 1>&2
|
||||||
|
grep -e '[-?+*/^&|.<>=]' prog.c | less -EXF
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
# ^-- SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
|
||||||
|
# ^-- SC1083 (warning): This { is literal. Check expression (missing ;/\n?) or quote it.
|
||||||
|
# ^-- SC1083 (warning): This } is literal. Check expression (missing ;/\n?) or quote it.
|
||||||
|
# ^-- SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
|
||||||
|
# shellcheck disable=SC2140
|
||||||
|
# shellcheck disable=SC1083
|
||||||
|
echo "(cd ..; ls -lS -- */prog.c) | \
|
||||||
|
awk 'BEGIN { print "["; } { print "{\"winner\":\"",\$9,"\", \"size\":",\$5,"},"} END { print "]"}' \
|
||||||
|
> ioccc.json"
|
||||||
|
|
||||||
|
(cd ..; ls -lS -- */prog.c) | \
|
||||||
|
awk 'BEGIN { print "["; } { print "{\"winner\":\"",$9,"\", \"size\":",$5,"},"} END { print "]"}' \
|
||||||
|
> ioccc.json
|
||||||
|
./prog < ioccc.json > ioccc.html
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "Now open ioccc.html in your browser." 1>&2
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -3974,6 +3974,8 @@ that's probably true: let's just say that for the IOCCC I'm (Cody) a weasel! :-)
|
|||||||
[Cody](#cody) added explicit linking of libm (`-lm`) for systems that do not do this
|
[Cody](#cody) added explicit linking of libm (`-lm`) for systems that do not do this
|
||||||
(Linux doesn't seem to but macOS does).
|
(Linux doesn't seem to but macOS does).
|
||||||
|
|
||||||
|
Cody also added the [try.sh](/2018/hou/try.sh) script.
|
||||||
|
|
||||||
|
|
||||||
## <a name="2018_vokes"></a>[2018/vokes](/2018/vokes/prog.c) ([README.md](/2018/vokes/README.md))
|
## <a name="2018_vokes"></a>[2018/vokes](/2018/vokes/prog.c) ([README.md](/2018/vokes/README.md))
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user