https://github.com/calebwin/go-fern
A small library for creating persistent L-systems in the Go programming language
https://github.com/calebwin/go-fern
golang l-system
Last synced: about 1 year ago
JSON representation
A small library for creating persistent L-systems in the Go programming language
- Host: GitHub
- URL: https://github.com/calebwin/go-fern
- Owner: calebwin
- Created: 2018-09-13T19:00:46.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-24T20:41:17.000Z (almost 8 years ago)
- Last Synced: 2025-03-23T18:50:54.454Z (over 1 year ago)
- Topics: golang, l-system
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## What it is
A tiny library for creating Lindenmayer systems. Currently supports stochastic grammars, context-sensitive grammars.
## How to use it
```
import "github.com/calebwin/fern"
var myL = fern.generate("ABC") // create new L-System with an axiom of "ABC"
myRules := map[string][]fern.Successor {
"A" : []fern.Successor{
fern.Successor {
"AB",
1.0,
"",
"",
},
},
"B" : []fern.Successor{
fern.Successor {
"BA",
1.0,
"C",
"A",
},
},
}
myL = fern.setRules(myL, myRules) // set rules for the L-System
fern.iterate(myL, 3) // "ABBBBC" after 3 iterations of the L-System
```