{"id":20333337,"url":"https://github.com/daneelsan/wireworld","last_synced_at":"2025-06-20T09:06:10.488Z","repository":{"id":40503898,"uuid":"444301768","full_name":"daneelsan/Wireworld","owner":"daneelsan","description":"Wireworld: a Turing-complete cellular automaton suited for simulating logic gates and other real-world computer elements","archived":false,"fork":false,"pushed_at":"2025-03-10T04:28:09.000Z","size":1407,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T21:41:16.190Z","etag":null,"topics":["c","wireworld","wolfram-language","zig"],"latest_commit_sha":null,"homepage":"","language":"Mathematica","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/daneelsan.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,"zenodo":null}},"created_at":"2022-01-04T05:51:10.000Z","updated_at":"2025-03-10T04:28:12.000Z","dependencies_parsed_at":"2025-04-11T21:35:35.702Z","dependency_job_id":"3fd30a80-2c33-4ed7-8499-7c0aa987a1b0","html_url":"https://github.com/daneelsan/Wireworld","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/daneelsan/Wireworld","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daneelsan%2FWireworld","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daneelsan%2FWireworld/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daneelsan%2FWireworld/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daneelsan%2FWireworld/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daneelsan","download_url":"https://codeload.github.com/daneelsan/Wireworld/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daneelsan%2FWireworld/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260915880,"owners_count":23082038,"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":["c","wireworld","wolfram-language","zig"],"created_at":"2024-11-14T20:30:51.110Z","updated_at":"2025-06-20T09:06:05.477Z","avatar_url":"https://github.com/daneelsan.png","language":"Mathematica","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wireworld\n\nWireworld is a Turing-complete cellular automaton first proposed by Brian Silverman in 1987 suited for simulating logic gates and other real-world computer elements.\n\n## Installation\n\nInstall the paclet (version `1.0.0`) from github releases:\n\n```Mathematica\nPacletInstall[\"https://github.com/daneelsan/Wireworld/releases/download/v1.0.0/Wireworld-1.0.0.paclet\"]\n```\n\n## Usage\n\nLoad the Wireworld` package:\n\n```Mathematica\nNeeds[\"Wireworld`\"]\n```\n\nWireworld symbols:\n\n```Mathematica\nIn[]:= Names[\"Wireworld`*\"]\nOut[]= {\n\t\"WireworldDraw\",\n\t\"WireworldEvolve\",\n\t\"WireworldPlot\",\n\t\"WireworldStateQ\",\n\t\"$WireworldFunctionRule\",\n\t\"$WireworldNumberRule\",\n\t\"$WireworldRule\"\n}\n```\n\nOpen the documentation of the `WireworldEvolve` function:\n\n```Mathematica\nNotebookOpen[Information[WireworldEvolve, \"Documentation\"][\"Local\"]]\n```\n\n![ref/WireworldEvolve](./screenshots/ref-WireworldEvolve.png)\n\n## Examples\n\n### A Clock Generator\n\nA period 12 electron clock generator:\n\n```Mathematica\nIn[]:= state = {\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 3, 3, 3, 0, 3, 2, 1, 3, 3, 0, 0, 0},\n\t{0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0},\n\t{0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0},\n\t{0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 3, 0, 0},\n\t{0, 0, 3, 3, 1, 0, 0, 0, 0, 0, 0, 3, 0, 0},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0}\n};\n\nIn[]:= ListAnimate[WireworldPlot /@ WireworldEvolve[state, 11]]\n```\n\n![A clock generator](./screenshots/example-ClockGenerator.gif)\n\n### The Diode\n\nA diode allows electrons to flow in only one direction:\n\n```Mathematica\nIn[]:= state = {\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\t{3, 3, 2, 1, 3, 3, 3, 3, 2, 1, 3, 0, 3, 3, 2, 1, 3, 3, 3, 3, 2},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\t{3, 3, 2, 1, 3, 3, 3, 3, 2, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}\n};\n\nIn[]:= ListAnimate[WireworldPlot /@ WireworldEvolve[state, 8]]\n```\n\n![Two diodes](./screenshots/example-Diode.gif)\n\n### The OR gate\n\nTwo clock generators sending electrons into an OR gate:\n\n```Mathematica\nIn[]:= state = {\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 0, 3, 3, 3, 3, 3, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 0, 3, 3, 3, 1, 2, 3, 3, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 2, 1, 3},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 0, 2, 1, 3, 3, 3, 3, 2, 1, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\t{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}\n};\n\nIn[]:= ListAnimate[WireworldPlot /@ WireworldEvolve[state, 20]]\n```\n\n![An OR gate](./screenshots/example-OR.gif)\n\n## Wolfram Paclet Repository\n\nA copy of the lastest released paclet is in the Wolfram Paclet Repository (WPR):\nhttps://resources.wolframcloud.com/PacletRepository/resources/DanielS/Wireworld/\n\n## Build\n\n1. Build the `Wireworld` paclet using the `build_paclet.wls` wolframscript:\n\n```sh\n./scripts/build_paclet.wls\n```\n\nThe paclet will be placed under the `build` directory:\n\n```sh\nls build/*.paclet # build/Wireworld-1.0.0.paclet\n```\n\n2. Install the built paclet:\n\n```Mathematica\nPacletInstall[\"./build/Wireworld-1.0.0.paclet\"]\n```\n\n## Build libWireworld\n\nThe `LibraryLink` library `libWireworld` contains the low-level functions `` Wireworld`Library`WireworldStepImmutable `` and `` Wireworld`Library`WireworldStepMutable ``. There are two ways to build it:\n\n### build_library.wls\n\nRun `scripts/build_library.wls`:\n\n```sh\n./scripts/build_library.wls\n```\n\nThe library will be stored in `LibraryResources/$SystemID/`:\n\n```sh\nls LibraryResources/MacOSX-ARM64 # libWireworld.dylib\n```\n\nNote: this script only builds the library for your builtin `$SystemID`.\n\n### zig build\n\nUse `zig build` (https://ziglang.org) to build the library:\n\n```sh\nzig version # 0.14.0\nzig build\n```\n\nThe library will be stored in `LibraryResources/$SystemID/`:\n\n```sh\nls LibraryResources/MacOSX-ARM64 # libWireworld.dylib\n```\n\nOne can also cross compile specifying the target:\n\n```sh\nzig build -Dtarget=x86_64-linux\nls LibraryResources/Linux-x86-64 # libWireworld.so\n```\n\nThe mapping between `zig targets` and `$SystemID` is:\n\n```Mathematica\n{\n\t\"Linux-x86-64\" -\u003e \"x86_64-linux\",\n\t\"MacOSX-x86-64\" -\u003e \"x86_64-macos\",\n\t\"Windows-x86-64\" -\u003e \"x86_64-windows\",\n\t\"MacOSX-ARM64\" -\u003e \"aarch64-macos\",\n}\n```\n\nNote: other targets will be stored in `zig-out/lib`.\n\nThe build configuration is specified in `build.zig`. If necessary, change the location of the Wolfram libraries and headers:\n\n```zig\nlib.addIncludeDir(...);\nlib.addLibPath(...);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaneelsan%2Fwireworld","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaneelsan%2Fwireworld","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaneelsan%2Fwireworld/lists"}