From 195759bf0390e48cca1bfb4cbe502698ecbd72ea Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 20 Jan 2024 10:42:28 -0800
Subject: [PATCH 1/6] Add 2004/omoikane/try.sh
---
2004/omoikane/README.md | 2 +-
2004/omoikane/try.sh | 8 ++++++++
thanks-for-help.md | 5 +++++
3 files changed, 14 insertions(+), 1 deletion(-)
create mode 100755 2004/omoikane/try.sh
diff --git a/2004/omoikane/README.md b/2004/omoikane/README.md
index 0fafaf7ae..b7e6cb90c 100644
--- a/2004/omoikane/README.md
+++ b/2004/omoikane/README.md
@@ -15,7 +15,7 @@ make
## Try:
```
-./omoikane omoikane.info omoikane.info omoikane.output
+./try.sh
```
diff --git a/2004/omoikane/try.sh b/2004/omoikane/try.sh
new file mode 100755
index 000000000..791cbebae
--- /dev/null
+++ b/2004/omoikane/try.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+
+read -r -n 1 -p "Press any key to run: ./omoikane omoikane.info omoikane.info omoikane.output: "
+echo 1>&2
+./omoikane omoikane.info omoikane.info omoikane.output
+echo 1>&2
+exit 0
diff --git a/thanks-for-help.md b/thanks-for-help.md
index ce0dd2b57..5fda2cda5 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -3068,6 +3068,11 @@ that the author referred to and was documented by [Yusuke](#yusuke) though Cody
chose the word `IOCCC` instead of `AAA`).
+## [2004/omoikane](/2004/omoikane/omoikane.c) ([README.md](/2004/omoikane/README.md]))
+
+[Cody](#cody) added the [try.sh](/2004/omoikane/try.sh) script.
+
+
## [2004/schnitzi](/2004/schnitzi/schnitzi.c) ([README.md](/2004/schnitzi/README.md]))
[Cody](#cody) made this use `fgets(3)`.
From b622a68af8efe23b930ff8f492b56b7ea3080ed9 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 20 Jan 2024 10:47:22 -0800
Subject: [PATCH 2/6] Improve 2004/schnitzi/try.sh
It also now checks that vi is installed (for the unlikely case it's not
installed).
---
2004/schnitzi/try.sh | 17 ++++++++++++-----
thanks-for-help.md | 2 ++
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/2004/schnitzi/try.sh b/2004/schnitzi/try.sh
index 00fe66539..56c6d21f9 100755
--- a/2004/schnitzi/try.sh
+++ b/2004/schnitzi/try.sh
@@ -15,12 +15,19 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
+# check for vi in the unlikely case it's not installed
+#
+if [[ -z "$(type -P vi)" ]]; then
+ echo "$0: vi not installed, cannot proceed." 1>&2
+ exit 1
+fi
-echo "$ ./schnitzi &2
+read -r -n 1 -p "Press any key to run: ./schnitzi &2
./schnitzi &2
-read -r -n 1 -p "Press any key to continue: "
-echo
-
-echo "$ ./schnitzi &2
+read -r -n 1 -p "Press any key to run: ./schnitzi &2
./schnitzi &2
diff --git a/thanks-for-help.md b/thanks-for-help.md
index 5fda2cda5..7721e8ba6 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -3081,6 +3081,8 @@ He also changed the time factor in the data files as the animations went too
fast in modern systems, especially the scrolling text of
[schnitzi.inp1](schnitzi.inp1).
+Cody also added the [try.sh](/2004/schnitzi/try.sh) script.
+
## [2004/sds](/2004/sds/sds.c) ([README.md](/2004/sds/README.md))
From 8ce3247921623a072b7512aaf30aeb8e7314dea3 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 20 Jan 2024 10:57:58 -0800
Subject: [PATCH 3/6] Improve 2004/sds/try.sh
---
2004/sds/try.sh | 55 +++++++++++++++++++++++++++++++++----------------
1 file changed, 37 insertions(+), 18 deletions(-)
diff --git a/2004/sds/try.sh b/2004/sds/try.sh
index 86c50994c..80fde7233 100755
--- a/2004/sds/try.sh
+++ b/2004/sds/try.sh
@@ -15,41 +15,60 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
-echo "$ ./sds < sds.c > encoder.c" 1>&2
-./sds < sds.c > encoder.c
+read -r -n 1 -p "Press any key to show sds.c (space = next page, q = quit): "
+echo 1>&2
+less -rEXF sds.c
echo 1>&2
-echo "$ make encoder 2>/dev/null" 1>&2
+read -r -n 1 -p "Press any key to run: ./sds < sds.c | tee encoder.c (space = next page, q = quit): "
+echo 1>&2
+./sds < sds.c | tee encoder.c | less -rEXF
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: make encoder 2>/dev/null: "
+echo 1>&2
make encoder 2>/dev/null
echo 1>&2
-echo "$ ./encoder README.md sds_msg.c"
-./encoder README.md sds_msg.c
+echo "$ ./encoder README.md &2
+read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
+echo 1>&2
+./encoder README.md /dev/null" 1>&2
+read -r -n 1 -p "Press any key to run: make sds_msg 2>/dev/null: "
+echo 1>&2
make sds_msg 2>/dev/null
echo 1>&2
-echo "$ ./sds_msg < sds.c > sds2_msg.c" 1>&2
-./sds_msg < sds.c > sds2_msg.c
+echo "$ ./sds_msg < sds.c | tee sds2_msg.c | less -rEXF" 1>&2
+read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
+echo 1>&2
+./sds_msg < sds.c | tee sds2_msg.c | less -rEXF
-echo "$ diff sds2_msg.c encoder.c" 1>&2
-diff sds2_msg.c encoder.c
+read -r -n 1 -p "Press any key to run: diff -s sds2_msg.c encoder.c: "
+echo 1>&2
+diff -s sds2_msg.c encoder.c
+echo 1>&2
-echo "$ echo 'Hello, World!' > message" 1>&2
+read -r -n 1 -p "Press any key to run: echo 'Hello, World!' > message: "
+echo 1>&2
echo 'Hello, World!' > message
+echo 1>&2
-echo "$ ./encoder message < README.md > remarks.md" 1>&2
-./encoder message < README.md > remarks.md
+echo "$ ./encoder message < README.md | tee remarks.md" 1>&2
+read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
+echo 1>&2
+./encoder message < README.md | tee remarks.md | less -rEXF
+echo 1>&2
-read -r -n 1 -p "Press any key to show diff remarks.md README.md: "
-echo "$ diff remarks.md README.md" 1>&2
+read -r -n 1 -p "Press any key to run: diff remarks.md README.md: "
+echo 1>&2
diff remarks.md README.md # notice how similar they are
echo "Did you notice how similar they are?" 1>&2
echo 1>&2
-read -r -n 1 -p "Press any key to continue: "
-echo 1>&2
# and then observe:
-echo "$ ./sds < remarks.md" 1>&2
+read -r -n 1 -p "Press any key to run: ./sds < remarks.md: "
+echo 1>&2
./sds < remarks.md
+echo 1>&2
From 8070711ef9942bc654b415c1ad8df0906bf758bb Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 20 Jan 2024 10:59:42 -0800
Subject: [PATCH 4/6] Minor update to 2004/vik1/README.md
---
2004/vik1/README.md | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/2004/vik1/README.md b/2004/vik1/README.md
index e68902150..902cd686e 100644
--- a/2004/vik1/README.md
+++ b/2004/vik1/README.md
@@ -16,13 +16,20 @@ make
```sh
./vik1
+
./vik1 a
+
./vik1 d2
+
./vik1 ad3
```
+
Can you figure out how to cheat?
+Also see the author's remarks below for more details on the different
+modes/options.
+
## Judges' remarks:
From 379e585e0f4c2885f983e27dbceb68e87230bc14 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 20 Jan 2024 11:13:52 -0800
Subject: [PATCH 5/6] Add 2004/anonymous/try.sh
---
2004/anonymous/README.md | 12 ++++-----
2004/anonymous/try.sh | 55 ++++++++++++++++++++++++++++++++++++++++
thanks-for-help.md | 5 ++++
3 files changed, 65 insertions(+), 7 deletions(-)
create mode 100755 2004/anonymous/try.sh
diff --git a/2004/anonymous/README.md b/2004/anonymous/README.md
index fd59aa54d..e357864f1 100644
--- a/2004/anonymous/README.md
+++ b/2004/anonymous/README.md
@@ -22,14 +22,11 @@ images.
## Try:
```sh
-./anonymous "ash nazg durhbatuluhk, ash nazg gimbatul, \
- ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm
-
-./anonymous "My Precious. Yes, my Precious." > precious.pgm
+./try.sh
```
-NOTE: technically the text is supposed to be in all lower case but the above
-still works for demonstration purposes.
+NOTE: technically the text is supposed to be in all lower case but the script
+does use some upper case letters for demonstration purposes.
## Judges' remarks:
@@ -55,13 +52,14 @@ Hobbit](https://tolkiengateway.net/wiki/The_History_of_The_Hobbit).
p.s. Frodo lives!
+
### An important aside :-)
BTW: if you haven't read [The Lord of the
Rings](https://en.wikipedia.org/wiki/The_Lord_of_the_Rings) what are you waiting for? :-)
You'll find out the source of the text above though you'll see that there are
some circumflexes missing! That's okay though due to I/O of the entry and in
-earlier drafts sometimes the û with an umlaut had no umlaut but H after the `u`
+earlier drafts sometimes the û had no diacritic but H after the `u` in
it. The real text is:
> Ash nazg durbatulûk, ash nazg gimbatul, ash nazg thrakatulûk, agh
diff --git a/2004/anonymous/try.sh b/2004/anonymous/try.sh
new file mode 100755
index 000000000..2c3b8809e
--- /dev/null
+++ b/2004/anonymous/try.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+#
+# try.sh - demonstrate IOCCC winner 2001/anonymous
+#
+
+# 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
+
+# see if we have convert(1)
+#
+CONVERT="$(type -P convert)"
+
+echo "$ ./anonymous "ash nazg durhbatuluhk, ash nazg gimbatul, \
+ ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm" 1>&2
+
+read -r -n 1 -p "Press any key to continue: "
+echo 1>&2
+./anonymous "ash nazg durhbatuluhk, ash nazg gimbatul, \
+ ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm
+
+if [[ -n "$CONVERT" ]]; then
+ "$CONVERT" ring.pgm ring.jpg
+ echo "Now open ring.jpg in a graphics viewer, editor or web browser." 1>&2
+ echo "If you don't recognise it you should read The Lord of the Rings" 1>&2
+ echo "immediately. Don't worry! It's not that long. It's only 1031 pages," 1>&2
+ echo "my Precious, yes. :-)" 1>&2
+else
+ echo "Now open ring.pgm in a graphics viewer capable of reading Netpbm graphics." 1>&2
+ echo "Alternatively, install ImageMagick and try running this script again." 1>&2
+ echo "Once you've done so, if you don't recognise this image, you should read The" 1>&2
+ echo "Lord of the Rings immediately. Don't worry! It's not that long. It's only 1031" 1>&2
+ echo "pages, my Precious, yes. :-)" 1>&2
+fi
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./anonymous \"My Precious. Yes, my Precious.\" > precious.pgm: "
+echo 1>&2
+./anonymous "My Precious. Yes, my Precious." > precious.pgm
+
+if [[ -n "$CONVERT" ]]; then
+ "$CONVERT" precious.pgm precious.jpg
+ echo "Now open precious.jpg in a graphics viewer, editor or web browser." 1>&2
+else
+ echo "Now open precious.pgm in a graphics viewer capable of reading Netpbm graphics." 1>&2
+ echo "Alternatively, install ImageMagick and try running this script again." 1>&2
+fi
diff --git a/thanks-for-help.md b/thanks-for-help.md
index 7721e8ba6..bbcfeba61 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -2923,6 +2923,11 @@ described in the README.md, based on the author's remarks.
# 2004
+## [2004/anonymous](/2004/anonymous/anonymous.c) ([README.md](/2004/anonymous/README.md]))
+
+[Cody](#cody) added the [try.sh](/2004/anonymous/try.sh) script.
+
+
## [2004/arachnid](/2004/arachnid/arachnid.c) ([README.md](/2004/arachnid/README.md]))
[Cody](#cody) added an [alternate version](/2004/arachnid/README.md#alternate-code) which
From 7ce57bc879e8747c804c6fbf3ff9c9ed31c863fb Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 20 Jan 2024 11:14:45 -0800
Subject: [PATCH 6/6] Update 2004/anonymous/.gitignore for try.sh
---
2004/anonymous/.gitignore | 2 ++
1 file changed, 2 insertions(+)
diff --git a/2004/anonymous/.gitignore b/2004/anonymous/.gitignore
index 8ded6c07c..a09dd3996 100644
--- a/2004/anonymous/.gitignore
+++ b/2004/anonymous/.gitignore
@@ -8,5 +8,7 @@ indent
indent.c
indent.o
precious.pgm
+precious.jpg
prog.orig
ring.pgm
+ring.jpg