From 021d5f5c4eff1cf5fcb9b83a398b732070b890ae Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 04:36:30 -0800 Subject: [PATCH 01/37] Improve FAQ 3.7 - how to compile/run X11 entries Some typo fixes and various other changes and improvements. --- faq.md | 97 ++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 40 deletions(-) diff --git a/faq.md b/faq.md index f5b02040f..c459b86bc 100644 --- a/faq.md +++ b/faq.md @@ -886,17 +886,19 @@ will too but it won't reset the terminal). ### FAQ 3.7: How do I run an IOCCC winner that requires X11? -#### Generically, to compile and run an IOCCC winner that requires X11: +#### Generally, to compile and run an IOCCC winner that requires X11: -In order to have the X11 related include files and X11 libraries in order to compile the IOCCC winner, -you will need to install Xorg and related packages including development related packages. In particular: +You must have the X11 related include files and X11 libraries in order to +compile the IOCCC winner. In order to do this you will need to install Xorg and +related packages including development related packages. If you have macOS see +further down for different instructions. Otherwise: in particular you must: -* Install the Xorg server -* Configure the Xorg server for your graphics environment -* Install a X11 terminal application -* Start the Xorg server -* Launch the X11 terminal application -* Run the IOCCC winner in the X11 terminal application +* Install the Xorg server. +* Configure the Xorg server for your graphics environment. +* Install a X11 terminal application. +* Start the Xorg server. +* Launch the X11 terminal application. +* Run the IOCCC winner in the X11 terminal application. By X11 terminal application we suggest one of: @@ -904,43 +906,50 @@ By X11 terminal application we suggest one of: * [KDE](https://kde.org) terminal application * `xterm(`) terminal application -See the below for various system related hints that may be of help. +See below for various system related hints that may be of help. #### X.org server has been deprecated -The Red Hat RHEL9.0 release notes state that [X.org Server is now deprecated](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/9.0_release_notes/deprecated_functionality#deprecated-functionality_graphics-infrastructures). +The Red Hat RHEL9.0 release notes state that [X.org Server is now +deprecated](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/9.0_release_notes/deprecated_functionality#deprecated-functionality_graphics-infrastructures). -According to this [Linux for Devices tutorial on XOrg](https://www.linuxfordevices.com/tutorials/linux/install-xorg-on-linux) -as of 2023 Mar 25:: +According to this [Linux for Devices tutorial on +XOrg](https://www.linuxfordevices.com/tutorials/linux/install-xorg-on-linux) as +of 2023 Mar 25: -``` -Recently, RHEL developers categorized Xorg was put in the ‘deprecated’ -software, as its development has mostly halted. Subsequent updates -will completely replace it with Wayland, a more modern windowing -system.. Although Wayland is not fully developed yet, many applications -do not support it properly yet and screen sharing might not work -sometime, but it is the future. Fedora, also developed by RHEL, has -switched to a Wayland session as it’s default windowing system (And -it works flawlessly on my Laptop). -``` + +> Recently, RHEL developers categorized [Xorg was put in the ‘deprecated’ +software](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/9.0_release_notes/deprecated_functionality), +as its development has mostly halted. Subsequent updates will completely replace +it with Wayland, a more modern windowing system.. Although Wayland is not fully +developed yet, many applications do not support it properly yet and screen +sharing might not work sometime, but it is the future. Fedora, also developed by +RHEL, has switched to a Wayland session as it’s default windowing system (And it +works flawlessly on my Laptop). See the [Wayland](https://wayland.freedesktop.org) web site for more details. -**IMPORTANT NOTE**: We do **NOT** know if IOCCC winners will run under **Wayland**. -Some IOCCC winners that use X11 might be OK while other IOCCC winners that use X11 in an unusual way might fail -under **Wayland**. +**IMPORTANT NOTE**: We do **NOT** know if IOCCC winners will run under +**Wayland**. Some IOCCC winners that use X11 might be OK while other IOCCC +winners that use X11 in an unusual way might fail under **Wayland**. -See the [Wayland FAQ](https://wayland.freedesktop.org/faq.html) for more information. -If your system uses **Wayland** and not X11, you might give the IOCCC winners that use X11 a try. -They might work. +See the [Wayland FAQ](https://wayland.freedesktop.org/faq.html) for more +information. -**IMPORTANT NOTE**: The [IOCCC judges [do not support support IOCCC winners](#no_support). +If your system uses **Wayland** and not X11, you might give the IOCCC winners +that use X11 a try. They might work but again we do not know. + +**IMPORTANT NOTE**: The [IOCCC judges](/judges.html) [do not support IOCCC winners](#no_support). So if an IOCCC winner that uses X11 fails under **Wayland**, and you wish to provide a fix to the IOCCC winner so that it will run under **Wayland**, then consider [submitting a fix](#fix_a_winner) so that it will run under **Wayland**. +Basically: if you discover an entry does not work in Wayland you are welcome to +provide **alternate code** that works for Wayland. We will happily credit you in +the [thanks-for-help.md](/thanks-for-help.md) file. + #### Red Hat based Linux @@ -956,7 +965,8 @@ See also: * [How to Configure X11 in Linux](https://www.wikihow.com/Configure-X11-in-Linux) -**IMPORTANT NOTE**: The [X.org server has been deprecated](#Xorg_deprecated). See the above note for details. +**IMPORTANT NOTE**: The [X.org server has been deprecated](#Xorg_deprecated). +See the above note for details. #### macOS @@ -973,7 +983,7 @@ with macOS 14.2.1 (macOS Sonoma). First of all you will need to install the [most recent XQuartz](https://www.xquartz.org), preferably on an [Apple supported version of macOS, preferably the most recent version](https://support.apple.com/macos). -Then open the "XQuartz" application (usually located in +After it is installed, open the "XQuartz" application (usually located in `/Applications/Utilities/XQuartz.app`) by typing at the command line: ```sh @@ -996,30 +1006,35 @@ And then run the program as directed by the `README.md` file. For example with running 1993/jonth in macOS Note that you can compile the code in your regular terminal prior to opening -XQuartz, should you wish to. +XQuartz, should you wish to. You can even run it from that terminal and it +should open XQuartz. -**IMPORTANT NOTE**: The [X.org server has been deprecated](#Xorg_deprecated). See the above note for details. +**IMPORTANT NOTE**: The [X.org server has been deprecated](#Xorg_deprecated). +See the above note for details. #### Debian based Linux First, see the above note on [installing and starting Xorg](#X11_general). -According to the [Debian Xorg wiki](https://wiki.debian.org/Xorg), installing X11 requires: +According to the [Debian Xorg wiki](https://wiki.debian.org/Xorg), installing +X11 requires: ```sh sudo apt install xorg ``` -**IMPORTANT NOTE**: The [X.org server has been deprecated](#Xorg_deprecated). See the above note for details. +**IMPORTANT NOTE**: The [X.org server has been deprecated](#Xorg_deprecated). +See the above note for details. #### Other Linux distributions First, see the above note on [installing and starting Xorg](#X11_general). -For general documentation on installing X11, this [ServerGUI for Ubuntu](https://help.ubuntu.com/community/ServerGUI), -and in particular, this may be helpful: +For general documentation on installing X11, this [ServerGUI for +Ubuntu](https://help.ubuntu.com/community/ServerGUI), and in particular, these +may be helpful: * [X11 Client Installation](https://help.ubuntu.com/community/ServerGUI#X11_Client_Installation) * [X11 Server Installation](https://help.ubuntu.com/community/ServerGUI#X11_Server_Installation) @@ -1041,7 +1056,8 @@ For systems that have the `yum(1)` command: sudo yum install --skip-broken --best --exclude xorgxrdp --exclude xorgxrdp-glamor '*xorg*' 'libx*' 'libX*' 'fontconfig*' ``` -**IMPORTANT NOTE**: The [X.org server has been deprecated](#Xorg_deprecated). See the above note for details. +**IMPORTANT NOTE**: The [X.org server has been deprecated](#Xorg_deprecated). +See the above note for details. #### package website @@ -1050,7 +1066,8 @@ First, see the above note on [installing and starting Xorg](#X11_general). See the [X.org](https://x.org/wiki/) foundation web site. -**IMPORTANT NOTE**: The [X.org server has been deprecated](#Xorg_deprecated). See the above note for details. +**IMPORTANT NOTE**: The [X.org server has been deprecated](#Xorg_deprecated). +See the above note for details. ### FAQ 3.8: How do I compile an IOCCC winner that requires SDL1 or SDL2? From 140aadc5ad136bf5dfb60232905f49e43c7b2021 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 04:54:46 -0800 Subject: [PATCH 02/37] Reword thanks for 1996/august --- thanks-for-help.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/thanks-for-help.md b/thanks-for-help.md index 0e3c4dea3..c0877cf0b 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2096,15 +2096,17 @@ Cody also added the [try.sh](/1995/vanschnitz/try.sh) script. ## [1996/august](/1996/august/august.c) ([README.md](/1996/august/README.md])) [Cody](#cody) fixed a segfault in this program that prevented it from working right and -also fixed an infinite loop in the try commands. The problem with the infinite -loop is that the file `august.oc` had to have lines starting with `#` removed -and it was not being done. After this is done with say `sed(/1)` (like `sed -i'' -'/^#/d' august.oc` which has been added to both the remarks and the `try.sh` -script noted below) the code can proceed. This problem existed in macOS. +also fixed an infinite loop in the try commands. + +The problem with the infinite loop is that the file `august.oc` had to have +lines starting with `#` removed and it was not being done. After this is done +with say `sed(/1)` (like `sed -i'' '/^#/d' august.oc` which has been added to +both the remarks and the `try.sh` script noted below) the code can proceed. This +problem existed in macOS. Cody also added the [try.sh](/1996/august/try.sh) script that runs all the -commands given in the try section to simplify it as there are quite a lot of -commands. +commands that were given by the judges in the try section, with the fix above +applied. ## [1996/dalbec](/1996/dalbec/dalbec.c) ([README.md](/1996/dalbec/README.md])) From 8da99acce0d987d4e66ea57b91987285b613f8d6 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 04:58:47 -0800 Subject: [PATCH 03/37] Make my fix to 1995/makarios more like original The parameters to the functions spell out (backwards) the function name. As for main() since there can only be three args it has in comments a fourth to spell out main (backwards). Also use old style ( main(n,i,a)char**i,**a;{/*..*/} ) as that's how the original code is (and the added function is that way too though only ints like main() used to be). Added -Wno-implicit-int -Wno-return-type to CSILENCE in Makefile. There's still one more warning but I'm not sure if it's supported by all compilers so I haven't disabled it (yet?). --- 1995/makarios/Makefile | 2 +- 1995/makarios/makarios.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/1995/makarios/Makefile b/1995/makarios/Makefile index d128cda77..e41fb65e8 100644 --- a/1995/makarios/Makefile +++ b/1995/makarios/Makefile @@ -39,7 +39,7 @@ include ../../var.mk # Common C compiler warnings to silence # CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-parentheses \ - -Wno-int-conversion + -Wno-int-conversion -Wno-implicit-int -Wno-return-type # Common C compiler warning flags # diff --git a/1995/makarios/makarios.c b/1995/makarios/makarios.c index aad494825..6a3de2445 100644 --- a/1995/makarios/makarios.c +++ b/1995/makarios/makarios.c @@ -1,3 +1,3 @@ -pain(int n, char **ia, char **aa, char **ma){int i=ia, a=aa, m=ma; while(i=++n) -for(a=0;a Date: Fri, 19 Jan 2024 05:12:26 -0800 Subject: [PATCH 04/37] Add 1996/rcm/try.sh The 'to use' section was fixed also: it's not just specific gzipped files but any so it now says 'file.gz' and adds that file.gz is any gzipped file. The try.sh script now has the command that used to be in to use and also what was in the try section. It also copies rcm.c to rcm.cp.c and gzips that file and then runs the program on that to show the source. All paged through less(1), of course. Finally it does what the judges have in their comments (which have been updated to say that the command is in the try.sh script). The judges' command is naturally a shorter way to do the one added in the try.sh script but it uses tee(1) to write both to another file (piped to less(1)) so that it can compare the two. Obviously the files will be the same but it shows how it works in multiple ways. --- 1996/rcm/.gitignore | 3 +++ 1996/rcm/README.md | 9 +++++++-- 1996/rcm/try.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++ thanks-for-help.md | 5 +++++ 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100755 1996/rcm/try.sh diff --git a/1996/rcm/.gitignore b/1996/rcm/.gitignore index 2d74aa8cf..a7113ed57 100644 --- a/1996/rcm/.gitignore +++ b/1996/rcm/.gitignore @@ -6,4 +6,7 @@ indent.c indent.o prog.orig rcm +rcm.cp2.c +rcm.cp.c +rcm.cp.c.gz rcm.orig diff --git a/1996/rcm/README.md b/1996/rcm/README.md index f2032e480..a23a63a6d 100644 --- a/1996/rcm/README.md +++ b/1996/rcm/README.md @@ -8,16 +8,18 @@ make all ## To use: ```sh -./rcm < rfc1951.gz +./rcm < file.gz ``` +where `file.gz` is some gzipped file. + ## Try: For more information try: ```sh -./rcm < rfc1952.gz +./try.sh ``` @@ -29,6 +31,9 @@ For a good no-op try: gzip -c < rcm.c | ./rcm ``` +NOTE: this is done in the [try.sh](try.sh) script as well, along with some other +commands including a way to do the above command but with more steps. + ## Author's remarks: diff --git a/1996/rcm/try.sh b/1996/rcm/try.sh new file mode 100755 index 000000000..8ca9bb960 --- /dev/null +++ b/1996/rcm/try.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# +# try.sh - show IOCCC winner 1996/rcm +# + +# 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 run: ./rcm < rfc1951.gz (space = next page, q = quit): " +echo 1>&2 +./rcm < rfc1951.gz | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./rcm < rfc1952.gz (space = next page, q = quit): " +echo 1>&2 +./rcm < rfc1952.gz | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: cp -vf rcm.c rcm.cp.c; gzip rcm.cp.c: " +echo 1>&2 +cp -vf rcm.c rcm.cp.c; gzip rcm.cp.c + +read -r -n 1 -p "Press any key to run: ./rcm < rcm.cp.c.gz | tee rcm.cp.c (space = next page, q = quit): " +echo 1>&2 +./rcm < rcm.cp.c.gz | tee rcm.cp.c | less -rEXF +echo 1>&2 +rm rcm.cp.c.gz + +read -r -n 1 -p "Press any key to run: gzip -c < rcm.c | ./rcm | tee rcm.cp2.c (space = next page, q = quit): " +echo 1>&2 +gzip -c < rcm.c | ./rcm | tee rcm.cp2.c | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to show diff between rcm.cp.c and rcm.cp2.c: " +echo 1>&2 +diff -s rcm.cp.c rcm.cp2.c +echo 1>&2 +rm -f rcm.cp.c rcm.cp2.c + diff --git a/thanks-for-help.md b/thanks-for-help.md index c0877cf0b..fd125bb5a 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2166,6 +2166,11 @@ the function in the pointer assignment. NOTE: if there is no X server running this program will still crash. +## [1996/rcm](/1996/rcm/rcm.c) ([README.md](/1996/rcm/README.md])) + +[Cody](#cody) added the [try.sh](/1996/rcm/try.sh) script. + + ## [1996/schweikh1](/1996/schweikh1/schweikh1.c) ([README.md](/1996/schweikh1/README.md])) The author stated that `-I/usr/include` is needed by gcc in Solaris because From 1de404c42b6cd21557d40840a25bb838be0990b7 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 05:30:13 -0800 Subject: [PATCH 05/37] Improve 1996/schweikh2/try.sh --- 1996/schweikh2/try.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/1996/schweikh2/try.sh b/1996/schweikh2/try.sh index de86a4934..6089ccd61 100755 --- a/1996/schweikh2/try.sh +++ b/1996/schweikh2/try.sh @@ -15,16 +15,17 @@ 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 to run ./schweikh2: " 1>&2 -./schweikh2 +read -r -n 1 -p "Press any key to to run ./schweikh2 (space = next page, q = quit): " 1>&2 +echo >&2 +./schweikh2 | less -rEXF echo >&2 read -r -n 1 -p "Press any key to run: ./schweikh2 15 1 0 0/0 | head -n 15: " 1>&2 +echo >&2 ./schweikh2 15 1 0 0/0 | head -n 15 echo >&2 -read -r -n 1 -p "Press any key one more time: " 1>&2 -i=0 -while ((i++<15)); do - grep -v '#' schweikh2.c -done +read -r -n 1 -p "Press any key to run grep -v '#' schweikh2.c (space = next page, q = quit): " +echo 1>&2 +grep -v '#' schweikh2.c | less -rEXF +echo 1>&2 From e88b19a307ae5267200f194783e6fbcca9515991 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 05:38:26 -0800 Subject: [PATCH 06/37] Add 1996/schweikh1/try.sh --- 1996/schweikh1/README.md | 5 +++-- 1996/schweikh1/try.sh | 27 +++++++++++++++++++++++++++ thanks-for-help.md | 5 +++-- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100755 1996/schweikh1/try.sh diff --git a/1996/schweikh1/README.md b/1996/schweikh1/README.md index dc50fcfa3..9c9488986 100644 --- a/1996/schweikh1/README.md +++ b/1996/schweikh1/README.md @@ -14,10 +14,11 @@ make all ## Try: -To find the day that Easter falls on in the current year: +To find the day that Easter falls on in the current year and to show all Easter +dates from 1582 to 2199: ```sh -./schweikh1 |grep $(date +%Y) +./try.sh ``` diff --git a/1996/schweikh1/try.sh b/1996/schweikh1/try.sh new file mode 100755 index 000000000..591250564 --- /dev/null +++ b/1996/schweikh1/try.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# +# try.sh - show IOCCC winner 1996/schweikh1 +# + +# 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 show date of Easter this year (./schweikh1 |grep \$(date +%Y)): " +echo 1>&2 +./schweikh1 |grep "$(date +%Y)" +echo 1>&2 + +read -r -n 1 -p "Press any key to show Easter dates from 1582 to 2199 (space = next page, q = quit): " +echo 1>&2 +./schweikh1 | less -rEXF +echo 1>&2 diff --git a/thanks-for-help.md b/thanks-for-help.md index fd125bb5a..522020397 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2173,16 +2173,17 @@ NOTE: if there is no X server running this program will still crash. ## [1996/schweikh1](/1996/schweikh1/schweikh1.c) ([README.md](/1996/schweikh1/README.md])) +[Cody](#cody) added the [try.sh](/1996/schweikh1/try.sh) script. + The author stated that `-I/usr/include` is needed by gcc in Solaris because `errno.h` has two identical extern declarations of `errno`. That leads to an error due to the redefinition of `main` but the `-I` option makes sure the working `/usr/include/rrno.h` is found first, which shouldn't cause any problems on other systems (the other file is -`gcc-lib/sparc-sun-solaris2.5/2.7.2/include/errno.h`). Thus Cody added this to +`gcc-lib/sparc-sun-solaris2.5/2.7.2/include/errno.h`). Thus Cody also added this to the Makefile despite the fact that very few probably use Solaris nowadays. - ## [1996/schweikh2](/1996/schweikh2/schweikh2.c) ([README.md](/1996/schweikh2/README.md])) [Cody](#cody) added the [try.sh](/1996/schweikh2/try.sh) script with a few commands to try From 9f988afacec4178a7b38cc78df525b369308d512 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 05:42:31 -0800 Subject: [PATCH 07/37] Fix comment about 1996/schweikh2/try.sh The script was changed to run a certain command only once but the README.md file stated the old way of it running several times in a row. I can't see the use of running it several times when we can just pipe it through less to see the look. The author's suggested command, meanwhile, is hard to see what is happening as it doesn't go slow enough and it floods the screen until one hits ctrl-c/sends intr. --- 1996/schweikh2/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1996/schweikh2/README.md b/1996/schweikh2/README.md index 7d64bb79d..3515892f3 100644 --- a/1996/schweikh2/README.md +++ b/1996/schweikh2/README.md @@ -41,8 +41,8 @@ while :; do grep -v '#' schweikh2.c; done ``` (and we do too) which works with `sh`, `bash`, `ksh` and `zsh` as well. Press -ctrl-c to stop it. Observe how the [try.sh](try.sh) script does this a number of -times. +ctrl-c to stop it. Observe how the [try.sh](try.sh) script does this once to +make it easier to see what is happening. ## Judges' remarks: From 6344fd55846ae707016acccc546767b70a555c5f Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 05:48:26 -0800 Subject: [PATCH 08/37] Update 1996/schweikh3/Makefile for SunOS Rather than make anyone manually update the Makefile (the command in the README.md file suggested that one would use Makefile variables) or type a more complicated command the Makefile now tries to compile the entry as suggested if compilation fails. Thus one can type 'make all' and if compilation fails it will try the SunOS way. --- 1996/schweikh3/Makefile | 3 ++- 1996/schweikh3/README.md | 8 -------- thanks-for-help.md | 7 +++++++ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/1996/schweikh3/Makefile b/1996/schweikh3/Makefile index 9fcc955dd..0a1facb23 100644 --- a/1996/schweikh3/Makefile +++ b/1996/schweikh3/Makefile @@ -129,7 +129,8 @@ all: data ${TARGET} sandwich supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c - ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} + ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} || \ + ${CC} ${CFLAGS} -I. '-Ddifftime(a,b)=(double)(b-a)' $< -o $@ ${LDFLAGS} # alternative executable # diff --git a/1996/schweikh3/README.md b/1996/schweikh3/README.md index 3e39ab8bd..b5e2c63ff 100644 --- a/1996/schweikh3/README.md +++ b/1996/schweikh3/README.md @@ -33,14 +33,6 @@ But still it is a useful utility. To use try: and thanks for the virtual memories! :-) -NOTE: On some systems such as SunOS, one may need to compile with: - -```make - ${CC} ${CFLAGS} \ - -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ - schweikh3.c -o schweikh3 -``` - ## Author's remarks: diff --git a/thanks-for-help.md b/thanks-for-help.md index 522020397..f9844e76b 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2192,6 +2192,13 @@ suggested that one try the longer version too but it will run in an infinite loop so having it in a script is less desired). +## [1996/schweikh3](/1996/schweikh3/schweikh3.c) ([README.md](/1996/schweikh3/README.md])) + +[Cody](#cody) updated the Makefile so that if it fails to compile it will try he +method suggested for SunOS rather than having to update the Makefile manually or +running a more complicated command: now one can just run `make`. + + ## [1996/westley](/1996/westley/westley.c) ([README.md](/1996/westley/README.md])) [Cody](#cody) fixed a segfault in this entry as well as it displaying environmental From 31793b035c97ab41101087ff9bf3fea732c6bb27 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 06:00:43 -0800 Subject: [PATCH 09/37] Improve 1996/westley/try scripts --- 1996/westley/try.alt.sh | 19 ++++++++++++++----- 1996/westley/try.sh | 14 +++++++++----- thanks-for-help.md | 7 ++----- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/1996/westley/try.alt.sh b/1996/westley/try.alt.sh index 6c9e4c480..cac5e17d7 100755 --- a/1996/westley/try.alt.sh +++ b/1996/westley/try.alt.sh @@ -15,13 +15,22 @@ make CC="$CC" everything >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "Showing alt grandfather clock:" 1>&2 +echo "WARNING: this is likely to segfault after showing the output." 1>&2 +echo "It might also show one or more environmental variables. Use" 1>&2 +echo "try.sh if you want to see the fixed version." 1>&2 +echo 1>&2 + +read -r -n 1 -p "Press any key to show alt grandfather clock: " +echo 1>&2 WESTLEY=./westley.alt ./clock1.sh -read -r -n 1 -p "Press any key to continue: " 1>&2 +echo 1>&2 -echo "Showing alt mantle clock that runs backwards:" 1>&2 +read -r -n 1 -p "Press any key to show alt mantle clock that runs backwards: " +echo 1>&2 WESTLEY=./westley.alt ./clock2.sh -read -r -n 1 -p "Press any key to continue: " 1>&2 +echo 1>&2 -echo "Showing alt linear style clock:" 1>&2 +read -r -n 1 -p "Press any key to show alt linear style clock: " +echo 1>&2 WESTLEY=./westley.alt ./clock3.sh +echo 1>&2 diff --git a/1996/westley/try.sh b/1996/westley/try.sh index 56cd8abe7..241294492 100755 --- a/1996/westley/try.sh +++ b/1996/westley/try.sh @@ -15,13 +15,17 @@ make CC="$CC" everything >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "Showing grandfather clock:" 1>&2 +read -r -n 1 -p "Press any key to show grandfather clock: " +echo 1>&2 WESTLEY=./westley ./clock1.sh -read -r -n 1 -p "Press any key to continue: " 1>&2 +echo 1>&2 -echo "Showing mantle clock that runs backwards:" 1>&2 +read -r -n 1 -p "Press any key to show alt mantle clock that runs backwards: " +echo 1>&2 WESTLEY=./westley ./clock2.sh -read -r -n 1 -p "Press any key to continue: " 1>&2 +echo 1>&2 -echo "Showing linear style clock:" 1>&2 +read -r -n 1 -p "Press any key to show alt linear style clock: " +echo 1>&2 WESTLEY=./westley ./clock3.sh +echo 1>&2 diff --git a/thanks-for-help.md b/thanks-for-help.md index f9844e76b..85c7ee169 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2213,14 +2213,11 @@ when reading the author's comments. To see how to use the original, see the README.md file. Cody also added the two scripts, [try.sh](/1996/westley/try.sh) and -[try.alt.sh](/1996/westley/try.alt.sh) to show automate showing the different +[try.alt.sh](/1996/westley/try.alt.sh) to automate showing the different clocks, both with the fixed version and the original (alt) version. Also, to fix any potential problem with displaying in GitHub the scripts -provided by the author, Cody added '.sh'. - -Later Cody made the entry look more like the original, removing the `argc` in -`main()` (K&R style functions). +provided by the author, Cody added '.sh' to the `clock[1-3].sh` scripts. # 1998 From 30492282bdcefff94238e668884fca77a52e5a2c Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 06:17:26 -0800 Subject: [PATCH 10/37] Reword alt build of 1998/banks a bit --- 1998/banks/README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/1998/banks/README.md b/1998/banks/README.md index e9ab9fc6f..9cd9d197e 100644 --- a/1998/banks/README.md +++ b/1998/banks/README.md @@ -4,11 +4,13 @@ make all ``` +If you do not have a page up or page down key you might wish to see the +[Alternate code](#alternate-code) section below. You may redefine all the keys +and the time step with predefined macros, however, so one lacking page up / page +down does not strictly need the alternate code; it jut gives those controls a +default value. The author provided the following table: -You may redefine all the keys and the time step with predefined macros. The -author provided the following able: - ``` Control Description Default Key ------- ------------------------- ----------- @@ -94,12 +96,13 @@ arrows at the same time as typing on the right side. As the Makefile allows you to configure the keys to use you may redefine the keys but with the alt build you cannot, as described earlier, redefine the page -up and page down replacement keys. If you want to do that you should use the -original entry as described in the to build section above. +up and page down replacement keys. The other controls you may redefine; this is +just a convenience build. If you want to redefine the page up / page down keys +you should use the original entry as described in the to build section above. -In the alt build it is `f` and `d` respectively as these are letters on the left -side of the keyboard which is easier to use if one is using the right side for -movement. These are hard coded, as noted. +In the alt build it is `f` (for page up) and `d` (for page down) as these are +letters on the left side of the keyboard which is easier to use if one is using +the right side for movement. These are hard coded, as noted. To use the default settings for the alternate build: @@ -114,7 +117,7 @@ want to use page up and page down. ### Alternate use: -Use `banks.alt` as you would `banks` but for use the different keys as +Use `banks.alt` as you would `banks` but use the different keys as configured at compilation. From ee5d57352f0e2ab8659661b4677428405b07ed4a Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 06:26:51 -0800 Subject: [PATCH 11/37] Improve 1998/bas2/try.sh --- 1998/bas2/README.md | 2 ++ 1998/bas2/try.sh | 28 +++++++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/1998/bas2/README.md b/1998/bas2/README.md index 26916d94b..39a246096 100644 --- a/1998/bas2/README.md +++ b/1998/bas2/README.md @@ -19,6 +19,8 @@ echo text | ./bas2 ./try.sh ./try.sh "foo bar" "baz" "IOCCC 1998/bas2" README.md + +./try.sh try.sh "bas2.c" bas2.orig.c ``` diff --git a/1998/bas2/try.sh b/1998/bas2/try.sh index 2bcacde81..8f0031bee 100755 --- a/1998/bas2/try.sh +++ b/1998/bas2/try.sh @@ -15,30 +15,44 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "$ ./bas2 < bas2.c" 1>&2 +read -r -n 1 -p "Press any key to run: ./bas2 < bas2.c: " +echo 1>&2 ./bas2 < bas2.c +echo 1>&2 -echo "$ ./bas2 < README.md" 1>&2 +read -r -n 1 -p "Press any key to run: ./bas2 < README.md: " +echo 1>&2 ./bas2 < README.md +echo 1>&2 -echo "$ ./bas2 < Makefile" 1>&2 +read -r -n 1 -p "Press any key to run: ./bas2 < Makefile: " +echo 1>&2 ./bas2 < Makefile +echo 1>&2 -echo "$ echo foo bar baz | ./bas2" 1>&2 +read -r -n 1 -p "Press any key to run: echo foo bar baz | ./bas2: " +echo 1>&2 echo foo bar baz | ./bas2 +echo 1>&2 -echo "$ cat README.md Makefile bas2.c | ./bas2" 1>&2 +read -r -n 1 -p "Press any key to run: cat README.md Makefile bas2.c | ./bas2: " +echo 1>&2 cat README.md Makefile bas2.c | ./bas2 +echo 1>&2 # while we have an arg check if it's a file. If it is a regular file that is # readable feed it to the program; otherwise act as if it's a string. while [[ "$#" -gt 0 ]]; do if [[ -f "$1" && -r "$1" ]]; then - echo "$ ./bas2 < $1" 1>&2 + read -r -n 1 -p "Press any key to run: ./bas2 < $1: " + echo 1>&2 ./bas2 < "$1" + echo 1>&2 else - echo "$ echo $1 | ./bas2" 1>&2 + read -r -n 1 -p "Press any key to run: echo $1 | ./bas2: " + echo 1>&2 echo "$1" | ./bas2 + echo 1>&2 fi shift 1 done From ed47e4ab55b80468dad9f95fb35937638cb1e85a Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 06:42:33 -0800 Subject: [PATCH 12/37] Add 1998/chaos/try.sh The script runs the program on each data file, explaining how to use the program, things to try and how to quit the program and how to terminate the script prematurely. --- 1998/chaos/README.md | 15 +++++++++++++++ 1998/chaos/try.sh | 35 +++++++++++++++++++++++++++++++++++ thanks-for-help.md | 4 ++++ 3 files changed, 54 insertions(+) create mode 100755 1998/chaos/try.sh diff --git a/1998/chaos/README.md b/1998/chaos/README.md index d4f1f1521..da54ee82c 100644 --- a/1998/chaos/README.md +++ b/1998/chaos/README.md @@ -21,6 +21,21 @@ make chaos_nohalf ``` +## Try: + + +```sh +./try.sh +``` + +This script will run the program on each data file. To quit the program hit `q`. +If not all files have been used it will go to the next one; otherwise the script +will be finished. To end the script early send intr/ctrl-c. + +The script will give you instructions on how to use the program and things to +try each time it is run, as a helpful reminder. + + ## Judge's Comments: This is the author's first IOCCC entry. We thought the entry was diff --git a/1998/chaos/try.sh b/1998/chaos/try.sh new file mode 100755 index 000000000..2c0f0de04 --- /dev/null +++ b/1998/chaos/try.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 1998/chaos +# + +# 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 + +show_instructions() +{ + echo 1>&2 + echo "Try the keys 'y', 'u', 'i', 'h', 'j' and 'k'; 'a' and 'z' zoom in and out." 1>&2 + echo "When tired of moving it manually wait a short bit and watch what happens. You" 1>&2 + echo "might try zooming in and out and then wait for it to start moving (again or" 1>&2 + echo "initially). You can interrupt the automatic movement by pressing any key or 'q' to" 1>&2 + echo "quit. Send intr/ctrl-c to quit the script prematurely." 1>&2 + echo 1>&2 +} + +for f in cube.data desk.data ioccc.data pyramid.data xwing.data; do + clear + show_instructions + read -r -n 1 -p "Press any key to run: ./chaos $f: " + echo 1>&2 + ./chaos "$f" +done diff --git a/thanks-for-help.md b/thanks-for-help.md index 85c7ee169..8c78fd3c9 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2259,6 +2259,10 @@ as well as allowing one to pass in different file names or strings. [Cody](#cody) added a call to `endwin()` to restore terminal sanity (echo etc.) when exiting the program (in both versions). +Cody also added the [try.sh](/1998/chaos/try.sh) script that runs the program on +all the data files, giving instructions on how to rotate and zoom in and out, +prior to each run. + ## [1998/df](/1998/df/df.c) ([README.md](/1998/df/README.md])) From 99e79b1e13bd62e27fcc929b232c03b4ccd1775d Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 06:57:28 -0800 Subject: [PATCH 13/37] Add 1998/df/try.sh This script runs repeatedly until (when prompted) one hits 'q' (or 'Q') or else sends ctrl-c/intr. I also added a question to the extra credit questions: are there any misspelt words and if there are what are they? I also added that there's a way to cheat very easily but I did not say how to do it. It should be pretty obvious how to do it to anyone who tries the program once or if not once a few times. --- 1998/df/README.md | 14 ++++++++++++++ 1998/df/try.sh | 25 +++++++++++++++++++++++++ thanks-for-help.md | 10 +++++++--- 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100755 1998/df/try.sh diff --git a/1998/df/README.md b/1998/df/README.md index db17ebda2..2d51dd7e2 100644 --- a/1998/df/README.md +++ b/1998/df/README.md @@ -11,6 +11,19 @@ make all ./df ``` + +## Try: + +```sh +./try.sh +``` + +This will run the program in a loop until you exit (`q` when prompted or +ctrl-c/intr). + +Can you figure out a very simple pipeline to cheat? + + ## Judges' remarks; Everyone talks about how data hiding can produce clearer code; I am @@ -33,6 +46,7 @@ Extra credit questions: - Where are the words stored? - How many words does this entry use? - Can you add more words to the program and still make it work? +- Are there any misspelt words? If yes what are they? ## Author's remarks: diff --git a/1998/df/try.sh b/1998/df/try.sh new file mode 100755 index 000000000..284ebd4be --- /dev/null +++ b/1998/df/try.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 1998/df +# + +# 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 + +while [[ 1 ]]; do + read -r -n 1 -p "Press any key to run ./df or 'q' to quit: " + echo 1>&2 + if [[ "$REPLY" = "q" || "$REPLY" = "Q" ]]; then + exit 0 + fi + ./df +done diff --git a/thanks-for-help.md b/thanks-for-help.md index 8c78fd3c9..abfebc6d1 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2269,10 +2269,14 @@ prior to each run. [Cody](#cody) changed a `int *` used for `fopen(3)` to be a `FILE *` to be more correct and prevent any possible problems in some systems (which has happened). -Cody also made the fixed version look more like the original version by using +Cody also made the fixed version to look more like the original version by using the old style of `main()` args so that it reads `i,love_unix` more naturally, -and by changing the typedef `lint` (to `int` - see the code for why this has to -be done in modern systems) to be `_int`. +and by changing the `typedef int lint` to be `typedef int _int`. See the code +for why this has to be done this way. + +Cody also added the [try.sh](/1998/df/try.sh) script which runs the program in a +loop until one hits `q` (or `Q`) or sends intr/ctrl-c. He also proposed there's +a way to cheat very easily. Can you figure out how? ## [1998/dlowe](/1998/dlowe/dlowe.c) ([README.md](/1998/dlowe/README.md])) From 51b9d3c096fd5dc9dcfbcd877552aa0991cd5db9 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 07:09:15 -0800 Subject: [PATCH 14/37] Slightly modify 1998/dlowe/try scripts Allow specifying paths to man, col and cat. This is done in a way that the CC variable should have been done in all the other scripts (and this one) but I didn't think about it at the time. --- 1998/dlowe/README.md | 11 +++++++++-- 1998/dlowe/try.alt.sh | 12 ++++++------ 1998/dlowe/try.sh | 12 ++++++------ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/1998/dlowe/README.md b/1998/dlowe/README.md index 4532c8ead..a01c22f06 100644 --- a/1998/dlowe/README.md +++ b/1998/dlowe/README.md @@ -11,7 +11,9 @@ below for more details. ## To use: ```sh -./dlowe < anyfile > pootfile +./dlowe < file > pootfile + +./dlowe < file ``` @@ -42,6 +44,8 @@ Also try: ./try.sh ``` +Did you spot the Easter egg there? + ## Alternate code: @@ -59,7 +63,7 @@ make alt ### Alternate use: ``` -./dlowe.alt < anyfile > pootfile +./dlowe.alt < file > pootfile ``` What's the difference between this and `dlowe`? @@ -71,6 +75,9 @@ What's the difference between this and `dlowe`? ./try.alt.sh ``` +Did you spot the Easter egg there? + + ## Judges' remarks: diff --git a/1998/dlowe/try.alt.sh b/1998/dlowe/try.alt.sh index 05b11df0a..ca1a73410 100755 --- a/1998/dlowe/try.alt.sh +++ b/1998/dlowe/try.alt.sh @@ -5,18 +5,18 @@ make everything || exit 1 -CAT="$(type -P cat)" -MAN="$(type -P man)" -COL="$(type -P col)" +[[ -z "$CAT" ]] && CAT="$(type -P cat)" +[[ -z "$MAN" ]] && MAN="$(type -P man)" +[[ -z "$COL" ]] && COL="$(type -P col)" if [[ -z "$CAT" || ! -e "$CAT" ]]; then - echo "$0: no cat found" 1>&2 + echo "$0: no cat '$CAT' found" 1>&2 exit 1 elif [[ -z "$COL" || ! -e "$COL" ]]; then - echo "$0: col not found" 1>&2 + echo "$0: col '$COL' not found" 1>&2 exit 1 elif [[ -z "$MAN" || ! -e "$MAN" ]]; then - echo "$0: can't execute man" 1>&2 + echo "$0: can't execute '$MAN'" 1>&2 exit 1 fi diff --git a/1998/dlowe/try.sh b/1998/dlowe/try.sh index 18645fc87..419baa5c0 100755 --- a/1998/dlowe/try.sh +++ b/1998/dlowe/try.sh @@ -5,18 +5,18 @@ make all || exit 1 -CAT="$(type -P cat)" -MAN="$(type -P man)" -COL="$(type -P col)" +[[ -z "$CAT" ]] && CAT="$(type -P cat)" +[[ -z "$MAN" ]] && MAN="$(type -P man)" +[[ -z "$COL" ]] && COL="$(type -P col)" if [[ -z "$CAT" || ! -e "$CAT" ]]; then - echo "$0: no cat found" 1>&2 + echo "$0: no cat '$CAT' found" 1>&2 exit 1 elif [[ -z "$COL" || ! -e "$COL" ]]; then - echo "$0: col not found" 1>&2 + echo "$0: col '$COL' not found" 1>&2 exit 1 elif [[ -z "$MAN" || ! -e "$MAN" ]]; then - echo "$0: can't execute man" 1>&2 + echo "$0: can't execute '$MAN'" 1>&2 exit 1 fi From 8ce922b448af2dcd578563a1c4860e4a602e5426 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 07:13:01 -0800 Subject: [PATCH 15/37] Make usage of 1998/dloweneil more inclusive This is a cosmetic change only and rather unimportant but I have to be complete: when I added the alt code I used the word anticlockwise (as I would) instead of counterclockwise. But since the original entry referred only to counterclockwise I decided to make it use both like the alt code does. --- 1998/dloweneil/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/1998/dloweneil/README.md b/1998/dloweneil/README.md index b6e2042aa..11b9aed84 100644 --- a/1998/dloweneil/README.md +++ b/1998/dloweneil/README.md @@ -27,8 +27,8 @@ For more detailed information see [1998 dloweneil in bugs.md](/bugs.md#1998-dlow ./pootris [X size of board] [Y size of board] ``` -Pressing `a` moves the current letter position counterclockwise around the -border of the playing field. +Pressing `a` moves the current letter position counterclockwise/anticlockwise +(a)round the border of the playing field. Pressing `s` moves the current letter one position clockwise around the border of the playing field. @@ -39,7 +39,7 @@ Pressing `d` drops the current letter onto the board. ## Alternate code: This version has it so that where in addition to `a` moving you -anticlockwise/counterclockwise `h` does as well; and in addition to `s` moving +counterclockwise/anticlockwise `h` does as well; and in addition to `s` moving clockwise `l` does as well. Instead of using `d` to drop the letter you can do `j` or space. Finally to quit this version you can press `q`. From 400a2019e54b3fad1216acc561ca924cf4b4db13 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 08:10:34 -0800 Subject: [PATCH 16/37] Improve 1998/dorssel/try.sh --- 1998/dorssel/README.md | 6 ------ 1998/dorssel/try.sh | 30 ++++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/1998/dorssel/README.md b/1998/dorssel/README.md index 3cdec819b..50b20f9cd 100644 --- a/1998/dorssel/README.md +++ b/1998/dorssel/README.md @@ -21,12 +21,6 @@ echo text | ./dorssel ./try.sh ``` -Also try: - -```sh -./dorssel < dorssel.md -``` - ## Judges' remarks: diff --git a/1998/dorssel/try.sh b/1998/dorssel/try.sh index 830cddfd2..4953317d4 100755 --- a/1998/dorssel/try.sh +++ b/1998/dorssel/try.sh @@ -15,24 +15,36 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "$ echo 'Simple as 123' | ./dorssel" 1>&2 +read -r -n 1 -p "Press any key to run: echo 'Simple as 123' | ./dorssel: " +echo 1>&2 echo 'Simple as 123' | ./dorssel +echo 1>&2 -echo "$ echo 'Binary as simple as 1, 10 11.' | ./dorssel" 1>&2 +read -r -n 1 -p "Press any key to run: echo 'Binary as simple as 1, 10 11.' | ./dorssel: " 1>&2 +echo 1>&2 echo 'Binary as simple as 1, 10 11.' | ./dorssel +echo 1>&2 echo "$ echo '.... --- .-- -.. --- . ... .. - -.. --- - .... .- -' | ./dorssel" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 echo '.... --- .-- -.. --- . ... .. - -.. --- - .... .- -' | ./dorssel +echo 1>&2 -echo "$ echo 'HOW DOES IT DO THAT' | ./dorssel" 1>&2 +read -r -n 1 -p "Press any key to run: echo 'HOW DOES IT DO THAT' | ./dorssel: " +echo 1>&2 echo 'HOW DOES IT DO THAT' | ./dorssel +echo 1>&2 -echo "$ echo 'HOW DOES IT DO THAT' | ./dorssel | ./dorssel" 1>&2 +read -r -n 1 -p "Press any key to run: echo 'HOW DOES IT DO THAT' | ./dorssel | ./dorssel: " +echo 1>&2 echo 'HOW DOES IT DO THAT' | ./dorssel | ./dorssel +echo 1>&2 - -echo "$ ./dorssel < dorssel.c | ./dorssel" 1>&2 +read -r -n 1 -p "Press any key to run: ./dorssel < dorssel.c | ./dorssel: " +echo 1>&2 ./dorssel < dorssel.c | ./dorssel +echo 1>&2 echo "$ echo ' @@ -40,6 +52,8 @@ echo "$ echo ' . -..- . .-. -.-. .. ... . -.-. .... .- -. --. . - .... . .--. .-. --- --. .-. .- -- ... --- .. - -.. --- . ... -. --- - ... .... --- ..- -' | ./dorssel" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 echo " .. - .... .. -. -.- - .... .. ... ... .--. --- .. .-.. . .-. .. ... -- --- .-. . --- -... ..-. ..- ... -.-. .- - . -.. - .... .- -. - .... . .--. .-. --- --. .-. .- -- @@ -47,3 +61,7 @@ echo " . -..- . .-. -.-. .. ... . -.-. .... .- -. --. . - .... . .--. .-. --- --. .-. .- -- ... --- .. - -.. --- . ... -. --- - ... .... --- ..- -" | ./dorssel +read -r -n 1 -p "Press any key to run: ./dorssel < dorssel.md (space = next page, q = quit): " +echo 1>&2 +./dorssel < dorssel.md | less -rEXF +echo 1>&2 From 1537254600511103b3140dac92e41578cddee1d3 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 08:13:28 -0800 Subject: [PATCH 17/37] Improve 1998/fanf/try.sh --- 1998/fanf/try.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/1998/fanf/try.sh b/1998/fanf/try.sh index 8e0bfc016..24504d93b 100755 --- a/1998/fanf/try.sh +++ b/1998/fanf/try.sh @@ -15,7 +15,8 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "$ echo '((\a(\b(\c(d)))) e' | ./fanf" 1>&2 +read -r -n 1 -p "Press any key to run: echo '((\a(\b(\c(d)))) e)' | ./fanf: " +echo 1>&2 echo '((\a(\b(\c(d)))) e)' | ./fanf echo 1>&2 @@ -25,6 +26,8 @@ echo "$ echo ' (g x) (f x) ) K K z )'|./fanf" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 echo ' (\f\g\x ( @@ -35,6 +38,8 @@ echo 1>&2 echo "$ echo '(\f(\f\g\x( (f((\a(g(b))) e)) (g x) ) K K z))' | ./fanf" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 echo '(\f(\f\g\x( (f((\a(g(b))) e)) (g x) ) K K z))' | ./fanf echo 1>&2 @@ -45,6 +50,8 @@ echo "$ echo ' (* n (f (- n 1))) ) )' | ./fanf" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 echo '(Y\f\n ((= n 0) @@ -52,3 +59,5 @@ echo '(Y\f\n (* n (f (- n 1))) ) )' | ./fanf + +exit 0 From 0bcbcbebc8453a3469ccf9667e4abb4cbf75bd0d Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 08:20:34 -0800 Subject: [PATCH 18/37] Improve 1998/schnitzi/try.sh --- 1998/schnitzi/try.sh | 59 ++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/1998/schnitzi/try.sh b/1998/schnitzi/try.sh index 90817251e..5bc4fb65e 100755 --- a/1998/schnitzi/try.sh +++ b/1998/schnitzi/try.sh @@ -15,67 +15,62 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "$ ./schnitzi 3 > sort.c" 1>&2 +read -r -n 1 -p "Press any key to run: ./schnitzi 3 > sort.c: " +echo 1>&2 ./schnitzi 3 > sort.c +echo 1>&2 -echo "Compiling sort.c:" 1>&2 +read -r -n 1 -p "Press any key to run: make sort >/dev/null || exit 1: " +echo 1>&2 make sort >/dev/null || exit 1 +echo 1>&2 echo "...built sort." 1>&2 +echo 1>&2 echo "Creating data:" 1>&2 -echo "$ echo 234 > data" 1>&2 -echo 234 > data - -echo "$ echo 413 >> data" 1>&2 -echo 413 >> data - -echo "$ echo 123 >> data" 1>&2 -echo 123 >> data +read -r -n 1 -p "Press any key to run: printf \"234\n413\n123\" > data: " +echo 1>&2 +printf "234\n413\n123" > data +echo 1>&2 echo "Sorting data:" 1>&2 -echo "$ ./sort < data" 1>&2 +read -r -n 1 -p "Press any key to run: ./sort < data: " +echo 1>&2 ./sort < data - echo 1>&2 echo "Using stdin/stdout:" 1>&2 -echo "$ echo 10 7 9 | ./sort" 1>&2 +read -r -n 1 -p "Press any key to run: echo \"10 7 9\" | ./sort: " +echo 1>&2 echo "10 7 9" | ./sort +echo 1>&2 -echo "$ ./schnitzi 5 > sort.c" 1>&2 -./schnitzi 5 > sort.c +read -r -n 1 -p "Press any key to run: ./schnitzi 5 | tee sort.c (space = next page, q = quit): " +echo 1>&2 +./schnitzi 5 | tee sort.c | less -rEXF echo "Compiling sort.c:" 1>&2 make sort >/dev/null || exit 1 - +echo 1>&2 echo "...built sort." 1>&2 echo "Creating data:" 1>&2 -echo "$ echo 124 > data" 1>&2 -echo 124 > data - -echo "$ echo 422 >> data" 1>&2 -echo 422 >> data - -echo "$ echo 120 >> data" 1>&2 -echo 120 >> data - -echo "$ echo 100 >> data" 1>&2 -echo 100 >> data - -echo "$ echo 777 >> data" 1>&2 -echo 777 >> data +read -r -n 1 -p "Press any key to run: printf \"124\n422\n120\n100\n777\" > data: " +echo 1>&2 +printf "124\n422\n120\n100\n777" > data echo "Sorting data:" 1>&2 -echo "$ ./sort < data" 1>&2 +read -r -n 1 -p "Press any key to run: ./sort < data: " +echo 1>&2 ./sort < data echo 1>&2 echo "Using stdin/stdout:" 1>&2 -echo "$ echo 5 10 7 9 1 | ./sort" 1>&2 +read -r -n 1 -p "Press any key to run: echo "5 10 7 9 1" | ./sort: " +echo 1>&2 echo "5 10 7 9 1" | ./sort echo 1>&2 From f9f4e27535406efdafdf78c9e7f7b577adb3f88d Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 08:28:48 -0800 Subject: [PATCH 19/37] Add 1998/schweikh2/try.sh --- 1998/schweikh2/README.md | 5 +++-- 1998/schweikh2/try.sh | 32 ++++++++++++++++++++++++++++++++ thanks-for-help.md | 2 ++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100755 1998/schweikh2/try.sh diff --git a/1998/schweikh2/README.md b/1998/schweikh2/README.md index 683857911..1f646d895 100644 --- a/1998/schweikh2/README.md +++ b/1998/schweikh2/README.md @@ -21,13 +21,14 @@ or ## Try: ```sh -./yarng 5 +./try.sh ./yarng # watch what it does ``` -What is the difference there? +What is the difference between what is in the script and running `yarng` without +an arg? ## Judges' remarks: diff --git a/1998/schweikh2/try.sh b/1998/schweikh2/try.sh new file mode 100755 index 000000000..0d07488a5 --- /dev/null +++ b/1998/schweikh2/try.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 1998/schweikh2 +# + +# 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 + +i=0 +while [[ "$i" -lt 3 ]]; do + NUM="$((RANDOM % 10))" + read -r -n 1 -p "Press any key to run: ./yarng $NUM: " + echo 1>&2 + ./yarng "$NUM" + echo 1>&2 + + read -r -n 1 -p "Press any key to run: ./yarng $NUM: " + echo 1>&2 + ./yarng "$NUM" + echo 1>&2 + + ((i++)) +done diff --git a/thanks-for-help.md b/thanks-for-help.md index abfebc6d1..4003752ed 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2428,6 +2428,8 @@ Cody also added an `int` after `register` in `main()` in case clang decides to have a problem with that in the future which is not entirely out of the question. +Cody also added the [try.sh](/1998/schweikh2/try.sh) script. + ## [1998/schweikh3](/1998/schweikh3/schweikh3.c) ([README.md](/1998/schweikh3/README.md])) From 0b27c467f2367c7ff28de1bcba6d1e8b29b9d619 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 08:31:51 -0800 Subject: [PATCH 20/37] Improve 1998/schweikh3/try.sh --- 1998/schweikh3/try.sh | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/1998/schweikh3/try.sh b/1998/schweikh3/try.sh index ffd2b88b2..8cb147cbf 100755 --- a/1998/schweikh3/try.sh +++ b/1998/schweikh3/try.sh @@ -15,16 +15,30 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "$ cp -f schweikh3 file1" -cp -f schweikh3 file1 -echo "$ cp -f schweikh3 file2" -cp -f schweikh3 file2 -echo "$ cp -f schweikh3.c file3" -cp -f schweikh3.c file3 -echo "$ ln -f file3 file4" -ln -f file3 file4 -echo "$ find . -type f -name 'file?' | ./samefile" -find . -type f -name 'file?' | ./samefile +read -r -n 1 -p "Press any key to run: cp -vf schweikh3 file1: " +echo 1>&2 +cp -vf schweikh3 file1 +echo 1>&2 -echo "find . -type f -print | ./samefile" 1>&2 +read -r -n 1 -p "Press any key to run: cp -vf schweikh3 file2: " +echo 1>&2 +cp -vf schweikh3 file2 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: cp -vf schweikh3.c file3: " +echo 1>&2 +cp -vf schweikh3.c file3 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ln -vf file3 file4: " +echo 1>&2 +ln -vf file3 file4 +read -r -n 1 -p "Press any key to run: find . -type f -name 'file?' | ./samefile: " +echo 1>&2 +find . -type f -name 'file?' | ./samefile +echo 1>&2 + +read -r -n 1 -p "Press any key to run: find . -type f -print | ./samefile: " +echo 1>&2 find . -type f -print | ./samefile +echo 1>&2 From c223aaa44c0fd006acd8d82b9a7c41ad232ce321 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 08:35:04 -0800 Subject: [PATCH 21/37] Improve 1998/tomtorfs/try.sh --- 1998/tomtorfs/try.sh | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/1998/tomtorfs/try.sh b/1998/tomtorfs/try.sh index f68f90c27..10684e1ab 100755 --- a/1998/tomtorfs/try.sh +++ b/1998/tomtorfs/try.sh @@ -17,19 +17,32 @@ clear rm -f file.A file.B file.C -echo "$ echo abscond conferrable > file.A" 1>&2 +read -r -n 1 -p "Press any key to run: echo \"abscond conferrable\" > file.A: " +echo 1>&2 echo "abscond conferrable" > file.A -echo "$ ./tomtorfs file.A 32 04C11DB7 1 FFFFFFFF FFFFFFFF" 1>&2 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./tomtorfs file.A 32 04C11DB7 1 FFFFFFFF FFFFFFFF: " +echo 1>&2 ./tomtorfs file.A 32 04C11DB7 1 FFFFFFFF FFFFFFFF +echo 1>&2 -echo "$ echo adorn condolence > file.B" 1>&2 +read -r -n 1 -p "Press any key to run: echo \"adorn condolence\" > file.B: " +echo 1>&2 echo "adorn condolence" > file.B -echo "$ ./tomtorfs file.B 32 04C11DB7 1 FFFFFFFF FFFFFFFF" 1>&2 -./tomtorfs file.B 32 04C11DB7 1 FFFFFFFF FFFFFFFF -echo "$ echo adorn condolence too > file.C" 1>&2 +read -r -n 1 -p "Press any key to run: ./tomtorfs file.B 32 04C11DB7 1 FFFFFFFF FFFFFFFF: " +echo 1>&2 +./tomtorfs file.B 32 04C11DB7 1 FFFFFFFF FFFFFFFF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: echo \"adorn condolence too\" > file.C: " +echo 1>&2 echo "adorn condolence too" > file.C -echo "$ ./tomtorfs file.C 32 04C11DB7 1 FFFFFFFF FFFFFFFF" 1>&2 +echo 1>&2 +read -r -n 1 -p "Press any key to run: ./tomtorfs file.C 32 04C11DB7 1 FFFFFFFF FFFFFFFF: " +echo 1>&2 ./tomtorfs file.C 32 04C11DB7 1 FFFFFFFF FFFFFFFF +echo 1>&2 rm -f file.A file.B file.C From bd6bef9faab7984df28d27d3569f656857b346e5 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 08:36:34 -0800 Subject: [PATCH 22/37] Minor fixes in 2000/anderson/try.sh --- 2000/anderson/try.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/2000/anderson/try.sh b/2000/anderson/try.sh index 0028f7986..88a53a6b7 100755 --- a/2000/anderson/try.sh +++ b/2000/anderson/try.sh @@ -16,16 +16,26 @@ make CC="$CC" all >/dev/null || exit 1 clear read -r -n 1 -p "Press any key to run: echo Obfuscate | ./anderson: " +echo 1>&2 echo Obfuscate | ./anderson +echo 1>&2 read -r -n 1 -p "Press any key to run: echo 'Hello, world!' | ./anderson: " +echo 1>&2 echo 'Hello, world!' | ./anderson +echo 1>&2 read -r -n 1 -p "Press any key to run: ./anderson < anderson.c: " +echo 1>&2 ./anderson < anderson.c +echo 1>&2 read -r -n 1 -p "Press any key to run: ./anderson < README.md: " +echo 1>&2 ./anderson < README.md +echo 1>&2 read -r -n 1 -p "Press any key to run: cat README.md anderson.c | ./anderson: " +echo 1>&2 cat README.md anderson.c | ./anderson +echo 1>&2 From 168f7dc9191658915b5baa704a67a03547ce3f9a Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 08:42:41 -0800 Subject: [PATCH 23/37] Improve 2000/bmeyer/try.sh --- 2000/bmeyer/try.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/2000/bmeyer/try.sh b/2000/bmeyer/try.sh index 76d41b987..d2c59583c 100755 --- a/2000/bmeyer/try.sh +++ b/2000/bmeyer/try.sh @@ -45,33 +45,42 @@ if [[ "$COLUMNS" -lt 81 ]]; then fi -read -r -n 1 -p "Press any key to start: " -echo "$ ./glicbawls < michael.pgm > michael.glic" 1>&2 +read -r -n 1 -p "Press any key to run: ./glicbawls < michael.pgm > michael.glic: " +echo 1>&2 ./glicbawls < michael.pgm > michael.glic echo "Now compare the michael.pgm to the screen output." 1>&2 +echo 1>&2 -read -r -n 1 -p "Press any key to continue: " echo "$ ./glicbawls < michael.pgm 2>/dev/null | ./glicbawls > new.pgm" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 ./glicbawls < michael.pgm 2>/dev/null | ./glicbawls > new.pgm +echo 1>&2 echo "Now compare the michael.pgm to the screen output." 1>&2 read -r -n 1 -p "Press any key to continue: " +echo 1>&2 echo "Now compare the new.pgm file to the michael.pgm file." read -r -n 1 -p "Press any key to continue: " +echo 1>&2 -read -r -n -p 1 "Press any key to trying and use your screen width on lava bus pic: " +read -r -n 1 -p "Press any key to try and use your screen width on lava bus pic: " +echo 1>&2 -echo "$ ./glicbawls $COLUMNS < lavabus.pgm > lavabus.glic" 1>&2 +read -r -n 1 -p "Press any key to run: ./glicbawls $COLUMNS < lavabus.pgm > lavabus.glic: " +echo 1>&2 ./glicbawls "$COLUMNS" < lavabus.pgm > lavabus.glic +echo 1>&2 -read -r -n 1 -p "Press any key to continue: " - -echo "$ ./glicbawls -2 "$COLUMNS" < lavabus.pgm > lavabus.glic2" +read -r -n 1 -p "Press any key to run: ./glicbawls -2 "$COLUMNS" < lavabus.pgm > lavabus.glic2: " +echo 1>&2 ./glicbawls -2 "$COLUMNS" < lavabus.pgm > lavabus.glic2 +echo 1>&2 read -r -n 1 -p "Press any key to decompress the smaller glic-file: " +echo 1>&2 echo "$ ./glicbawls -2 150 < lavabus.glic2 > new.pgm" 1>&2 ./glicbawls -2 150 < lavabus.glic2 > new.pgm From 5b01e685125bc9900a736872fca475274f77a129 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:04:06 -0800 Subject: [PATCH 24/37] Improve 2000/dhyang/try.sh --- 2000/dhyang/try.sh | 60 ++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/2000/dhyang/try.sh b/2000/dhyang/try.sh index b032578a3..1c9470ef8 100755 --- a/2000/dhyang/try.sh +++ b/2000/dhyang/try.sh @@ -16,38 +16,40 @@ make CC="$CC" all >/dev/null || exit 1 clear -echo "$ make saitou >/dev/null" 1>&2 -make saitou >/dev/null - -echo "$ ./saitou > aku.c" 1>&2 -./saitou > aku.c - -read -r -n 1 -p "Press any key to run: cat aku.c (space = next page, q = quit): " +read -r -n 1 -p "Press any key to run: make saitou >/dev/null || exit 1: " echo 1>&2 -cat aku.c | less -EXF - -echo "$ make soku >/dev/null" 1>&2 -make soku >/dev/null - -echo "$ ./soku > soku.c" 1>&2 -./soku > soku.c - -read -r -n 1 -p "Press any key to run: cat soku.c (space = next page, q = quit): " +make saitou >/dev/null || exit 1 echo 1>&2 -cat soku.c | less -EXF -echo "$ make zan >/dev/null" 1>&2 -make zan >/dev/null - -echo "$ ./zan > zan.c" 1>&2 -./zan > zan.c - -read -r -n 1 -p "Press any key to run: cat zan.c (space = next page, q = quit): " +read -r -n 1 -p "Press any key to run: ./saitou | tee aku.c (space = next page, q = quit): " echo 1>&2 -cat zan.c | less -EXF +./saitou | tee aku.c | less -rEXF -echo "$ make aku >/dev/null" 1>&2 -make aku >/dev/null +read -r -n 1 -p "Press any key to run: make soku >/dev/null || exit 1: " +echo 1>&2 +make soku >/dev/null || exit 1 +echo 1>&2 -echo "$ ./aku | diff - aku.c" 1>&2 -./aku | diff - aku.c +read -r -n 1 -p "Press any key to run: ./soku | tee soku.c (space = next page, q = quit): " +echo 1>&2 +./soku | tee soku.c | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: make zan >/dev/null || exit 1: " +echo 1>&2 +make zan >/dev/null || exit 1 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./zan | tee zan.c (space = next page, q = quit): " +echo 1>&2 +./zan | tee zan.c | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: make aku >/dev/null || exit 1: " +echo 1>&2 +make aku >/dev/null || exit 1 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./aku | diff -s - aku.c: " +echo 1>&2 +./aku | diff -s - aku.c From 54ef14bbde3375ff689da33a93ec50b55b8a00a5 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:06:38 -0800 Subject: [PATCH 25/37] Improve 2000/dlowe/try.sh --- 2000/dlowe/try.sh | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/2000/dlowe/try.sh b/2000/dlowe/try.sh index 37c85c701..e80947299 100755 --- a/2000/dlowe/try.sh +++ b/2000/dlowe/try.sh @@ -15,23 +15,37 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "$ echo '13 14 15 16 17 + - * / p' | ./dlowe" 1>&2 +read -r -n 1 -p "Press any key to run: echo '13 14 15 16 17 + - * / p' | ./dlowe: " +echo 1>&2 echo '13 14 15 16 17 + - * / p' | ./dlowe +echo 1>&2 -echo "$ echo '12 13 14 15 16 + + + + f' | ./dlowe" 1>&2 +read -r -n 1 -p "Press any key to run: echo '12 13 14 15 16 + + + + f' | ./dlowe: " +echo 1>&2 echo '12 13 14 15 16 + + + + f' | ./dlowe +echo 1>&2 -echo "$ echo '12 13 14 15 16 17 + - * / p' | ./dlowe" 1>&2 +read -r -n 1 -p "Press any key to run: echo '12 13 14 15 16 17 + - * / p' | ./dlowe: " +echo 1>&2 echo '12 13 14 15 16 17 + - * / p' | ./dlowe +echo 1>&2 -echo "$ echo '+' | ./dlowe" 1>&2 +read -r -n 1 -p "Press any key to run: echo '+' | ./dlowe: " +echo 1>&2 echo '+' | ./dlowe +echo 1>&2 -echo "$ echo '999999999999999 1 + p' | ./dlowe" 1>&2 +read -r -n 1 -p "Press any key to run: echo '999999999999999 1 + p' | ./dlowe: " +echo 1>&2 echo '999999999999999 1 + p' | ./dlowe +echo 1>&2 -echo "$ echo '99999999999999 1 + p' | ./dlowe" 1>&2 +read -r -n 1 -p "Press any key to run: echo '99999999999999 1 + p' | ./dlowe: " +echo 1>&2 echo '99999999999999 1 + p' | ./dlowe +echo 1>&2 -echo "$ echo '12.5 9 % 10 * 15 + f' | ./dlowe" 1>&2 +read -r -n 1 -p "Press any key to run: echo '12.5 9 % 10 * 15 + f' | ./dlowe: " +echo 1>&2 echo '12.5 9 % 10 * 15 + f' | ./dlowe +echo 1>&2 From 6252e3c692d48aee681f9dfd76bbff00cc6d9485 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:09:57 -0800 Subject: [PATCH 26/37] Improve 2000/natori/try.sh --- 2000/natori/try.sh | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/2000/natori/try.sh b/2000/natori/try.sh index 95d2faa96..e3536cc23 100755 --- a/2000/natori/try.sh +++ b/2000/natori/try.sh @@ -19,12 +19,15 @@ NATORI="natori" moon() { read -r -n 1 -p "Press any key to randomly show the northern/southern hemisphere Moon: " + echo 1>&2 for ((i=0;i<=10;i++)); do RAND=$((RANDOM % 1000)) if [[ "$RAND" -le 500 ]]; then ./"$NATORI" + echo 1>&2 else ./"$NATORI".alt + echo 1>&2 fi done @@ -32,6 +35,7 @@ moon() RAND=$((RANDOM % 1000)) if [[ "$RAND" -gt 500 ]]; then read -r -n 1 -p "Press any key to alternate between the northern/southern hemisphere Moon: " + echo 1>&2 ./"$NATORI" ./"$NATORI".alt ./"$NATORI" @@ -40,6 +44,7 @@ moon() ./"$NATORI".alt else read -r -n 1 -p "Press any key to alternate between the southern/northern hemisphere Moon: " + echo 1>&2 ./"$NATORI".alt ./"$NATORI" ./"$NATORI".alt @@ -54,6 +59,7 @@ moon() if [[ "$RAND" -le 499 ]]; then read -r -n 1 -p "Press any key to alternate between the northern/southern hemisphere Moon: " + echo 1>&2 ./"$NATORI" ./"$NATORI".alt ./"$NATORI" @@ -62,6 +68,7 @@ moon() ./"$NATORI".alt else read -r -n 1 -p "Press any key to alternate between the southern/northern hemisphere Moon: " + echo 1>&2 ./"$NATORI".alt ./"$NATORI" ./"$NATORI".alt @@ -77,12 +84,14 @@ moon() RAND=$((RANDOM % 1000)) if [[ "$RAND" -gt 500 ]]; then read -r -n 1 -p "Press any key to alternate between the northern/southern hemisphere Moon: " + echo 1>&2 ( ./"$NATORI"; ./"$NATORI.alt" ; ./"$NATORI" ; ./"$NATORI.alt"; \ - ./"$NATORI"; ./"$NATORI.alt" ) | less + ./"$NATORI"; ./"$NATORI.alt" ) | less -rEXF else read -r -n 1 -p "Press any key to alternate between the southern/northern hemisphere Moon: " + echo 1>&2 ( ./"$NATORI.alt"; ./"$NATORI" ; ./"$NATORI.alt" ; ./"$NATORI"; \ - ./"$NATORI.alt"; ./"$NATORI" ) | less + ./"$NATORI.alt"; ./"$NATORI" ) | less -rEXF fi echo 1>&2 @@ -91,12 +100,14 @@ moon() echo 1>&2 if [[ "$RAND" -gt 500 ]]; then read -r -n 1 -p "Press any key to alternate between the northern/southern hemisphere Moon: " + echo 1>&2 ( ./"$NATORI"; ./"$NATORI.alt" ; ./"$NATORI" ; ./"$NATORI.alt"; \ - ./"$NATORI"; ./"$NATORI.alt" ) | less + ./"$NATORI"; ./"$NATORI.alt" ) | less -rEXF else read -r -n 1 -p "Press any key to alternate between the southern/northern hemisphere Moon: " + echo 1>&2 ( ./"$NATORI.alt"; ./"$NATORI" ; ./"$NATORI.alt" ; ./"$NATORI"; \ - ./"$NATORI.alt"; ./"$NATORI" ) | less + ./"$NATORI.alt"; ./"$NATORI" ) | less -rEXF fi echo 1>&2 @@ -107,12 +118,14 @@ moon() echo 1>&2 if [[ "$RAND" -le 499 ]]; then read -r -n 1 -p "Press any key to alternate between the northern/southern hemisphere Moon: " + echo 1>&2 ( ./"$NATORI"; ./"$NATORI.alt" ; ./"$NATORI" ; ./"$NATORI.alt"; \ - ./"$NATORI"; ./"$NATORI.alt" ) | less + ./"$NATORI"; ./"$NATORI.alt" ) | less -rEXF else read -r -n 1 -p "Press any key to alternate between the southern/northern hemisphere Moon: " + echo 1>&2 ( ./"$NATORI.alt"; ./"$NATORI" ; ./"$NATORI.alt" ; ./"$NATORI"; \ - ./"$NATORI.alt"; ./"$NATORI" ) | less + ./"$NATORI.alt"; ./"$NATORI" ) | less -rEXF fi echo 1>&2 @@ -121,12 +134,14 @@ moon() echo 1>&2 if [[ "$RAND" -le 499 ]]; then read -r -n 1 -p "Press any key to alternate between the northern/southern hemisphere Moon: " + echo 1>&2 ( ./"$NATORI"; ./"$NATORI.alt" ; ./"$NATORI" ; ./"$NATORI.alt"; \ - ./"$NATORI"; ./"$NATORI.alt" ) | less + ./"$NATORI"; ./"$NATORI.alt" ) | less -rEXF else read -r -n 1 -p "Press any key to alternate between the southern/northern hemisphere Moon: " + echo 1>&2 ( ./"$NATORI.alt"; ./"$NATORI" ; ./"$NATORI.alt" ; ./"$NATORI"; \ - ./"$NATORI.alt"; ./"$NATORI" ) | less + ./"$NATORI.alt"; ./"$NATORI" ) | less -rEXF fi echo 1>&2 } From ac860471da98b0c94dd4c1386a82d335b5f2738b Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:12:37 -0800 Subject: [PATCH 27/37] Improve 2000/primenum/try.sh --- 2000/primenum/try.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/2000/primenum/try.sh b/2000/primenum/try.sh index 0020aaee6..53e1f1697 100755 --- a/2000/primenum/try.sh +++ b/2000/primenum/try.sh @@ -16,19 +16,29 @@ make CC="$CC" all >/dev/null || exit 1 clear -echo "$ echo IOCCC 23209 | ./primenum 23209" 1>&2 +read -r -n 1 -p "Press any key to run: echo IOCCC 23209 | ./primenum 23209: " +echo 1>&2 echo IOCCC 23209 | ./primenum 23209 echo 1>&2 -echo "$ echo THIS MESSAGE IS IN ALL CAPS | ./primenum 32" 1>&2 +read -r -n 1 -p "Press any key to run: echo THIS MESSAGE IS IN ALL CAPS | ./primenum 32: " +echo 1>&2 echo THIS MESSAGE IS IN ALL CAPS | ./primenum 32 echo 1>&2 rm -f try.sh.txt -echo "$ ./primenum 101 < try.sh | ./primenum n > try.sh.txt" 1>&2 +read -r -n 1 -p "Press any key to run: ./primenum 101 < try.sh | ./primenum n > try.sh.txt: " +echo 1>&2 ./primenum 101 < try.sh | ./primenum n > try.sh.txt +echo 1>&2 + +read -r -n 1 -p "Press any key to show try.sh.txt (space = next page, q = quit): " +echo 1>&2 +less -rEXF try.sh.txt +echo 1>&2 + echo "$ diff try.sh try.sh.txt" read -r -n 1 -p "Press any key to see diff (space = next page, q = quit): " 1>&2 -diff try.sh try.sh.txt|less -EXF +diff try.sh try.sh.txt | less -rEXF rm -f try.sh.txt From bcf5abfd0410912beebc0641f012e34a044b5f59 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:17:34 -0800 Subject: [PATCH 28/37] Improve 2000/rince/try.sh --- 2000/rince/try.sh | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/2000/rince/try.sh b/2000/rince/try.sh index 2537b9246..375f04f1d 100755 --- a/2000/rince/try.sh +++ b/2000/rince/try.sh @@ -15,26 +15,42 @@ make CC="$CC" everything >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "$ ./rince" 1>&2 +read -r -n 1 -p "Press any key to run: ./rince: " +echo 1>&2 ./rince +echo 1>&2 -echo "$ ./rince 0.001 $(./dmy2jd 7.8 1 1610)" 1>&2 +read -r -n 1 -p "Press any key to run: ./rince 0.001 $(./dmy2jd 7.8 1 1610): " +echo 1>&2 ./rince 0.001 $(./dmy2jd 7.8 1 1610) +echo 1>&2 -echo "$ ./rince 0.01" 1>&2 +read -r -n 1 -p "Press any key to run: ./rince 0.01: " +echo 1>&2 ./rince 0.01 +echo 1>&2 -echo "$ ./rince 0 2441193.6" 1>&2 +read -r -n 1 -p "Press any key to run: ./rince 0 2441193.6: " +echo 1>&2 ./rince 0 2441193.6 +echo 1>&2 -echo "$ ./rince 0.01 2441193.6" 1>&2 +read -r -n 1 -p "Press any key to run: ./rince 0.01 2441193.6: " +echo 1>&2 ./rince 0.01 2441193.6 +echo 1>&2 -echo "$ ./rince 0 $(./dmy2jd 7.8 1 1610)" 1>&2 +read -r -n 1 -p "Press any key to run: ./rince 0 $(./dmy2jd 7.8 1 1610): " +echo 1>&2 ./rince 0 $(./dmy2jd 7.8 1 1610) +echo 1>&2 -echo "$ ./rince 0 $(./dmy2jd 8.8 1 1610)" 1>&2 +read -r -n 1 -p "Press any key to run: ./rince 0 $(./dmy2jd 8.8 1 1610): " +echo 1>&2 ./rince 0 $(./dmy2jd 8.8 1 1610) +echo 1>&2 -echo "$ ./rince 0 $(./dmy2jd 10.8 1 1610)" 1>&2 +read -r -n 1 -p "Press any key to run: ./rince 0 $(./dmy2jd 10.8 1 1610): " +echo 1>&2 ./rince 0 $(./dmy2jd 10.8 1 1610) +echo 1>&2 From f7ecec003f0e4d1449cff96767b26c5c26b6003a Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:25:37 -0800 Subject: [PATCH 29/37] Add 2000/schneiderwent/try.sh --- 2000/schneiderwent/README.md | 7 +++++++ 2000/schneiderwent/try.sh | 28 ++++++++++++++++++++++++++++ thanks-for-help.md | 5 +++++ 3 files changed, 40 insertions(+) create mode 100755 2000/schneiderwent/try.sh diff --git a/2000/schneiderwent/README.md b/2000/schneiderwent/README.md index f8b4aeaa1..10af15555 100644 --- a/2000/schneiderwent/README.md +++ b/2000/schneiderwent/README.md @@ -21,6 +21,13 @@ make What's the difference? +If you have a long while to spare (and you're bored enough that you could watch +paint dry :-) ) you might also try: + +```sh +./try.sh +``` + ## Judges' remarks: diff --git a/2000/schneiderwent/try.sh b/2000/schneiderwent/try.sh new file mode 100755 index 000000000..5af75696b --- /dev/null +++ b/2000/schneiderwent/try.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2000/schneiderwent +# + +# 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 + +echo "This will take a long time to run to completion: " 1>&2 +i=0 +while [[ "$i" -lt 60 ]]; do + ./schneiderwent + ./schneiderwent schneiderwent.data + sleep 60 + ((i++)) +done + + + diff --git a/thanks-for-help.md b/thanks-for-help.md index 4003752ed..c8a4a90f6 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2570,6 +2570,11 @@ on it to assign to the `int`s, much like with `1987/lievaart`. The strings are `char[5]` and the `%` specifier is `%4s` which is enough for the game. +## [2000/schneiderwent](/2000/schneiderwent/schneiderwent.c) ([README.md](/2000/schneiderwent/README.md])) + +[Cody](#cody) added the [try.sh](/2000/schneiderwent/try.sh) script. + + ## [2000/thadgavin](/2000/thadgavin/thadgavin.c) ([README.md](/2000/thadgavin/README.md])) [Cody](#cody) fixed the code and added an appropriate make rule so that the From ea4d465a541437282f1ef5239623473538d30f17 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:32:49 -0800 Subject: [PATCH 30/37] Improve 2000/tomx/try scripts --- 2000/tomx/try.alt.sh | 30 +++++++++++++++++++++--------- 2000/tomx/try.sh | 41 ++++++++++++++++++++++++++++------------- 2 files changed, 49 insertions(+), 22 deletions(-) diff --git a/2000/tomx/try.alt.sh b/2000/tomx/try.alt.sh index 0ffb04090..114925294 100755 --- a/2000/tomx/try.alt.sh +++ b/2000/tomx/try.alt.sh @@ -16,21 +16,33 @@ make CC="$CC" alt >/dev/null || exit 1 clear echo "Using tomx.alt.c to compile mkentry.c directly:" 1>&2 -echo "$ chmod +x tomx.alt.c" 1>&2 +read -r -n 1 -p "Press any key to run: chmod +x tomx.alt.c: " +echo 1>&2 chmod +x tomx.alt.c -echo "$ rm -f mkentry" 1>&2 -rm -f mkentry -echo "$ ./tomx.alt.c" 1>&2 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: rm -vf mkentry: " +echo 1>&2 +rm -vf mkentry +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./tomx.alt.c: " +echo 1>&2 ./tomx.alt.c echo 1>&2 echo "Using tomx.alt.c as a Makefile to compile mkentry.c:" 1>&2 -echo "$ rm -f mkentry" -rm mkentry -echo "$ make -f tomx.alt.c" 1>&2 +read -r -n 1 -p "Press any key to run: rm -vf mkentry: " +echo 1>&2 +rm -vf mkentry +echo 1>&2 + +read -r -n 1 -p "Press any key to run: make -f tomx.alt.c: " +echo 1>&2 make -f tomx.alt.c echo 1>&2 -echo "Running mkentry via tomx.alt:" 1>&2 -echo "$ ./tomx.alt" 1>&2 +read -r -n 1 -p "Press any key to run: ./tomx.alt: " +echo 1>&2 ./tomx.alt +echo 1>&2 diff --git a/2000/tomx/try.sh b/2000/tomx/try.sh index 82e9dcdc8..5d3a0aeb6 100755 --- a/2000/tomx/try.sh +++ b/2000/tomx/try.sh @@ -15,28 +15,43 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "Running tomx:" 1>&2 -echo "$ ./tomx" 1>&2 +read -r -n 1 -p "Press any key to run: ./tomx: " +echo 1>&2 ./tomx echo 1>&2 echo "Using source code to compile tomx.c: " 1>&2 -echo "$ rm -f tomx" 1>&2 -rm -f tomx -echo "$ chmod +x tomx.c" 1>&2 +read -r -n 1 -p "Press any key to run: rm -vf tomx: " +echo 1>&2 +rm -vf tomx +echo 1>&2 + +read -r -n 1 -p "Press any key to run: chmod +x tomx.c: " +echo 1>&2 chmod +x tomx.c -echo "$ ./tomx.c" 1>&2 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./tomx.c: " +echo 1>&2 ./tomx.c -echo "Running tomx again:" 1>&2 -echo "$ ./tomx" 1>&2 +echo 1>&2 +read -r -n 1 -p "Press any key to run: ./tomx (a second time): " +echo 1>&2 ./tomx echo 1>&2 echo "Using tomx.c as a Makefile:" 1>&2 -echo "$ rm -f tomx" 1>&2 -rm -f tomx -echo "$ make -f tomx.c" 1>&2 +read -r -n 1 -p "Press any key to run: rm -vf tomx: " +echo 1>&2 +rm -vf tomx +echo 1>&2 + +read -r -n 1 -p "Press any key to run: make -f tomx.c: " +echo 1>&2 make -f tomx.c -echo "Running tomx again:" 1>&2 -echo "$ ./tomx" +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./tomx (a third time): " +echo 1>&2 ./tomx +echo 1>&2 From a5302b26aa4d7d9f0d62f9b1572b40af7767ddcd Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:47:53 -0800 Subject: [PATCH 31/37] Improve 2001/anonymous/try.sh --- 2001/anonymous/try.sh | 59 ++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/2001/anonymous/try.sh b/2001/anonymous/try.sh index 5a91b07d3..1ca7ba798 100755 --- a/2001/anonymous/try.sh +++ b/2001/anonymous/try.sh @@ -19,26 +19,55 @@ clear TARGET="anonymous.ten" if [[ -f "$TARGET" ]]; then - echo "$ cp $TARGET anonymous.ten.bak" 1>&2 - cp "$TARGET" anonymous.ten.bak - echo "$ ./anonymous $TARGET" 1>&2 - ./anonymous "$TARGET" - echo "$ ./$TARGET" 1>&2 - ./"$TARGET" - echo "$ diff -s $TARGET anonymous.ten.bak" 1>&2 + read -r -n 1 -p "Press any key to run: cp -vf $TARGET anonymous.ten.bak: " + echo 1>&2 + cp -vf "$TARGET" anonymous.ten.bak + echo 1>&2 + + read -r -n 1 -p "Press any key to run: ./anonymous $TARGET (space = next page, q = quit): " + echo 1>&2 + ./anonymous "$TARGET" | less -rEXF + echo 1>&2 + + read -r -n 1 -p "Press any key to run: ./$TARGET (space = next page, q = quit): " + echo 1>&2 + ./"$TARGET" | less -rEXF + echo 1>&2 + + read -r -n 1 -p "Press any key to run: diff -s $TARGET anonymous.ten.bak: " + echo 1>&2 diff -s "$TARGET" anonymous.ten.bak - echo "$ od -t x1 $TARGET > ten.od" 1>&2 + echo 1>&2 + + read -r -n 1 -p "Press any key to run: od -t x1 $TARGET > ten.od: " + echo 1>&2 od -t x1 "$TARGET" > ten.od - echo "$ od -t x1 anonymous.ten.bak > ten.bak.od" 1>&2 + echo 1>&2 + + read -r -n 1 -p "Press any key to run: od -t x1 anonymous.ten.bak > ten.bak.od: " + echo 1>&2 od -t x1 anonymous.ten.bak > ten.bak.od - echo "$ diff ten.bak.od ten.od" 1>&2 + echo 1>&2 + + read -r -n 1 -p "Press any key to run: diff ten.bak.od ten.od: " + echo 1>&2 diff ten.bak.od ten.od - echo "$ ./$TARGET > ten.txt" 1>&2 - ./"$TARGET" > ten.txt - echo "$ ./anonymous.ten.bak > ten.bak.txt" 1>&2 - ./anonymous.ten.bak > ten.bak.txt - echo "$ diff -s ten.txt ten.bak.txt" 1>&2 + echo 1>&2 + + read -r -n 1 -p "Press any key to run: ./$TARGET | tee ten.txt (space = next page, q = quit): " + echo 1>&2 + ./"$TARGET" | tee ten.txt | less -rEXF + echo 1>&2 + + read -r -n 1 -p "Press any key to run: ./anonymous.ten.bak | tee ten.bak.txt (space = next page, q = quit): " + echo 1>&2 + ./anonymous.ten.bak | tee ten.bak.txt | less -rEXF + echo 1>&2 + + read -r -n 1 -p "Press any key to run: diff -s ten.txt ten.bak.txt: " + echo 1>&2 diff -s ten.txt ten.bak.txt + echo 1>&2 else echo "cannot compile anonymous.ten.c as 32-bit, sorry." echo "will run alt versions directly." From fab4368cd2667bc580cff04907a4f36fec49e1e1 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:50:24 -0800 Subject: [PATCH 32/37] Improve 2001/cheong/try.sh --- 2001/cheong/try.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/2001/cheong/try.sh b/2001/cheong/try.sh index d5f989e71..2d64f9750 100755 --- a/2001/cheong/try.sh +++ b/2001/cheong/try.sh @@ -15,21 +15,33 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "$ ./cheong 1024" 1>&2 +read -r -n 1 -p "Press any key to run: ./cheong 1024: " +echo 1>&2 ./cheong 1024 +echo 1>&2 -echo "$ ./cheong 0512" 1>&2 +read -r -n 1 -p "Press any key to run: ./cheong 0512: " +echo 1>&2 ./cheong 0512 +echo 1>&2 -echo "$ ./cheong 12345678901234567890" 1>&2 +read -r -n 1 -p "Press any key to run: ./cheong 12345678901234567890: " +echo 1>&2 ./cheong 12345678901234567890 +echo 1>&2 -echo "$ ./cheong 05305265226926441255040573044986873789" 1>&2 +read -r -n 1 -p "Press any key to run: ./cheong 05305265226926441255040573044986873789: " +echo 1>&2 ./cheong 05305265226926441255040573044986873789 +echo 1>&2 -echo "$ ./cheong 1234567890" 1>&2 +read -r -n 1 -p "Press any key to run: ./cheong 1234567890: " +echo 1>&2 ./cheong 1234567890 +echo 1>&2 -echo "$ ./cheong 0200000000000000000000000000" 1>&2 +read -r -n 1 -p "Press any key to run: ./cheong 0200000000000000000000000000: " +echo 1>&2 ./cheong 0200000000000000000000000000 +echo 1>&2 From c5202552b5a9e328fd02beaefd8add20dff778dc Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:56:28 -0800 Subject: [PATCH 33/37] Add 2001/herrmann1/try.sh --- 2001/herrmann1/README.md | 8 +------- 2001/herrmann1/try.sh | 31 +++++++++++++++++++++++++++++++ thanks-for-help.md | 2 ++ 3 files changed, 34 insertions(+), 7 deletions(-) create mode 100755 2001/herrmann1/try.sh diff --git a/2001/herrmann1/README.md b/2001/herrmann1/README.md index 1db935360..e01bb6140 100644 --- a/2001/herrmann1/README.md +++ b/2001/herrmann1/README.md @@ -31,13 +31,7 @@ need an older compiler perhaps gcc 2.95. ## Try: ```sh -./herrmann1.sh 'prg=herrmann1.times2' -``` - --or- - -```sh -./herrmann1.sh 'prg=herrmann1.gcd' +./try.sh ``` diff --git a/2001/herrmann1/try.sh b/2001/herrmann1/try.sh new file mode 100755 index 000000000..2fdbed0ea --- /dev/null +++ b/2001/herrmann1/try.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2001/herrmann1 +# + +# 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 + +# in this case we won't fail if we can't compile the code because we can still +# run the supplementary program. +make CC="$CC" everything >/dev/null + +# clear screen after compilation so that only the entry is shown +clear + +echo "$ ./herrmann1.sh 'prg=herrmann1.times2'" 1>&2 +read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " +echo 1>&2 +./herrmann1.sh 'prg=herrmann1.times2' +echo 1>&2 + +echo "$ ./herrmann1.sh 'prg=herrmann1.gcd'" 1>&2 +read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " +echo 1>&2 +./herrmann1.sh 'prg=herrmann1.gcd' +echo 1>&2 + diff --git a/thanks-for-help.md b/thanks-for-help.md index c8a4a90f6..b39f0116b 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2849,6 +2849,8 @@ SC2248 (style): Prefer double quoting even when variables don't contain special errors/warnings. +Cody also added the [try.sh](/2001/herrmann1/try.sh) script. + ## [2001/herrmann2](/2001/herrmann2/herrmann2.c) ([README.md](/2001/herrmann2/README.md])) From 7c9694177e9c4b0a02dd175dd9a15fccd849a00a Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:59:39 -0800 Subject: [PATCH 34/37] Improve 2001/herrmann2/try.sh --- 2001/herrmann2/try.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/2001/herrmann2/try.sh b/2001/herrmann2/try.sh index b5067120b..37f8eba28 100755 --- a/2001/herrmann2/try.sh +++ b/2001/herrmann2/try.sh @@ -28,7 +28,8 @@ echo "$ ./herrmann2 \ '++ &&r:b<<2+a +w) ((!main(n*n,V) , +-) ),l)),w= +T-->o +o+;{ &!'\ 'a;}return _+= ' < herrmann2.ioccc > herrmann2.orig.c && \ echo && diff -s herrmann2.alt.c herrmann2.orig.c" 1>&2 - +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 ./herrmann2 \ 'char*d,A[9876];e;b;*ad,a,c; tw,ndr,T; wri; ;*h; _,ar ;on;'\ ' ;l ;i(V)man,n {-!har ; =Aadre(0,&e,o||n -- +,o4,=9,l=b=8,'\ @@ -39,26 +40,31 @@ echo && diff -s herrmann2.alt.c herrmann2.orig.c" 1>&2 '++ &&r:b<<2+a +w) ((!main(n*n,V) , +-) ),l)),w= +T-->o +o+;{ &!'\ 'a;}return _+= ' < herrmann2.ioccc > herrmann2.orig.c && \ echo && diff -s herrmann2.alt.c herrmann2.orig.c - echo 1>&2 + echo "./herrmann2 "234 84 045 5 6765 7487 65190 84 656 254 12 43931 818 0 6542 \ 341 45 567 76967 7244 606 976567 895 81898 095 68678 1843 4650547 \ 565980691 389 04974" < herrmann2.ioccc" 1>&2 - +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 ./herrmann2 "234 84 045 5 6765 7487 65190 84 656 254 12 43931 818 0 6542 \ 341 45 567 76967 7244 606 976567 895 81898 095 68678 1843 4650547 \ 565980691 389 04974" < herrmann2.ioccc echo 1>&2 -rm -f ioccc.out ioccc.out2 +read -r -n 1 -p "Press any key to run: rm -vf ioccc.out ioccc.out2: " +echo 1>&2 +rm -vf ioccc.out ioccc.out2 + read -r -n 1 -p "Press any key to test the output a couple times on herrmann2.ioccc: " echo "$ ./herrmann2 < herrmann2.ioccc" 1>&2 ./herrmann2 < herrmann2.ioccc | tee ioccc.out sleep 2 echo "$ ./herrmann2 < herrmann2.ioccc" 1>&2 ./herrmann2 < herrmann2.ioccc | tee ioccc.out2 -echo "$ diff ioccc.out ioccc.out2" 1>&2 -diff ioccc.out ioccc.out2 +read -r -n 1 -p "Press any key to run: diff -s ioccc.out ioccc.out2: " +echo 1>&2 +diff -s ioccc.out ioccc.out2 rm -f ioccc.out ioccc.out2 echo 1>&2 @@ -68,7 +74,9 @@ echo "$ ./herrmann2 < herrmann2.cup" 1>&2 sleep 2 echo "$ ./herrmann2 < herrmann2.cup" 1>&2 ./herrmann2 < herrmann2.cup | tee cup.out2 -echo "$ diff cup.out cup.out2" 1>&2 -diff cup.out cup.out2 +read -r -n 1 -p "Press any key to run: diff -s cup.out cup.out2: " +echo 1>&2 +diff -s cup.out cup.out2 +echo 1>&2 rm -f cup.out cup.out2 From 2110b8873511c8177c2a2aca4ee8d0e8b92dfa85 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 10:05:33 -0800 Subject: [PATCH 35/37] Add 2001/ollinger/try.sh --- 2001/ollinger/README.md | 2 +- 2001/ollinger/try.sh | 43 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 2001/ollinger/try.sh diff --git a/2001/ollinger/README.md b/2001/ollinger/README.md index f16c4c078..3ba0d0556 100644 --- a/2001/ollinger/README.md +++ b/2001/ollinger/README.md @@ -15,7 +15,7 @@ make ## Try: ```sh -./ollinger 1000 | cut -c -200 +./try.sh ``` Try the above command in a large window, say 200 chars wide and 100 diff --git a/2001/ollinger/try.sh b/2001/ollinger/try.sh new file mode 100755 index 000000000..80998d955 --- /dev/null +++ b/2001/ollinger/try.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2001/ollinger +# + +# 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 + +# in this case we won't fail if we can't compile the code because we can still +# run the supplementary program. +make CC="$CC" everything >/dev/null + +# clear screen after compilation so that only the entry is shown +clear + +read -r -n 1 -p "Press any key to run: ./ollinger 1000 | cut -c -200 (space = next page, q = quit): " +echo 1>&2 +./ollinger 1000 | cut -c -200 | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./ollinger 1000 | cut -c -100 (space = next page, q = quit): " +echo 1>&2 +./ollinger 1000 | cut -c -100 | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./ollinger 42 (space = next page, q = quit): " +echo 1>&2 +./ollinger 42 | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./ollinger 42 | cut -c -100 (space = next page, q = quit): " +echo 1>&2 +./ollinger 42 | cut -c -100 | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./ollinger 42 | cut -c -200 (space = next page, q = quit): " +echo 1>&2 +./ollinger 42 | cut -c -200 | less -rEXF +echo 1>&2 From 1ef24be70c123af8f94c7c683240990847c0c0c7 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 10:08:32 -0800 Subject: [PATCH 36/37] Improve 2001/schweikh/try.sh --- 2001/schweikh/try.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/2001/schweikh/try.sh b/2001/schweikh/try.sh index 31366963e..f8a0f81c2 100755 --- a/2001/schweikh/try.sh +++ b/2001/schweikh/try.sh @@ -15,11 +15,17 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "$ ./schweikh foo 'f??'; echo \$?" 1>&2 +read -r -n 1 -p "Press any key to run: ./schweikh foo 'f??'; echo \$?: " +echo 1>&2 ./schweikh foo 'f??'; echo $? +echo 1>&2 -echo "$ ./schweikh 'best short program' '??st*o**p?*'; echo \$?" 1>&2 +read -r -n 1 -p "Press any key to run: ./schweikh 'best short program' '??st*o**p?*'; echo \$?: " +echo 1>&2 ./schweikh 'best short program' '??st*o**p?*'; echo $? +echo 1>&2 -echo "$ ./schweikh bar 'f??'; echo \$?" 1>&2 +read -r -n 1 -p "Press any key to run: ./schweikh bar 'f??'; echo \$?: " +echo 1>&2 ./schweikh bar 'f??'; echo $? +echo 1>&2 From 81da08da8d6d30083d0fb1d613fd40511ab414e5 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 10:18:07 -0800 Subject: [PATCH 37/37] Improve 2001/westley/try.sh --- 2001/westley/try.sh | 65 ++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/2001/westley/try.sh b/2001/westley/try.sh index 6490c564d..664af080b 100755 --- a/2001/westley/try.sh +++ b/2001/westley/try.sh @@ -15,40 +15,67 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "./westley < westley.c 2>/dev/null > westley2.c" 1>&2 -./westley < westley.c 2>/dev/null > westley2.c +echo "$ ./westley < westley.c 2>/dev/null | tee westley2.c" 1>&2 +read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " +echo 1>&2 +./westley < westley.c 2>/dev/null | tee westley2.c | less -rEXF + echo "Compiling westley2.c..." 1>&2 make CC="$CC" westley2 2>/dev/null 1>&2 -echo +echo 1>&2 echo "$ echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null" +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null -echo +echo 1>&2 +read -r -n 1 -p "Press any key to run: make CC=\"$CC\" westley.sort 2>/dev/null: " +echo 1>&2 make CC="$CC" westley.sort 2>/dev/null 1>&2 -echo -echo "./westley.sort < westley.c 2>/dev/null | diff - westley.c" +echo 1>&2 + +echo "$ ./westley.sort < westley.c 2>/dev/null | diff -s - westley.c" +read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " +echo 1>&2 # SC2094 (info): Make sure not to read and write the same file in the same pipeline. # shellcheck disable=SC2094 -./westley.sort < westley.c 2>/dev/null | diff - westley.c -echo "./westley.sort < westley.c 2>/dev/null | diff - westley2.c" -./westley.sort < westley.c 2>/dev/null | diff - westley2.c -echo "./westley.sort < westley.c 2>/dev/null | diff - westley.sort.c" -./westley.sort < westley.c 2>/dev/null | diff - westley.sort.c -echo "./westley.sort < westley.c 2>/dev/null | diff - westley.punch.c" -./westley.sort < westley.c 2>/dev/null | diff - westley.punch.c +./westley.sort < westley.c 2>/dev/null | diff -s - westley.c | less -rEXF +echo 1>&2 -echo +echo "$ ./westley.sort < westley.c 2>/dev/null | diff - westley2.c" +read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " +echo 1>&2 +./westley.sort < westley.c 2>/dev/null | diff -s - westley2.c | less -rEXF +echo 1>&2 + +echo "$ ./westley.sort < westley.c 2>/dev/null | diff - westley.sort.c" +read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " +echo 1>&2 +./westley.sort < westley.c 2>/dev/null | diff - westley.sort.c | less -rEXF +echo 1>&2 + +echo "$ ./westley.sort < westley.c 2>/dev/null | diff - westley.punch.c" +read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " +echo 1>&2 +./westley.sort < westley.c 2>/dev/null | diff - westley.punch.c | less -rEXF + +echo 1>&2 # SC2028 (info): echo may not expand escape sequences. Use printf. # shellcheck disable=SC2028 -echo "printf \"1\n\4\n5\" | ./westley 2>/dev/null" +read -r -n 1 -p "Press any key to run: printf \"1\n\4\n5\" | ./westley 2>/dev/null: " +echo 1>&2 printf "1\n4\n5" | ./westley 2>/dev/null +echo 1>&2 -echo +echo 1>&2 # SC2028 (info): echo may not expand escape sequences. Use printf. # shellcheck disable=SC2028 -echo "printf \"1\n4\n5\" | ./westley 2>/dev/null" +read -r -n 1 -p "Press any key to run: printf \"1\n4\n5\" | ./westley 2>/dev/null: " +echo 1>&2 printf "1\n4\n5" | ./westley 2>/dev/null +echo 1>&2 -echo -echo "echo 'Hello, world!' | ./westley.punch 2>/dev/null" +echo 1>&2 +read -r -n 1 -p "Press any key to run: echo 'Hello, world!' | ./westley.punch 2>/dev/null: " +echo 1>&2 echo 'Hello, world!' | ./westley.punch 2>/dev/null