

- #CONWAYS GAME OF LIFE COMMAND LINE OUTPUT UPDATE#
- #CONWAYS GAME OF LIFE COMMAND LINE OUTPUT CODE#
- #CONWAYS GAME OF LIFE COMMAND LINE OUTPUT PLUS#
a dead cell with exactly three live neighbours is reborn ( a three-parent-baby) and.A live cell with two or three live neighbours remains alive (the happy middle ground),.Life proceeds in time steps, where the fate of a cell is determined by a set of rules that depends on the previous state of each cell and it’s eight neighbours: In Life, the world is comprised of a grid of cells, where each cell can be either alive or dead.

Also known as Life, it has the interesting property of being Turing complete, meaning that (mathematically speaking) anything that can be computed algorithmically, can be computed within the game. It was first published in a column in Scientific American in 1970. In the late 1960s, the mathematician John Conway came up with a cellular automata that he named the Game Of Life. This is a blog post about my experience with Verilator, and other things… John Conway
#CONWAYS GAME OF LIFE COMMAND LINE OUTPUT CODE#
Finally I discovered Verilator: a tool that generates C++ code from Verilog modules. While trying to simulate and debug my implementation with Icarus Verilog’s iverilog on my laptop, I quickly grew frustrated with the limitations of the behavioural part of Verilog as a language to build test-benches. Unlike most of the problems before it, I was unable to solve this one by just iterating on the Verilog using the web interface provided by HDLbits.
#CONWAYS GAME OF LIFE COMMAND LINE OUTPUT UPDATE#
#CONWAYS GAME OF LIFE COMMAND LINE OUTPUT PLUS#
You might think that dividn up a 10,000*10,000 spae into subspaces of 8*8 is a lot os tasks - but accumulating their states values is in fact much, much less computing work than performing the GoL algo to each cell plus their 8 neighbours plus comparing the number and storing the new state for the net iteration somewhere.īut like i said above, for a random init state with 30% population this wont make much sense, as there will be not many completely dead 8*8 subspaces to find (leave alone dead 256*256 subpaces)Īnd of course, the way of perfect optimisation will last but not least depend on your language.Toward the end of last year I became interested in FPGAs, in part because it is now possible to target them with an open tool-chain.

When you are finished assigning the "has life" attribute to all possible subspaces, you end up with a list of subspaces which you now simply extend by +1 to each direction - with empty cells - and perform the regular (or modified) game of life rules to them. Only spaces which "have life" need to be divided into smaller subspaces - the empty ones can be skipped. Whenever you find life, you mark these subspaces as "has life". You could go down to subframes of 8*8 or 10*10 (not sure what makes the most sense here) now. If its sum of states is >0, you will now divide up the second quarter into 4 pieces again - and repeat this check for life for each of these subspaces. So if you have a field of 10,000 * 10,000, you´d first accumulate the states of the upper left quarter of 5,000 * 5,000.Īnd if the sum of states is zero in the first quarter, you can ignore this first quarter completely now and check the upper right 5,000 * 5,000 for life next. I would just divide the matrix up into halves and start checking the bigger ones first. Im my opinion it can make sense to check for completely dead spaces first, when your initial state is something like "random, but with chance for life lower than 5%." If the majority of cells is dead, you could save a lot of CPU time by skipping empty parts and not calculating stuff cell by cell. What is the most efficient algo mainly depends on the initial state.
