The Game of Life is a cellular automaton devised by the mathematician John Horton Conway in 1970. It is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an initial configuration and observing how it evolves.
In late 1940, John von Neumann defined life as a creation (as a being or organism)
Stanislaw Ulam invented cellular automata
Conway chose his rules carefully, after considerable experimentation, to meet the following criteria:
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, live or dead, (or populated and unpopulated, respectively). 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:
These rules can be condensed into the following:
If one forgets the biological interpretation of the rules then they reduce to:
State of the cell :
live = true
dead = false
The state of a cell in the next generation is given by:
(S = 3) OU (E = 1 ET S = 2)
where
I did this by myself but this guy had the same idea. He states that he wants to avoid
As I expected, the lines that checked whether a player had achieved a
five-in-a-row was a verbose series of nested for-loops checking a plethora of
cases. While they often seem like a natural course of action, in many settings
they are often unwieldy and slower than desirable. Luckily for my friend, the
code ran quite quickly, but I thought about whether there was a faster way.
My code from last year:
H = signal.convolve2d( G, K, boundary='wrap')[1:-1,1:-1]
H[H<=2] = 0 #dies
H[(H==4)&(G==0)] = 0 # dies
H[H>4] = 0 #dies
H[H>0] = 1 #lives
G = H
Because I was thinking about death/life:
H[H<=2] = 0 #dies
H[(H==4)&(G==0)] = 0 # dies
H[H>4] = 0 #dies
This stopped me from finding the optimal solution straight away. This is an example of cognitive bias.
L’état suivant d’une cellule est :
(S = 3) OU (E = 1 ET S = 2).
Avec :
S = signal.convolve2d( E, K, boundary='wrap')[1:-1,1:-1]
T = np.zeros_like(E)
T[ (S==3) | ( ( S == 2) & (E == 1) )] = 1
E = T
I had to change the kernel too but you will see that in the notebook.
I can code the game of life in 4 LOC because
this guy suggests changing the kernel.
what about
Or abelian sandpiles ?