The Robot Simulation
Click here to see the applet! (May take some time to download - be patient.)
See JavaDocs for this project.
Description
The Robot Simulation started as a project for an Artificial Intelligence class. The goal is to create a "community" of robots (or "agents") working in cooperation to complete a number of tasks. Basically it works like this:
- You have a large room (currently hard-coded to 200x200)
- In this room are a number of tasks (currently 20,000) that appear as black squares. Each task must be touched by five robots to be complete. As a task gets more complete it turns "greener" until when it is complete it is bright green.
- A number (300) of "robots" enter the room randomly from one of the four corners. They appear as open squares. Each robot can have one of 4 states.
- RANDOM: the robot moves about completely at random until it encounters a task that it hasn't touched before. Then it transitions to the "RANDOM-COMMS" state (described below). A robot in this state appears as a black square.
- RANDOM-COMMS: a robot in this state continues to move about randomly, but it "broadcasts" the location of the task that it most-recently touched. It does this for a limited number of clock cycles (currently 10) and then switches back to RANDOM state. A robot in this state appears as a blue square. If "helper graphics" is enabled, the robot will have a red circle around it indicating the broadcast range for the transmitter.
- GOTO: a robot that "receives" a broadcast from another robot first checks to see if it has touched that task before. If not, it switches to the GOTO state. In this state, it proceeds as quickly as possible to the location of that task and touches it. Then it switches to RANDOM-COMMS state and broadcasts the location itself. A robot in this state appears as a green square. If "helper graphics" is enabled a line will be drawn between the robot and its destination task.
- STOPPED: if a robot has "touched" all tasks, there is nothing more it can do, so it switches itself off. A robot in this state appears as a red square.
- OPTIONS:
- There is currently no way to change the number of robots, tasks, or size of the room. I'm working on providing this functionality.
- Push the "pause" button to pause the simulation. Push it again to restart.
- Use the "show agents" checkbox to control whether to display agents or not. Only tasks will be shown. This greatly speeds up processing.
- Use the "render" checkbox to completely stop rendering the robots and tasks. Calculation will continue in the background. This hugely speeds up the processing speed.
Unfortunately there is no very good way to "restart" the applet at this time. If you "refresh" your browser it doesn't completely reset the applet. The only way I know to truly reset it is to close the browser and reopen. I'm working on this.