The game “Life” (
Conway's Game of Life ) is the funniest thing that serious people severely call the “cellular automaton”. She came up with the English mathematician John Conway (
John Horton Conway ) in the distant 1970.
The playing surface is an infinite or limited field, divided into a certain number of cells. Each cell can be either alive or dead. With each turn, the field population changes according to simple rules:
- A cell with less than two neighbors dies of loneliness;
- A cell with more than three neighbors dies from overpopulation;
- A dead cell with exactly three neighbors comes to life.
The game world develops without the player's help. It only requires to arrange the cells for the first generation. Often the development of the world becomes completely unpredictable. Cells form complex patterns, and as soon as you begin to think that you understand everything, they suddenly die out, or “hang” in an endless loop.
Here is what they write about the origin of the game on Wikipedia:
John Conway became interested in the problem proposed in the 1940s by the famous mathematician John von Neumann , who was trying to create a hypothetical machine that could reproduce itself. John von Neumann managed to create a mathematical model of such a machine with very complex rules. Conway tried to simplify the ideas proposed by Neumann, and in the end he managed to create rules that became the rules of the game "Life."
I liked the idea so much that I decided to write
my own implementation of the game in Javascript .
')
Games are games, and in "Life" you can even implement
a Turing machine . By the way, the
Hashfile algorithm used by him calculates 6,366,548,773,467,669,985,195,496,000 (6 octillion) generations per second on a modest Intel Duo 2GHz. For comparison, my non-optimized version generates 5 generations per second, and then the “
Gosper Glidener Gun ” slows down noticeably even in Firefox. There is something to think about.
Webmasters note:
As I already wrote, I didn’t particularly bother with the optimization, but the performance of the praised Firefox really surprised me. Gun Gosper on it begins to slow down sharply already somewhere on the 4-5 glider. IE 7 slows down steadily, without sudden drops, but it seems that it works faster than FF. I did not conduct tests, so I can not say for sure. Safari and Chrome did not begin to slow down after 10 or 20 minutes of the gun.
Write to my blog