{"id":16533816,"url":"https://github.com/kchapelier/cellular-automata","last_synced_at":"2025-09-22T01:31:29.225Z","repository":{"id":57195714,"uuid":"43223296","full_name":"kchapelier/cellular-automata","owner":"kchapelier","description":"Cellular automata runner","archived":false,"fork":false,"pushed_at":"2019-09-28T14:42:32.000Z","size":51,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-19T15:28:00.249Z","etag":null,"topics":["arbitrary-dimensions","cellular-automata","cellular-automation","javascript","procedural-generation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/kchapelier.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}},"created_at":"2015-09-26T21:15:57.000Z","updated_at":"2025-03-19T17:14:45.000Z","dependencies_parsed_at":"2022-09-17T03:11:46.480Z","dependency_job_id":null,"html_url":"https://github.com/kchapelier/cellular-automata","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kchapelier/cellular-automata","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kchapelier%2Fcellular-automata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kchapelier%2Fcellular-automata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kchapelier%2Fcellular-automata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kchapelier%2Fcellular-automata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kchapelier","download_url":"https://codeload.github.com/kchapelier/cellular-automata/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kchapelier%2Fcellular-automata/sbom","scorecard":{"id":552798,"data":{"date":"2025-08-11","repo":{"name":"github.com/kchapelier/cellular-automata","commit":"fe534bd7faf157b56ff6aaa8a0a371f5123b7e4b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"16 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T11:22:19.145Z","repository_id":57195714,"created_at":"2025-08-20T11:22:19.145Z","updated_at":"2025-08-20T11:22:19.145Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276265546,"owners_count":25612861,"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","status":"online","status_checked_at":"2025-09-21T02:00:07.055Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["arbitrary-dimensions","cellular-automata","cellular-automation","javascript","procedural-generation"],"created_at":"2024-10-11T18:15:54.739Z","updated_at":"2025-09-22T01:31:28.910Z","avatar_url":"https://github.com/kchapelier.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cellular-automata\n\n[![Build Status](https://travis-ci.org/kchapelier/cellular-automata.svg)](https://travis-ci.org/kchapelier/cellular-automata) [![NPM version](https://badge.fury.io/js/cellular-automata.svg)](http://badge.fury.io/js/cellular-automata)\n\n## Installing and testing\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install cellular-automata\n```\n\nTo run the test suite, run the following command from the ```cellular-automata``` directory:\n\n```\nnpm test\n```\n\n## Features\n\n- Doesn't have any dependency to the DOM.\n- Can easily apply different successive rules.\n- Can be used in any dimension (1D, 2D, 3D and more).\n- Allow the cellular automata rules to be passed as a string in one of several common CA rule format, see [cellular-automata-rule-parser](https://www.npmjs.com/package/cellular-automata-rule-parser).\n\n## Usage\n\n### Code\n\n```js\nvar CellularAutomata = require('cellular-automata');\n\n// create a cellular automata with width of 200 cells and a height of 80 cells\nvar cellularAutomata = new CellularAutomata([200, 80]);\n\n// fill the array with 95% of 0 values and 5% of 1 values\ncellularAutomata.fillWithDistribution([[0, 95], [1, 5]]);\n\n// define that the value out of the array should be interpreted as 0 values\ncellularAutomata.setOutOfBoundValue(0);\n\ncellularAutomata.setRule('23/3').iterate(5); // apply 5 times the S23/B3 rule (conway's life)\ncellularAutomata.setRule('135/17').iterate(3); // apply 3 times the S135/B17 rule\ncellularAutomata.setRule('234/12345678').iterate(5); // apply 5 times the S234/B12345768 rule\n\nconsole.log(cellularAutomata.array); // ndarray containing the result\n```\n\n### Result as an image\n\n\u003cimg src=\"https://github.com/kchapelier/cellular-automata/raw/master/readme1.png\" style=\"image-rendering:pixelated; width:400px;\"\u003e\u003c/img\u003e\n\n### Code\n\n```js\n// create a cellular automata with width of 75 cells and a height of 75 cells\nvar cellularAutomata = new CellularAutomata([75, 75]);\n\n// use the fluent interface and the shortcut method \"apply\"\ncellularAutomata\n    .setOutOfBoundValue(1)\n    .apply('23/3', 16)\n    .apply('23456/45678', 16)\n    .apply('23456/478', 16);\n\nconsole.log(cellularAutomata.array); // ndarray containing the result\n```\n\n### Result as an image\n\n\u003cimg src=\"https://github.com/kchapelier/cellular-automata/raw/master/readme2.png\" style=\"image-rendering:pixelated; width:150px;\"\u003e\u003c/img\u003e\n\n## Public API\n\n### Constructor\n\n**new CellularAutomata(shape[, defaultValue = 0])**\n\n- *shape :* Shape of the grid (ie: [800,600] for a 2d grid of 800 cells of width and 600 cells of height).\n- *defaultValue :* Default value of the cells.\n\n### Methods\n\nAll methods are chainable\n\n**setOutOfBoundValue([outOfBoundValue = 0])**\n\nDefine the value used for the neighbours out of the array's bounds.\n\n- *outOfBoundValue :* The value to use, either an integer, the string \"wrap\" to enable grid wrapping or the string \"clamp\" to use the nearest in-bound cell.\n\n**setRng([rng = null])**\n\nSet the random number generation function used internally.\n\n- *rng :* A function to use as random number generator, defaults to Math.random.\n\n**fillWithDistribution(distribution[, rng = null])**\n\nFill the grid with a given distribution.\n\n- *distribution :* An array of two dimensions representing the distribution to fill the grid with. (ie: [[0,90], [1,10]] for 90% of 0 and 10% of 1). Null values are ignored.\n- *rng :* A function used as random number generator, defaults to the internal RNG function.\n\n**setRule(rule[, neighbourhoodType[, neighbourhoodRange = 1]])**\n\nDefine the rule of the cellular automata and the neighbourhood to be used.\n\n- *rule :* Either a valid rule string (see [cellular-automata-rule-parser](https://www.npmjs.com/package/cellular-automata-rule-parser)) or a function taking as arguments the value of the current cell and an array containing the values of all its neighbours.\n- *neighbourhoodType :* Neighbourhood type (moore, von-neumann, axis, corner, edge or face), only used when the rule is a function.\n- *neighbourhoodRange :* Neighbourhood range, only used when the rule is a function.\n\n**iterate([iterations = 1])**\n\nApply the previously defined CA rule multiple times.\n\n- *iteration :* Number of iterations.\n\n**apply(rule[, iterations = 1[, neighbourhoodType[, neighbourhoodRange = 1]]])**\n\nApply a given rule for a given number of iterations, shortcut method for setRule and iterate.\n\n- *rule :* Either a valid rule string (see [cellular-automata-rule-parser](https://www.npmjs.com/package/cellular-automata-rule-parser)) or a function taking as arguments the value of the current cell and an array containing the values of all its neighbours.\n- *iteration :* Number of iterations.\n- *neighbourhoodType :* Neighbourhood type (moore, von-neumann, axis, corner, edge or face), only used when the rule is a function.\n- *neighbourhoodRange :* Neighbourhood range, only used when the rule is a function.\n\n### Properties\n\n**shape**\n\nThe shape of the grid.\n\n**dimension**\n\nThe dimension of the grid.\n\n**array**\n\nThe ndarray containing all the current data in the grid.\n\n## Changelog\n\n### 2.0.1 (2019-09-28) :\n\n- Update dependencies.\n\n### 2.0.0 (2019-04-19) :\n\n- Minor refactoring.\n- Reduce npm package size.\n- Update dependencies.\n- Add travis support.\n- Less direct support for older browser (now use `const` and `let` variable declarations).\n\n### 1.2.0 (2016-03-22) :\n\n- Update the rule parser to support the extended stochastic rule format.\n- Add the method setRng() to set the internal RNG function.\n\n### 1.1.0 (2016-03-09) :\n\n- Support for 'clamp' out-of-bound value.\n\n### 1.0.1 (2016-01-24) :\n\n- Update the rule parser.\n\n### 1.0.0 (2015-11-17) :\n\n- Better documentation.\n- The method fillWithDistribution now ignores null values.\n- Rename the properties currentArray to array and dimensions to dimension.\n- Remove the property defaultValue, the method switchArray and the method replace.\n- Declare stable.\n\n### 0.1.0 (2015-11-02) :\n\n- Update the rule parser.\n- Supports unconventional neighbourhood types (axis, corner, edge and face).\n- Sort neighbourhood to allow position dependent rules.\n\n### 0.0.3 (2015-10-17) :\n\n- Update the rule parser.\n\n### 0.0.2 (2015-10-13) :\n\n- Update the rule parser.\n\n### 0.0.1 (2015-10-04) :\n\n- First implementation.\n\n## Roadmap\n\n- More tests.\n\n## License\n\nMIT\n\n## Learn more about cellular automata\n\n- [Mirek Wojtowicz's Cellular Automata rules lexicon for MCell](http://www.mirekw.com/ca/ca_rules.html)\n- [Cellular Automata Theory in Cellab's manual](https://www.fourmilab.ch/cellab/manual/chap4.html)\n- [Wolfram's Elementary Cellular Automaton](http://mathworld.wolfram.com/ElementaryCellularAutomaton.html)\n- [Golly](http://golly.sourceforge.net/)\n- [Cellular Automaton on Wikipedia](https://en.wikipedia.org/wiki/Cellular_automaton)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkchapelier%2Fcellular-automata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkchapelier%2Fcellular-automata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkchapelier%2Fcellular-automata/lists"}