The behavior of an agent is defined by a set of rules which are located inside its contour. PJ Programs PJ objects can be combined to a PJ program. A PJ program mainly consists of a network of agents, which communicate by passing messages over a channel. Agents consist of one or more rules. Here the left agent consists of one and the right agent of two rules.
Rules determine the agent's behavior according to a rule's preconditions.
If the preconditions of a rule match the corresponding input patterns of an agent, the rule defines a subconfiguration of new objects. The agent and the matched input patterns will be removed and the new subconfiguration will be integrated in the remaining network. As shape, size, and color of objects have no semantical meaning, the shape can be used to comment the purpose of the program. This program models the frying of an fried egg. In this case the agents represent a frying pan and a cook through its shapes.