Gnarly DOS Programs
by Rudy Rucker

Copyright (C) 1994 Rudy Rucker
rucker@mathcs.sjsu.edu

Copyright (C) 1994 Rudy Rucker
rucker@mathcs.sjsu.edu

These are shareware DOS programs with source code.  They may 
be freely copied and passed on.  Any commercial use or resale must be 
approved in writing by Rudy Rucker.
The GNARLY.ZIP file contains six PKZIP files. The files with 
"EXE" in their names include an executable DOS graphics program with 
support files. These programs should run on any DOS machine with 
VGA graphics. The files with "SRC" in their names include source code 
for the corresponding "EXE" programs. If you are not interested in 
programming, then you may not want to bother unzipping the source 
code. With the exception of Spiro, the source is in each case complete, 
and was in fact used to build the corresponding "EXE" program. The 
compiler used was Borland C++ 4.0. If you know programming, then 
you may be able to use the source code to build an executable for a 
different platform, e.g. Mac, Unix, Windows, etc. (If you manage to do 
this, let me know!) All of these files are provided "as is," with no 
guarantees. Rudy Rucker does not undertake to provide any technical 
support whatsoever.

Spiro

Spiro is a simple DOS graphics program that draws patterns like 
a Spirograph. When it starts, you can get rid of the filling by pressing F. 
You can stop the automatic randomizing by pressing SHIFT+R, and 
randomize as you like by pressing R. Or you can leave it alone and let it 
change on its own, like a screen-saver. The curves being drawn are 
mathematically known as epicycloids and hypocycloids. They have a 
mandala-like quality. If you stare at SPIRO for awhile, you may start to 
feel kind of strange. If you feel *too* strange, press Q to make the 
program stop.

Vine

Vine is based on an algorithm suggested by Clifford Pickover; it 
takes the sine of the sine function. Some people call this algorithm 
"Popcorn," but in the startup mode I use, it looks more like a vine. In 
startup mode, Vine moves across the screen in an undulating path, 
drawing branches out from successive points. It also cycles the colors 
automatically. You can sit and watch Vine like a screen-saver, or you 
can use the hot-keys to affect what is going on. It's hard to remember 
the hot-keys, so you might try printing the *.HLP file out for reference. 
More detailed information about the Vine program can be found in the 
VINE.INF file included in VINE1EXE.ZIP. 

Julgnarl

Julgnarl is a program where the user can seek the gnarl in a large 
space of possibilities by selecting an attractive image and generating 
eight mutations of it. In this context, a gnarly Julia set would be one 
which is not just a simple closed curve (too orderly) and which is not 
some disconnected dusting of pixels (too disorderly). The patterns in 
Julgnarl are Julia sets (named after the French mathematician Gaston 
Julia, who invented them in 1918!) A Julia set is gotten by iterating 
some kind of function on points in the complex plane, and finding the 
boundary between the points whose iterations get very large and the 
points whose iterations stay bounded. Quadratic Julia sets are quite well 
known, and cubic Julia sets appear in, e.g., the software package: Josh 
Gordon, Rudy Rucker and John Walker James Gleick's Chaos: The 
Software, Autodesk 1990. But Julgnarl has, I believe, the first quartic 
Julia sets ever computed. ("Quartic" means "based on equations with 
highest power four".) In the past, people trying to find higher-order Julia 
sets have made the mistake (at least in my opinion it's a mistake because 
the shapes are not very interesting) of staying with quadratic equations, 
but using quaternions instead of complex numbers. There is a sense in 
which all of the quartic Julia sets are cross-sections of a single, VERY 
gnarly eight- dimensional object. By the same token the quadratic Julia 
sets form a four-dimensional whole and the cubic Julia sets form a six-
dimensional whole. You step along the axes with the arrow keys and by 
varying the parameters. The algorithm I use for Julgnarl is the inverse 
iteration technique described in H.O.Peitgen and D.Saupe, THE 
SCIENCE OF FRACTAL IMAGES, Springer-Verlag, 1988; see also 
H.O.Peitgen and P.H.Richter, THE BEAUTY OF FRACTALS, 
Springer-Verlag, 1986. For an n-degree Julia set, you keep solving 
degree n equations. The inverse iteration method is "holistic" in that you 
have to compute the whole fractal to compute any part of it. This means 
that when you zoom in you have to keep track of the points offscreen. I 
used a hash table for this; the first time I've ever had call to use one of 
those! I didn't do quintic Julia sets yet because (gnarly surprise in the 
History of Mathematics!) there is no formula for solving fifth-degree 
equations. That is, there is a quadratic formula to solve quadratic 
equations, formulas for cubic and quartic equations, but no quintic 
formula. I could of course numerically beat the fifth and higher-order 
equations to death; indeed I'd like to do this for once and for all for 
arbitrary degree n. After the quadratics, the cubics surprised me, and 
after the cubics the quartics surprised me again. I look forward to being 
surprised a *lot* by the n-degree Julias one of these days.

About Using The Source Code

The source code for the programs is for building a DOS 
application on a DOS machine. The source code for the Spiro program is 
in Turbo Pascal, and the source code for Vine, Calife, and Julgnarl is 
Borland C++. As I don't currently have a Pascal compiler, I was 
unable to test if the Spiro source code still compiles correctly. 
(Sometimes, with old source-code the mysterious process of "bit-rot" 
sets in!) I did recently recompile the source code for Vine, Julgnarl, and 
Calife, using Borland C++ 4.0. If you have this particular compiler, 
you need only start it up in Windows, load the relevant project file, and 
select Make. Note that the Borland C++ 4.0 project files have the 
*.IDE file extension. These three programs can also be compiled with 
the less expensive Borland compiler known as Turbo C++. This 
compiler can't use the *.IDE project files, instead it uses *.PRJ project 
files. I provide a VINE.PRJ file, but you would need to make your own 
JULGNARL.PRJ. Your project files should include all of the *.OBJ and 
*.CPP files that are in the relevant ????1SRC.ZIP file. Your project file 
should also include the Borland Graphics library GRAPHICS.LIB (or 
you can adjust a Turbo C++ menu-setting to link in this library 
automatically). Use the LARGE model type for JULGNARL and the 
SMALL model type for CALIFE and for VINE. If you wish to use a 
different compiler, you will need to check your compiler manual for the 
names of the graphics functions analogous to such Borland Graphics 
functions as putpixel(); also you will not want to link in the special 
Borland module EGAVGA.OBJ. It may also be that the randomizing 
functions of your other compiler have different names from the names 
used by Borland. It is fairly easy to port any of these programs to a 
windows-based operating system such as Windows, Macintosh, or X-
Windows. First you have to find the appropriate names for the memory 
allocation functions, the randomizing functions and the handful of 
graphics functions. And then you need a top-level widowed program that 
executes a step of the target program loop whenever there's no messages 
on the queue. 


