Probes allow the user to dynamically interact with the objects in their simulation. As the simulation progresses, the user can observe and adjust the values of the instance variables. Furthermore, the user can cause objects to execute their methods, taking parameter values or input specified by the user during the simulation. generating method calls. The main appeal of this approach is that these interactions are not hardwired into the program code, but occur due to user-generated requests. This interactive process is managed by objects and methods that are, for the most part, hidden from the user. Still, the interaction can be customized easily.
Anyone who has run Heatbugs (or any of the demo programs, for that matter) has seen a probe display. It is a rectangular window that has rows which list attributes of the object being displayed. The data being displayed may be gathered from a high level object, such as the observer swarm or the model swarm, or it may be collected from an individual agent. Almost all Swarm projects have a probe display for the observer and model swarms because starting values for the parameters can be set with those displays. Probe displays for individual agents are typically created during a run by user interaction with the Swarm program (for example, by clicking on a "clickable ZoomRaster", as discussed in the previous section).
The key to this capability is the probe. A probe is an object that can gather information from one object and relay it to other objects, including displays on the screen. Swarm provides two kinds of probes. The Swarm class VarProbe extracts the value of a specific instance variable from an object. The second kind of probe is provided by the MessageProbe class. The MessageProbe. A message probe gives the user the ability to access methods inside an object--to send messages to it, in other words:
VarProbe. Probes an instance variable. A variable probe appears to the user in a window with the name of the instance variable and a space that may display the value of the variable (or show a blank or "nil"). Variable probes can display the values of integers and floating point numbers, as well as information about the identity of object variables. Variable probes do not display the contents of C arrays or structs.
MessageProbe . Probes a method. In the same window where the Variable Probe is shown, there may be "buttons" that have the names of methods on them. These buttons will be executed when they are depressed. If a method takes arguments, there will be spaces in which the user can enter them. This can cause agents to change their course of action during a simulation run.
There are two main uses for probes: they can be fed into data-collection objects and serve as interfaces to the objects about which data is being collected (thus keeping the data-collection objects as general as possible) - the Averager class, for example, directly subclasses MessageProbe. Or, they can be used in order to generate a GUI to the individual objects in the simulation (the more common usage).
There is a middle-level object between the probe display that appears on the screen and the individual probes. It is the ProbeMap. A probe map is a set that collects up all of the probes for a given object. The probe display does not manage individual probes, but rather it manages probe maps. As we shall see, then, most of the detail in tailoring probe displays ends up in steps that add or remove probes from the probe map.