{"id":16533810,"url":"https://github.com/kchapelier/convchain-gpu","last_synced_at":"2025-09-22T01:31:30.435Z","repository":{"id":57206684,"uuid":"177170474","full_name":"kchapelier/convchain-gpu","owner":"kchapelier","description":"Javascript/WebGL2 port of https://github.com/mxgmn/ConvChain","archived":false,"fork":false,"pushed_at":"2019-03-22T20:17:49.000Z","size":16,"stargazers_count":30,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-11T08:27:05.689Z","etag":null,"topics":["gpgpu","javascript","procedural-generation","webgl2"],"latest_commit_sha":null,"homepage":null,"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":"2019-03-22T16:01:35.000Z","updated_at":"2023-11-06T10:28:16.000Z","dependencies_parsed_at":"2022-09-11T05:01:53.717Z","dependency_job_id":null,"html_url":"https://github.com/kchapelier/convchain-gpu","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kchapelier/convchain-gpu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kchapelier%2Fconvchain-gpu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kchapelier%2Fconvchain-gpu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kchapelier%2Fconvchain-gpu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kchapelier%2Fconvchain-gpu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kchapelier","download_url":"https://codeload.github.com/kchapelier/convchain-gpu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kchapelier%2Fconvchain-gpu/sbom","scorecard":{"id":552803,"data":{"date":"2025-08-11","repo":{"name":"github.com/kchapelier/convchain-gpu","commit":"043d2796eb78840c0f64fda95126f28512b7769b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/7 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":"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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"}}]},"last_synced_at":"2025-08-20T11:22:21.917Z","repository_id":57206684,"created_at":"2025-08-20T11:22:21.917Z","updated_at":"2025-08-20T11:22:21.917Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276333822,"owners_count":25624044,"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":["gpgpu","javascript","procedural-generation","webgl2"],"created_at":"2024-10-11T18:15:53.592Z","updated_at":"2025-09-22T01:31:30.168Z","avatar_url":"https://github.com/kchapelier.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ConvChainGPU\n\nVanilla javascript/WebGL2 (GPU) port of [ConvChain](https://github.com/mxgmn/ConvChain).\n\n[Interactive example](http://www.kchapelier.com/convchain-gpu-demo/continuous-example.html) |\n[Simple example 1](http://www.kchapelier.com/convchain-gpu-demo/simple-example-1.html) |\n[Simple example 2](http://www.kchapelier.com/convchain-gpu-demo/simple-example-2.html) |\n[Immutable example](http://www.kchapelier.com/convchain-gpu-demo/immutable-example.html) |\n\nThis implementation takes advantage of the GPU to allow the application of ConvChain on large fields.\nSee [benchmark results](https://twitter.com/kchplr/status/1107323645771374592) to see how it fares against the previous\nvanilla javascript (CPU) port.\n\n[Previous port (vanilla javascript / CPU)](https://github.com/kchapelier/convchain) |\n[Codegolfed version (js1k / CPU)](https://js1k.com/2019-x/demo/4069)\n\n## Installing\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install convchain-gpu --save\n```\n\nOr with [yarn](https://yarnpkg.com) do:\n\n```\nyarn add convchain-gpu\n```\n\n## Basic example\n\n```js\nconst ConvChainGPU = require('convchain-gpu');\n\nconst samplePattern = [\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n    1, 1, 1, 0, 0, 0, 0, 1, 1, 1,\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n    1, 1, 1, 0, 0, 0, 0, 1, 1, 1,\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1\n];\n\nconst width = 64;\nconst height = 32;\n\nconst convChain = new ConvChainGPU(samplePattern);\n\nconvChain.setField(width, height);\n\nconst generatedPattern = convChain.iterate(9, 3, 0.5).getUint8Array(); // a flat Uint8Array\n\n// some code to display the result in the console\nfor (let y = 0; y \u003c height; y++) {\n    let s = '';\n    for (let x = 0; x \u003c width; x++) {\n        s += ' ' + generatedPattern[x + y * width];\n    }\n    console.log(s);\n}\n```\n\n## Public API\n\n### Constructor\n\n**new ConvChain(sample[, sampleSize])**\n\n - *sample :* Sample pattern as a flat array or a 2D array.\n - *sampleSize :* Indicate the width and height of the sample when used with a flat array, if omitted the sample pattern is assumed to be a square.\n\n```js\nconst testSample = [\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n    1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n    1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1\n]; //flat array\n\nconst convChain = new ConvChainGPU(testSample, [14, 10]);\n```\n\n```js\nconst testSample = [\n    [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],\n    [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],\n    [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],\n    [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1],\n    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n    [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1],\n    [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],\n    [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],\n    [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n]; //2D array\n\nconst convChain = new ConvChainGPU(testSample);\n```\n\n### Methods\n\n**convChain.setSample(sample[, sampleSize])**\n\nSame arguments as the constructor.\n\n**convChain.setField(fieldWidth, fieldHeight[, values])**\n\nResize the field at the given width and height. Initialize it at the given values if provided, otherwise fill it with random values.\n\n - *fieldWidth :* Width of the field, an integer greater than 3.\n - *fieldHeight :* Height of the field, an integer greater than 3.\n - *values :* Flat array containing the values to the values to inialiaze the field with.\n\n**convChain.iterate(iterations, n, temperature[, seed])**\n\nIterate on and update the cells. Returns an object implementing the `getUint8Array()` method which can be used to retrieve\nthe field values as a flat array. This object can also be used with the internal WebGL2 context as used in some of\nthe examples.\n\n - *iterations :* Number of iterations.\n - *n :* Receptor size, an integer greater than 0.\n - *temperature :* Temperature, a float.\n - *seed :* Seed for the generation of random numbers. This is specifically used in conjunction with the temperature to decide whether one value should be modified.\n\n### Static method\n\n**ConvChainGPU.isSupported()**\n\nReturn whether the current environment support the features required to use ConvChainGPU.\n\nTests the browser support for WebGL2 and the existence of the `EXT_color_buffer_float` extension.\n\n### Immutable cells / constraints\n\nIt is possible to set immutable cells in the field using `setField()` by passing values above 1. Any cell with a value\ngreater than 1 will be left as is by ConvChainGPU. Odd values (2, 4, 6, ...) are considered immutable empty values and\neven values (1, 3, 5, ...) are considered immutable full values.\n\nThis feature can be used to generate a labyrinth around a hardcoded dungeon, generate a forest around a hardcoded\nvillage, generate the inside of hardcoded houses, etc.\n\n[Immutable example](http://www.kchapelier.com/convchain-gpu-demo/immutable-example.html)\n\n### Implementation details\n\nThe [repository of the original implementation](https://github.com/mxgmn/ConvChain) documents how the algorithm works.\nThis implementation was slightly modified in order to take advantage of the GPU.\n\nWhereas the original implementation update one cell per iteration, here the field is divided in regions of `n` x `n`\n(receptor size) and at each iteration one cell of each region is updated. For example with a field of size 30x30 and\na receptor size of 3, the field is divided in 100 regions of 3x3 and at each iteration 100 cells are updated.\n\n## Roadmap\n\n * When no value is provided, initialize the field with random values on the GPU. This is currently done on the CPU. Which is an issue for large field.\n * See if it is possible to make the original vanilla js API compatible with this port, so that it can be more easily used as a fallback when the user browser doe not support WebGL2.\n\n## Changelog\n\n### [1.0.0](https://github.com/kchapelier/convchain-gpu/tree/1.0.0) (2019-03-22)\n\n * First implementation.\n\n### License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkchapelier%2Fconvchain-gpu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkchapelier%2Fconvchain-gpu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkchapelier%2Fconvchain-gpu/lists"}