16K cassette 24K disk


by Andrew Katz

After seeing the expansion of crystals in a TV film, wanted to see if I could simulate that beautiful event using my ATARI. The graphics demonstration program presented in this article does just that. Type Listing 1 into your computer and check your typing accuracy by using C:CHECK or D:CHECK. If you don't have either CHECK program, be sure you SAVE the expansion demo before running it.

After the program is entered, RUN it. You will see 15 different-colored "seeds" appear. These seeds will gradually begin to grow into larger groups of pixels, all pixels in a group being the same color. The shapes will grow until they collide with a differentcolored group, at which time they will stop growing. Those shapes lucky enough to avoid early collisions will become the largest. Eventually the screen will become solid with color, resembling a colorful map. Pressing the START key will start the process again from the beginning.

The BASIC program provided (lines 70-110) can be changed to build other scenarios. Experiment with other graphic modes, make line drawings and watch them grow together, and so on.

There are several parameters which can be changed to give different effects. These parameters are in lines 1000-1040. The 3 in line 1040 controls the rate of expansion. Change it to a 2 and RUN the program. Now the rate of expansion is many times quicker. You will notice holes appearing as the shapes form. These holes fill soon and the shapes stay completely well formed. Change the 3 to 1 and the expansion will look like a boiling pot!

Why GTIA? Well, GTIA modes are the easiest to program, and of course they give the most color. This program will work for those without GTIA, but the colors will be different. I am told that all ATARI computers sold in 1982 and after have the GTIA. I recommend that anyone without a GTIA chip get one from ATARI. They cost only $22 and are easy to install (see "Installing Your Own GTIA Chip" in A.N.A.L.O.G. #10).

I have provided the assembly source code listing (Listing 2) for those interested in seeing how the expansion works. In each cycle, a pixel is chosen at random. Note that I have cut the Y resolution in half to get a more even aspect ratio. Once the pixel is chosen, a neighborhood around the pixel is read (see FIGURE 1). The neighborhood is then reordered into a clockwise loop (one for pixels with an even X coordinate, and one for an odd coordinate). If the pixel chosen is uncolored AND there are 3 pixels in a row with the same color surrounding it, the pixel is plotted with that color. Otherwise it is left alone. That's all there is to it. If you have any questions or suggestions, contact me at 9 River St. Ext. 158, Little Ferry, NJ 07643.

Editor's Note

Our programming staff has come up with an interesting modification to the expansion demo. First, change the 3 in line 1040 to a 1 to speed up the program execution. Then enter the following program lines and type RUN.

80 COLOR 8:FOR I=1 TO 37
82 REM
111 COLOR 2:FOR I=1 TO 13
112 Y=INT(RND(0)*92)+1:X=INT(RND(0)*78)+1
113 PLOT X,Y*2:DRAWTO X,Y*2+5
114 NEXT I

This modification changes the 15 different color "seeds" to 2 colors, blue and orange. There are approximately 75% blue seeds and 25% orange, roughly the same proportions as areas of water and land on the earth. When the modified expansion demo is RUN, it will produce a display that looks remarkably like a planet's surface! Make your own modifications and see what you can come up with.