Salk Institute



Wormcraft is a worm-based simulator that converts sensory input to behavioral output. Users can build diverse neural networks using the open-ended Wormcraft GUI. Wormcraft simulates how worms perform in an environment with the user-created neural network.

Users can benefit from Wormcraft in several ways. First and foremost, Wormcraft is a great learning tool for anyone with an interest in neuroscience or robotics. Users will quickly gain an intuition for how to string together neurons in order to solve different problems. Also, researchers (especially C. elegans researchers) will be able to test their models without having to build their own simulation framework.


I will introduce Wormcraft by showing how it can be used to solve a common C. elegans problem: how to ascend a food concentration gradient. There are many ways to solve this problem. I will share a model I find to be particularly robust.

Central to my model is an oscillator that acts as a central pattern generator. The oscillator outputs signals to the ‘rotate muscle’. This rotate muscle changes the orientation of the worm depending on the strength of the input it receives. There is also a forward muscle separate from this system, constantly moving the animal forward.

I couple the phase speed of the oscillator with the second derivative of the amount of food detected by the animal. That is, when the second derivative is positive—occurs when the animal is turning towards ascending the concentration gradient—the phase speed slows—and vice versa for a negative second derivative. In this way, turns that orient the animal in line with the concentration gradient are accentuated, while turns that orient the animal down the concentration gradient are silenced.

Here is how we build the model with the GUI.


Here is the GUI at the beginning of program run. The toolbar contains all of the tools we need to build a network: (from left to right) neuron, oscillating neuron, sensor, muscle, and connection. We click to select a network tool and then click on the left of the Map to place our new tool.


Here, I have built the model. The black circles are non-oscillating neurons. The blue circle is an oscillating neuron. The green arc is a detector. The red triangle is the rotating muscle.

Each of the components in the network is highly customizable. Customizations are done within the command window (the window on the right). As an example, let us look at how to customize a sensor.


When we click on the sensor, the GUI renders options for customizing the sensor. For right now, the sensor has only two customizable parameters: the threshold and the sensor type. For this simulation, we will set the threshold to 0.0, and the type to ‘Food’ (by clicking the toggle button), as the worm must ascend a food concentration gradient.

We then use the command window to customize the rest of the network components. The connection from the sensor to the first neuron is a positive, linear connection. The next two connections in the network send positive, derivative signals. The connection from the oscillator to the muscle is a positive, linear connection. Finally, we set the integration properties of the oscillator such that the oscillator only receives positive values. This keeps us from having to deal with the case of oscillation reversal.

Then, we press enter. Wormcraft builds the neural network into a worm and runs on the worm on a landscape with a concentration gradient.


This is an example run. The function that defines the food concentration gradient landscape = 10.0*(20 - abs(y - 10)). Thus, the worm should move up the y-axis until it reaches y=10, then circle back. This is exactly what the worm does.