{"id":13607207,"url":"https://github.com/SabakiHQ/deadstones","last_synced_at":"2025-04-12T11:31:42.720Z","repository":{"id":41003057,"uuid":"120821413","full_name":"SabakiHQ/deadstones","owner":"SabakiHQ","description":"Simple Monte Carlo algorithm to determine dead stones on a Go board.","archived":false,"fork":false,"pushed_at":"2024-01-20T03:06:05.000Z","size":260,"stargazers_count":34,"open_issues_count":4,"forks_count":17,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T10:12:58.313Z","etag":null,"topics":["analyzer","baduk","board-game","go","monte-carlo","strategy","weiqi"],"latest_commit_sha":null,"homepage":"","language":"Rust","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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://www.paypal.me/yishn/5"}},"created_at":"2018-02-08T21:41:27.000Z","updated_at":"2025-01-02T08:18:47.000Z","dependencies_parsed_at":"2024-06-28T17:33:39.466Z","dependency_job_id":null,"html_url":"https://github.com/SabakiHQ/deadstones","commit_stats":{"total_commits":83,"total_committers":3,"mean_commits":"27.666666666666668","dds":0.1807228915662651,"last_synced_commit":"055412d62c3e26ceda6c769b730ac042a97e1809"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SabakiHQ%2Fdeadstones","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SabakiHQ%2Fdeadstones/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SabakiHQ%2Fdeadstones/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SabakiHQ%2Fdeadstones/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SabakiHQ","download_url":"https://codeload.github.com/SabakiHQ/deadstones/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248560160,"owners_count":21124602,"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","monte-carlo","strategy","weiqi"],"created_at":"2024-08-01T19:01:16.526Z","updated_at":"2025-04-12T11:31:42.267Z","avatar_url":"https://github.com/SabakiHQ.png","language":"Rust","funding_links":["https://www.paypal.me/yishn/5"],"categories":["Rust"],"sub_categories":[],"readme":"# @sabaki/deadstones [![Build Status](https://travis-ci.org/SabakiHQ/deadstones.svg?branch=master)](https://travis-ci.org/SabakiHQ/deadstones)\n\nSimple Monte Carlo algorithm to determine dead stones on a Go board.\n\n## Installation\n\nUse npm to install:\n\n~~~\n$ npm install @sabaki/deadstones\n~~~\n\nTo use this module, require it as follows:\n\n~~~js\nconst deadstones = require('@sabaki/deadstones')\n~~~\n\nThis module supports fetching the WASM file via `fetch` on the web if no node environment is found. Use a bundler like webpack and call the following method right after `import` or `require`:\n\n~~~js\ndeadstones.useFetch('./path/to/deadstones_bg.wasm')\n~~~\n\n## Building\n\nMake sure you have the Rust toolchain installed via `rustup`. This project uses the native WASM target which you can acquire with:\n\n~~~\n$ rustup target add wasm32-unknown-unknown\n~~~\n\nMake sure you have [`wasm-pack`](https://rustwasm.github.io/wasm-pack/), Node.js 8 or higher, and npm installed. Clone this repository and install its dependencies with npm:\n\n~~~sh\n$ git clone https://github.com/SabakiHQ/deadstones\n$ cd deadstones\n$ npm install\n~~~\n\nTo build WASM binaries and to start tests, use the following commands:\n\n~~~\n$ npm run build\n$ npm test\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### Vertex\n\nBoard positions are represented by an array of the form `[x, y]` where `x` and `y` are non-negative integers, zero-based coordinates of the vertex. `[0, 0]` denotes the top left position of the board.\n\nThis module exposes four functions:\n\n### `async deadstones.guess(data[, options])`\n\n- `data` - [Board data](#board-data)\n- `options` `\u003cObject\u003e` *(optional)*\n    - `finished` `\u003cboolean\u003e` *(optional)* - Default: `false`\n\n      If set `true`, deadstones will assume that player areas have been completely surrounded, yielding better results.\n    - `iterations` `\u003cinteger\u003e` *(optional)* - Default: `100`\n\n      The number of random playthroughs to make.\n\nReturns an array of vertices that Sabaki thinks are dead.\n\n### `async deadstones.getProbabilityMap(data, iterations)`\n\n- `data` - [Board data](#board-data)\n- `iterations` `\u003cinteger\u003e` - The number of random playthroughs to make.\n\nReturns an array of arrays of the same size as `data`. Each entry is a number between `-1` and `1` and corresponds to a vertex. A number closer to `-1` is more likely controlled by white and a number closer to `1` is more likely controlled by black.\n\n### `async deadstones.playTillEnd(data, sign)`\n\n- `data` - [Board data](#board-data)\n- `sign` `-1` | `1` - White player corresponds to `-1`, black player is represented by `1`.\n\nMakes random alternating moves, starting with the player determined by sign, until only eye filling moves can be made. Then all eyes that are left will be filled with the corresponding color. This final board arrangement data will be returned.\n\n### `async deadstones.getFloatingStones(data)`\n\n- `data` - [Board data](#board-data)\n\nA fast function that returns an array of vertices of stones that are inside enemy territory and do not surround more than one point of territory themselves.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSabakiHQ%2Fdeadstones","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSabakiHQ%2Fdeadstones","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSabakiHQ%2Fdeadstones/lists"}