<commit_before><permalink>rtc-artificial-life</permalink>
<month>5</month>
<year>2015</year>

# Collaborative artificial life

I have always been fascinated with artificial life and decided to make a cellular automaton, one of the most known artificial life models out there.

In case you don’t know what a cellular automaton is, allow me to explain what it is with a very simple example.

A cellular automaton is a form of artificial life that creates structures that “act like if they were alive”. Imagine a chess board, but instead of having several different chess pieces this time you only have 1 type which we will call a living cell. If there is a living cell on the board that cell is considered to be alive, if there is not living cell then that square is considered to be dead.

Fortunately these two states are can be easily represented on a computer by using the binary system, so that the equivalence ends up being 1 for a living cell and 0 for a dead cell.

Now image that you throw 5 living cells on the 8 x 8 board that end up in the following pattern:

[image]

This is called to be the generation 0, to compute the next generation we will follow these 4 rules:

1.- Any living cell with fewer than two live neighbors dies, as if caused by under-population.
2.- Any living cell with two or three live neighbors lives on to the next generation.
3.- Any living cell with more than three live neighbors dies, as if by overcrowding.
4.- Any dead cell with exactly three living neighbors becomes a living cell, as if by reproduction.

So that the next generation will look like this:

[image]

And consequent generations will actually make the pattern move away from where it started and will eventually die until it reaches the border of the chessboard.

[animation]

This last example is on of several structures that create different results. You can try it on a real chessboard or a piece of paper, or you could simply use my project [here].

And that’s it! With some really simple rules you end up having an living ecosystem (well and artificially living one).

This is how the projects looks like:

[]

Click on the image to load the board and play with it creating some structures, bear in mind that the app is real-time collaborative, every user is actually seeing the same board and changing the same board, I made it this way to see how it evolves with time, I plan to run leave this project running for a looong time...<commit_msg>Style changes<commit_after><permalink>rtc-artificial-life</permalink>
<month>5</month>
<year>2015</year>

# Collaborative artificial life

I have always been fascinated with artificial life and decided to make my own real-time collaborative cellular automaton in Node.js. More specifically I wanted to bring the magic of real-time collaboration to the Conway's Game of Life so that every single user that loads the game will be interacting with the same board.

The Game of Life was created by the British mathematician <NAME>. In an attempt to find an "self-replicating machine" Conway drastically simplified the an earlier automaton by <NAME> which contained several complex rules. The Conway's model [appeared on the page 120 of the 1970's issue of the Scientific American] and made him instantly famous.

Most of the cellular automatons ahve very simple rules, here is a simple example of these mathematical models work:

Let's say we have a chessboard grid and a bunch of pawns which we will call a *living cell* from now on. If there is a *living cell* on the board that grid square is considered to be alive, if there is not living cell then that square is considered to be dead.

These two states are can be easily represented on a computer by using the binary system, so that the equivalence ends up being **1 for a living cell** and **0 for a dead cell**.

Now image that you throw 5 living pawns on the 8x8 board and you end up in the following pattern:

[image]

This is called the generation 0, to compute the next generation we will follow these 4 rules:

*1.- Any living cell with fewer than two live neighbors dies, as if caused by under-population.
2.- Any living cell with two or three live neighbors lives on to the next generation.
3.- Any living cell with more than three live neighbors dies, as if by overcrowding.
4.- Any dead cell with exactly three living neighbors becomes a living cell, as if by reproduction.*

By applying these simple rules we end up with the next generation which looks like this:

[image]

You will notice that successive generations will make the pattern move away from where it started, this pattern will eventually perish when it reaches the border of the chessboard.

[animation]

This example is one of several, many, many structures that create different results. You can try them on a real chessboard or a piece of paper, or you could simply use the project I made [here].

That’s it! With some really simple rules you end up having an living ecosystem (hmm well and artificially living ecosystem).

This is how the finished project looks like:

[]

Click on the image to load the Game of Life and play with it creating some structures, don't forget to set your nickname! Note that **the app is real-time collaborative**, every user is actually seeing and interacting with the same board, I made it this way to see how it evolves with time, I plan to leave running this project running for a looong time...
{'fraction_non_alphanumeric': 0.03748845798707295, 'fraction_numerical': 0.007386888273314866, 'mean_word_length': 4.237911025145068, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5411681', 'n_tokens_mistral': 1337, 'n_tokens_neox': 1253, 'n_words': 923}