I was playing with the MAX7219LED8x8 library and writing some code for how to use a simple scheduler to automate the task of outputting the buffer to the LED 8×8 matrix. So I was thinking … may be writing a simple game will illustrate the use of those libraries very well. Because just few days earlier I was looking at some Arduino projects implementing the Conway’s Game of LifeI decided to write it for ATtiny85 and MAX7219/LED 8×8.
The Game of Life is a classical computer game and a cellular automaton created by the British mathematician John Horton Conway in 1970. This is a zero-player game which means that once it starts no input from user is required to play the game’s turns – it goes by itself.
Its simple rules (outlined below) allow to be implemented on very simple microprocessor systems and Tinusaur (and ATtinysystems in general) could be perfect platform for that.
Hardware
One Tinusaur Board connected to LED matrix 8×8 controlled by MAX7219.
Drivers
The MAX7219Led8x8 library is used to output the pixels to the LED 8×8 matrix.
The Rules
The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead. Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:
- Any live cell with fewer than two live neighbours dies, as if caused by under-population.
- Any live cell with two or three live neighbours lives on to the next generation.
- Any live cell with more than three live neighbours dies, as if by overcrowding.
- Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
The initial pattern constitutes the seed of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed—births and deaths occur simultaneously, and the discrete moment at which this happens is sometimes called atick (in other words, each generation is a pure function of the preceding one). The rules continue to be applied repeatedly to create further generations.
(ref: Wikipedia/Conway’s_Game_of_Life)
Read more »
Hey, we have just launched our first Indiegogo crowdfunding campaign at http://igg.me/at/tinusaur that will help us build more of those awesome boards. Please, support us if you can and wish us luck!