Introduction
Logic Diffusion Simulator is a Godot-based software designed to simulate, on a computer, the experimental process of placing engineered bacterial colonies on an agar plate to construct biological logic gates.
This simulator provides researchers with inspiration for colony spatial arrangement and new logic gate design, and also serves educational purposes—helping the public better understand how engineered colonies can be used to build biological logic gates, and allowing users to try constructing their own logic gates digitally.
Mathematical Simulation
With the aid of precise computational modeling, this project establishes a simplified mathematical model suitable for dynamic interactive simulations. We adopt the Gaussian solution of the diffusion equation and propose the following formulation:
\[C(r,t) = C_0 e^{-kt} \exp\left(- \frac{r^2}{4D(t + t_0)}\right)\]
- \(C_0\): Initial central concentration (reference value at the instant of the event).
- \(\lambda\): Central first-order decay rate (unit: per hour).
- \(D\): Diffusion coefficient (related to diffusion rate, unit: distance²/time).
- \(t_0\): Time difference between system start and the actual onset of diffusion.
- \(r\): Spatial distance.
By taking the derivative of the function with respect to $t$ at a fixed $r$, we can determine the time and magnitude of the peak concentration at distance $r$ from the source:
\[t^* = \frac{r}{2\sqrt{Dk}} - t_0\]
\[C_0 \exp(kt_0) \exp\left(- r\sqrt{\frac{k}{D}}\right)\]
In the program, diffusion begins simultaneously with simulation start, so $t_0 = 0$, meaning there is no time offset. The equation thus simplifies to:
\[t^* = \frac{r}{2\sqrt{Dk}}\]
\[ C_{\text{max}}(r) = C_0 e^{kt_0} e^{-r\sqrt{k/D}} \xrightarrow{t_0 = 0} C_0 e^{-r\sqrt{k/D}} \]
This yields a set of computationally efficient simplified models suitable for large-scale numerical operations, forming the foundation for building fast, interactive, and complex game-like simulation software.
User Guide
Launching the Program
Run Logic.exe to enter the home page:
Click Settings to adjust configurations, or click New Game to start a new experiment. If a save file exists, click Continue to resume from the last saved experiment.
Placing Colonies
Click the three circular colony buttons on the top left to enter High-Pass, Band-Pass, and Input Source placement modes, respectively.
In these modes, left-click on the screen to place colonies.
If the colony position is unsatisfactory, drag it to reposition.
After finishing placement, click Start to begin diffusion simulation. The colonies will then respond according to their properties.
(Note: The diffusion animation is only a visual cue; for actual diffusion results, refer to the section below.)
Peak Display Mode
Click Peak Page to enter peak display mode.
In this mode, the software renders the peak signal concentrations at different distances from the input source:
- In the blue region, high-pass colonies respond.
- In the green region, band-pass colonies respond.
- In other regions, no colonies respond.
Distance Display Mode
Right-click a colony to select it (the selected colony will be highlighted).
Then click Show Distance to enter distance display mode, where the Manhattan distances between colonies are shown.
You can drag colonies during this mode, and the displayed distances will update dynamically.
Half Adder Mode
Click Half Adder to enter the half-adder placement mode.
You can place a preconfigured half-adder logic gate model.
Left-click to choose the placement position, then drag to set the orientation.
Click Confirm to finalize the placement.
Additionally:
- Press Ctrl+Z or click Withdraw to undo your last placement
- Click Delete to clear all colonies on screen.
- Click the Speed button at the top right to switch between 1× and 2× simulation speed.
Pause and Restart
Click the Pause button to enter the pause page.
- Restart: Return to the initial arrangement of this experiment (if loaded from a previous save, it restores that saved state).
- Continue or the top-right icon: Resume the experiment.
- Home: Save the current experiment and return to the home page.
Settings Page
In the Settings page, you can change the window format or adjust the diffusion coefficient and colony response thresholds as needed.
- Enter new numerical values in the input fields and press Enter.
- Click Confirm to apply changes.
- Click Default to restore initial values (you must still click Confirm afterward).
- Click Close to return to the home page.
Diffusion Real-Time Tracking Display
After pressing the Start button and entering the Peak Page, you can monitor the real-time concentration of each point at the current moment (indicated by color brightness).
The display principle remains the same as before:
- Blue indicates regions capable of activating high-pass gates.
- Green indicates regions capable of activating band-pass gates.
Note:Please do NOT return to the main menu before pressing Stop to halt the logic gate operation, as this may cause the Peak Page mode to malfunction. If this occurs, simply restart the software to restore normal functionality.