ALife version of Assignment 4

 

Today in class we briefly discussed the field of artificial life and how we might use it inside KnownSpace; here is an assignment built around that idea.

The idea is to build a visual display system that shows a number of agents roaming around a space and doing something to objects in the space. In our application of course the motionless objects will usually be pages and the mobile agents will be KnownSpace agents (ferrets, filters, clusterers, linkers, mapmakers, and so on). The goal is to have user-controllable windows on every part of the internal workings of KnownSpace so that the user will be able at any time to see some visual representation of the users own data while it is being processed. Besides being able to see the data processing, we will also let the user go in and manually alter how the data is being processed with various visual controls.

For this assignment you must build a ALife-style system that displays a number of mobile and immobile objects. Both the mobile and immobile objects have state and behavior. In this case, there will be two kinds of immobile objects (pink round objects and blue square objects) and one kind of mobile agent (choose some reasonable color). The agents can pick up precisely one object and they can only do so if they are on the same square as the object. The agents are trying to find and collect in one place the pink objects while ignoring the blue objects.

The action takes place in an n by n grid of squares. Each agent and object occupies one square and initially they are all randomly place on the grid.

The pink objects regularly emit a chemical that diffuses into the neighboring squares. Once a chemical molecule is emitted, it can hop, with some small probability, to a neighboring square. Each chemical molecule also ages and evaporates after a certain amount of time.

So the chemical diffuses by dispersing randomly into surrounding squares. with the probability of a molecule being found near to a pink object being very high and then exponentially decreasing the further away you are. The display should reflect the diffusion of the molecules by changing the color of each square with some number of molecules in proportion to the number of such molecules.

The agents can detect this chemical and can do simple tests and actions like ("move left if there is more pink chemical on my left side than on my right"). The blue objects also emit a chemical, and it too diffuses. The only problem is that the agents sometimes get a little confused about whether they are smelling a blue or a pink molecule (which means that they can sometimes go after the wrong object).

The point is not to write an optimal algorithm but to produce an interesting animation. So ignore options like giving the agents lots of intelligence and allowing them to start in one place and do an exhaustive search.

If you finish this version of the assignment early (it isn't very hard given the supporting code) you should consider how to build a more general-purpose platform which would allow scripting of agent actions. That way there would be no need to build a program from scratch; rather you'd be able to specify behavior and state in a script and then run it. Further, with a scripting language there would be no need for the scripter to know Java to be able to write ALife programs.

The geek zone has been updated with two new chunks of code that will help you build your own simple ALife system. (see the third collection.)