{"id":17998361,"url":"https://github.com/primaryobjects/lsystems","last_synced_at":"2025-04-04T06:42:12.770Z","repository":{"id":139343274,"uuid":"180671906","full_name":"primaryobjects/lsystems","owner":"primaryobjects","description":"Recursive patterns using Lindenmayer systems.","archived":false,"fork":false,"pushed_at":"2020-01-22T21:56:09.000Z","size":363,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-09T17:47:48.363Z","etag":null,"topics":["ai","artificial-intelligence","canvas","canvasjs","grammar","heuristic","heuristics","html5-canvas","javascript","lindenmayer","lindenmayer-systems","logo","react","reactjs","recursion","recursive","turtle","turtle-graphics"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/primaryobjects.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-04-10T22:14:47.000Z","updated_at":"2024-02-27T13:40:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"581da2ee-2627-4352-b5b7-11d2cf7390a5","html_url":"https://github.com/primaryobjects/lsystems","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primaryobjects%2Flsystems","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primaryobjects%2Flsystems/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primaryobjects%2Flsystems/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primaryobjects%2Flsystems/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/primaryobjects","download_url":"https://codeload.github.com/primaryobjects/lsystems/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135123,"owners_count":20889420,"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":["ai","artificial-intelligence","canvas","canvasjs","grammar","heuristic","heuristics","html5-canvas","javascript","lindenmayer","lindenmayer-systems","logo","react","reactjs","recursion","recursive","turtle","turtle-graphics"],"created_at":"2024-10-29T21:24:57.527Z","updated_at":"2025-04-04T06:42:12.745Z","avatar_url":"https://github.com/primaryobjects.png","language":"JavaScript","readme":"L-Systems\n===========\n\nDrawing recursive patterns using a formal grammar heuristic.\n\nThis is a demo of using a [Lindenmayer system](https://en.wikipedia.org/wiki/L-system) to draw patterns using a basic implementation of the programming language [Logo](https://en.wikipedia.org/wiki/Logo_(programming_language)). The pattern is drawn using a heuristic based upon a formula for X and Y movement. The formula is defined using the grammar shown below. The default value is the [Dragon](https://en.wikipedia.org/wiki/L-system#Example_6:_Dragon_curve) pattern!\n\nThe project is demonstrated using React, Javascript, and the HTML5 canvas. Run it on [Codepen](https://codepen.io/anon/pen/GLjOOe).\n\n## Screenshot\n\nTry the online [demo](http://primaryobjects.github.io/lsystems/).\n\n![Screenshot](https://raw.githubusercontent.com/primaryobjects/lsystems/master/screenshot.gif)\n\n## Grammar\n\nA lindemayer system consists of a formal grammar, which defines the movement, steps, and direction for the pen to take. This project's grammar is defined below.\n\n```\nX = Run the formula for X\nY = Run the formula for Y\nF = Move forward by n steps\n+ = Turn right by 90 degrees\n- = Turn left by 90 degrees\n```\n\nFrom the above set of simple rules, complex patterns can emerge on the canvas. For example, the default formula defines the so-called \"Dragon\" pattern, which consists of a x-axis movement and a y-axis movement. The definition is listed below.\n\n```\nX: X+YF+\nY: -FX-Y\n```\n\nFor formula X, the grammar dictates that we first execute the X-axis formula for the pen, turn right by 90 degrees, execute the Y-axis formula, move forward (drawing a line), turn right by 90 degrees.\n\nWe follow a similar set of steps for formula Y. Since the recursive nature of the grammar would continue running infinitely, we limit the execution of the pattern to a specified number of steps, thus completing the pattern.\n\n## Example Formulas to Try\n\n#### Cross\n\n```\nX: X+YF+\nY: -FX\n```\n\n#### Diagonal\n\n```\nX: X+YYF-\nY: -FX+Y\n```\n\n## License\n\nMIT\n\n## Author\n\nKory Becker\nhttp://www.primaryobjects.com/kory-becker","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimaryobjects%2Flsystems","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprimaryobjects%2Flsystems","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimaryobjects%2Flsystems/lists"}