Evolving a Roomba
In my paper Calcott (2020), I argue that …
We now have a simple architecture that can be evolved to produce adaptive behavior in a changing environment. Building an actual Roomba is beyound 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: responsing 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.
Our environment will be a simple 2d grid world, consisting of a set of patches1. 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?
What happens?
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 behavioral modeling.
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 behavioral agents, consider the classical tripartite division of intelligent action:
- Perception: gathering information from the environment through sensors
- Cognition: processing sensory data to make decisions
- Motor control: translating decisions into physical actions
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 modelers, 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:
- The World: We construct a simple two-dimensional grid environment—a computational petri dish where our agents can explore, encounter obstacles, and discover resources.
- The Senses: Local information from the agent’s immediate surroundings feeds directly into its AND program, creating a tight coupling between environment and computation.
- The Actions: The program’s output determines the agent’s next move, transforming abstract computation into concrete behavior—turning left or right, moving forward, or pausing to “consider” its options.
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
Footnotes
To avoid confusion with biological cells, I will refer to locations in the grid world as “patches” rather than “cells”.↩︎

