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.
This commit is contained in:
1 parent
549633020f
commit
c0b8d32b59
4 files changed
+70
-6
No files matched your search
+22
-6
@@ -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:
|
## To use:
|
||||||
|
|
||||||
```sh
|
```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?
|
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
|
```sh
|
||||||
./prog < large_file
|
./prog < large_file
|
||||||
@@ -50,7 +64,7 @@ Where does that message come from?
|
|||||||
|
|
||||||
This looks like a normal C program.
|
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).
|
There are tell-tale signs like `pow(2,(?/12))` and `exp(-?*?)` (names redacted).
|
||||||
You can also find a bunch of cosines and polynomial evaluations.
|
You can also find a bunch of cosines and polynomial evaluations.
|
||||||
@@ -59,6 +73,7 @@ It looks like a ????? ???????????, right?
|
|||||||
|
|
||||||
Run and find out.
|
Run and find out.
|
||||||
|
|
||||||
|
|
||||||
### Why obfuscated
|
### Why obfuscated
|
||||||
|
|
||||||
Some poor scripting folks only have access to doubles (Jav?script, L?a, BA?IC,
|
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
|
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
|
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
|
### Limitations
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Executable
+45
@@ -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
|
||||||
@@ -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
|
[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](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
|
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
|
the directory, to make it so one need not download it, and which the README.md
|
||||||
file now links to.
|
file now links to.
|
||||||
|
|||||||
Reference in new issue
Block a user