BaLiS was my first attempt at designing an AI (high school). It uses a priority matrix which it builds by exploring. As it explores the 50x50 world, it encounters different items (such as food). The bacterium exhibits certain behaviors based on what it finds, and adjusts it's memory accordingly. For instance, if the bacterium moves into a area (represented by one circle on the grid to your right) where there is food (represented by green dots), the bacterium responds positively. Specifically it increases the priority of corresponding location in his memory. If it returns to an adjacent location at a later time, it will be more likely to move to that spot than an unexplored spot.

Another 50x50 matrix is maintained in addition to the world matrix. This matrix is the memory matrix. The memory matrix is initialized will all neutral priorities (It can be user specified, default is 5). When the bacterium is "dropped" into the world his memory displays this.

 5 
555
 5 

This is a piece of the memory matrix. Assume the rest of the world is all neutral, the the bacterium is in the center and can only move north, south, east, west. This is all the bacterium can remember about it's place in the environment. It is new so everything is neutral, 5.

  
 
   

(Green=food, Red=Poison, Blue=Bacterium) Now lets assume the world directly around this bacterium looks like this. The bacterium doesn't know that food is directly "north" nor does it know that a poison is located to the "east".

 5 
595
575
 5 
   
  
  
   

A simple function is used to determine movement. Basically it adds up the 4 directions it can move (north, south, east, west) (5+5+5+5) and calculates the probability it should move to each one. In this case all directions have a 5/20 or 1/4 chance to be moved to. Let's say the bacterium moves north and finds a food. It evokes a response like "memory for that location +4 and previous location + 2". Now its memory and world have changed.

Now the place where the bacterium found food has a 9 priority. Note the previous spot also received a +2 priority. If the bacterium had gone west rather than north in the beginning, it would have encountered a poison. Negative reactions would have been expressed at that location and perhaps at the previous location as well depending on the user defines preferences.

 9 
575
 5 

Now assume that bacterium explores some more and returns to it's original spot. The picture to the left is what the bacterium "sees". Now when the movement function is called, (9+5+5+5) the total is 24. This means that the probability of going north again is 9/24 and the other 3 directions are 5/24. This means the bacterium is more likely to go north and get the food (assuming it has "grown" back) that go to an unexplored area. This works even better when there are poisons in the mix because the bacterium learns where poisons are and is less likely to move to that space again. Priority maps appear in the simulation like the picture to the right. The colors range from red (very low priority) to bright green (very high priority).

The bacterium can also increment it's previous location's priority if the one it moved to has a high priority. This way, safe paths are developed between food sources (and areas of high food density) and the more it uses them, the stronger the reinforcement.


Some additional things that make it interesting:

  • The whole simulation revolves around energy. Food supplies energy while poison consumes it. Every move the bacterium makes, it expends energy. The whole point of the simulation is for the bacterium to survive.
  • Food and Poisons are randomly placed in the beginning and grow back at user specified rates (default is around 5 turns).
  • All of the simulations variables are editable via a preference file. For example, users can modify reactions to food, poison, even neutral spots.
  • Users can turn off graphics and run thousands of turns very quickly to test different reactions or combinations of reactions.


Download

PC BaLiS OpenGL - Needs Glut installed to run. (zip 120k)
PC BaLiS CMU - Uses 2D graphics. (zip 244k)
Mac BaLiS OpenGL - Needs OpenGL 1.1 or better (MacOS 9) (sit 148k)
Mac BaLiS CMU - Uses 2D graphics (MacOS 9) (sit 152k)

© Chris Harrison