diff --git a/1986/bright/try.sh b/1986/bright/try.sh index ed7eef0bb..de42f3483 100755 --- a/1986/bright/try.sh +++ b/1986/bright/try.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# try.sh - demonstrate IOCCC winner 2000/tomx +# try.sh - demonstrate IOCCC winner 1986/bright # # make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it diff --git a/2012/blakely/.gitignore b/2012/blakely/.gitignore index 94feba676..ceac26a4c 100644 --- a/2012/blakely/.gitignore +++ b/2012/blakely/.gitignore @@ -3,14 +3,8 @@ blakely blakely.orig *.dSYM -empty.gif -flat.gif +*.gif indent indent.c indent.o -output.gif -paraboloid.gif -pic.gif prog.orig -ripple.gif -saddle.gif diff --git a/2012/blakely/try.sh b/2012/blakely/try.sh index 4dc9c11ef..71e265a59 100755 --- a/2012/blakely/try.sh +++ b/2012/blakely/try.sh @@ -15,21 +15,34 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "$ ./blakely "xx*yy*+" 64 > paraboloid.gif" 1>&2 -./blakely "xx*yy*+" 64 > paraboloid.gif +read -r -n 1 -p "Press any key to run: ./blakely 'xx*yy*+' 64 > paraboloid.gif: " +echo 1>&2 +echo "This might take a bit of time, please be patient." 1>&2 +./blakely 'xx*yy*+' 64 > paraboloid.gif +echo 1>&2 -echo "$ ./blakely 9 32 > empty.gif 1>&2" +read -r -n 1 -p "Press any key to run: ./blakely 9 32 > empty.gif: " +echo 1>&2 ./blakely 9 32 > empty.gif +echo 1>&2 -echo "$ ./blakely xy* 32 > saddle.gif" 1>&2 -./blakely xy* 32 > saddle.gif +read -r -n 1 -p "Press any key to run: ./blakely 'xy*' 32 > saddle.gif: " +echo 1>&2 +echo "This might take a little bit of time, please be patient." 1>&2 +./blakely 'xy*' 32 > saddle.gif +echo 1>&2 -echo "$ ./blakely xx*yy*1++d5*ct/ 64 > ripple.gif" 1>&2 -./blakely xx*yy*1++d5*ct/ 64 > ripple.gif +read -r -n 1 -p "Press any key to run: ./blakely 'xx*yy*1++d5*ct/' 64 > ripple.gif: " +echo 1>&2 +echo "This might take a bit of time, please be patient." 1>&2 +./blakely 'xx*yy*1++d5*ct/' 64 > ripple.gif +echo 1>&2 -echo "This might take a bit of time:" 1>&2 -echo "$ time ./blakely 0 250 > flat.gif" 1>&2 +read -r -n 1 -p "Press any key to run: time ./blakely 0 250 > flat.gif: " +echo 1>&2 +echo "This might take a while, please be patient." 1>&2 time ./blakely 0 250 > flat.gif +echo 1>&2 echo "Now open paraboloid.gif, empty.gif, saddle.gif, ripple.gif and flat.gif in a" 1>&2 -echo "viewer that shows animated GIFs." 1>&2 +echo "graphics viewer that ANIMATES ANIMATED GIFs." 1>&2 diff --git a/2012/deckmyn/.gitignore b/2012/deckmyn/.gitignore index 2ea892cd5..9b9af080d 100644 --- a/2012/deckmyn/.gitignore +++ b/2012/deckmyn/.gitignore @@ -1,15 +1,12 @@ # # sort with: sort -d -u -beethoven.pbm -blank.pbm *.dSYM deckmyn deckmyn.orig example_greensleeves -greensleeves.pbm indent indent.c indent.o -output.pbm +*.pbm +*.png prog.orig -sheetmusic.pbm diff --git a/2012/deckmyn/try.sh b/2012/deckmyn/try.sh index ef62403dc..cc1ef3566 100755 --- a/2012/deckmyn/try.sh +++ b/2012/deckmyn/try.sh @@ -15,26 +15,67 @@ 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 deckmyn.c through less (space = next page, q = quit): " +read -r -n 1 -p "Press any key to show deckmyn.c (space = next page, q = quit): " echo 1>&2 -less deckmyn.c +less -rEXF deckmyn.c echo 1>&2 + echo "$ ./deckmyn "\$\(cat deckmyn.c\)" "\$\(cat example_greensleeves\)" 2>/dev/null > greensleeves.pbm" 1>&2 -./deckmyn "$(cat deckmyn.c)" "$(cat example_greensleeves)" 2>/dev/null > greensleeves.pbm +read -r -n 1 -p "Press any key to continue: " echo 1>&2 -echo "Now open greensleeves.pbm in your image viewer of choice." 1>&2 +./deckmyn "$(cat deckmyn.c)" "$(cat example_greensleeves)" 2>/dev/null > greensleeves.pbm echo 1>&2 echo "$ ./deckmyn "\$\(cat deckmyn.c\)" "\$\(cat example_beethoven\)" 2>/dev/null > beethoven.pbm" 1>&2 read -r -n 1 -p "Press any key to continue: " echo 1>&2 ./deckmyn "$(cat deckmyn.c)" "$(cat example_beethoven)" 2>/dev/null > beethoven.pbm -echo "Now open beethoven.pbm in your image viewer of choice." 1>&2 echo 1>&2 echo "$ ./deckmyn "\$\(cat deckmyn.c\)" \"sz sa x s1 x s1 x s1 x s1 x s1 \" 2>/dev/null > blank.pbm" 1>&2 read -r -n 1 -p "Press any key to continue: " echo 1>&2 ./deckmyn "$(cat deckmyn.c)" "sz sa x s1 x s1 x s1 x s1 x s1 " 2>/dev/null > blank.pbm -echo "Now open blank.pbm in your image viewer of choice." 1>&2 +echo 1>&2 +# Convert pbm files to png files if convert(1) is found in case the user does +# not have a viewer of pbm files. At the end we will check for png files to ake +# sure that there was at least one conversion. If that does not happen as long +# as there are pbm files those will be listed instead. Otherwise something went +# wrong and we warn the user about it. +CONVERT="$(type -P convert)" +if [[ -n "$CONVERT" && -f "$CONVERT" && -x "$CONVERT" ]]; then + if [[ -f "greensleeves.pbm" ]]; then + if "$CONVERT" greensleeves.pbm greensleeves.png; then + echo "Converted greensleeves.pbm to greensleeves.png." 1>&2 + fi + fi + if [[ -f "beethoven.pbm" ]]; then + if "$CONVERT" beethoven.pbm beethoven.png; then + echo "Converted beethoven.pbm to beethoven.png." 1>&2 + fi + fi + if [[ -f "blank.pbm" ]]; then + if "$CONVERT" blank.pbm blank.png; then + echo "Converted blank.pbm to blank.png." 1>&2 + fi + fi +fi + +# Now tell the user to look at png files if any exist and otherwise any pbm +# files if any exist. If no files exist then something went wrong so show a +# warning message. +if [[ ! "$(find . -name '*.png')" ]]; then + echo "Now open the following files with your image viewer of choice:" 1>&2 + echo 1>&2 + find . -name '*.png' -printf " %p\n" +elif [[ ! "$(find . -name '*.pbm')" ]]; then + echo "Now open the following files with your image viewer of choice:" 1>&2 + echo 1>&2 + find . -name '*.pbm' -printf " %p\n" +else + echo "-=-=-" 1>&2 + echo "Notice: failed to write any image files. Free free to fix and open a" 1>&2 + echo "pull request against the GitHub repo." 1>&2 + echo "-=-=-" 1>&2 +fi diff --git a/2012/endoh1/.gitignore b/2012/endoh1/.gitignore index 11c2f090c..2bf7c2e2b 100644 --- a/2012/endoh1/.gitignore +++ b/2012/endoh1/.gitignore @@ -5,7 +5,9 @@ configuration.txt endoh1 endoh1.alt endoh1.alt2 +endoh1.alt3 endoh1_color +endoh1_color2 endoh1_color.alt endoh1_color.alt2 endoh1.orig diff --git a/2012/endoh1/Makefile b/2012/endoh1/Makefile index 2b40032f6..d64d108d8 100644 --- a/2012/endoh1/Makefile +++ b/2012/endoh1/Makefile @@ -115,8 +115,8 @@ DATA= column.txt column2.txt column3.txt corners.txt dripping-pan.txt \ funnel3.txt leidenfrost.txt logo.txt pour-out.txt tanada.txt TARGET= ${PROG} ${PROG}_color # -ALT_OBJ= ${PROG}.alt.o ${PROG}_color.alt.o -ALT_TARGET= ${PROG}.alt ${PROG}_color.alt +ALT_OBJ= ${PROG}.alt.o ${PROG}_color.alt.o ${PROG}.alt2.o +ALT_TARGET= ${PROG}.alt ${PROG}_color.alt ${PROG}.alt2 # The factor of gravity # @@ -167,9 +167,7 @@ ${PROG}.alt: ${PROG}.alt.c ${PROG}_color.alt: ${PROG}_color.alt.c ${CC} ${CFLAGS} -DS=${SLEEP} -DA=${TIMER} $< -o $@ ${LDFLAGS} -alt2: ${PROG}.alt2 - @${TRUE} - +# deobfuscated version: ${PROG}.alt2: ${PROG}.alt2.c ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} diff --git a/2012/endoh1/README.md b/2012/endoh1/README.md index 31a206162..6331c1a17 100644 --- a/2012/endoh1/README.md +++ b/2012/endoh1/README.md @@ -6,31 +6,36 @@ make There are two alt versions that let you control the compile time variables that control the fluid behaviour and the added variables to speed up or slow down the fluid as well as setting a timeout (if not 0): one for the original black and -white and the colour one added by the author at the request of the judges. -Another version is the deobfuscated version provided by the author as well. See -[alternate code](#alternate-code) below for more details. +white and one for the colour one added by the author (at the request of the +judges at the time of the contest). Another version is the deobfuscated version +provided by the author as well. See the [Alternate code](#alternate-code) +section below for more details. ## To use: ```sh -./endoh1 < configuration.txt +./endoh1 < file ``` +WARNING: if you're sensitive to/don't like flashing colours/text or just want to +see what this looks like not going so fast then you might wish to try the +[Alternate code](#alternate-code) instead. + ## Try: ```sh -./endoh1 < endoh1.c +./try.bw.sh endoh1.c +./try.sh endoh1.c -./endoh1 < pour-out.txt +./try.bw.sh pour-out.txt +./try.sh pour-out.txt -./endoh1 < fountain.txt +./try.bw.sh fountain.txt +./try.sh fountain.txt ``` -Also try using `endoh1_color` as you would `endoh1` above. `make` will compile -this by default. - ## Alternate code: @@ -46,46 +51,19 @@ the fluid and change the behaviour of the fluid. The file For the default values, try: ```sh -make alt alt2 +make alt ``` -The `alt2` is only necessary if you wish to compile the deobfuscated version but -it is equivalent in function to the original entry, [endoh1.c](endoh1.c). - In the `alt` versions a default time of 10 seconds is set as an alarm so that -one can more easily go through the list of files to see them all in succession -for fun. That is controlled by the variable `A`; 0 disables it. - -If you wish to change the speed you should do: +one can more easily go through the list of files to see them all in succession, +for fun. That is controlled by the variable `TIMER` at compilation. +For instance if you wish to change the value to 5: ```sh -make clobber SLEEP=N alt +make clobber TIMER=5 alt ``` -where `N` is number or the letter `I`. - -WARNING: if you're sensitive to flashing colours or any flashing at all do make -sure you don't decrease the value of `S`, the sleep time passed to `usleep(3)`, -too much. - -If however you wish to change the gravity factor, pressure factor and/or -viscosity factor, you should redefine the values `G`, `P` and/or `V` macros, -respectively, with the same caveat about numbers for `S` above. For instance if -you wish to change the viscosity and pressure factors but leave the other macros -alone: - -```sh -make clobber VISCOSITY=X PRESSURE=Y alt -``` - -where `X` and `Y` are numbers or the letter `I` and which are, respectively, the -viscosity and pressure factors. - -There is no restriction on what the number is because doing so prevents the -macros from being defined to `I` which would prevent the author's remarks about -it from being done. - -If you want to disable the alarm time, set `A` to 0: +If you want to disable the alarm time, set it to 0: ```sh make clobber TIMER=0 alt @@ -93,26 +71,41 @@ make clobber TIMER=0 alt It cannot be < 0 or > 60 (arbitrarily selected). -Try slowing down the display by increasing the sleep time from `12321` to -`50000`: +The `SLEEP` variable is to delay the time between updates to make it easier to +see and to not flash too quickly. The code protects against a value < 0 and +defaults to 12321 but you can change it to. For instance to slow it down you +could increase the sleep time from `12321` to `50000`: ```sh make clobber SLEEP=50000 alt ``` -Now try using both `endoh1.alt` and `endoh1_color.alt` as you would `endoh1` above. -Also try speeding up the display by decreasing the sleep time from `12321` to +If you wish to speed it up you might decrease the sleep time from `12321` to `9999`: ```sh -make clobber SLEEP=9999 alt2 +make clobber SLEEP=9999 alt ``` -WARNING: again, be careful with too low a value if you're sensitive to flashing -colours or anything at all. +WARNING: the lower the value the faster it will flash so be careful if you're +sensitive to this. + + +If you wish to change the gravity factor, pressure factor and/or +viscosity factor, you should redefine the values `GRAVITY`, `PRESSURE` and/or +`VISCOSITY` macros, respectively. For instance if you wish to change the +viscosity and pressure factors but leave the other values alone: + +```sh +make clobber VISCOSITY=X PRESSURE=Y alt +``` + +where `X` and `Y` are numbers or the letter `I` and which are, respectively, the +viscosity and pressure factors. There is no attempt to check the value or type +because doing so prevents the macros from being defined to `I` which would +prevent the author's remarks about it from being done. -Now try using both `endoh1.alt` and `endoh1_color.alt` as you would `endoh1` above. You might also wish to try redefining the macros `G`, `P` and/or `V`. For instance: @@ -128,7 +121,13 @@ You might try even: make clobber GRAVITY=I alt ``` -See the author's remarks for details on these macros. +See the author's remarks for details on these macros where: + +``` +G = GRAVITY +P = PRESSURE +V = VISCOSITY +``` ### Alternate use: @@ -148,6 +147,12 @@ try: The second run of each will be with the gravity factor set to `I`. +To see the same thing but in the original uncoloured version, try: + +```sh +./try.alt.bw.sh +``` + ## Judges' remarks: diff --git a/2012/endoh1/endoh1.alt.c b/2012/endoh1/endoh1.alt.c index 465ab5f4b..31ba020c2 100644 --- a/2012/endoh1/endoh1.alt.c +++ b/2012/endoh1/endoh1.alt.c @@ -3,7 +3,7 @@ # include //|||| ,____. IOCCC- # # ifndef S # define S 12321 -# elif S < 1 +# elif S < 0 # undef S # define S 12321 # endif diff --git a/2012/endoh1/try.alt.bw.sh b/2012/endoh1/try.alt.bw.sh new file mode 100755 index 000000000..041acfb48 --- /dev/null +++ b/2012/endoh1/try.alt.bw.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash +# +# try.alt.bw.sh - demonstrate IOCCC winner 2012/endoh1 alt code w/o colour +# + +# 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. +[[ -z "$CC" ]] && CC="cc" + +# We will use a timer (alarm(3) value) of 10 (the default) but we will allow the +# user to redefine it. The code protects against negative values and values > 60 +# (arbitrary) but if the user is silly enough to specify a value that is not a +# number that's on them. +[[ -z "$TIMER" ]] && TIMER=10 + +# We will use a sleep value of 39000 but just like the others we will let the +# user override it if they so wish. The code protects against values < 0 but if +# someone chooses a value that's not a number that's on them. +[[ -z "$SLEEP" ]] && SLEEP=39000 + +# We will let users redefine GRAVITY but only for the version that is NOT I +# (letter I not digit 1). Just like the others we do not protect against input +# that is not a number and in the case of GRAVITY it is even documented that +# some non number values (I) are good to try. +[[ -z "$GRAVITY" ]] && GRAVITY=1 + +# We will use the default 8 for VISCOSITY but we'll allow the user to redefine +# it. We don't protect against < 0 as it doesn't seem to break the program to +# have < 0 but if they set it to a non number value that's on them. +[[ -z "$VISCOSITY" ]] && VISCOSITY=8 + +# We will use the default PRESSURE of 4 but like the other variables we will let +# the user redefine it. We do not protect against any value, even non-numbers. +# If someone wants to set it to something else that's on them. +[[ -z "$PRESSURE" ]] && PRESSURE=4 + +# unlike other try.sh/try.alt.sh scripts this one has two compiled binaries: one +# which sets the gravity factor to I (letter I, not digit 1) and the other that +# does not. Thus we do not compile it like the others. +echo "$ make clobber CC=$CC TIMER=$TIMER SLEEP=$SLEEP GRAVITY=I VISCOSITY=$VISCOSITY PRESSURE=$PRESSURE alt" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +make clobber CC="$CC" TIMER="$TIMER" SLEEP="$SLEEP" GRAVITY=I VISCOSITY="$VISCOSITY" PRESSURE="$PRESSURE" alt >/dev/null || exit 1 +# we have to move the endoh1.alt to endoh1.alt3, not alt2, because +# we have to use make clobber which would wipe out endoh1.alt2. +read -r -n 1 -p "Press any key to move endoh1.alt to endoh1.alt3: " +echo 1>&2 +mv -v endoh1.alt endoh1.alt3 +echo 1>&2 +echo "$ make clobber CC=$CC TIMER=$TIMER SLEEP=$SLEEP GRAVITY=$GRAVITY VISCOSITY=$VISCOSITY PRESSURE=$PRESSURE alt" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +make clobber CC="$CC" TIMER="$TIMER" SLEEP="$SLEEP" GRAVITY="$GRAVITY" VISCOSITY="$VISCOSITY" PRESSURE="$PRESSURE" alt >/dev/null || exit 1 +read -r -n 1 -p "Press any key to move endoh1.alt3 to endoh1.alt2: " +echo 1>&2 +mv -v endoh1.alt3 endoh1.alt2 +# clear screen before continuing +clear + +# now that we have both binaries we can run each one on the data files, first +# the source file. +read -r -n 1 -p "Press any key to run: ./endoh1.alt < endoh1.alt.c 2>/dev/null: " +echo 1>&2 +./endoh1.alt < endoh1.alt.c 2>/dev/null +echo 1>&2 +# reset terminal sanity +reset +read -r -n 1 -p "Press any key to run: ./endoh1.alt2 < endoh1.alt.c 2>/dev/null: " +echo 1>&2 +./endoh1.alt2 < endoh1.alt.c 2>/dev/null +# reset terminal sanity +reset + +# for each of the supplied text files we will run both 'versions' on them, in +# succession, prompting the user for each text file so they know the name. +for i in clock.txt column.txt column2.txt column3.txt corners.txt \ + dripping-pan.txt evaporation.txt flat.txt fountain.txt funnel.txt \ + funnel2.txt funnel3.txt glass-half-empty.txt leidenfrost.txt logo.txt \ + pour-out.txt tanada.txt; do + + # to make it more 'fluid' :-) we only prompt once per file even though the + # second command is a different file in that the gravity factor is set to I. + read -r -n 1 -p "Press any key to run: ./endoh1.alt < $i: " + clear + ./endoh1.alt < "$i" 2>/dev/null + clear + ./endoh1.alt2 < "$i" 2>/dev/null + # reset terminal sanity + reset +done diff --git a/2012/endoh1/try.alt.sh b/2012/endoh1/try.alt.sh index 56a48d044..8e5b869ae 100755 --- a/2012/endoh1/try.alt.sh +++ b/2012/endoh1/try.alt.sh @@ -1,34 +1,76 @@ #!/usr/bin/env bash # -# try.alt.sh - demonstrate IOCCC winner 2012/endoh1 alt code +# try.alt.sh - demonstrate IOCCC winner 2012/endoh1 alt code with colour # # 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 +[[ -z "$CC" ]] && CC="cc" +# We will use a timer (alarm(3) value) of 10 (the default) but we will allow the +# user to redefine it. The code protects against negative values and values > 60 +# (arbitrary) but if the user is silly enough to specify a value that is not a +# number that's on them. +[[ -z "$TIMER" ]] && TIMER=10 + +# We will use a sleep value of 39000 but just like the others we will let the +# user override it if they so wish. The code protects against values < 0 but if +# someone chooses a value that's not a number that's on them. +[[ -z "$SLEEP" ]] && SLEEP=39000 + +# We will let users redefine GRAVITY but only for the version that is NOT I +# (letter I not digit 1). Just like the others we do not protect against input +# that is not a number and in the case of GRAVITY it is even documented that +# some non number values (I) are good to try. +[[ -z "$GRAVITY" ]] && GRAVITY=1 + +# We will use the default 8 for VISCOSITY but we'll allow the user to redefine +# it. We don't protect against < 0 as it doesn't seem to break the program to +# have < 0 but if they set it to a non number value that's on them. +[[ -z "$VISCOSITY" ]] && VISCOSITY=8 + +# We will use the default PRESSURE of 4 but like the other variables we will let +# the user redefine it. We do not protect against any value, even non-numbers. +# If someone wants to set it to something else that's on them. +[[ -z "$PRESSURE" ]] && PRESSURE=4 # unlike other try.sh/try.alt.sh scripts this one has two compiled binaries: one -# which sets the gravity factor to I and the other that does not. -make clobber CC="$CC" TIMER=10 GRAVITY=I SLEEP=39000 alt >/dev/null || exit 1 +# which sets the gravity factor to I (letter I, not digit 1) and the other that +# does not. Thus we do not compile it like the others. +echo "$ make clobber CC=$CC TIMER=$TIMER SLEEP=$SLEEP GRAVITY=I VISCOSITY=$VISCOSITY PRESSURE=$PRESSURE alt" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +make clobber CC="$CC" TIMER="$TIMER" SLEEP="$SLEEP" GRAVITY=I VISCOSITY="$VISCOSITY" PRESSURE="$PRESSURE" alt >/dev/null || exit 1 # we have to move the endoh1_color.alt to endoh1_color.alt3, not alt2, because # we have to use make clobber which would wipe out endoh1_color.alt2. -mv endoh1_color.alt endoh1_color.alt3 -make clobber CC="$CC" TIMER=10 SLEEP=39000 alt >/dev/null || exit 1 -read -r -n 1 -p "Press any key run run slower fluid on endoh1_color.alt.c: " -mv endoh1_color.alt3 endoh1_color.alt2 +read -r -n 1 -p "Press any key to move endoh1_color.alt to endoh1_color.alt3: " +echo 1>&2 +mv -v endoh1_color.alt endoh1_color.alt3 +echo 1>&2 +echo "$ make clobber CC=$CC TIMER=$TIMER SLEEP=$SLEEP GRAVITY=$GRAVITY VISCOSITY=$VISCOSITY PRESSURE=$PRESSURE alt" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +make clobber CC="$CC" TIMER="$TIMER" SLEEP="$SLEEP" GRAVITY="$GRAVITY" VISCOSITY="$VISCOSITY" PRESSURE="$PRESSURE" alt >/dev/null || exit 1 +read -r -n 1 -p "Press any key to move endoh1_color.alt3 to endoh1_color.alt2: " +echo 1>&2 +mv -v endoh1_color.alt3 endoh1_color.alt2 # clear screen before continuing clear - # now that we have both binaries we can run each one on the data files, first # the source file. +read -r -n 1 -p "Press any key to run: ./endoh1_color.alt < endoh1_color.alt.c 2>/dev/null: " +echo 1>&2 ./endoh1_color.alt < endoh1_color.alt.c 2>/dev/null +echo 1>&2 +# reset terminal sanity +reset +read -r -n 1 -p "Press any key to run: ./endoh1_color.alt2 < endoh1_color.alt.c 2>/dev/null: " +echo 1>&2 ./endoh1_color.alt2 < endoh1_color.alt.c 2>/dev/null -clear +# reset terminal sanity +reset # for each of the supplied text files we will run both 'versions' on them, in # succession, prompting the user for each text file so they know the name. @@ -40,8 +82,10 @@ for i in clock.txt column.txt column2.txt column3.txt corners.txt \ # to make it more 'fluid' :-) we only prompt once per file even though the # second command is a different file in that the gravity factor is set to I. read -r -n 1 -p "Press any key to run: ./endoh1_color.alt < $i: " + clear ./endoh1_color.alt < "$i" 2>/dev/null clear ./endoh1_color.alt2 < "$i" 2>/dev/null - clear + # reset terminal sanity + reset done diff --git a/2012/endoh1/try.bw.sh b/2012/endoh1/try.bw.sh new file mode 100755 index 000000000..81609887a --- /dev/null +++ b/2012/endoh1/try.bw.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# +# try.bw.sh - demonstrate IOCCC winner 2012/endoh1 w/o colour +# + +# 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 + +if [[ "$#" -ne 1 ]]; then + echo "usage: $0 file" 1>&2 + exit 1 +fi + +read -r -n 1 -p "Press any key to run: ./endoh1 < $1 (ctrl-c/intr to end program): " +./endoh1 < "$1" diff --git a/2012/endoh1/try.sh b/2012/endoh1/try.sh new file mode 100755 index 000000000..4c211c98a --- /dev/null +++ b/2012/endoh1/try.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2012/endoh1 with colour +# + +# 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 + +if [[ "$#" -ne 1 ]]; then + echo "usage: $0 file" 1>&2 + exit 1 +fi + +read -r -n 1 -p "Press any key to run: ./endoh1_color < $1 (ctrl-c/intr to end program): " +./endoh1_color < "$1" diff --git a/2012/endoh2/try.sh b/2012/endoh2/try.sh index 5c0acae4a..0d8a57cba 100755 --- a/2012/endoh2/try.sh +++ b/2012/endoh2/try.sh @@ -17,11 +17,17 @@ clear run() { - local program="$1" - echo "" 1>&2 - read -r -n 1 -p "Press any key to run: ./${program} (space = next page, q = quit): " - "./${program}" | less -K -E -X + if [[ "$#" -eq 0 ]]; then + echo "$0: run() expects at least 1 arg, got: $#" 1>&2 + return + fi + + echo 1>&2 + read -r -n 1 -p "Press any key to run: ./$1 (space = next page, q = quit): " + echo 1>&2 + ./"$1" | less -rKEXF } + run pi run 314 run 3141 diff --git a/2012/grothe/README.md b/2012/grothe/README.md index fd5da73ec..89e846724 100644 --- a/2012/grothe/README.md +++ b/2012/grothe/README.md @@ -25,11 +25,7 @@ more shared files with their proper numbers): ## Try: ```sh -./grothe -grothe.c 1+grothe.c.1 2+grothe.c.2 - -./grothe -cookie_recipe.txt 1-/dev/urandom 2-/dev/urandom 1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat - -./grothe 1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat 4+cookie_recipe_restore.txt +./try.sh ``` diff --git a/2012/grothe/cookie_piece1.dat b/2012/grothe/cookie_piece1.dat index dd3742e1c..88f8d76d2 100644 Binary files a/2012/grothe/cookie_piece1.dat and b/2012/grothe/cookie_piece1.dat differ diff --git a/2012/grothe/cookie_piece2.dat b/2012/grothe/cookie_piece2.dat index 77f68d417..5098b1373 100644 Binary files a/2012/grothe/cookie_piece2.dat and b/2012/grothe/cookie_piece2.dat differ diff --git a/2012/grothe/cookie_piece3.dat b/2012/grothe/cookie_piece3.dat index b17cd5f59..d13b06ab8 100644 Binary files a/2012/grothe/cookie_piece3.dat and b/2012/grothe/cookie_piece3.dat differ diff --git a/2012/grothe/cookie_piece4.dat b/2012/grothe/cookie_piece4.dat index fd9a4a61d..5efa2642b 100644 Binary files a/2012/grothe/cookie_piece4.dat and b/2012/grothe/cookie_piece4.dat differ diff --git a/2012/grothe/cookie_recipe.txt b/2012/grothe/cookie_recipe.txt index 4a2a786b1..59c239204 100644 --- a/2012/grothe/cookie_recipe.txt +++ b/2012/grothe/cookie_recipe.txt @@ -2,7 +2,7 @@ This is based on the Urban Legend about Neiman Marcus charging $25,000 for their cookie recipe. No one knows the source, but the recipe does make good cookies and a LOT of them. Recipe is in Public Domain. -From Steve's Recipe Database http://recipes.stevex.net/ +From Steve's Recipe Database https://www.mealsteps.com. Title: $25,000 Cookies Yield: 112 Servings diff --git a/2012/grothe/cookie_recipe_restore.txt b/2012/grothe/cookie_recipe_restore.txt index 4a2a786b1..59c239204 100644 --- a/2012/grothe/cookie_recipe_restore.txt +++ b/2012/grothe/cookie_recipe_restore.txt @@ -2,7 +2,7 @@ This is based on the Urban Legend about Neiman Marcus charging $25,000 for their cookie recipe. No one knows the source, but the recipe does make good cookies and a LOT of them. Recipe is in Public Domain. -From Steve's Recipe Database http://recipes.stevex.net/ +From Steve's Recipe Database https://www.mealsteps.com. Title: $25,000 Cookies Yield: 112 Servings diff --git a/2012/grothe/try.sh b/2012/grothe/try.sh index 1a7945d7f..153728b47 100755 --- a/2012/grothe/try.sh +++ b/2012/grothe/try.sh @@ -12,22 +12,24 @@ fi make CC="$CC" all >/dev/null || exit 1 -read -r -n 1 -p "Press any key to break recipe into crumbs: " -echo 1>&2 echo "$ ./grothe -cookie_recipe.txt 1-/dev/urandom 2-/dev/urandom \\ 1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat" +read -r -n 1 -p "Press any key to continue (break recipe into crumbs): " +echo 1>&2 +./grothe -cookie_recipe.txt 1-/dev/urandom 2-/dev/urandom \ + 1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat echo 1>&2 -read -r -n 1 -p "Press any key to restore cookie recipe: " -echo 1>&2 echo "$ ./grothe 1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat +cookie_recipe_restore.txt" 1>&2 +./grothe 1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat +cookie_recipe_restore.txt +read -r -n 1 -p "Press any key to continue (restore cookie recipe): " echo 1>&2 -read -r -n 1 -p "Press any key to show that the two files are the same: " +read -r -n 1 -p "Press any key to run: diff -s cookie_recipe.txt cookie_recipe_restore.txt: " echo 1>&2 diff -s cookie_recipe.txt cookie_recipe_restore.txt echo 1>&2 -read -r -n 1 -p "Press any key to see the recipe file, restored: " +read -r -n 1 -p "Press any key to see the recipe file, restored (space = next page, q = quit): " echo 1>&2 -cat cookie_recipe_restore.txt +less -rEXFK cookie_recipe_restore.txt diff --git a/thanks-for-help.md b/thanks-for-help.md index 035241a8b..62e84285f 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -3727,8 +3727,16 @@ with the default, and which is run on the source file and each of the text files supplied by the author. This code has an alarm set at 10 seconds so that one need not hit ctrl-c/intr in between .. say to make it more fluid :-) -The [endoh1.alt2.c](/2012/endoh1/endoh1.alt.c) was provided by Yusuke as a -de-obfuscated version. +Cody also added the [try.alt.bw.sh](/2012/endoh1/try.alt.bw.sh) which is the +same as the `try.alt.sh` except it does not use the coloured version. + +Finally Cody added the [try.sh](/2012/endoh1/try.sh) and +[try.bw.sh](/2012/endoh1/try.bw.sh) which correspond to the coloured version +[endoh1_color.c](/2012/endoh1/endoh1_color.c) and the original submitted +version without colour, [endoh1.c](/2012/endoh1/endoh1.c). + +The [endoh1.alt2.c](/2012/endoh1/endoh1.alt2.c) was provided by the author, +[Yusuke](#yusuke), at the time of the contest as a de-obfuscated version. ## [2012/endoh2](/2012/endoh2/endoh2.c) ([README.md](/2012/endoh2/README.md)) @@ -3751,6 +3759,13 @@ restrict them. Cody also restored the original code from the archive. +And although the URL works for now (via redirect), Cody changed the website +linked to in the recipe file to the domain that the old one currently redirects +to, in case the other domain ends up expiring or stops redirecting to the more +recent domain. For historical purposes the old link was +`http://recipes.stevex.net/` but it redirects to `https://www.mealsteps.com` +which the recipe file now links to. + ## [2012/hamano](/2012/hamano/hamano.c) ([README.md](/2012/hamano/README.md]))