From 21c7a08d9b6f12d5aee898c48d07fe500efc89ac Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 23 Dec 2023 09:27:57 -0800 Subject: [PATCH] Added 1986/hague/try.sh + input.txt Also actually deleted hague.alt.c which was supposed to be done in an earlier commit. --- 1986/hague/README.md | 13 ++++--------- 1986/hague/hague.alt.c | 28 ---------------------------- 1986/hague/input.txt | 3 +++ 1986/hague/try.sh | 33 +++++++++++++++++++++++++++++++++ thanks-for-help.md | 3 +++ 5 files changed, 43 insertions(+), 37 deletions(-) delete mode 100644 1986/hague/hague.alt.c create mode 100644 1986/hague/input.txt create mode 100755 1986/hague/try.sh diff --git a/1986/hague/README.md b/1986/hague/README.md index 405da1a5e..6166df86c 100644 --- a/1986/hague/README.md +++ b/1986/hague/README.md @@ -16,17 +16,12 @@ make all ### Try: ```sh -./hague 2>/dev/null -IOCCC -International Obfuscated C Code Contest -Jim Hague +./try.sh ``` -Also try: - -```sh -echo IOCCC | ./hague 2>/dev/null -``` +Note that you can run the program without feeding it anything and then type in a +message and line by line it will show the right output. Notice also how certain +characters will print a `?`. ## Judges' remarks: diff --git a/1986/hague/hague.alt.c b/1986/hague/hague.alt.c deleted file mode 100644 index 49973a91e..000000000 --- a/1986/hague/hague.alt.c +++ /dev/null @@ -1,28 +0,0 @@ -#define DIT ( -#define DAH ) -#define __DAH ++ -#define DITDAH * -#define DAHDIT for -#define DIT_DAH malloc -#define DAH_DIT fgets -#define _DAHDIT char -_DAHDIT _DAH_[]="ETIANMSURWDKGOHVFaLaPJBXCYZQb54a3d2f16g7c8a90l?e'b.s;i,d:" -;main DIT DAH{_DAHDIT -DITDAH _DIT,DITDAH DAH_,DITDAH DIT_, -DITDAH _DIT_,DITDAH DIT_DAH DIT -DAH,DITDAH DAH_DIT DIT DAH;DAHDIT -DIT _DIT=DIT_DAH DIT 81 DAH,DIT_=_DIT -__DAH;_DIT==DAH_DIT DIT _DIT,81,stdin DAH&&(_DIT[strlen(_DIT)-1]='\0',_DIT);__DIT -DIT'\n'DAH DAH DAHDIT DIT DAH_=_DIT;DITDAH -DAH_;__DIT DIT DITDAH -_DIT_?_DAH DIT DITDAH DIT_ DAH:'?'DAH,__DIT -DIT' 'DAH,DAH_ __DAH DAH DAHDIT DIT -DITDAH DIT_=2,_DIT_=_DAH_; DITDAH _DIT_&&DIT -DITDAH _DIT_!=DIT DITDAH DAH_>='a'? DITDAH -DAH_&223:DITDAH DAH_ DAH DAH; DIT -DITDAH DIT_ DAH __DAH,_DIT_ __DAH DAH -DITDAH DIT_+= DIT DITDAH _DIT_>='a'? DITDAH _DIT_-'a':0 -DAH;}_DAH DIT DIT_ DAH{ __DIT DIT -DIT_>3?_DAH DIT DIT_>>1 DAH:'\0'DAH;return -DIT_&1?'-':'.';}__DIT DIT DIT_ DAH _DAHDIT -DIT_;{DIT void DAH write DIT 1,&DIT_,1 DAH;} diff --git a/1986/hague/input.txt b/1986/hague/input.txt new file mode 100644 index 000000000..364f06392 --- /dev/null +++ b/1986/hague/input.txt @@ -0,0 +1,3 @@ +IOCCC +International Obfuscated C Code Contest +Jim Hague diff --git a/1986/hague/try.sh b/1986/hague/try.sh new file mode 100755 index 000000000..521d0ff49 --- /dev/null +++ b/1986/hague/try.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 1986/hague +# + +# 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 input.txt: " +echo 1>&2 +cat input.txt +echo 1>&2 + +read -r -n 1 -p "Press any key to feed input.txt to hague: " +echo 1>&2 +./hague < input.txt +echo 1>&2 + +read -r -n 1 -p "Press any key to run: echo IOCCC | ./hague: " +echo 1>&2 +echo IOCCC | ./hague + + + diff --git a/thanks-for-help.md b/thanks-for-help.md index bb08c871b..2928d2a51 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -349,6 +349,9 @@ Cody also added the [try.sh](/1985/sicherman/try.sh) script. [Cody](#cody) made this use `fgets()`. +Cody also added the [try.sh](1986/hague/try.sh) script which also feeds to the +program the added `input.txt` file. + ## [1986/holloway](/1986/holloway/holloway.c) ([README.md](/1986/holloway/README.md]))