Saturday, April 16, 2011

LivingCells hits the Market

At last, my LivingCells application appears on Android Market. This is a collection of several cellular automata, which includes at this point famous Conway's Game Of Life, its colored variant, and also a family of cellular automata called Generations, which includes widely known Brian's Brain.

There are several implementations of Game Of Life on Android Market by now, a few of them have really nice features. But in my opinion a cellular automaton implementation should, first of all, look cool. Even damn cool. So that's what I tried to achieve, and I sure hope I managed to accomplish this goal. Also it should be customizable and interactive - that's how I see it. In my app you can even drag existing groups of cells on the screen. Also it is fun to play with different rules, for Game of Life I recommend to try Day And Night and Walled CitiesGenerations automaton has even cooler rules like the amazing Star Wars rule (thanks to Mirek W√≥jtowicz for it) or Faders.

This applications runs on any Android device with OS version 2.1 or higher. Oh, and I also should mention, this app is, of course, completely free.

So, try it, tell me what you liked, what you didn't like and so on. I have a few suggestions what to add to this app, but I'd like to hear yours too.

Update: now I have one more automaton - Turmites. Help has been updated, and you can also read my newer post about this automaton.

Download this application from Android Market

Screenshots:
Generations - Star Wars rule
Colored Game Of Life - Conway's Life rule

Help
For those of you who want to read more about using this app, here goes.

Main screen
If the simulation is running, it will do so until you pause it or until it reaches such a point when no new cells will appear or disappear anymore. You can select an action which will be performed when you touch the screen.
You may either create or erase cells by dragging your finger across the screen or drag existing groups of cells (or turmites). In the first mode you can switch between creating and erasing cells with long-presses. You can also double tap to the screen to add a bunch of cells at the same time. In the second mode when you point to an alive cell, your device will vibrate, so you know you're not dragging empty space.

Game Of Life
In this cellular automaton cells exist in two states: on and off. In the next generation a cell stays alive only if it has a certain number of neighbors. A new cell also appears in an empty cell only when a specific number of neighbors surrounds it.

In this applications a few more conditions may apply to the cells. Cells may have a finite life, which means that no cell can live longer than specified number of generations. Also a rule may have a condition that cells past certain age can't give birth to new cells. The last two rules make cell colonies die eventually.

Colored Game Of Life
This cellular automaton behaves exactly like regular Game Of Life. However, when a new cell is born, it also gets a distinct hue depending on what hue its neighbors have.

There are six main color ranges, which a cell can belong to: red, yellow, green, cyan, blue and magenta. First of all, it is determined what color range most of the neighbors have. Then an average hue is calculated from hue of those cells which belong to the dominant range. A small random value is applied to it and it is assigned to the new cell.

Generations 
The main difference between this cellular automaton and Game Of Life is that cells have more than two states. When a cell is born, it enters "on" state. When a cell in its "on" state is determined to have more or less neighbors than required to survive, then instead of dying instantly it switches to its older state. It continues to do so every next generation and eventually disappears. Cells which got older don't count as neighbors in birth of new cells or survival of the living ones. However, they still occupy space, which affects the patterns. In this application older states are reflected by changing the cell color.

Turmites
  This type of cellular automaton is very distinct from the others. In Turmites the field itself is static. However, there are so-called turmites on the field, which move from cell to cell and change them. A turmite occupies only one cell at a time and faces some direction. Then depending on the color of the cell and on the state of the turmite, it changes the color of the cell, changes its state, turns and makes one or more steps in that direction. Rules for turmites define what actions they undertake given a specific color of the cell and a turmite state.


Settings

Cell size
Determines how big the cells appear on your screen. Since the grid always occupies all the available space on the screen, this also defines the size of the entire grid.

Speed
As the name suggests, affects the speed of the simulation.

Status bar
If checked, a status bar will be shown at the top of the screen which tells you how many cells are present in the field, how many generations have passed and also whether the grid is static. 

Pause when touched
When the screen is touched, the simulation pauses by default. If you turn this setting off, the simulation will continue to run regardless of whether you doing something with cells.

Torus grid
If this setting is on, then the grid will have no boundaries: cells may travel across the edge of the screen and appear on the opposite side. This works especially good with the Generations automaton.

Color scheme
There you can adjust colors of cells and background. Color scheme settings don't apply to Colored Game Of Life, since colors are a part of the algorithm.

Rule for ...
This menus allow to select and edit rule for each type of cellular automata. There's no separate settings entry for Colored Game Of Life, it uses the rule set for regular Game Of Life instead.

Keep grid non-static
If this option is on, cells in Game Of Life, Colored Game Of Life and Generations may appear randomly if too little changes happen on the grid.

Number of turmites
Defines how many turmites will appear on the field. Currently every option has a fixed corresponding number of turmites.

How to edit color scheme
Adjust the colors by either using the color picker (access it by touching the color buttons), or by entering values manually in HEX. All the changes will be saved automatically when you quit editing scheme. If you have been editing a built-in scheme, then a new untitled scheme will be created automatically. You may wish to rename it in the future.

Background color
Affects background on which the cells are drawn (except for Colored Game Of Life).

Primary color
In all of the automata, except for Turmites, newborn cells have this color. In Game Of Life this is the only color a cell can have. In Generations this is the color of the youngest cells.

Secondary color
This color has meaning only for Generations and Turmites. In these automata the color range spans from the primary color to the secondary as a gradient. In Generations this is the color of the oldest cells. In Turmites the color range is defined by the rule.

Turmites color
This color is only used in Turmites. Obviously enough, this is the color of the turmites.

How to edit rules in lifelike automata
There is a set of predefined rules for each cellular automaton type, and you can also create your own rules. All the changes will be saved automatically when you quit editing the rule. If you have been editing a built-in rule, a new untitled rule will be created automatically.

Which cells count as neghbors
Defines whether diagonal cells count as neighbors (Moore neighborhood) or not (Von Neumann neighborhood). All built-in rules use the first option.

Survival and birth
Check a box if you want a cell to survive or to be born with a specified number of neighbors.

Maximum life
Here you can choose the cells to be either immortal or to live a specified number of generations. Zero value is treated as if you specified cells to be immortal. If you are editing a rule for Generations, you can't make cells immortal, and maximum life basically is the same as the number of states minus the "off" state.

When cells stop to birth to new cells
This setting defines how old a cell can be until it stops to count as a neighbor when considering whether a new cell is born. Zero is treated as if there's no limit.This setting is unavailable in Generations.

How to edit rules for Turmites
There is a set of predefined rules for each cellular automaton type, and you can also create your own rules. All the changes will be saved automatically when you quit editing the rule. If you have been editing a built-in rule, a new untitled rule will be created automatically.

Number of colors
Defines how many different colors a cell can have. The lowest possible value is 2.

Number of turmite states
Each turmite can be in several states, and this setting defines how many. The lowest possible value is 1, and in this case it means that turmites will not change their state.

State transition table

In this table each cell color and turmite state is matched with the corresponding actions which a turmite will undertake when it finds itself in a cell of this particular color in a particular state. Actions include the next turmite state, cell color, which turn a turmite takes and how many steps it makes after turning.

No comments:

Post a Comment