"Reprint" "Cellular Automata" Life Game (a brief History of time)

Source: Internet
Author: User

Original posts: http://www.cnblogs.com/lvpengms/archive/2010/02/08/1666095.html

Idle at night do not have nothing to do, in view of the previous period of time to see the life of the game in mathematical modeling, so with C + + implementation, the effect is good.

This program is written in vs2005 C + +, interested in the program and the source of the friend can send me e-mail.

  Update: Program source code can be downloaded from this address: download cellular automata source code and procedures

=======================================================

First, a brief introduction to the game of life

The game of life is actually a 0 player game. It consists of a two-dimensional rectangular world in which every square in the world is inhabited by a living or dead cell. The life and death of a cell at the next moment depends on the number of living or dead cells in the adjacent eight squares. If the number of cells living in the adjacent squares is too large, the cell will die at the next moment because of the scarcity of resources, but if there are too few living cells around, the cell will die too lonely. Specific example:

The life and death of each lattice follows the following principles:

1. If there are 3 cells around a cell for a living (a total of 8 cells around a cell), the cell will live (that is, if the cell is dead, it will live, and if it does, it will remain the same).

2. If there are 2 cells around a cell for a living, the cell's life and death status remains the same;

3. In other cases, the cell is dead (that is, if the cell is the original life, then to die, if the original is dead, then the initial state of each pixel in the set image according to the above-mentioned rules of the game to deduce the changes in lives, due to the initial state and the number of iterations, will be impressive beautiful pattern).

Pattern:

There are three types of patterns:

The first category of this pattern is fixed:

The second type: it changes according to the law:

The third category: is constantly changing and moving, but there are certain periodicity, the most famous is the glider:

======================================================

About the life of the game first introduced here, the following is their own practice

If there are 3 live around a cell, then the cell will live, and we call this number burn, and if there are 2 live around a cell, then the cell is unchanged, and we call this number live.

After running, this generates a random maze-style pattern when burn=1,live=2, such as:

When burn=1,live= other, you will not get the labyrinth pattern, will only see the irregular clutter.

When burn=2,live= other, will get some messy dots flashing

When burn=3,live=2, the survival rate of the cell is very high, and there are certain rules of reproduction, which is the best environment for the breeding of the cell:

When burn=3,live! = 2 o'clock, the death rate of the cell is very high.

When the burn>3, the cell is almost unable to survive and reproduce, it is clear that at this time the cell survival of the environment is highly dependent.

Thus we can determine that the best living environment of a species is neither too dependent on the environment nor dependent on the environment. There is a lot of knowledge about the game of life, you have time to share it slowly.

Finally, a famous example is introduced:Gosper's machine gun is making a glider, see, did you find out?

Analysis

Well, before in a brief history of time to see, Xiang elder brother also let me do one. Very interesting stuff ....

Accidentally saw it taken off.

"Reprint" "Cellular Automata" Life Game (a brief History of time)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.