Home  |  FAQ  |  About  |  Contact  |  View Source   
 
SEARCH:
 
BROWSE:
    My Hood
Edit My Info
View Events
Read Tutorials
Training Modules
View Presentations
Download Tools
Scan News
Get Jobs
Message Forums
School Forums
Member Directory
   
CONTRIBUTE:
    Sign me up!
Post an Event
Submit Tutorials
Upload Tools
Link News
Post Jobs
   
   
Home >  Tutorials >  General Coding >  Artificial Life Simulations
Add to MyHood
Artificial Life Simulations   [ printer friendly ]
Stats
  Rating: 3.25 out of 5 by 16 users
  Submitted: 04/11/02
Simon Parsons ()

 
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

Return to Browsing Tutorials

Email this Tutorial to a Friend

Rate this Content:  
low quality  1 2 3 4 5  high quality

Reader's Comments Post a Comment
 
Note:

The reference to sample code should've been removed. I decided not to include sample code when I realized that the best reason to tell you about this really was the other DevHooders might want to code it up, just to see it run.

If you do want the code, email/private message me.
-- Simon Parsons, April 13, 2002
 
Hmm... an interesting but brief overview Simon. I definately didn't learn this stuff in my AI class, but I don't think there was all that much information here.

***
-- Brian Papa, April 13, 2002
 
This isn't too bad, but why is this a tutorial?
-- Larry Mak, April 13, 2002
 
Well, I have to admit that this a pretty shallow look at this subject.

But I didn't want to go overboard with information, just point people in a direction that they might not have considered. If these models are taught at all, they aren't taught early or to everyone.

So the purpose was just to suggest an interesing coding project, and also give enough background on it to make the context in which these simulations are used clear.

and as far as the broken sentence, I don't know how it happened, or if it was on my end. I'm working on another tutorial also, been sitting on it for a while. I'll ensure that nothing goes wrong ;-0
-- Simon Parsons, April 13, 2002
 
what language did you use to code your AI in? did you use the traditional LISP or did you use another language such as C/C++/C# or JAVA or what? what languages can you use to create an AI, you could have talked about that a few other things along those lines. i also don't see why this is a tutorial...it is more of an informational thing not meant to teach anything beyond kind of describing what AI sort of is.
-- J J, April 13, 2002
 
interesting tutorial
-- john jenty, April 13, 2002
 
A little short.
-- Brian Simoneau, April 14, 2002
 

This is pretty interesting. First look at AI subject. Thanks for the tutorial! : )
-- Eric Lee, April 16, 2002
 
This should have been an article instead of a tutorial. I quess it informed me about
another sector of AI but it didn't do much for me if I wanted to recreate it,
or even expand apon it.
-- Jason Dameron, April 17, 2002
 
Short but good explanation about the topic. Good work!!
-- Mihir Patel, April 17, 2002
 
Short and to the point. Good job.
-- Trent Taufer, April 18, 2002
 
Definately interesting. Can this be done in any coding language?
-- Ben B, April 18, 2002
 
Thought provoking! Recently a friend of mine had to do an artificial life simulation for a programming course at university. The idea was to set up two colonies of ants, one colony was peacefull plant eaters, and the other warlike ant eaters. The problem was his algorithm kept seperating the two colonies at opposite sides of the screen! This was fine for the plant eaters, but the ant eaters had a problem. He is now busy writing an algorithm which will make the ant eaters chase the other ants, and not follow their tendancy to stick with their own kind! The thing is, this kind of problem is not always as easy as it looks. Anyway, this is a really interesting field and a nice way to spend a few programming hours...

Thanks for the info!
-- Johan Janse van Rensburg, April 19, 2002
 
A bit short, but interesting to say the least. Good job.
-- Reid Jonasson, April 19, 2002
 
Interesting to read, but I'm suprised it was accepted as a tutorial. Perhaps there should be a place for posting articles.
-- parker thompson, April 22, 2002
 
To those who asked why this is a tutorial, it teaches you how to do something.

That said, the goal was to give people a fun coding project, and the simulations are pretty much useless for most people.

Perhaps an article would be better, but since a number of people gave positive comments, I think that it was worth posting.
-- Simon Parsons, April 24, 2002
 
interesting, but good
-- Kirk Boone, April 29, 2002
 
Copyright © 2001 DevHood® All Rights Reserved