Macro Life - Toni Baker (ZX Computing-October 86-Page 54) Toni Baker plumbs the mysteries of creation with an intriguing program for the Spectrum. Just like real life, Macro Life is what you make it. This is what you might call an artistic program. Not an artist's program, you understand, but an artistic program, for it is the program itself which creates all the patterns - all you have to do is start it off. The program is called Macro-Life, and is essentially a version of Life, a program which is supposed to represent the birth/growth/death cycle of a colony of cells living on a grid. It produces rather fascinating results. Before your eyes you see a constantly evolving pattern - always changing, always growing - almost as if it were alive. Who knows - perhaps it is. Life was invented in 1970 by a man called John Conway of Cambridge University and I believe that the Tate Gallery really ought to have a version of LIFE running at all times, because although it is intended to represent the growth of cells which follow hard and fast mathematical rules, in practice it becomes a rather effective pattern generating algorithm. The rules of Life (or indeed Macro-Life) are very simple. A grid is initialised by having a number of its available squares filled with cells (A square may either contain a cell, or it may be empty. Only one cell at most is allowed per square). This initial configuration is called generation zero. Successive generations are worked out by a fairly simple-to-understand process. Every square on the grid is surrounded by eight other squares. These neighbouring squares may or may not contain cells. What you do is count how many of the neighbouring squares contain cells. Every cell which has precisely either two or three neighbours will survive to the next generation, and all other cells will die. In addition, new cells will be born in every empty square which has precisely three neighbouring cells Although these rules are simple the algorithm produces surprisingly elegant results. A better life I have seen quite a few versions of Life in my time. I have seen a small, eight by eight version; I have seen a couple of sixteen by sixteen versions (this is the usual size): I have also seen a twenty-four by twenty-four version, which was also quite interesting. The largest version I have seen so far is a thirty-two by twenty-four square version which used the whole of the Spectrum's screen, with one character square for each square of the grid. This version of Life is quite over the top. It uses a grid of 256 by 192, with a single pixel for each grid-square. It is the largest version of Life which could conceivably fit onto the Spectrum's screen. The patterns which it produces are dramatically different from those produced by smaller versions - they are more intricate and delicate, rather like a close up of a snowflake (except that the symmetry here is four-fold, not six-fold). When I ran the program for the first time, after having written it and got it working, I was quite stunned by the intricacy and beauty of the designs it was producing. I felt that since the overall effect was markedly different from the smaller versions of Life, then it needed a different name. Such sanctimonious titles as "Mega-Life" and "Super-Life" came to mind, but it was John Conway's original idea which gave me the idea for the title I have used. You see, Life is supposed to show cells multiplying and dying. Living cells are generally speaking, microscopic. in my program, however, individual cells may not even be discernable (depending on the quality of TV picture), so that the overall patterns are determined by large numbers of cells collectively - cell structures. Large cell structures are macroscopic (rather than microscopic), and are a result of the underlying microscopic cells. For this reason, and also because of the double meaning of the word "macro" (it also means a machine code procedure which may be duplicated several times In a program) I decided to call the program Macro-Life. The machine code part of this program does NOT create the initial configuration (generation zero). Instead, I use BASIC for this purpose. Lines 1000 and 1010 integrate the machine code into the BASIC. Line 1000 generates the next pattern, while 1010 is just a repeat loop, which also enables the user to break out by pressing BREAK (or CAPS SHIFT/SPACE) in between generations. All BASIC lines between 1 and 999 may be used to create generation zero. I have provided seven examples of small BASIC programs which when merged with lines 1000 and 1010 will provide beautiful examples of the kind of thing that Macro-Life is capable of. You can, of course, write your own BASIC programs to create the initial configuration, and indeed this was my deliberate intention, and the reason that I left the construction of this initial pattern to BASIC. The machine code begins at address 8000 (hex) and is less than two hundred bytes long. The machine code runs from the label NEXTGEN - this is the address referred to in BASIC line 1000. In addition, whilst running, the program uses addresses COOO to D7FF to store a back-up copy of the screen. The back-up copy contains the "last generation" while the current generation is being calculated directly onto the screen. Cell blocks I've also discovered that interesting effects occur if you place new live cells onto the grid between successive generations. Try deleting all lines before 1000 and adding a new line 1005 CIRCLE 128,80,80. The grid used for this program exists in a strange warped space continuum, whereby the left hand edge is joined to the right hand edge (and vice versa), and the top is joined to the bottom (and vice versa). Technically this represents a doughnut shaped universa You might try changing this feature - you can do this quite easily in BASIC by killing all cells around the edges. Adding line 1005 INVERSE 1: PLOT 0,0: DRAW 255,0: DRAW 0,175: DRAW -255,0: DRAW O,-175: INVERSE 0 will do the trick. You can try out this, as well as many other experiments. Use your imagination, sit back and watch the speccy go to work. ------------------------------------------------------------------------------ TYPE: Utility COMMENT: This info file was typed by Matthew Wilson Downloaded from: Desert Island Disks -- http://www.image.dk/~frankie/ Maintained by: Michael Bruhn -- frankie@image.dk