From c0b8d32b5970b3c939d957e1a57642e29097e7c8 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 8 Dec 2023 10:53:15 -0800 Subject: [PATCH] Add 2015/hou/try.sh + format/typo checks The file large is from dd(1) of /dev/zero to be large enough to cause the program to run out of memory (but not too large for the repo, see 'wc -c' on it) as suggested by the judges' remarks. --- 2015/hou/README.md | 28 ++++++++++++++++++++++------ 2015/hou/large | Bin 0 -> 524288 bytes 2015/hou/try.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ thanks-for-help.md | 3 +++ 4 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 2015/hou/large create mode 100755 2015/hou/try.sh diff --git a/2015/hou/README.md b/2015/hou/README.md index 7b6146b2f..c712151af 100644 --- a/2015/hou/README.md +++ b/2015/hou/README.md @@ -5,10 +5,24 @@ make ``` +### Bugs and (Mis)features: + +The current status of this entry is: + +``` +STATUS: INABIAF - please **DO NOT** fix +``` + +For more detailed information see [2015 hou in bugs.md](/bugs.md#2015-hou). + + + + ## To use: ```sh -echo IOCCC | ./prog +echo something | ./prog +./prog < file ``` @@ -37,7 +51,7 @@ Some things that make you go, "huh?" How are those values magically returned? -What happens with a large file? Something over 256K +What happens with a large file? Something over 256K. ```sh ./prog < large_file @@ -50,7 +64,7 @@ Where does that message come from? This looks like a normal C program. -Almost everything is a double. +Almost everything is a `double`. There are tell-tale signs like `pow(2,(?/12))` and `exp(-?*?)` (names redacted). You can also find a bunch of cosines and polynomial evaluations. @@ -59,6 +73,7 @@ It looks like a ????? ???????????, right? Run and find out. + ### Why obfuscated Some poor scripting folks only have access to doubles (Jav?script, L?a, BA?IC, @@ -72,10 +87,11 @@ isn't a single integer. Even `getchar()` and `EOF` are immediately converted. Since `bool` counts as an integer type too, there is no boolean either. No comparison, no `if`, no `?:`, no `||` `&&`. Everything is done in a single loop -that terminates on printf. Straight up arithmetic. +that terminates on `printf(3)`. Straight up arithmetic. + +`floor(3)` and `ceil(3)` are technically double-to-double functions, but they feel +like cheating. Yes `cos(3)`, no `floor(3)`. -`floor` and `ceil` are technically double-to-double functions, but they feel -like cheating. Yes `cos`, no `floor`. ### Limitations diff --git a/2015/hou/large b/2015/hou/large new file mode 100644 index 0000000000000000000000000000000000000000..8dd9b32398037d9b41b3651c8ca362d48243bb3d GIT binary patch literal 524288 zcmeIufdBvi0K=g9Q{UhOg-~I@fB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM z7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* z1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA zz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEj zFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r z3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@ z0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VK zfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5 zV8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM z7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* z1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|p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b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VK VfB^#r3>YwAz<>b*1`HVZ0|Nkf00961 literal 0 HcmV?d00001 diff --git a/2015/hou/try.sh b/2015/hou/try.sh new file mode 100755 index 000000000..6fadf04b5 --- /dev/null +++ b/2015/hou/try.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2015/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 + + +echo "$ echo IOCCC | ./prog" 1>&2 +echo IOCCC | ./prog +echo 1>&2 + +echo "$ ./prog < rfc1321.txt" 1>&2 +./prog < rfc1321.txt +echo 1>&2 + +echo "$ echo \"\" | ./prog" 1>&2 +echo "" | ./prog +echo 1>&2 + +echo "For the next two, observe the magical values: " +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +echo "$ ./prog < prog.c | cut -c-5" 1>&2 +./prog < prog.c | cut -c-5 + +echo "$ ./prog < Makefile | cut -c-4" 1>&2 +./prog < Makefile | cut -c-4 +echo 1>&2 + +echo "$ wc -c large" 1>&2 +wc -c large + +echo "$ ./prog < large" 1>&2 +./prog < large diff --git a/thanks-for-help.md b/thanks-for-help.md index 021f8176c..335ce31cd 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -3835,6 +3835,9 @@ simply typing `make back_to` or `make mullender`) and then runs the famous [Cody](#cody) added explicit linking of libm (`-lm`) for systems that do not do this (Linux doesn't seem to but macOS does). +Cody also added the [try.sh](2015/hou/try.sh) script and the large file `large` +which the `try.sh` script uses. + Cody also added the RFC 1321 text file, [rfc1321.txt](2015/hou/rfc1321.txt) to the directory, to make it so one need not download it, and which the README.md file now links to.