Format/typo check + add try.sh to 2012/blakely
The bugs.md was also updated with a INABIAF section.
This commit is contained in:
1 parent
290c40dba8
commit
75ab4869e2
4 files changed
+69
-2
No files matched your search
+18
-2
@@ -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
|
||||
|
||||
Executable
+35
@@ -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
|
||||
Reference in new issue
Block a user