https://github.com/michael-ryan/cellularautomata
A graphical cellular automaton simulator, written in Go.
https://github.com/michael-ryan/cellularautomata
cellular-automata cellular-automaton golang
Last synced: 5 months ago
JSON representation
A graphical cellular automaton simulator, written in Go.
- Host: GitHub
- URL: https://github.com/michael-ryan/cellularautomata
- Owner: michael-ryan
- License: mit
- Created: 2024-09-19T21:21:45.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-25T22:26:34.000Z (over 1 year ago)
- Last Synced: 2024-09-26T08:49:27.538Z (over 1 year ago)
- Topics: cellular-automata, cellular-automaton, golang
- Language: Go
- Homepage:
- Size: 63.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cellular Automata Simulator
## 📝 Documentation
For using the tool, see [here](https://pkg.go.dev/github.com/michael-ryan/cellularautomata).
For the API to construct your own automata, see [here](https://pkg.go.dev/github.com/michael-ryan/cellularautomata/model).
For example automata, see [here](examples/).
## 🚀 Usage
The simplest usage is as follows. In your `main` package, set up a `Config` object and supply it to `Launch`.
```Go
package main
import (
"github.com/michael-ryan/cellularautomata"
"github.com/michael-ryan/cellularautomata/examples"
)
func main() {
c := cellularautomata.Config{
Fps: 15,
CellsX: 128,
CellsY: 72,
WindowX: 1280,
WindowY: 720,
Automaton: examples.NewForest(),
InitialState: 0,
SkipEditor: true,
}
cellularautomata.Launch(c)
}
```
This will open a GUI window and run a simulation.
There is an optional edit mode which the program will start in if `SkipEditor` is `false`. In this mode, you can click on cells to cycle their initial state, then press `S` on your keyboard to start the simulation.
Note: Launch must be called from the main goroutine, due to a limitation in OpenGL.
Feel free to play with the config parameters. You can swap out `Automaton` for other sample models (defined [here](models/)), or you can easily construct your own automata. For examples, see [here](examples/).
## 🐛 Known Issues & Planned Improvements
- Analysis tools to record cell state counts and how they change over time.
## 🔧 Troubleshooting
### *There's some error about x11, package 'gl' missing etc etc*
See requirements for the graphics library I'm using [here](https://github.com/gopxl/pixel?tab=readme-ov-file#requirements). You'll probably need to install `gcc`, `libgl1-mesa-dev` and `xorg-dev`.
### *My issue isn't listed here!*
Please file an issue on this repository, and I'll take a look.
## 🤝 Contributing
Feel free to file pull requests.