Game of life

I always wanted to write game of life but never had time. So this week I wrote it in python. Here you can find the code. Its probably not the easiest way or most strait forward but its the first version. I wrote it in half an hour maybe. I eventually spent quite some time figuring out how to display it properly in console. I had previously tried flushing the terminal using sys.stdout.flush(). but somehow it didn’t work for multiple lines.  I didn’t have time to investigate it properly why flush doesn’t work. I tried clearing the screen by sending the command directly to the os. It works but looks like an awful and ugly fix. In the end I decided that I’m going to use curses for clearing the console. I also made some video from the console. Here you can see how it looks for small exploder you can find it here. Later i updated it a bit, made the display a bit clearer and also the screen size and number of steps configurable by user. You can see the result here:

I’m thinking about making a hardware version of this. I have written the code for the state-machine. I also have prepared some that if you try you can see the bit flips. You can find all the hardware files here. However, I’m not really happy with looking at the waveforms. I’m not quite sure what kind of display I can use! my initial thought is to use a VGA display to make my life way simpler.

If I find some time to do it on FPGA I will write another post about it or will update this one!