Add 1993/ejb/try.sh

This commit is contained in:
Cody Boone Ferguson committed 2024-01-14 10:23:37 -08:00
1 parent 5609ceaf59
commit d347b24626
3 files changed
+44

No files matched your search

+8
View File
@@ -18,6 +18,14 @@ level a value from -128 to 127
```
## Try:
```sh
./try.sh
```
## Judges' remarks:
A negative argument plays the patience puzzle. An argument
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 1993/ejb
#
# 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
read -r -n 1 -p "Press any key to play the patience puzzle: ./ejb -3: "
echo 1>&2
./ejb -3
echo 1>&2
read -r -n 1 -p "Press any key to play the Tower of Hanoi puzzle: ./ejb 3: "
echo 1>&2
./ejb 3
echo 1>&2
read -r -n 1 -p "Press any key to run: ./ejb 0: "
echo 1>&2
./ejb 0
exit 0