Those wings... I want them too.
Английский
It's funny when old forgotten things can be encountered while learning such trendy subject as neural networks. I was doing a homework on deep learning framework (PyTorch) and convolution neural networks, and one of the steps was to program classic example - the Conway's «Game of Life». I would not call it a "game", as the only "player" sets up only initial configuration and further computation and visualization is performed without his interference; but it is the generally accepted title and it's not for me to judge about its correctness.
The rules are simple enough. There is a field, divided into cells. In theory, the field can be unbounded, but in a computer simulation, of course, you have only limited space. Sometimes the right border is imaginatively continued by the left one, and the bottom - by the top, thus forming a flat representation of the torus just like a map forms the flat representation of the globe. Each cell has eight neighbors (in the borderless variation) and can be "alive" or "dead" in each moment, that cal also be called "step", or "generation". If a dead cell has two or three alive neighbors, it becomes alive on the next step. If an alive cell has two or three neighbors, it continues to live. If an alive cell has less than two or more than three neighbors, it dies; the dead cell in such conditions continues to be dead.
The calculation of the next state of the cell is similar to the principle used when passing an image through convolution layer of a neural network. There, the convolution for each pixel is determined as a weighted sum of its neighbors. Schematically it looks like this:
X = w1*n1 + w2*n2 + w3*n3 + ... + w8*n8
In the case of «Game of Life» each weight in the "convolution" equals to 1, alive neighbor has value "1" and the dead one "0". The X cell is considered alive when neighbors' weighted sum equals to 2 or 3.
The game can continue infinitely, lead to the extinction of the cells population, start to repeat the same configurations steps periodically or, as the degenerate case of the previous, become "frozen" in a fixed state.
Beside the mathematics, the visualization of this game's progress can be quite curious. Like this:

Or this:

There are many studied configurations, one of the most well-known is a "glider", that is moving constantly in diagonal direction:
It's so popular, that some hackers even proposed to use it as the hacker's community emblem.
Gliders can be infinitely produced by another stable configuration, Gosper's glider gun:

And many, many others.
In general, it's famous topic, and there are a lot of words were spoken about it. Even Russian and English wikipedia have corresponding articles and media resources:
https://ru.wikipedia.org/wiki/%D0%98%D0%B3%D1%80%D0%B0_%C2%AB%D0%96%D0%B8%D0%B7%D0%BD%D1%8C%C2%BB
https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
https://commons.wikimedia.org/wiki/Category:Game_of_Life?uselang=ru
https://commons.wikimedia.org/wiki/Game_of_Life
Anyway, it isn't a reason to forget it as something trite. The gif-animations are very lovely, in my opinion
It's funny when old forgotten things can be encountered while learning such trendy subject as neural networks. I was doing a homework on deep learning framework (PyTorch) and convolution neural networks, and one of the steps was to program classic example - the Conway's «Game of Life». I would not call it a "game", as the only "player" sets up only initial configuration and further computation and visualization is performed without his interference; but it is the generally accepted title and it's not for me to judge about its correctness.
The rules are simple enough. There is a field, divided into cells. In theory, the field can be unbounded, but in a computer simulation, of course, you have only limited space. Sometimes the right border is imaginatively continued by the left one, and the bottom - by the top, thus forming a flat representation of the torus just like a map forms the flat representation of the globe. Each cell has eight neighbors (in the borderless variation) and can be "alive" or "dead" in each moment, that cal also be called "step", or "generation". If a dead cell has two or three alive neighbors, it becomes alive on the next step. If an alive cell has two or three neighbors, it continues to live. If an alive cell has less than two or more than three neighbors, it dies; the dead cell in such conditions continues to be dead.
The calculation of the next state of the cell is similar to the principle used when passing an image through convolution layer of a neural network. There, the convolution for each pixel is determined as a weighted sum of its neighbors. Schematically it looks like this:
filter
| image
|
X = w1*n1 + w2*n2 + w3*n3 + ... + w8*n8
In the case of «Game of Life» each weight in the "convolution" equals to 1, alive neighbor has value "1" and the dead one "0". The X cell is considered alive when neighbors' weighted sum equals to 2 or 3.
The game can continue infinitely, lead to the extinction of the cells population, start to repeat the same configurations steps periodically or, as the degenerate case of the previous, become "frozen" in a fixed state.
Beside the mathematics, the visualization of this game's progress can be quite curious. Like this:

Or this:

There are many studied configurations, one of the most well-known is a "glider", that is moving constantly in diagonal direction:

It's so popular, that some hackers even proposed to use it as the hacker's community emblem.
Gliders can be infinitely produced by another stable configuration, Gosper's glider gun:

And many, many others.
In general, it's famous topic, and there are a lot of words were spoken about it. Even Russian and English wikipedia have corresponding articles and media resources:
https://ru.wikipedia.org/wiki/%D0%98%D0%B3%D1%80%D0%B0_%C2%AB%D0%96%D0%B8%D0%B7%D0%BD%D1%8C%C2%BB
https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
https://commons.wikimedia.org/wiki/Category:Game_of_Life?uselang=ru
https://commons.wikimedia.org/wiki/Game_of_Life
Anyway, it isn't a reason to forget it as something trite. The gif-animations are very lovely, in my opinion

@темы: Программирование, Визуальное, english writing skills, Data Science, Machine Learning