Tyrone Stewart and I wrote this application for our Artificial Intelligence course in November of 2005. It was a two week project from conception to final presentation (the PowerPoint of which is also available here).
Questions and comments can be sent to Lissa, but this project is no longer under development and will not be updated. So enjoy all bugs and weirdness you find, and trust that I know they’re there. If you’d like the source code, it can be made available upon request.
A critter (such as a mouse) is in an interactive environment where objects, which are immediately and fully observable by the critter, can be placed by the user. He starts as an infant with a randomly allotted time for life. This time will average some specified amount of time, but will have some deviation among critters. When time runs out the death is considered natural. For instance, the average lifespan may be something like 10 days, but the critter may die naturally of old age anywhere from 8 to 12 days. These numbers are arbitrary, but offer a concrete example. He must eat a certain number of times per day (such as two) to survive, and will starve after a few days with no food. He has some number of health points at the start of his life, and these will temporarily deteriorate if he becomes sick or is injured.
The critter knows that procreation is amazingly wonderful and eating is good. He does not initially know what foods are good for him, but he has the ability to nibble on an item, which will cause some small fraction of the effect of eating the entire thing. Water may or may not be a factor in the simulation. It can recognize others of its species immediately and can distinguish gender with no trouble.
The user will drop items into the critter’s space, including cheese, arsenic, wood, male or female critters, cyanide tablets, etc., each of which can have a positive or negative effect on his health or chances of procreation. The user may also be able to alter the critters environment in order to understand the critter’s behavior in different situations. The critter will need to learn what is safe and what to avoid in order to live a longer life and produce the most children.
Final implementation features
The final implementation of Critters in a Box contains the following objects that can be placed by the user:
- Bike tires
- Loaves of bread
- Moldy cheese
- Pop tarts
Why Pop Tarts? Hell if we know. Sounded like fun at the time.
Water is a special, high-quantity item that can also be placed by the user.
The critters have the following imperatives: thirst, hunger, procreation urges, and the desire to explore. Thirst and hunger are handled through independent “meters”, so to speak, such that once the thirst meter gets down below a certain level, the critters eagerly seeks out water. If he doesn’t get water within a certain amount of time, he will become dehydrated and begin to lose health. If either the health meter depletes or his thirst meter runs out, he will die. Likewise for the hunger meter.
If the critter is neither hungry nor thirsty, he may wish to either procreate or explore. Procreation is a time-limited urge based on the limitations of the computer running the simulation to be able to handle the large number of critters born otherwise. As such, critters will not feel an urge to procreate until about 40 seconds after creation, and will wait another 40 seconds after procreation to seek out a partner again.
Exploration is how the critter learns his environment, and generally consists of him wandering around to each item in the box and taking a nibble of those he has not already.
Pretty simple. Lots of fun.
There are several bugs–you may find that critters get stuck in a place and don’t move when it seems they should be exploring. We have no idea why this is happening, so don’t bug us about it.
Download at your own risk. I promise I didn’t put a virus in anything, but always scan files, just in case.
- Critters in a Box executable. This is a Java JAR file.
- PowerPoint presentation. Major kudos to Dr. 7 for help with the jokes within.
- Design document. A document specifying some of our design decisions in the development of the project.
If you’re in Windows and have the Java 1.5.0 Runtime Environment installed, you should be able to simple double-click on the downloaded JAR file to start the program. The easiest way to check if you do would be to download the Critters and see if the file runs when you double-click it.
If it doesn’t and you’re still intent on running my little application, you’ll want to go here and download JRE 5.0 Update 5 (a little bit down the page). Once that downloads and installs, you should be able to double-click and run Critters.
It’s up to you if it’s really worth all that trouble.
If you’re running Linux, you’ll also need to make sure you have the above JRE (Linux-version, bien sûr), then you’ll want to go to a command-line and enter “java -jar critters.jar” in the directory of “critters.jar”. You may need to include the path to Java if that wasn’t setup automatically. I don’t think Sun is cool enough to toss in the relevant environment variables, so you may have to.
Anyway, once the damn thing is running, you may be disappointed to find yourself looking at a grey screen with a couple of wimpy menu options.
This is pre-simulation time. Use this time to choose items from the “Item” menu and drop them in in the blank grey area. Once an item has been picked in the menu, it remains selected until you either pick it again or pick something else. This way you can drop more than one of an item in without having to revisit the menu every time.
You’ll notice that once you drop in something, you’ll see the name of the item and a number in parentheses. This is the quantity of the item that’s available. When a critter nibbles, it only takes one of however many are there. When it eats, it consumes the entire remaining quantity.
Make sure you drop in at least one water.
When you’re ready to start the simulation, click File->Start. A critter will appear in the center of the screen and begin bouncing around and nibbling things. Experiment with adding other critters using the “Critter” menu, and watch ’em kill themselves dead.