The Etc Files

Here Be Oddball Stuff...

Well, as if most of the other stuff on this site isn't rather odd.

LIFE

This section is in memory of John Horton Conway, 1937-2020.

The rules of LIFE are simple but produce much complexity...

I was only 7 when Conway's Game of Life was introduced in the pages of Scientific American in October 1970, don't recall when I first heard about it but when I got my first computer in 1981 (a ZX81 with a whopping 1K of ram that I soldered together myself) it was one of the first programs I wrote. First in BASIC but I wanted speed so rewrote it in Z80 machine code and was mesmerized by its fast-moving patterns! That piece of code is long gone but I found a similar version of LIFE that I wrote for the C64...


I don't have the assembly source for it, in those days I coded the assembly on paper then converted the opcodes to the actual bytes. Here's the original files, the loader graphics to the left was made from three screen shots, cropped and color-edited - the C64's default colors were rather pale.

This version of LIFE was very simple, it only did random starting patterns and only recognizes one key - Q to quit - any other key restarts it with a new random pattern. If it enters a repeating pattern it automatically restarts, it does this by counting the number of live cells and comparing to the last two generations, if it matches for more than a few generations it generates a new random starting pattern.

I coded versions of LIFE for every 8-bit computer I had, starting with the ZX81, then the Tandy Color Computer, the C64 then the Atari 800 and derivitives. Here's an animation made from my old Atari CELLS program...


I fooled around with LIFE a bit in QBasic when I got a PC in 1993 but PC machine coding was nowhere near the fun of coding for 8-bitters and soon there were much better programs than anything I could possibly come up with. LIFE is Turing-complete and it's possible to craft a general-purpose computer in LIFE. Here's one that runs Tetris. And one that runs LIFE in LIFE. (!!! yikes !!!)


LIFE in COBOL

This is a strange one...


