About Flux Bugs
Flux Bugs is an interactive cellular automaton inspired by Langton's Ant. It simulates agents—called "bugs"—with different personalities moving on a grid and modifying cell states as they go. The simulation emphasizes emergent behavior from simple rules, with support for real-time interaction and visual aging of the environment.
Bug Personalities
- P0 (Red): Turns based on the age of the cell. Tends to form expanding angular patterns.
- P1 (Green): Turns based on the color state of the cell. Reacts predictably to previously visited or unvisited spaces.
- P2 (Blue): Cycles through three internal states (A → B → C), with randomized turns. This makes it highly unpredictable and chaotic.
Interface Controls
- Run/Pause/Reset: Start, stop, or restart the simulation.
- Speed: A slider that determines how quickly bugs take steps. Higher values make bugs move more frequently.
- Mute: Disables the soft audio cues triggered by each bug interaction.
- P0 / P1 / P2: Numeric input for how many bugs of each personality should be spawned at the center of the grid on reset.
Mouse Interaction
- Click: Cycles the clicked cell through the sequence: blank → P0 → P1 → P2 → blank. This allows manual grid editing.
- Shift + Click: Spawns a new bug at the clicked location with a random personality.
Behavior Overview
Bugs begin at the center and move one cell at a time. At each step, they:
- Observe the cell's state (color and age).
- Decide how to turn based on their personality logic.
- Update the cell's color and increment its age.
- Move forward and repeat.
Over time, patterns emerge from the interaction of bug rules and the changing grid. Cell aging creates a fading visual trail, and different bug types can interact in complex ways—either cooperating or disrupting each other's structures.
Educational Use
This simulation is ideal for demonstrating complex systems, self-organization, and emergent behavior. It offers a hands-on way to understand how simple rules can create rich, unpredictable dynamics.
Audio Feedback
Each bug type produces a distinct audible tone when it takes a step:
- P0 (Red): Low tone (350 Hz)
- P1 (Green): Medium tone (550 Hz)
- P2 (Blue): High tone (750 Hz)
The audio feedback can be disabled using the "Mute" checkbox. When unmuted, the soft tones create an algorithmic soundscape that corresponds to the bugs' movements.