4.1.1. STOP

The robots must move until one of the walls that surrounds the arena emits a stop signal by turning green. Once the wall turns green, all the robots in the swarm must stop moving as soon as possible. The swarm operates in an octagonal arena of 2.75 m2 and gray floor. The wall that emits the stop signal is selected randomly. At the beginning of each run, the robots are positioned in the right side of the arena. Figure 2 (left) shows the arena for STOP.

The performance of the swarm (*Cs*) is measured by the objective function described by Equation (1); the lower the better.

$$\mathbf{C}\_{s} = \sum\_{t=1}^{I} \sum\_{i=1}^{N} \bar{I}\_{i}(t) + \sum\_{t=\bar{t}+1}^{T} \sum\_{i=1}^{N} I\_{i}(t);\tag{1}$$

$$I\_{l}(t) = \begin{cases} \ 1, \text{if robot } i \text{ is moving at time } t; \\ \ 0, \text{otherwise;} \end{cases} \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad I\_{l}(t) = 1 - I\_{l}(t).$$

*Cs* measures the amount of time during which the robots do not perform the intended behavior—before and after the stop signal. *N* and *T* represent respectively the number of robots and the duration of the mission. ¯*t* indicates the time at which the stop signal is displayed. The time ¯*t* is uniformly sampled between [40, 60] s. We expect that TuttiFrutti produces collective behaviors with event-handling capabilities that allow the swarm to react when the stop signal appears.

#### 4.1.2. AGGREGATION

The robots must aggregate in the left black region of the arena as soon as possible. The swarm operates in a hexagonal arena of about 2.60 m2 and gray floor. Triangular black regions of about 0.45 m2 are located at the left and right side of the arena. The walls lining the left black region are blue and those lining the right black region are green—the colors do not change during the mission. Each black region is characterized by the color of the walls that lines it. That is, the *blue zone* refers to the black region lined by blue walls and the *green zone* refers to the black region lined by green walls. At the beginning of each run, the robots are randomly positioned in the center of the arena—between the black regions. Figure 2 (center) shows the arena for AGGREGATION.

The performance of the swarm (*Ca*) is measured by the objective function described by Equation (2); the lower the better.

$$\mathbf{C}\_{d} = \sum\_{t=1}^{T} \sum\_{i=1}^{N} I\_{i}(t) \tag{2}$$

*Ii*(*t*) = 1, if robot *i* is not in the aggregation area at time *t*; 0, otherwise.

*Ca* indicates the time that the robots spend outside of the blue zone. *N* and *T* represent the number of robots and the duration of the mission, respectively. We expect that TuttiFrutti produces collective behaviors in which the swarm uses the blue walls as a reference to navigate and aggregate in the blue zone.

#### 4.1.3. FORAGING

The robots must select and forage from the most profitable of two sources of items. The swarm operates in a squared arena of 2.25 m2 and gray floor. A rectangular white region of about 0.23 m2 is located at the bottom of the arena and represents the nest of the swarm. A rectangular black region of 0.23 m2 is located at the top of the arena and represents the two sources of items—the sources are separated by a short wall segment that does not display any color. This wall segment divides the black region in half. We account that an item is transported and successfully delivered when a robot travels

from any of the sources to the nest. The walls lining the nest are red, the walls lining the left source are blue, and the walls lining the right source are green—the colors do not change during the mission. We consider then two types of sources of items: the *blue source*—the black region lined by blue walls; and the *green source*—the black region lined by green walls. At the beginning of each run, the robots are randomly positioned in the center of the arena—between the white and black areas. Figure 2 (right) shows the arena for FORAGING.

The performance of the swarm (*Cf*) is measured by the objective function described by Equation (3); the higher the better.

$$\mathbf{C}\_f = (\kappa) I\_\varnothing + (-\kappa) I\_\varnothing \mathbf{\dot{s}} \tag{3}$$

$$\kappa = 1.$$

*Cf* indicates the aggregate profit of the total of items collected from the two sources. *Ib* corresponds to the number of items collected from the blue source, and *Ig* corresponds number of items collected from the green one. We added the factor *κ* to balance the profit of the items available in each source. In our study *κ* = 1. Items from the blue source account for a profit of +1 and items from the green source account for a penalization of −1. We expect that TuttiFrutti produces collective behaviors in which swarms use the blue walls as a reference to navigate towards the blue source, the green walls for avoiding the green source, and the red walls to navigate towards the nest.
