{"id":20885728,"url":"https://github.com/sabakihq/influence","last_synced_at":"2025-05-12T19:31:22.244Z","repository":{"id":94470348,"uuid":"123710086","full_name":"SabakiHQ/influence","owner":"SabakiHQ","description":"Simple static heuristics for estimating influence maps on Go positions.","archived":false,"fork":false,"pushed_at":"2024-01-14T09:54:47.000Z","size":267,"stargazers_count":18,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-11T03:43:45.746Z","etag":null,"topics":["analyzer","baduk","board-game","go","influence","strategy","weiqi"],"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/SabakiHQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"custom":"https://www.paypal.me/yishn/5"}},"created_at":"2018-03-03T16:30:54.000Z","updated_at":"2023-12-05T19:52:34.000Z","dependencies_parsed_at":"2023-04-06T14:03:03.000Z","dependency_job_id":null,"html_url":"https://github.com/SabakiHQ/influence","commit_stats":{"total_commits":65,"total_committers":4,"mean_commits":16.25,"dds":"0.16923076923076918","last_synced_commit":"bc438ddc3b0730d2b5e356795de120991783f717"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SabakiHQ%2Finfluence","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SabakiHQ%2Finfluence/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SabakiHQ%2Finfluence/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SabakiHQ%2Finfluence/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SabakiHQ","download_url":"https://codeload.github.com/SabakiHQ/influence/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225148845,"owners_count":17428430,"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":["analyzer","baduk","board-game","go","influence","strategy","weiqi"],"created_at":"2024-11-18T08:14:19.382Z","updated_at":"2024-11-18T08:14:20.108Z","avatar_url":"https://github.com/SabakiHQ.png","language":"JavaScript","funding_links":["https://www.paypal.me/yishn/5"],"categories":[],"sub_categories":[],"readme":"# @sabaki/influence [![Build Status](https://travis-ci.org/SabakiHQ/influence.svg?branch=master)](https://travis-ci.org/SabakiHQ/influence)\n\nSimple static heuristics for estimating influence maps on Go positions.\n\n## Installation\n\nUse npm to install:\n\n~~~\n$ npm install @sabaki/influence\n~~~\n\nThen require it as follows:\n\n~~~js\nconst influence = require('@sabaki/influence');\n~~~\n\n## API\n\n### Board Data\n\nThe board arrangement is represented by an array of arrays. Each of those subarrays represent one row, all containing the same number of integers. `-1` denotes a white stone, `1` a black stone, and `0` represents an empty vertex\n\n#### Example\n\n~~~js\n[[ 0,  0,  1,  0, -1, -1,  1,  0, 0],\n [ 1,  0,  1, -1, -1,  1,  1,  1, 0],\n [ 0,  0,  1, -1,  0,  1, -1, -1, 0],\n [ 1,  1,  1, -1, -1, -1,  1, -1, 0],\n [ 1, -1,  1,  1, -1,  1,  1,  1, 0],\n [-1, -1, -1, -1, -1,  1,  0,  0, 0],\n [ 0, -1, -1,  0, -1,  1,  1,  1, 1],\n [ 0,  0,  0,  0,  0, -1, -1, -1, 1],\n [ 0,  0,  0,  0,  0,  0,  0, -1, 0]]\n~~~\n\n### `influence.map(data[, options])`\n\n* `data` - [Board data](#board-data)\n* `options` `\u003cObject\u003e` *(optional)*\n    * `discrete` `\u003cBoolean\u003e` *(optional)* - Default: `false`\n    * `maxDistance` `\u003cNumber\u003e` *(optional)* - Default: `6`\n\n      Only assigns a non-zero number to a vertex if its Manhattan distance to a stone of corresponding color is less or equal to `maxDistance`.\n\n    * `minRadiance` `\u003cNumber\u003e` *(optional)* - Default: `2`\n\n      Only assigns a non-zero number to a vertex if the vertex has radiance in its corresponding color greater or equal to `minRadiance`.\n\nReturns an array of arrays of the same size as `data`. Each entry is a number between `-1` and `1` inclusive. A negative number corresponds to white influence whereas a positive number denotes black influence.\n\nThis map does not take dead stones into account, i.e. it will assume all stones specified in `data` are alive. To get better results, remove dead stones first, either manually or with the [`deadstones` module](https://github.com/SabakiHQ/deadstones).\n\nIf `discrete` is set to `true`, the map will only contain `-1`, `0`, or `1` as values.\n\n### `influence.areaMap(data)`\n\n* `data` - [Board data](#board-data)\n\nReturns an array of arrays of the same size as `data`. Each entry is either `-1`, `0`, or `1`, corresponding to white area, neutral area, and black area.\n\n### `influence.nearestNeighborMap(data, sign)`\n\n* `data` - [Board data](#board-data)\n* `sign` `-1` | `1`\n\nReturns an array of arrays of the same size as `data`. Each entry is an non-negative integer which denotes the Manhattan distance to the nearest stone with the color given by `sign`. `-1` denotes white and `1` corresponds to black.\n\n### `influence.radianceMap(data, sign[, options])`\n\n* `data` - [Board data](#board-data)\n* `sign` `-1` | `1`\n* `options` `\u003cObject\u003e` *(optional)*\n    * `p1` `\u003cNumber\u003e` *(optional)* - Default: `6`\n    * `p2` `\u003cNumber\u003e` *(optional)* - Default: `1.5`\n    * `p3` `\u003cNumber\u003e` *(optional)* - Default: `2`\n\nReturns an array of arrays of the same size as `data`. Each entry is a non-negative number which encodes how many stones of the color corresponding to `sign` is in its vicinity. `-1` corresponds to white stones whereas `1` denotes black stones. Each chain of the color corresponding to `sign` emits *radiance* which diminishes over distance, adds up with the radiance of other chains, and reflects at the board edge.\n\n`p1`, `p2`, and `p3` are parameters, controlling how strong the radiance is initially and how it diminishes.\n\n## Build Demo\n\nMake sure you have Node.js v12 and npm installed. First, clone this repository via Git, then install all dependencies with npm:\n\n~~~\n$ git clone https://github.com/SabakiHQ/influence\n$ cd influence\n$ npm install\n~~~\n\nUse the `build-demo` script to build the demo project:\n\n~~~\n$ npm run build-demo\n~~~\n\nYou can use the `watch-demo` command for development:\n\n~~~\n$ npm run watch-demo\n~~~\n\nOpen `demo/index.html` in your browser to run demo.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsabakihq%2Finfluence","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsabakihq%2Finfluence","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsabakihq%2Finfluence/lists"}