** Instructions for FRACTALS.BAS by Stuart T. Wyss-Gallifent ** I have attempted to break down these instructions into the following areas: WHAT IS A FRACTAL, OPERATION OF FRACTAL.BAS and DETAILS FOR THE INTERESTED What is a fractal: A fractal is a really neat looking picture that is drawn by use of a mathematical formula. This program draws one kind of fractal, called a Mandelbrot Set. There are other fractals, including Julia Sets (which this program should do, but keeps crashing), Newton's Basins of Attraction, Triangles, etc. Every Mandelbrot fractal relies on the SAME equation. What changes is the numbers you put into it. Imagine looking at a coastline from an airplane. You see a particular shape. Then you zoom in on one particular part of the coast, and see beaches and coves and breakers, etc. It is still the same coastline. You zoom in some more onto a specific cove, and see another set of detailed shapes, all belonging to the same coastline. You zoom in closer, perhaps a wading pool, and see MORE details. You look at the outline of the pool under a microscope and see more details. All from the SAME coastline. A fractal is the same way. You see an overall shape, and as you zoom in, or enlarge certain areas, you see more details that you couldn't see before. In theory, you could go on enlarging forever, seeing more and more details. In practice, the decimals on the coco get too small to compute and eventually, all you get are huge square blocks. There is a great fractal found around (0,0) on the coordinate system used for Mandelbrot fractals. So the first enlargement should use the following coordinates: Xlow=-2 Xhigh=.6 Ylow=-1 Yhigh=1 To compute a fractal, the coco takes the numbers, sticks them into an equation along with the current x and y locations of a point on the screen, takes whatever it gets out, and puts it in again. It keeps doing this over and over until something happens. These are called Iterations. What could happen? The coco could reach the Iteration Max that you set (16 to 255) If it does, the point is set black. What else could happen? The "answers" the computer gets out, that is puts in again, are constantly compared to another limit. If the numbers pass that limit, the color of the point is computed, based on the number of iterations done up to that point. This happens for EVERY SINGLE point on the 320x192 screen. Suggested Iteration Max for your first fractal:20 Operation of FRACTALS.BAS Using assembly language, I wrote/borrowed code to make a machine language routine that would do all the math VERY quickly. In BASIC, all the calculations would take about 4 days for the first fractal. In assembly, 20 minutes is all it takes. Let's talk about each option in FRACTALS.BAS If you select the option to start a fractal from scratch, the computer will automatically select Mandelbrot fractals, and ask for the Xlow, Xhigh Ylow and Yhigh values for the enlargement. Then it will ask for the Maximum iterations allowed. 20-60 are good numbers to use, although on successive enlargements, you may need to get up to 255 to see stuff. The problem is that some details may only show up after 80 iterations, but won't show up at 79. Of course, the more iterations you select, the longer it takes. (255 is the max. and 16 is the min.) You can select outline mode if you want. This makes the computer only plot the outlines of each colored area, it doesn't fill it in. It looks neat. You can select the resolution. High resolution uses a 318x192 screen. Low res. uses a 159x96 screen. Low res takes only 1/4 the time of high-res. It is good for 'intermediate' or 'test' fractals, because it looks a little 'blocky'. For what it is worth, you can also select if you want the fractal on screen to be cleared before the new one is drawn. The screen clears and the fractal begins drawing. If the fractal top half happens to be mirrored to the bottom half, the coco will only compute the top half, simply duplicating it to the bottom. (Saves 50% of the time) A good set of beginners coordinates: Xlow=-2 Xhigh=.6 Ylow=-1 Yhigh=1 Iterations: 20 Resolution:Low time for completion: about 20 mins. Outline mode:Off There are two options that need no explaining: View the fractal, and color cycle. When the fractal is done, the menu returns. Select View to see it, select cycle to cycle the 64 colors through the fractal. The colors will cycle slowly by themselves, or press a key to go quickly. Break will return you to the Menu. The option of continuing a fractal works only if there is a fractal that is not done. You can interrupt a fractal that is not done at any time, and save it. After you load it, or if you interrupt it, simply select the continue option and it keeps going. In fact, even if you exit the program, and run it again, it usually can pick up where it left off. Saving and loading is done with an external program. Selecting either will cause this program to be loaded, and the instructions are simple. The program does some VERY basic checking in case you enter a filename that already exists (It warns you that the file MAY already exist). A fractal requires 16 granules to save. You can NIB them later after they're done. After saving and loading, and I don't know why, but you must manually enter RUN"FRACTALS" to resume 'fractalling'. The enlargement option is the last one to discuss. Once your fractal is done, and even if it isn't done, you can use this option to select an area of the fractal for further magnification. Select this option, and the fractal will be shown on the screen. Just to the upper left of the center, you'll see 4 dots blinking. The area to be enlarged is between those four dots. There are 9 different sized pre-determined blocks. Pressing a number 1 to 9 will show you the different sizes. Hold down the arrow keys to move the 'box'. Once you are happy, press BREAK. The menu appears along with the new X and Y numbers. Press ENTER to begin the fractal with those numbers, you'll then be asked about iterations, outlines, and resolution. If you don't want that, press BREAK to abort. If you do select that fractal, the area you chose will be shown on the lower right corner as the new fractal is drawn. Looking over these instruction, I hope I have told you what you need to know. I suggest those 'beginner' coordinates to start with, and then just pick areas for enlargements. You'll discover many neat shapes. Technical stuff: The actual machine code is borrowed from a fractal program for the coco 2. It can only handle 256x192 fractals. Because of this, the 318x192 screen is divided into three segments, each is 1/3 of the actual screen. Because each third is about 106x192, it will work wonderfully with the routine. That is why info about the current segment and other numbers appear on the menu screen. In order to resume a fractal, data about the fractal must be stored somewhere. I chose to store it in the 319th column on the screen. Every important number is stored there, in a rather clever way, just before you exit, or run the save routine. The data is read off the screen right after you run the program, or after you load a fractal. Color cycling is done with a tiny machine language program that simply increments each palette register by one. I know it is a LONG program, but it sure is neat! The routine that the coco must load "MANDJULI" is actually capable of computing Julia Sets as well. But for some reason, some numbers cause it to crash. So while the programming is there for Julia sets, the function is disabled until (if ever) I solve the bug. If anyone wants the source code, just let me know. *** Hope you like the program. When I first got it running, I must have had the coco on for DAYS, even WEEKS, and computed over 100 fractals, saving some, printing some with AUTOGREY, etc. *** | |
|