Add 2006/monge/try scripts
The alt script will reconfigure the width, height and iterations for the second invocation. Note that in some platforms this entry will not work (this is documented in the remarks). That is one of the reasons there is only one expression tested as one of the platforms it will not work with is arm64 which is what I primarily use.
This commit is contained in:
1 parent
2d4b008d00
commit
1cd8c28280
4 files changed
+70
-10
No files matched your search
+11
-10
@@ -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),
|
||||
|
||||
Executable
+32
@@ -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
|
||||
Executable
+24
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user