As for me, I recently moved and Even though it was just before Christmas, I was alone in a murky room.

** "Okay, let's make and decorate a Christmas tree" **

However, if I just bought a commercially available tree and decorated it ... it would be crushed by loneliness.

"Isn't it interesting to make Christmas tree illuminations with ** Cellular Automata **?"

I came up with the idea. That's why I tried to make the Christmas tree (something like) shine according to the rules of the life game.

** Results are at the bottom, so if you're not interested in the content, click Skip. ** **

It is one of the discrete calculation models.

Give each of the grid-like cells to have either a "living" or "dead" state. Based on the current cell state, the state of the next cell is calculated, and this is repeated to observe the state of the entire cell arranged in a grid pattern.

Since it is applied to various simulations, I will introduce some of them.

-[Reproduce the pattern of the shell](https://ja.wikipedia.org/wiki/%E3%82%BB%E3%83%AB%E3%83%BB%E3%82%AA%E3%83% BC% E3% 83% 88% E3% 83% 9E% E3% 83% 88% E3% 83% B3 #% E7% 94% 9F% E7% 89% A9% E5% AD% A6% E3% 81% AB % E3% 81% 8A% E3% 81% 91% E3% 82% 8B% E4% BE% 8B) -Simulation of human evacuation behavior -Road traffic simulation -Snowflake pattern generation (I will introduce it because there was an article in Qiita.) -Retail store purchase simulation

Mathematical simulation has the image of constructing complicated differential equations and integral equations, Cellular automata are very simple rules, and you can observe complicated and interesting behavior, so I think it is relatively easy to get along with.

You can also observe chaotic behavior with cellular automata. As mentioned above, the ability to reproduce chaotic behavior, despite the fact that the simulation configuration itself is very simple, is one of the factors that attracted attention from cellular automata.

By the way, as examples of application of chaos, how to make Christmas illuminations shine and the realistic fluctuation of candlelight have already been studied.

Some people said that they made a lot of money by applying it to stock price forecasting.

A simulation of the birth and death of life, devised by the British mathematician Conway.

Cellular automaton wrote, "Calculate the state of the next cell based on the state of the current cell." The rules of "calculation" in Conway's Game of Life are very simple.

-** [Birth] **: If there are exactly three living cells adjacent to a dead cell, the next generation will be born.
-** [Survival] **: If there are two or three living cells adjacent to a living cell, it will survive in the next generation.
-** [Depopulation] **: If there is one or less living cells adjacent to a living cell, it will die due to depopulation.
-** [Overcrowding] **: If there are 4 or more living cells adjacent to a living cell, it will die due to overcrowding.

[(Quoted from wikipedia)](https://ja.wikipedia.org/wiki/%E3%83%A9%E3%82%A4%E3%83%95%E3%82%B2%E3%83%BC % E3% 83% A0)

That's it. It is a model of processes such as selection and evolution of living things with very simple rules. Why do you behave in a funny way?

For the life game, I referred to this article. "Making a life game with Java"

Simulation range: Leaf part of the tree Survival: yellow Death: green Initial state: A uniform random number is assigned to each cell, and there is a 30% chance of survival. Number of repetitions: 5000 times (The image is cut off in the middle because it has converged) Number of trials: Until an interesting move appears

The program was written in Java. Swing is used for drawing processing. ↓ Click here for the sauce (it's not beautiful, so don't be afraid ...) https://github.com/tf-tky/XmasLifeGame

――The top doesn't shine except in the initial state (it doesn't shine) ――The number of cells decreases as you go to the top of the tree, so it may disappear soon (it wasn't) ――I wonder if it's better to add a rule with randomness to make it look like illuminations (I tried it but it was not good)

Recommended Posts