Skip to content

profan/lovely-systems

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tree

lovely-systems

Simple implementation of L-Systems in Lua, with examples in LÖVE2D.

Requirements

  • Lua >= 5.1 (?)
  • LÖVE2D (for the example project)

Running the example project

	love example

Downloading the source

Either with git clone as below or by downloading a zipball of the latest...

	git clone https://github.com/Profan/lovely-systems.git

Usage

When testing the example, use your arrow keys to change scale and segment size.

Example of defining a sierpinski triangle, example also already present in example code.

local lsystem = require "l-system"
		
initial_state = {state = {'F'}, rules = {['F'] = 'G-F-G', ['G'] = 'F+G+F'} }
fractal = lsystem.nthstep(initial_state, 2) -- recurses twice
		
-- fractal.state now holds: F+G+F-G-F-G-F+G+F, in table form.

which in turn can be used to produce: Fractal

or by increasing the iterations to 8, you can produce: BetterFractal

another example, a christmas tree! (sort of) Gran

TODO

  • ... write tests?

Credits

Credits for the libraries which are used in the example!

  • Matthias Richter - HUMP.

License

See attached LICENSE file.

About

L-Systems in Lua with accompanying LÖVE2D example.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages