Skip to content

A Poker Chip Computer

June 25, 2011

Are you familiar with Conway’s Game Of Life? Probably most people reading this blog will be, as implementing it is a common exercise on many programming courses. But what if you haven’t got a computer?

Back in 1970, I was in the sixth form at the local grammar school, and our teacher (well known for his deal-making) had negotiated a deal where we could get Scientific American at a low price. This is the actual, thick, soft, glossy, beautifully illustrated Scientific American I am talking about here, not what sadly passes for it today.

The excitement of having Scientific American delivered! That meaty thunk as it crashed on the doormat! And the content! We are talking over 40 years ago now, but I can still remember these:

  • Build your own laser! Now even a can of beans probably has a laser in it somewhere, but back then …

  • How plants move sap around. Gorgeous hand drawn interpretations of electron micrographs that almost turned me into a botanist. And I hate botany!

  • Liquid crystals. They sounded cool, and would eventually become LCDs.

But specific articles, however great (and they were great) were not the best thing about Scientific American. What everyone turned to first was the Mathematical Games column, written by the late, great Martin Gardner. This column, which ran for many years until taken over by Douglas Hofstadter and then A.K. Dewdney, covered all aspects of recreational mathematics with exceptional wit and clarity, but the column that had the greatest effect on me was that on Conway’s Life, in the October 1970 issue.

I won’t describe the rules of Life here (see the link at the top of the post for details), but the key facts are that it is played on a 2D grid, and that the cells of the grid can have a number of states. After reading Gardner’s article, I tried to follow some life pattens using graph paper, a pencil and an eraser, but ended up with a smudged mess. What I needed was a grid of some sort, and some easily changeable state indicators. A bit of lateral thinking on my part resulted in a solution – my chess board and my Father’s poker chips (he was an RAF pilot at the time, not a professional gambler), which conveniently came in three colours – just right for the three states of cells in Life. Using these, I traced the life cycles of a number of simple Life patterns. I can still remember the thrill I felt when my poker chip glider wobbled its way slowly across the chessboard!

Of course, a poker chip computer has a few disadvantages – it’s very, very slow, it’s easy to make a mistake when applying the rules, and an 8×8 grid does not allow for much room for patterns to change and grow. What I really needed was a computer, but in 1970 this seemed to be out of the question. Computers were still things that filled entire rooms, and the first home computer, the Altair, was five years in future.

But strangely, fate played a hand and a few weeks after the Life article came out I found myself in the same (crowded) room as one of those room-filling computers. Our local technical college was running a short course for our Sixth Form maths class on computing using it’s pride and joy, an ICL mainframe computer. This was some beast – it was one of the last of ICL‘s machines to use valves (yes!) rather than transistors for at least part of its electronics, and the heat from these made the machine room tropical. We programmed (or tried to) the beast in FORTRAN, using a card punch, and got the output of our programs (inevitably a single line saying “Your code does not compile”) from a printer the next day. I did consider trying to get this thing to run Life, but it was obvious that my FORTRAN skills were not up to it, and in any case the lack of an interactive display meant that the results would be even less inspiring than my chess board and poker chip setup.

And there matters rested for some years. I went to university, got married and worked in the UK’s National Health Service as a lab technician. I maintained an interest in computing, but was far too poor to buy one of the home computers when they eventually arrived. Then, in 1979, I took up a new post in the Microbiology Department at Queen Elizabeth College, University of London. And what did I see on my first day there, but a gleaming new Research Machines 380Z! My then boss said that they had a few of these things around, that nobody seemed to know what to do with them, and that I should feel free to learn how to use them. I needed no further encouragement.

Of course, after writing by first “hello world” program in BASIC, my thoughts turned immediately to writing an implementation of Life. And I soon had something working on BASIC. But what a disappointment! I was expecting to beautiful figures change and evolve fluidly on my black and white monitor, but everything was happening at a snail’s pace, ruining the animation effect. I needed something faster than BASIC.

My thoughts turned to my old friend FORTRAN. We actually had a FORTRAN compiler for the 380Z. Written by Microsoft before they became rich and famous, it was horribly clunky to use. Or then there was the VAX that the college had just taken delivery of. This had a modern FORTRAN 77 compiler that was easy to use, but we were limited to talking to it down slow serial lines, so my animation effects would be doubtful at best. There was only one solution – I would have to learn assembly language.

Actually, there was a much better solution, one that only occurred to me years later, when I was older and a bit wiser. I should have stuck with BASIC, and used a different algorithm. This is almost always the correct way to go about solving performance problems.

But I was young and foolish then, so I bought the manual for the Z80 chip that ran the 380Z, and started reading. I was immediately baffled. I got the idea of memory, but what were these “registers” and “condition flags”? And what were “addressing modes” all about? I was stuck, until I came across a great book on learning to program the closely related 8080 chip. This was written by two women [unfortunately I’ve forgotten their names and the names of the book, which I lent out and never got back, if anyone knows the book I’m talking about, please let me know] , and adopted a quiz approach to the subject. After reading a couple of chapters, things clicked, and I returned to the Z80 manuals with new confidence.

My Life implementation came together quickly after that. It ran on the 380Z’s 40×20 text display and was very, very fast. Gliders zoomed across the screen and the R-pentomino exploded in a riot of pixels. Inspired by my success, and with the success of other programs I was writing, I soon gave up being a microbiologist, and moved to work for the Computer Services department at Middlesex Polytechnic. I did fun stuff there too, which I’ll write about at another time. But it was really programming Life that gave me the confidence to apply for the Middlesex Poly job, and which in a sense has informed and driven my career (such as it has been) ever since. Thank you, John Conway and Martin Gardner.

If you are interested in Life, I strongly suggest you implement a version yourself. It’s a lot of fun, and there are lots of interesting challenges to solve. If you don’t fancy the task, but are still interested then there are a lot of links to implementations here – I would recommend Golly, despite its rather strange user interface.


From → games, memoir

One Comment
  1. @Jenks Thanks – I intend to write a few more “memoirs”, if only for my own amusement!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: