https://github.com/marginallyclever/reactiondiffusion
Reaction Diffusion in Java
https://github.com/marginallyclever/reactiondiffusion
Last synced: about 1 month ago
JSON representation
Reaction Diffusion in Java
- Host: GitHub
- URL: https://github.com/marginallyclever/reactiondiffusion
- Owner: MarginallyClever
- Created: 2026-06-12T00:44:24.000Z (about 2 months ago)
- Default Branch: master
- Last Pushed: 2026-06-12T00:46:14.000Z (about 2 months ago)
- Last Synced: 2026-06-12T02:13:32.466Z (about 2 months ago)
- Language: Java
- Size: 176 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Reaction Diffusion

This is a Java maven project that implements a reaction diffusion system in Java.
It has a simple GUI to visualize the reaction diffusion process and control settings.
Resizing the window will restart the process.
## Running
Execute `Main.main()` to start the app. Maven will package a fat jar that can be executed with `java -jar target/reaction-diffusion-1.0.jar`.
Mouse left click+drag will paint in the grid.
Right click will report to the console the current state of the grid at the mouse position.
Use `File > Starter` or `File > Load` to load an image in the top left corner as a reaction starting point.
The Settings sliders and spinners respond to mouse wheel scrolling. Give it a try!
## Threading
The reaction diffusion process runs better in a multi-core CPU, as the process is parallelized. If you have a single core CPU, you may want to reduce the number of iterations per frame to improve responsiveness.
If the app is not responding well, try this: locate `gui.OutputPanel.paintComponent()`
and change
```java
for(int i=0;i<10;++i) {
model.performReactionDiffusion();
}
```
by replacing 10 with a smaller number. The animation is running 10 iterations per frame, and a lower number will slow
the process down, but it will be more responsive.
## Colors
All the color choices are made in `View.updateImage()`. Try replacing `rainbow()` with something else.
## See also
https://www.karlsims.com/rd.html
https://github.com/jasonwebb/morphogenesis-resources#reaction-diffusion