{"id":15104117,"url":"https://github.com/jryzkns/loss","last_synced_at":"2026-02-25T05:11:09.558Z","repository":{"id":133371826,"uuid":"132222382","full_name":"jryzkns/Loss","owner":"jryzkns","description":"Deterministic Context-Free L system implementation for drawing fractal curves and axial plants. Made with love, for löve.","archived":false,"fork":false,"pushed_at":"2018-11-07T21:41:42.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T23:51:21.198Z","etag":null,"topics":["love2d","love2d-framework","lua"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jryzkns.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-05T06:45:50.000Z","updated_at":"2018-11-07T21:41:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"1ec081ab-fab2-4acc-bd6d-97adfac931e2","html_url":"https://github.com/jryzkns/Loss","commit_stats":{"total_commits":24,"total_committers":2,"mean_commits":12.0,"dds":0.04166666666666663,"last_synced_commit":"d460a57ef18ac1ec19d1e87b41f7b33e2708d7c7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jryzkns%2FLoss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jryzkns%2FLoss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jryzkns%2FLoss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jryzkns%2FLoss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jryzkns","download_url":"https://codeload.github.com/jryzkns/Loss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247335977,"owners_count":20922543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["love2d","love2d-framework","lua"],"created_at":"2024-09-25T20:00:31.037Z","updated_at":"2025-10-25T10:11:24.621Z","avatar_url":"https://github.com/jryzkns.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Loss\nDeterministic Context-Free L system implementation to draw fractal curves and axial plants. Made with love, for löve.\n\n## Introduction \n- L-Systems, short for Lindenmayer Systems, is a formal contextualization of naturally recurring constructs (ex. fractals and plants) under the light of formal language and automata theory.\n- Wikipedia introduces excellent examples on the topic: https://en.wikipedia.org/wiki/L-system\n- Implemented on version 0.9.1 of the LÖVE engine: https://love2d.org/\n- A Python implementation written in Turtle is also provided.\n## Example Renders\n- Checkout the Python script attached to this repository\n- Finished products will be coming soon!\n## Example L Systems by Author\n- Lightning\n```\nlightning = {}\nlightning.path = \"F\" -- axiom\nlightning.size = 15\nlightning.angle = 25\nlightning.rules = {}\nlightning.rules[\"F\"] = \"FL[++F][-FF]\"\nlightning.rules[\"L\"] = \"L+F-F[L]\"\n\nligntning = L:init(lightning.path,lightning.size,lightning.angle,lightning.rules,4)\n```\n- A sample tree\n```\ntree = {}\ntree.path = \"Ff\"\ntree.maxorder = 4\ntree.angle = 18\ntree.rules = {}\ntree.rules[\"F\"] = \"F[+[F]+[Bf]]-B\"\ntree.rules[\"B\"] = \"BFB[--B]+Bf\"\n-- call L:init() with these values in mind\n```\n## Usage\n- `git clone https://github.com/jryzkns/Loss.git`\n- Copy and paste `L.lua` in the directory containing the target love script.\n- Append `local L = require(\"L\")` in the love script where drawing will be called.\n- Call `L:init()` and initialize values inside `love.load().`\n- Call `L:render()` to draw the construct.\n- To introduce new symbols into the alphabet, write the following:\n* For straight line drawings, append `L.extradrawchars = L.extradrawchars .. \"new symbol\"`\n* For symbols with new functionalities, the code is as follows:\n```\nL:drawtable[\"new symbol\"] = function()\n    -function details\nend\n```\n### The Alphabet:\n- The built-in alphabet consists of the following symbols:\n- `F`,`B`,`L`,`R`,`f`,`+`,`-`,`[`,`]`\n- `F`,`B`,`L`,`R` all correspond to drawing a straight line. This semantic distinction is to use the formation rules.\n- `f` denotes travelling as if drawing a line without producing one.\n- `+`,`-` denote rotating the current reference point in the positive or negative direction. The extent of the rotation depends on the `Angle` variable.\n- `[`,`]` denotes the stack operation, push or pop, which operates on the current state of the reference point. This symbol is used to branch the behaviour.\n### Initialize `Axiom`, `Rules`, `Iterations`, `Angle`, And `Linesize` As Variables\n- `Axiom` is a string denoting the initial state of the system.\n- `Rules` are tabulated formation rules, initialized as an empty table. The key is the original symbol in the alphabet.\n- Formation rules are tabulated. If the rules states that a -\u003e b, it is written, rules[\"a\"] = \"b\".\n- `Iterations` are integers denoting how many iterations the system will evolve.\n- `Angle` is a value in degrees, which determines how much each call will turn the construct.\n- `Linesize` is the length of the line. Use a small test value as drawings may enlarge quickly!\n### Drawing\n- Call L:render() to start drawing. Set `love.graphics.translate()` to the starting point and call `L:render()`.\n\n## A Side Note\n- Rendering L system constructs may exceed 100 calls, which is expensive if it is called on every flip. \n- Instead, draw to a canvas on initialization and draw the canvas on each flip.\n\njryzkns 2018\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjryzkns%2Floss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjryzkns%2Floss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjryzkns%2Floss/lists"}