Format/typo check 2006/stewart

The .gitignore has been updated to have '*.xbm' and '*.png' as it seems
that the point of maze.xbm and maze.png etc. are to not include the
images generated by the program and this is cleaner and easier.

The README.md file has been format/typo checked.

This should complete the review of 2006/stewart.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-24 11:46:55 -08:00
1 parent 4cf9301abc
commit 8c31afdcc8
2 files changed
+58 -41

No files matched your search

+2 -2
View File
@@ -1,6 +1,6 @@
stewart
stewart.html
maze.xbm
maze.png
*.xbm
*.png
stewart.orig
prog.orig
+56 -39
View File
@@ -12,6 +12,16 @@ make
convert file.xbm file.png
```
where `file` is one of:
```
altar box box2 box3 build carpet circles cross cross2 cross3
crystal curve diamonds diamonds2 dragon dragon2 dragon3
fern gasket gasket_mod gasket_mod2 ioccc maze octagon
pentagon pentagons rings rings2 spirals spirals2 spirals3
spirals4 squares stars stars2 tree tree2 tree3 tree4 triangle
```
NOTE: you cannot specify a different width from height; it's one number.
NOTE: `convert(1)` belongs to [ImageMagick](https://imagemagick.org/index.php).
@@ -20,17 +30,17 @@ NOTE: `convert(1)` belongs to [ImageMagick](https://imagemagick.org/index.php).
### Try:
```sh
./stewart 400 1000000 maze > maze.xbm\
./stewart 400 1000000 maze > maze.xbm
convert maze.xbm maze.png
./stewart 1024 1000000 gasket > gasket.xbm
convert gasket.xbm gasket.png
./stewart 1024 1500000 dragon3 > dragon3.xbm
convert dragon3.xbm dragon3.png
```
where `FILE` is one of:
altar box box2 box3 build carpet circles cross cross2 cross3
crystal curve diamonds diamonds2 dragon dragon2 dragon3
fern gasket gasket_mod gasket_mod2 ioccc maze octagon
pentagon pentagons rings rings2 spirals spirals2 spirals3
spirals4 squares stars stars2 tree tree2 tree3 tree4 triangle
Now open the images in your favourite graphics viewer or a web browser.
## Judges' remarks:
@@ -47,19 +57,24 @@ a reasonably experienced user who can parse formats in their mind. :-)
The program should be run with the following
```
./stewart <m> <n> <ifs>
m = The size of the picture (picture will be m X m in size).
n = The number of iterations to run (More will make for a
clearer picture).
ifs = The file to use as input.
```sh
./stewart <m> <n> <ifs>
```
The program will spit out a [XBM image](https://en.wikipedia.org/wiki/X_BitMap) on standard out.
Minimal checking is done on the arguments mainly that there are 3.
Wrong arguments will cause the program to bomb out.
where:
Ex:
```
m = The size of the picture (picture will be m X m in size).
n = The number of iterations to run (More will make for a
clearer picture).
ifs = The file to use as input.
```
The program will spit out an [XBM image](https://en.wikipedia.org/wiki/X_BitMap)
on standard out. Minimal checking is done on the arguments mainly that there
are 3. Wrong arguments will cause the program to bomb out.
#### Example:
```sh
./stewart 1024 1000000 gasket > gasket.xbm
@@ -68,7 +83,7 @@ Ex:
### Compilation/Testing
The program compiles without warning with `gcc -ansi -Wall`.
`lint` also seems to like the code. This must be a bug in lint.
`lint` also seems to like the code. This must be a bug in `lint`.
The program was tested on Linux on a x86 and NetBSD on an alpha.
Only gcc was tested for compilers (4.0.3 and 3.3.3).
@@ -93,13 +108,13 @@ another kind of fractal, those from the [Iterated Function System
The format of the input file is as follows:
```
<num ifs> <x min> <y min> <x max> <y max>
<a> <b> <c> <d> <e> <f> <p>
<a> <b> <c> <d> <e> <f> <p>
<a> <b> <c> <d> <e> <f> <p>
.
.
.
<num ifs> <x min> <y min> <x max> <y max>
<a> <b> <c> <d> <e> <f> <p>
<a> <b> <c> <d> <e> <f> <p>
<a> <b> <c> <d> <e> <f> <p>
.
.
.
```
This file describe an IFS.
@@ -107,20 +122,20 @@ This file describe an IFS.
One of the most well known would be the [Sierpinski Gasket](gasket):
```
3 0 0 1 1
.5 0 0 .5 0 0 .33
.5 0 0 .5 .5 0 .33
.5 0 0 .5 .25 .433 .34
3 0 0 1 1
.5 0 0 .5 0 0 .33
.5 0 0 .5 .5 0 .33
.5 0 0 .5 .25 .433 .34
```
or the [fern](fern):
```
4 -5.5 0 5.5 11
0 0 0 .16 0 0 .01
.85 .04 -.04 .85 0 1.6 .85
.2 -.26 .23 .22 0 1.6 .07
-.15 .28 .26 .24 0 .44 .07
4 -5.5 0 5.5 11
0 0 0 .16 0 0 .01
.85 .04 -.04 .85 0 1.6 .85
.2 -.26 .23 .22 0 1.6 .07
-.15 .28 .26 .24 0 .44 .07
```
etc...
@@ -136,9 +151,9 @@ Basically the break down is:
`num` is the number of equations in the `IFS`.
`x` (min, max) and `y` (min, max) define the ranges that will be displayed
in the `xbm`.
in the XBM image file.
The `a b c d e f` are used to iterative find points that lie in the `IFS`
The `a b c d e f` are used to iterative find points that lie in the IFS
from the algorithm
```
@@ -156,7 +171,7 @@ the args for `main()`). This causes me to do much casting and pointer
arithmetic to get the correct location and completely does away with
any meaning the variables could have. This also makes the code more
convenient to read in the current form vs preprocessed. After
preprocessing there will almost be 300 casts in the code and I believe
preprocessing there will be almost 300 casts in the code and I believe
they are all needed... (I would double check but my brain is kinda
mushy right now from chasing down a segfault in the code.)
@@ -165,6 +180,7 @@ all that common for a program to do. I mean google only has something
like 66,000 hits for "Iterated function system" so that means it is
obscure, right?
### Some other minor obfuscations
Since I formatted it as a "normal" program I did inject something that
@@ -181,12 +197,13 @@ information about the algorithm.
The use of many magic numbers. I figured if I get yelled about them in
a review they must be bad, right?
### Silly things
The use of decimal numbers where one would expect hex. Octal numbers
where one would expect decimal. Shifts instead of divides.
Using `xbm` as the output format. This might confuse someone who doesn't
Using xbm as the output format. This might confuse someone who doesn't
have an X background. It happens to be easy but is probably a very bad
choice from a file size standpoint. 1024x1024 image is 641k in size.