Merge pull request #1911 from xexyl/tvr94-try

Add 1994/tvr try scripts
This commit is contained in:
Landon Curt Noll authored and GitHub committed 2024-01-16 13:27:53 -08:00
commit e73819d2f1
6 files changed
+133 -5

No files matched your search

+12 -4
View File
@@ -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
+28
View File
@@ -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
+28
View File
@@ -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
+28
View File
@@ -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
+28
View File
@@ -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
+9 -1
View File
@@ -1960,7 +1960,15 @@ check the [bugs.md](bugs.md) file.
## <a name="1994_tvr"></a>[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