diff --git a/2015/yang/README.md b/2015/yang/README.md index fdae97a93..f91ff51b3 100644 --- a/2015/yang/README.md +++ b/2015/yang/README.md @@ -8,35 +8,16 @@ make ## To use: ```sh -echo Some text | ./prog\ +echo Some text | ./prog ``` ### Try: ```sh -echo IOCCC 2015 | ./prog | tee output.c -make output -./output - -echo IOCCC 2015 | ./prog_c11 | tee output.c -make output -./output - -echo IOCCC 2015 | ./prog_c++98 | tee output.c -make output -./output +./try.sh ``` -### Also try: - -```sh -./prog - -``` - -Keep pressing enter to see more output. Send EOF to terminate. - ## Judges' remarks: @@ -54,7 +35,7 @@ so you need not worry about this. ## Author's remarks: `Fuuko` is a [sea star](https://en.wikipedia.org/wiki/Starfish) generator. Feed -her some input through `stdin` to get lots of sea star patterns in `stdout`. +her some input through `stdin` to get lots of sea star patterns on `stdout`. ```sh cc -O3 -std=c90 fuuko.c -lm -o fuuko_c90 @@ -70,7 +51,7 @@ echo IOCCC | ./fuuko_c99 > output_c99.c ``` Don't like [sea stars](https://en.wikipedia.org/wiki/Starfish)? Use a C++98 -compiler to get [dango](https://en.wikipedia.org/wiki/Dango) instead. +compiler to get a [dango](https://en.wikipedia.org/wiki/Dango) instead. ```sh g++ -O3 -std=c++98 fuuko.c -lm -o fuuko_cpp98 @@ -102,6 +83,7 @@ filled with pointer dereferences (C stars). Next time people ask you for a few pointers on C, you can run their question through `Fuuko` and give them pointers all day long. + ### Compatibility `Fuuko` has been tested under these environments: @@ -117,6 +99,7 @@ question through `Fuuko` and give them pointers all day long. - clang 3.4.1 on Linux - tcc 0.9.25 on JS/Linux (C99 only) + ### Features The most obscure parts are in detecting the subtle differences in diff --git a/2015/yang/try.sh b/2015/yang/try.sh new file mode 100755 index 000000000..966f95c06 --- /dev/null +++ b/2015/yang/try.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2015/yang +# + +# 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" everything >/dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear + + +echo "$ echo IOCCC 2015 | ./prog | tee output.c | less" 1>&2 +read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " +echo 1>&2 +echo IOCCC 2015 | ./prog | tee output.c | less -EXF +echo "$ make CC=\"${CC}\" output" 1>&2 +make CC="${CC}" output 2>/dev/null +read -r -n 1 -p "Press any key to run: ./output: " +echo 1>&2 +./output + +echo 1>&2 +echo "$ echo IOCCC 2015 | ./prog_c90 | tee output.c | less" 1>&2 +read -r -n 1 -p "Press any key to show sea star (space = next page, q = quit): " +echo 1>&2 +echo IOCCC 2015 | ./prog_c90 | tee output.c | less -EXF +echo "$ make CC=\"${CC}\" output" 1>&2 +make CC="${CC}" output 2>/dev/null +read -r -n 1 -p "Press any key to run: ./output: " +echo 1>&2 +./output + +echo 1>&2 +echo "$ echo IOCCC 2015 | ./prog_c99 | tee output.c | less" 1>&2 +read -r -n 1 -p "Press any key to show sea star with eyes (space = next page, q = quit): " +echo 1>&2 +echo IOCCC 2015 | ./prog_c99 | tee output.c | less -EXF +echo "Did you notice the 'rabbit' in there?" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +echo "$ make CC=\"${CC}\" output" 1>&2 +make CC="${CC}" output 2>/dev/null +read -r -n 1 -p "Press any key to run: ./output: " +echo 1>&2 +./output + +echo "$ echo IOCCC 2015 | ./prog_cpp98 | tee output.c | less" 1>&2 +read -r -n 1 -p "Press any key to show dango (space = next page, q = quit): " +echo IOCCC 2015 | ./prog_cpp98 | tee output.c | less -EXF +echo "$ make CC=\"${CC}\" output" 1>&2 +make CC="${CC}" output 2>/dev/null +read -r -n 1 -p "Press any key to run: ./output: " +echo 1>&2 +./output + +echo "$ echo IOCCC 2015 | ./prog_cpp11 | tee output.c | less" 1>&2 +read -r -n 1 -p "Press any key to show circles/Swiss cheese (space = next page, q = quit): " +echo IOCCC 2015 | ./prog_cpp11 | tee output.c | less -EXF +echo "$ make CC=\"${CC}\" output" 1>&2 +make CC="${CC}" output 2>/dev/null +read -r -n 1 -p "Press any key to run: ./output: " +echo 1>&2 +./output + +echo 1>&2 +echo "$ echo IOCCC 2015 | ./prog_c11 | tee output.c | less" 1>&2 +read -r -n 1 -p "Press any key to show no extra pattern (space = next page, q = quit): " +echo 1>&2 +echo IOCCC 2015 | ./prog_c11 | tee output.c | less -EXF +echo "$ make CC=\"${CC}\" output" 1>&2 +make CC="${CC}" output 2>/dev/null +read -r -n 1 -p "Press any key to run: ./output: " +echo 1>&2 +./output + +read -r -n 1 -p "Press enter key repeatedly to get more output (send EOF to quit): " +./prog +exit 0 diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index c21981d26..29d0b303d 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -3811,6 +3811,8 @@ files from compiling properly, trying instead to compile already compiled code. He also added explicit linking of libm (`-lm`) for systems that do not do this (Linux seems to not but macOS does). +He also added the [try.sh](2015/yang/try.sh) script. + # 2018