Evolving a Roomba[draft]

We now have a simple architecture that can be evolved to produce adaptive behavior in a changing environment. Building an actual Roomba is beyond my skills, but we can build a simple agent that moves around a grid world and vacuums up “dirt”. The challenges for the agent are similar to those faced by a Roomba: it must navigate around walls, avoid getting stuck in corners, and efficiently find and clean the dirt.

The immediate aim is to evolve a AND program that can control this agent, allowing it to navigate the grid and achieve its goal of cleaning up the dirt. The chief goal behind this aim, however, is to demonstrate how a simple architecture inspired by gene regulation can give rise to goal-directed behavior in an agent interacting with its environment.

A Roomba uses a combination of sensors and rules to navigate its environment, avoiding obstacles and cleaning the floor. There is no detailed map of the room, and no pre-planned route. Yet, the Roomba effectively cleans the room, adapting to different layouts and obstacles. The route emerges from the interaction of the behaviour with the environment, rather than from a map and a plan of where to go.

This adaptable, goal-oriented behavior is reminiscent of biological systems. If you are drawn to the idea of agency in biology, you might consider the Roomba as a simple agent. A Roomba, of course, is not evolved, nor does it reproduce. But it meets many of the criteria for agency–or goal-directed behaviour—discussed in recent philosophy of biology literature. TODO: Perturbation etc. See Dan’s papers on XXX.

My aim of this section is to show how a simple AND program can be evolved to control a Roomba-like agent. That is, our AND program will be the “brain” of a simple agent that can navigate a grid world and vacuum up “dirt”.

We have already seen that AND programs produce behaviour: responding to a stream of stimuli. In the previous section, we supplied a set of fixed input patterns to the program, and observed how it responded. The difference now is that the input patterns will be generated by the agent’s interaction with its environment. So, we need to build an environment, and couple the agent to it.

We generate a random house plan on the grid (see Figure 1). Then we place our Roomba in one of these houses, and let it navigate the rooms vacuuming the patches. How well can it do this?

Figure 1: Randomly generated house plans. Our Roomba needs to navigate around rooms to vacuum them.

What happens?

Figure 2: Interactive replay of the best shopper from mall 1 on challenge 1.

This replay shows the best shopper from mall 1 acting in challenge 1, using the same browser simulation widget as the exploration demo.

Figure 3: Sampled JS strip from the same roomba recording.

Sensing the World via Feedback

In previous sections, we explored how AND programs can evolve to respond to streams of input—a capability that opens fascinating possibilities for behavioural modelling.

This shift from abstract computation to embodied behavior mirrors a fundamental transition in both robotics and biology—from processing information in isolation to acting purposefully in the world.

Embedding AND in an Agent

To understand how computational programs become behavioural agents, consider the classical tripartite division of intelligent action:

This division is, of course, an idealization—in biological systems, these processes interweave in complex feedback loops where action shapes perception and perception constrains action. Yet as modellers, we embrace such simplifications not as endpoints but as starting points. This framework provides the scaffolding upon which we can build agents that, despite their simplicity, exhibit surprisingly rich behaviors when released into their computational worlds.

Picture here. Perception. Cognition. Motor.

Creating an evolvable agent requires three fundamental design decisions that shape its potential for adaptive behavior:

A Simple Foraging World

Let’s bring these abstract concepts to life. Below, we define a miniature world using a simple ASCII map—a technique that lets us rapidly prototype environments while maintaining complete control over their structure. The hash marks (#) represent walls, impenetrable barriers that our agent must navigate around. The letter ‘f’ marks food sources—in this whimsical implementation, slices of cake that provide energy when consumed. Empty spaces (.) offer free passage, creating corridors and open areas where movement strategies can unfold.

The visualization above shows snapshots of our agent exploring this miniature world. Notice how the agent (represented as a directed arrow) leaves a fading trail behind it—a visual history of its path that reveals the emergent patterns of its movement strategy. The agent’s behavior, driven by its AND program brain, must balance exploration with exploitation: thoroughly searching the space while efficiently harvesting the resources it discovers.

References

Calcott, B. (2020). A Roomful of Robovacs: How to Think About Genetic Programs. In S. Holm & M. Serban (Eds.), Philosophical Perspectives on the Engineering Approach in Biology: Living Machines? Routledge. https://doi.org/10.4324/9781351212243