diff --git a/2012/blakely/README.md b/2012/blakely/README.md index 12774e4ec..8565e5e73 100644 --- a/2012/blakely/README.md +++ b/2012/blakely/README.md @@ -5,6 +5,17 @@ make ``` +### Bugs and (Mis)features: + +The current status of this entry is: + +``` +STATUS: INABIAF - please **DO NOT** fix +``` + +For more detailed information see [2012 blakely in bugs.md](/bugs.md#2012-blakely). + + ## To use: ```sh @@ -46,7 +57,7 @@ This program renders a generic [GIF](https://en.wikipedia.org/wiki/GIF) form. The expression in spatial variables `x` and `y` is specified on the command-line with the required resolution, and an animated GIF showing a fly-around of the resulting surface is -output to stdout. +output to `stdout`. ### Usage @@ -77,7 +88,7 @@ x - x coordinate value y - y coordinate value ``` -NB all arithmetic is done in double precision, so `23/` is two-thirds, rather +NB: all arithmetic is done in double precision, so `23/` is two-thirds, rather than 0. The surface plotted corresponds to `-1 <= x,y <= 1` and for best results, the @@ -86,6 +97,7 @@ generated `z` value should lie between `-1` and `1`. If there is a division by zero, square-root of a negative number, or similar operation, then the results are undefined. + ### Examples For test-runs, use a resolution of 32. For simple expressions, the @@ -103,6 +115,7 @@ processor](https://en.wikipedia.org/wiki/Intel_Core#Core_i7). ./blakely xx*yy*1++d5*ct/ 64 > ripple.gif ``` + ### Algorithm A generic root-finding algorithm to find the point of intersection between a ray @@ -111,6 +124,7 @@ make the rendering realistic, both the value of the expression, and its derivative with respect to `x` and `y` must be tracked. This is done using an obvious stack-based approach. + ### Obfuscations Much of the obfuscation is achieved through the use of single-letter variables @@ -120,6 +134,7 @@ and wonderful ways, making use of [XOR](https://en.wikipedia.org/wiki/Exclusive_or), return values from `putchar()`, and odd expressions. The layout is in the form of `X Y Z`. + ### Limitations ASCII is assumed since many bytes for the @@ -128,6 +143,7 @@ given in the source code. On compilation a few warnings about parentheses come up when using gcc 4.6.3, and one about no return value from `main()` (who uses exit codes anyway?), but clang 3.1 emits no warnings. + ### Questions * Apart from their appearance when computing the [RPN diff --git a/2012/blakely/try.sh b/2012/blakely/try.sh new file mode 100755 index 000000000..4dc9c11ef --- /dev/null +++ b/2012/blakely/try.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2012/blakely +# + +# 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 "$ ./blakely "xx*yy*+" 64 > paraboloid.gif" 1>&2 +./blakely "xx*yy*+" 64 > paraboloid.gif + +echo "$ ./blakely 9 32 > empty.gif 1>&2" +./blakely 9 32 > empty.gif + +echo "$ ./blakely xy* 32 > saddle.gif" 1>&2 +./blakely xy* 32 > saddle.gif + +echo "$ ./blakely xx*yy*1++d5*ct/ 64 > ripple.gif" 1>&2 +./blakely xx*yy*1++d5*ct/ 64 > ripple.gif + +echo "This might take a bit of time:" 1>&2 +echo "$ time ./blakely 0 250 > flat.gif" 1>&2 +time ./blakely 0 250 > flat.gif + +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 diff --git a/bugs.md b/bugs.md index b9fb5e81c..22f9700f7 100644 --- a/bugs.md +++ b/bugs.md @@ -2728,6 +2728,20 @@ fire](https://en.wikipedia.org/wiki/Halt_and_Catch_Fire_(computing)) :-) # 2012 +## 2012 blakely + +### STATUS: INABIAF - please **DO NOT** fix +### Source code: [2012/blakely/blakely.c](2012/blakely/blakely.c) +### Information: [2012/blakely/README.md](2012/blakely/README.md) + +The author stated: + +``` +If there is a division by zero, square-root of a negative number, or similar +operation, then the results are undefined. +``` + + ## 2012 deckmyn ### STATUS: INABIAF - please **DO NOT** fix diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index b46215264..265580718 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -3330,6 +3330,8 @@ dies. [Cody](#cody) added explicit linking of libm (`-lm`) as not all systems do this implicitly (Linux doesn't seem to but macOS does). +Cody also added the [try.sh](2012/blakely/try.sh) script. + ## [2012/deckmyn](2012/deckmyn/deckmyn.c) ([README.md](2012/deckmyn/README.md]))