diff --git a/2006/monge/README.md b/2006/monge/README.md index 4b06d8c3f..60dd8f6f1 100644 --- a/2006/monge/README.md +++ b/2006/monge/README.md @@ -28,21 +28,15 @@ For more detailed information see [2006 monge in bugs.md](/bugs.md#2006-monge). ./monge expression ... ``` +Incorrect formulas will ungracefully crash the program. + ## Try: ```sh -./monge "z = 0" "z = z*z*z + c; Abs2(z) < 4" +./try.sh ``` -Incorrect formulas will ungracefully crash the program. - -This is supposed to happen. As is written in the -[The Jargon File](http://catb.org/jargon/html/F/feature.html): - -``` -That's not a bug, that's a feature. -``` ## Alternate code: @@ -78,7 +72,7 @@ make clobber ITERATIONS=512 alt If you specify a value less than 1 for any of these it sets it back to the default. The value 1 was selected arbitrarily and such a small number as 1 will not do anything useful but as long as it's at least 1 it'll not be redefined. -Does not try taking care of overflows but such large values would be impractical +It does not try taking care of overflows but such large values would be impractical anyway. @@ -87,6 +81,13 @@ anyway. Use `monge.alt` exactly as you would `monge` above. +### Alternate try: + +```sh +./try.alt.sh +``` + + ## Judges' remarks: For those who are familiar with the previous [IOCCC winners](/winners.html), diff --git a/2006/monge/try.alt.sh b/2006/monge/try.alt.sh new file mode 100755 index 000000000..fab87d778 --- /dev/null +++ b/2006/monge/try.alt.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# +# try.alt.sh - demonstrate IOCCC winner 2006/monge alt code +# + +# 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" alt >/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: ./monge.alt \"z = 0\" \"z = z*z*z + c; Abs2(z) < 4\": " +echo 1>&2 +./monge.alt "z = 0" "z = z*z*z + c; Abs2(z) < 4" +echo 1>&2 + +read -r -n 1 -p "Press any key to change the width/height/iterations to 500/500/1024: " +echo 1>&2 +make clobber WIDTH=500 HEIGHT=500 ITERATIONS=1024 alt +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./monge.alt \"z = 0\" \"z = z*z*z + c; Abs2(z) < 4\": " +echo 1>&2 +./monge.alt "z = 0" "z = z*z*z + c; Abs2(z) < 4" +echo 1>&2 diff --git a/2006/monge/try.sh b/2006/monge/try.sh new file mode 100755 index 000000000..718361ac0 --- /dev/null +++ b/2006/monge/try.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2006/monge +# + +# 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: ./monge \"z = 0\" \"z = z*z*z + c; Abs2(z) < 4\": " +echo 1>&2 +./monge "z = 0" "z = z*z*z + c; Abs2(z) < 4" +echo 1>&2 + + diff --git a/thanks-for-help.md b/thanks-for-help.md index 5cee86d38..aa75671c2 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -3436,6 +3436,9 @@ Cody also added the [try.sh](/2006/hamre/try.sh) script. [Cody](#cody) added the [alternate code](/2006/monge/README.md#alternate-code) that lets one resize the image and redefine the number of iterations. +Cody also added the [try.sh](/2006/monge/try.sh) and +[try.alt.sh](/2006/monge/try.alt.sh) scripts. + Cody also fixed the Makefile to use `sdl-config` (which is what the author stated too though that was noticed later), not `sdl2-config` as two functions that are used were removed from [SDL2](https://www.libsdl.org),