{"id":13442863,"url":"https://github.com/inconvergent/snek","last_synced_at":"2025-03-20T15:31:18.508Z","repository":{"id":44569110,"uuid":"85746296","full_name":"inconvergent/snek","owner":"inconvergent","description":"See https://github.com/inconvergent/weir instead","archived":true,"fork":false,"pushed_at":"2018-11-15T22:12:47.000Z","size":23045,"stargazers_count":742,"open_issues_count":0,"forks_count":47,"subscribers_count":30,"default_branch":"master","last_synced_at":"2024-10-28T06:00:03.204Z","etag":null,"topics":["art","common-lisp","experimental","generative","generative-art","lisp","procedural","procedural-generation","procgen"],"latest_commit_sha":null,"homepage":"","language":"Common Lisp","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inconvergent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-21T19:48:08.000Z","updated_at":"2024-09-17T00:59:18.000Z","dependencies_parsed_at":"2022-08-31T14:21:58.271Z","dependency_job_id":null,"html_url":"https://github.com/inconvergent/snek","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/inconvergent%2Fsnek","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inconvergent%2Fsnek/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inconvergent%2Fsnek/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inconvergent%2Fsnek/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inconvergent","download_url":"https://codeload.github.com/inconvergent/snek/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244640020,"owners_count":20485966,"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":["art","common-lisp","experimental","generative","generative-art","lisp","procedural","procedural-generation","procgen"],"created_at":"2024-07-31T03:01:52.320Z","updated_at":"2025-03-20T15:31:18.503Z","avatar_url":"https://github.com/inconvergent.png","language":"Common Lisp","funding_links":[],"categories":["Common Lisp","Applications"],"sub_categories":["Graphics"],"readme":"# SNEK-A System for Making Generative Systems\n\n\n## About\n\nThis library is specifically written to be useful for a broad range of ways in\nwhich I create art using various generative algorithms.\n\n![head](img/cells.lisp.png?raw=true \"ex\")\n\nIn short `snek` is four things:\n\n1. A simple (graph) data structure for working with vertices and edges The\n   structure is named `snek`; the name is explained below. This structure is\n   combined with a programming pattern for applying changes to the structure.\n   The pattern relies on `alterations`, see below.\n\n2. A series of useful data structures and tools. E.g. a 2D vector `vec`, a\n   package for generating different kinds of random numbers: `rnd`, as well as\n   tools for handling colors (`pigment`), splines (`bzspl`), and various vector\n   an path functionality (`math`, `lin-path`).\n\n3. A tool for drawing things called `sandpaint`. `sandpaint` uses random\n   sampling to draw its primitives. This creates a fairly distinct and gritty\n   look in many cases.\n\n4. A tool for drawing svg files (`draw-svg`). Mainly svg files that are good\n   for plotting.\n\n![head](img/spline-script.lisp.png?raw=true \"ex\")\n\n\n### About the Name\n\nA while back someone on Twitter suggested that if Python 3 was named \"snek\" it\nwould avoid naming confusion. I found that amusing at the time, and picked\n`snek` as the placeholder name for this project. I've been looking for a better\nname, but I haven't found one yet.\n\n\n## Alterations\n\nThe pattern depends on the concept of `alterations`. In short: an `alteration`\nis a change that will be applied to the structure at the end of a given\ncontext. `alterations` are further described in\nhttps://inconvergent.net/2017/snek-is-not-an-acronym/.\n\nI have also written about things related to `snek` at\n\n  - https://inconvergent.net/2017/a-propensity-for-mistakes/ (indirectly about\n    `snek`)\n  - https://inconvergent.net/2017/a-method-for-mistakes/\n  - https://inconvergent.net/2017/arbitrary-alterations/\n  - https://inconvergent.net/2017/grains-of-sand/\n\nHere is and example of manipulating a `snek` instance called `snk` using\n`alterations`. Alteration constructors are postfixed with `?`.\n\n```lisp\n; context start\n(snek:with (snk)\n  ; iterate vertices\n  (snek:itr-verts (snk v)\n    ; move alteration\n    (snek:move-vert? v (rnd:in-circ 1d0))\n    ; w will be an arbitrary\n    ; vertex in snk\n    (snek:with-rnd-vert (snk w)\n      ; join v and w if they are closer than d\n      (if (\u003c (snek:edge-length snk v w) d)\n        ; join vertices alteration\n        (snek:add-edge? v w))))\n; context end\n; alterations have been applied\n```\n\nYou can also manipulate the state directly. These functions are postfixed with\n`!`.  Eg. `(snek:move-vert! ...)`.\n\n\n## Examples\n\nThere are some examples included. All examples are in the `examples` folder.\n\nIf you don't provide a filename (with full or relative path) as the first\nargument, the resulting file will be named `./tmp.png`.\n\n\n### Custom alterations\n\nYou can define your own arbitrary alterations. There is an example of this in\n`ex/custom-alt.lisp`. I have also written about it here:\nhttps://inconvergent.net/2017/arbitrary-alterations/\n\n\n## Usage\n\nI use snek for most of the work that I post online\n(https://twitter.com/inconvergent). Both for generating raster images as well\nas vector images for plotter drawings.\n\n![lines](img/lines.lisp.png?raw=true \"ex\")\n\n![lines](img/grid-bz-walk.lisp.png?raw=true \"ex\")\n\nHere are some plotted examples:\n\n - https://inconvergent.net/2017/spline-script-plots/\n - https://inconvergent.net/mechanical-plotter-drawings/\n - https://inconvergent.net/mechanical-plotter-drawings/3/\n - https://inconvergent.net/mechanical-plotter-drawings/5/\n\n\n## Dependencies\n\nThis code requires `libpng-dev`, `Quicklisp`, `zpng`, `cl-svg` and `cl-png`.\nThe path to quicklisp must be set in `src/load`. `zpng`, `cl-svg` and `cl-png`\nare automatically installed via `quicklisp`.\n\n - https://www.quicklisp.org/beta/\n - http://www.xach.com/lisp/zpng/\n\n\n## Tests\n\nThere are some tests included, see the `test` folder.\n\n\n## Stability, Changes and Versioning\n\nThis code is highly experimental on my part. It is likely to change with no\nwarning or explanation. I will keep a note of the version number in\n`src/load.lisp`.\n\n\n## Thanks\n\nI would like to thank:\n\n  - https://twitter.com/RainerJoswig\n  - https://twitter.com/paulg\n  - https://twitter.com/jackrusher\n\nWho have provided me with useful hints and code feedback.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finconvergent%2Fsnek","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finconvergent%2Fsnek","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finconvergent%2Fsnek/lists"}