From e500f94445aa59ac2bbad34cd84361eee1adbc39 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Mon, 22 Jan 2024 08:42:12 -0800
Subject: [PATCH] Add 2006/grothe/try.sh
After each command it prompts if you wish to resume as some people
(including myself) might find that only one file is enough.
---
2006/grothe/README.md | 14 ++++---------
2006/grothe/try.sh | 48 +++++++++++++++++++++++++++++++++++++++++++
thanks-for-help.md | 5 +++++
3 files changed, 57 insertions(+), 10 deletions(-)
create mode 100755 2006/grothe/try.sh
diff --git a/2006/grothe/README.md b/2006/grothe/README.md
index c024cc791..4be3b011a 100644
--- a/2006/grothe/README.md
+++ b/2006/grothe/README.md
@@ -14,21 +14,15 @@ make
## Try:
+Put on your "electronic ears" and then try:
+
```sh
-./grothe 65000000 10000000 1344 < twinkle.txt
+./try.sh
```
-... and then put on your "electronic ears". You may find using
+You may find using
a tunable scanning electronic ear helps.
-There are other text files you may wish to try:
-
-```sh
-./grothe 65000000 10000000 1344 < arabian.txt
-./grothe 65000000 10000000 1344 < olympics.txt
-./grothe 65000000 10000000 1344 < test.txt
-```
-
## Judges' remarks:
diff --git a/2006/grothe/try.sh b/2006/grothe/try.sh
new file mode 100755
index 000000000..bd4f17926
--- /dev/null
+++ b/2006/grothe/try.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+#
+# try.sh - demonstrate IOCCC winner 2006/grothe
+#
+
+# 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
+
+resume()
+{
+ echo 1>&2
+ read -r -n 1 -p "Do you wish to continue (Y/N)? "
+ if [[ "$REPLY" != "y" && "$REPLY" != "Y" ]]; then
+ exit 0
+ fi
+}
+
+read -r -n 1 -p "Press any key to run: ./grothe 65000000 10000000 1344 < twinkle.txt: "
+echo 1>&2
+./grothe 65000000 10000000 1344 < twinkle.txt
+resume
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./grothe 65000000 10000000 1344 < arabian.txt: "
+echo 1>&2
+./grothe 65000000 10000000 1344 < arabian.txt
+resume
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./grothe 65000000 10000000 1344 < olympics.txt: "
+echo 1>&2
+./grothe 65000000 10000000 1344 < olympics.txt
+resume
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./grothe 65000000 10000000 1344 < test.txt: "
+echo 1>&2
+./grothe 65000000 10000000 1344 < test.txt
+echo 1>&2
diff --git a/thanks-for-help.md b/thanks-for-help.md
index ce80553d1..5cee86d38 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -3418,6 +3418,11 @@ Cody also added the [try.sh](/2006/birken/try.sh) script.
implicitly linked in.
+## [2006/grothe](/2006/grothe/grothe.c) ([README.md](/2006/grothe/README.md))
+
+[Cody](#cody) added the [try.sh](/2006/grothe/try.sh) script.
+
+
## [2006/hamre](/2006/hamre/hamre.c) ([README.md](/2006/hamre/README.md))
[Cody](#cody) fixed this so that it will not crash without an arg after it was suggested