| |
A-Life
The following is a whimsical tutorial trying to open up another area that you can use for recreational coding and to broaden your programming horizons.
What are A-Life Simulations?
Artificial Life simulations are an emerging part of the Social Sciences. The base concept can be simplified as trying to get simulations based on a subset of the rules in the real world to behave as the real world does. This can, when the rules are properly designed and justified, be used to show which factors are most critical to the behavior of a system.
As you can imagine, isolating the most crucial factors in the behavior of a social system is useful in anthropology, sociology, and other related discipline. A-Life is interesting because it brings these fields together along with statisticians, logicians, and computer scientists.
Schelling
The Schelling Algorithm is the beginning of the purely rule-based simulations. It was created to determine if the seperation of neighborhoods by race could be explained by 'normal' circumstances or whether racism was running rampant.
The rules are simple; each square on a grid is filled by an 'X' or an '_' in my text-based version (Schelling made a board game for him and his son, using blue and red people), and each iteration, a person who does not have enough neighbors of the same color (up, down, left, and right only) is swapped with a person of the opposite color. This continues until no-one of either color needs moving. Note that the board wraps around the sides
This is a randomly generated grid:
XXX_X_X__XX__XX _X__X_XX_XXXXXX XX_XX__XXX___X_ _XXXX_XXX_XXX__ _XXXXXXXXXX_XXX XXX_X_XX_XX_XXX XXX__X_XX_XX___ XXXX_X__XXX_X_X _XX_____XXX___X X_XX_XXXXX__XX_ X__XXX_XX__XX__ XXX__XXXX_X_X_X __XX_XXXXX_XXX_ XXX_X_XXXXXX_X_ _XX_XXXX_XX_X_X
And in 32 iterations it sorted to this:
XXXXX____XXXXXX XXXXX____XXXXXX XXXXX__XXXXXX__ _XXXXXXXXXXXX__ _XXXXXXXXXXXXXX XXX___XXXXXXXXX XXX____XXXX____ XXX_____XXX____ _XX_____XXX____ __XXXXXXXX_____ __XXXXXXX______ __XXXXXXX______ __XXXXXXXXXXX__ _XXXXXXXXXXXX__ _XXXXXXX_XX_X__
The simulation is accepted as proof that seperation of residential areas by race does not hide racism- all the people wanted in the above simulation was two neighbors of the same color or more. Wanting half and half is not so bad, and yet it produces strong racial segregation, often coming from both directions at once.
What is more interesting is that if only one person of the same color is desired, the communitites still seperate quickly, though not as pronouncedly. It is not practical to show here, as grids of the size shown here tend to solve in less than ten moves.
The above description should be enough for you do implement this in your own way.
Sugarscape
Sugarscape is an agent-based model. That is, it is a grouping of discrete agents who interact using programmed behaviors. This is a much more powerful approach than rule-based modelling as many factors can be considered at once.
Sugarscape is so called because the only natural resource available is sugar, and the agents hoard it, consume it, and trade it. Each agent has their own independent preferences about how to get sugar, and each needs a different amount to survive. Thus the simple economy where the means of exchange is the means of sustainance can be employed to teach us how markets may behave. The idea that the microcosm mimics the macrocosm must always be proven, but the systems can be used to confirm older theories quite easily.
There are far more complex models that begin to require academia's server capacity to run. One particularly fascinating system tracks corruption by hav
Actually implementing Sugarscape goes well beyond the scope of this tutorial.
Why?
Artificial Life simulations are an interesting toy, but they go far beyond that mere label. They are a stepping stone to more convincing environments in all types of interactive simulations, games included. Real Artificial Intelligence is hard but to create simple A-Life is easy, and with a fairly simple construct, complex behaviors can be tracked.
Study of Artificial life has uses in academia and also in the consumer and entertainment spheres. Familiarity with it could be useful, but hopefully the concepts introduced here are interesting enough that you don't need a reason.
If you have problems coding, feel free to email or private message me.
Disclaimers:
The following should be kept in mind
- The Schelling algorithm is public domain.
- Sample code is my property. You may use it without my permission as long as it is attributed
|
|