I wrote this when I had a gig as a night-time computer operator at Citrus World in 1986.. that's what happens when you teach a young computer geek COBOL then leave them alone with a mainframe. The Wang VS also had BASIC, played with it too but had to be careful as it did not multitask well and had a tendency to mess up the work jobs I was running. This COBOL version of LIFE didn't have a random mode (Wang VS COBOL didn't have a random number generator that I could tell), after entering a starting pattern it ran for a fixed number of cycles then I could keep going, clear the screen and enter a new pattern, or stop wasting time.


Atari 8-bit Stuff

In the late '80's I worked at Shiloh Music in Mt. Juliet, TN and we were an Atari dealer. Mostly for the Atari ST which was used by many musicians back then, but also sold and serviced the Atari 800 line. I really liked the way the original 800 was made - like a tank - but with only 48K was limited so ended up with an Atari XE with 128K, the extra 64K could be configured as a ram disk but eventually got another box with several hundred K of ram with battery backup that I could trust better with my data. Atari DOS was functional but mostly used SpartaDOS along with the Ace C compiler and M65 assembler. The environment was primitive but could edit, compile and link code that I wrote. The resulting programs were extremely slow and low resolution by modern computing standards but back then it was pretty much all I had to work with. Here are some of the things I played with...

CELLS

This was a colorized version of LIFE, with different colors for birth, survival by 2 and survival by 3. The original program computed about one generation per second but it goes super-fast when running under the Atari800 emulator in turbo mode.

HODGE

This is a 2D cellular automaton called the Hodgepodge Machine, found in A.K. Dewdney's Computer Recreations column in the August 1988 issue of Scientific American. It was created by Martin Gerhardt and Heike Schuster to simulate the waves that occur in some kinds of chemical reactions. This implementation uses an 80 by 96 grid, each cell can have a number of states ranging from 0 for healthy and the maximum state for ill. Any state between the two was termed infected. The multiple states are (somehow) reduced to 4 colors for display.

The input variables are:

  NS    Number of cell states
K1 Constant 1 (infect)
K2 Constant 2 (ill)
G Rate of infection

For each generation the program makes the following computations on each cell:

A = number of surr. infected cells
(currentstate>0 and <NS)
B = number of surr. ill cells
(currentstate = NS)
S = sum of surr. cell states
If currentstate=0 then newstate=[A/K1]+[B/K2]
If currentstate>0 and currentstate<NS then newstate=[S/A]+G
If currentstate=NS then newstate=0

...while keeping track of the counts, after the future states of all the cells have been computed then copies the new state to the current state, displays and repeats. I forgot to press N for new when I took this screen dump so it used the current memory contents as the starting pattern...

HOP

This is a version of the HOPALONG algorithm from Computer Recreations, September 1986 Scientific American and also reprinted in A.K. Dewdney's "THE ARMCHAIR UNIVERSE". I couldn't find the source code for this particular program but this is the basic algorithm, adapted from the article...

  input a, b, c
x = 0
y = 0
clear screen
do
plot pixel x,y
x1 = y - sign(x) * sqrt(abs(b * x - c))
y = a - x
x = x1
until stopped

The S H and V parameters are the scaling factor and horizontal and vertical position. Despite the imprecision of floating point computer math (especially on an 8-bit computer) the "hop" tended to avoid certain regions, leaving a pattern of voids...

After many many more hops there are still voids...

BURST

This is a color version of HOPALONG, using the iteration count to periodically change the plotting color...


LNAUTO

This program generates various one-dimensional, or "line" automata, using a user-entered rule string. Line automata have been covered in the March and September 1984 issues of Scientific American and in the December 1986 issue of Byte, and also heavily researched by Stephen Wolfram. In this kind of automata the cell influences its own outcome along with the states of its surrounding cells. This program supports neighborhood sizes of 3, 5 or 7, determined by the length of the rule string, and up to 4 states numbered 0-3. To compute the next state of each cell the program adds up the states of all the cells in the neighborhood then looks up the appropriate digit in the rule string, with the left-most digit specifying the new state for a count of 0. When successive generations are plotted from top to bottom interesting patterns emerge...

MORPH

This program plots "Biomorphs", invented when IBM researcher Clifford Pickover had a bug in a fractal program that produced unexpected results, and reported by A.K. Dewdney in the July 1989 issue of Scientific American. The idea is for each pixel iterate Z=something(Z)+C with Z and C being complex numbers. C is held constant to determine the type of plot and the real and imaginary components of starting value of Z are swept to generate a 2D plot. Something(Z) can be any function of Z, from simple to complex. In my version I use one of 4 formulas from Z=Z^2+C to Z=Z^5+C. Each pixel is iterated until the absolute size of Z exceeds a limit or an iteration limit is reached. For my plots if both components of Z are less than the limit that point is plotted with color 0, color 1 if only the real component is less than the limit, color 2 if only the imaginary component is less than the limit, or color 3 if both components exceed the limit. There's something in there...

SCOPE

This is a Mandelbrot Set plotter. It produced interesting images for the day...

...but was infuratingly slow! Many hours per plot on the original Atari computer. Even with the Atari800 emulator's super-fast turbo mode it still takes several minutes per image. Back then I'd still run it overnight to see what would come out, and wonder how such images appear in otherwise ordinary numbers processed by relatively simple math.. as if Nature is an artist! When I got a PC in 1993 it wasn't too long thereafter when I discovered FractInt and many other fractal programs, each generation exponentially increasing in speed. These days the Mandelbrot set can be zoomed into in real time using software such as XaoS, but it still takes a lot of computing for an extreme zoom. Here are some things I found around 8 years ago using a program called Fraqtive, they make nice desktop wallpaper.

TREK

I played with more than math... had many games back then but this was one of my favorites...


This version of Mike Mayfield's TREK game is based on "Super Star Trek", published by David Ahl in 1978 in his book "BASIC Computer Games, Microcomputer Edition". I typed it in and converted it to Atari BASIC sometime around 1990. I remember playing it quite a bit but the code I found still had several cosmetic glitches - not sure if this was an early conversion (some things hadn't been converted at all) or if I just didn't care at the time - the game logic worked fine. The main conversion was to keep the main screen at the top so I wouldn't have to keep typing SRS all the time (plus it looked cool), then display temporary data on the bottom half of the screen. Which mostly worked but got tricky when firing at a bunch of Klingons then they'd shoot back, overwriting the previous text and sometimes leaving a messy display. Or worse scrolling the top display. Most of the recent fixes involved adding space padding to keep things neat and making sure the top display is properly updated. In most versions of this game the enemy ships fired first when entering a new quadrant. This one didn't do that and also seemed a bit on the easy side, so added a difficulty level prompt when the program starts. Level 0 keeps the easy gameplay, higher levels strengthen the enemies and increase the chance they'll shoot first.

Update Febuary 2021 - At it again.. recently I got back into Trek hacking and sure enough found a few more display glitches in this version where it would overwrite existing text without clearing it first, or in the case of technicians fixing my ship, completely obliterating the SRS display - bad techs! Can't have that.. fixed that and other glitches, should be better now but there are likely other bugs. One bug that I know of is on the new higher levels, sometimes SRS will trigger another round of incoming fire - normally SRS isn't needed as its mostly automatic in this version, except for when the display glitches.

. . . . .

Download the maprogs.zip file for disk images containing all of these programs plus scripts for running with the Atari800 emulator (last updated 2/22/2021). The disk images also work with other Atari emulators such as Altirra for Windows. Or browse through the converted source code and text.


Terry Newton <wtn90125@yahoo.com>