diff --git a/1994/tvr/README.md b/1994/tvr/README.md index 3311142ee..a32550216 100644 --- a/1994/tvr/README.md +++ b/1994/tvr/README.md @@ -26,16 +26,16 @@ For more detailed information see [1994 tvr in bugs.md](/bugs.md#1994-tvr). ./tvr mode screensize/2 < colormapfile ``` +Mode may be a value from 0 to 12. + ## Try: ```sh -./tvr 0 128 < tvr.color (for color displays) -./tvr 0 128 < tvr.bw (for Black & White displays) +./try.color.sh # for colour displays +./try.bw.sh # for Black & White displays ``` -Mode may be a value from 0 to 12. - ## Alternate code: @@ -59,6 +59,14 @@ where `altmode` `1` - `4` correspond to mode `0` - `3` in the original entry and `altmode 0` calculates Mandelbrot/Julian sets correctly. +## Alternate try: + +```sh +./try.alt.color.sh # for colour displays +./try.alt.bw.sh # for Black & White displays +``` + + ## Judges' remarks: This entry requires the use of X11. It will form two windows (hopefully your diff --git a/1994/tvr/try.alt.bw.sh b/1994/tvr/try.alt.bw.sh new file mode 100755 index 000000000..5d029b01f --- /dev/null +++ b/1994/tvr/try.alt.bw.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# +# try.alt.bw.sh - demonstrate IOCCC winner 1994/tvr alt code B&W mode +# + +# 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" alt >/dev/null || exit 1 + +for mode in $(seq 0 4); do + for size in 128 256; do + read -r -n 1 -p "Press any key to run: ./tvr.alt $mode $size < tvr.bw (q = quit, s = skip): " + echo 1>&2 + if [[ "$REPLY" == "q" || "$REPLY" == "Q" ]]; then + exit 0 + elif [[ "$REPLY" == "s" || "$REPLY" == "S" ]]; then + continue + fi + echo 1>&2 + ./tvr.alt "$mode" "$size" < tvr.bw + echo 1>&2 + done +done diff --git a/1994/tvr/try.alt.color.sh b/1994/tvr/try.alt.color.sh new file mode 100755 index 000000000..f06edc636 --- /dev/null +++ b/1994/tvr/try.alt.color.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# +# try.color.sh - demonstrate IOCCC winner 1994/tvr alt code colour mode +# + +# 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" alt >/dev/null || exit 1 + +for mode in $(seq 0 4); do + for size in 128 256; do + read -r -n 1 -p "Press any key to run: ./tvr.alt $mode $size < tvr.color (q = quit, s = skip): " + echo 1>&2 + if [[ "$REPLY" == "q" || "$REPLY" == "Q" ]]; then + exit 0 + elif [[ "$REPLY" == "s" || "$REPLY" == "S" ]]; then + continue + fi + echo 1>&2 + ./tvr.alt "$mode" "$size" < tvr.color + echo 1>&2 + done +done diff --git a/1994/tvr/try.bw.sh b/1994/tvr/try.bw.sh new file mode 100755 index 000000000..f87be3f95 --- /dev/null +++ b/1994/tvr/try.bw.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# +# try.bw.sh - demonstrate IOCCC winner 1994/tvr B&W mode +# + +# 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 + +for mode in $(seq 0 12); do + for size in 128 256; do + read -r -n 1 -p "Press any key to run: ./tvr $mode $size < tvr.bw (q = quit, s = skip): " + echo 1>&2 + if [[ "$REPLY" == "q" || "$REPLY" == "Q" ]]; then + exit 0 + elif [[ "$REPLY" == "s" || "$REPLY" == "S" ]]; then + continue + fi + echo 1>&2 + ./tvr "$mode" "$size" < tvr.bw + echo 1>&2 + done +done diff --git a/1994/tvr/try.color.sh b/1994/tvr/try.color.sh new file mode 100755 index 000000000..96d73afd2 --- /dev/null +++ b/1994/tvr/try.color.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# +# try.color.sh - demonstrate IOCCC winner 1994/tvr colour mode +# + +# 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 + +for mode in $(seq 0 12); do + for size in 128 256; do + read -r -n 1 -p "Press any key to run: ./tvr $mode $size < tvr.color (q = quit, s = skip): " + echo 1>&2 + if [[ "$REPLY" == "q" || "$REPLY" == "Q" ]]; then + exit 0 + elif [[ "$REPLY" == "s" || "$REPLY" == "S" ]]; then + continue + fi + echo 1>&2 + ./tvr "$mode" "$size" < tvr.color + echo 1>&2 + done +done diff --git a/thanks-for-help.md b/thanks-for-help.md index 7db16371d..8889a8e75 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -1960,7 +1960,15 @@ check the [bugs.md](bugs.md) file. ## [1994/tvr](/1994/tvr/tvr.c) ([README.md](/1994/tvr/README.md])) -[Cody](#cody) made this use `fgets(3)` instead of `gets(3)`. In this case the newline had +[Cody](#cody) added the try scripts, four total, colour and black and white +pairs for the original entry and the alt code. These scripts are +[try.color.sh](/1994/tvr/try.color.sh), [try.bw.sh](/1994/tvr/try.bw.sh), +[try.alt.color.sh](/1994/tvr/try.alt.color.sh) and +[try.alt.bw.sh](/1994/tvr/try.alt.bw.sh), respectively. The scripts go through +each mode allowed with two sizes, 128 and 256, allowing one to quit or skip each +(given that there are a lot of invocations this seemed like a good idea). + +Cody also made this use `fgets(3)` instead of `gets(3)`. In this case the newline had to be terminated but it was a pretty straightforward fix. `gets()` was defined to use `fgets()` and the inclusion of `stdio.h` had to be added but to make it more like the original entry this was done in the Makefile. The alt code was