L-system plant in Reprocessing
An L-system or Lindenmayer system is a parallel rewriting system and a type of formal grammar. An L-system consists of an alphabet of symbols that can be used to make strings, a collection of production rules that expand each symbol into some larger string of symbols, an initial "axiom" string from which to begin construction, and a mechanism for translating the generated strings into geometric structures.
This fractal plant is based on
variables : X F
constants : + − [ ]
start : X
rules : (X → F+[[X]-X]-F[-FX]+X), (F → FF)
angle : 25°
Here, F means "draw forward", − means "turn left 25°", and + means "turn right 25°". X does not correspond to any drawing action and is used to control the evolution of the curve. The square bracket "[" corresponds to saving the current values for position and angle, which are restored when the corresponding "]" is executed.
https://github.com/Rigellute/L-system-reasonml.git
yarn
yarn build
yarn start
To build to JS run npm run build:web
and then run a static server, like python -m SimpleHTTPServer
and go to localhost:8000
. If you're using safari you can simply open the index.html
and tick Develop > Disable Cross-Origin Restrictions
.
To build to native run npm run build:native
and run npm run start:native
The build system used is bsb-native.