Livecoding Graphics in Common Lisp: Building a Boids Program Without Restarts

2025-04-23
Livecoding Graphics in Common Lisp: Building a Boids Program Without Restarts

This article demonstrates livecoding in Common Lisp for graphics programming, using the Boids algorithm as an example. Common Lisp's powerful recompilation feature allows code modification and immediate effect while the program is running, eliminating the need for restarts. The author utilizes the Sketch graphics framework, incrementally implementing the Boids algorithm and showcasing the efficient development process enabled by livecoding. By modifying code and observing the real-time effects, the core Boids algorithm—including separation, cohesion, and alignment rules—is implemented, culminating in a mouse-following Boids simulation. Livecoding significantly enhances development efficiency and interactivity.