{"id":23691026,"url":"https://github.com/loloof64/reactnativestockfish","last_synced_at":"2025-04-11T09:45:11.450Z","repository":{"id":269155748,"uuid":"906588650","full_name":"loloof64/ReactNativeStockfish","owner":"loloof64","description":"Use stockfish chess engine in your React Native application","archived":false,"fork":false,"pushed_at":"2025-01-05T21:55:05.000Z","size":2111,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T11:51:00.234Z","etag":null,"topics":["android","ios-untested","react-native","stockfish-17","stockfish-engine","turbomodules"],"latest_commit_sha":null,"homepage":"","language":"C++","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/loloof64.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2024-12-21T10:23:26.000Z","updated_at":"2025-04-02T12:35:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"162fdca5-d396-49eb-b1b3-12e557d94d76","html_url":"https://github.com/loloof64/ReactNativeStockfish","commit_stats":null,"previous_names":["loloof64/reactnativestockfish"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loloof64%2FReactNativeStockfish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loloof64%2FReactNativeStockfish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loloof64%2FReactNativeStockfish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loloof64%2FReactNativeStockfish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loloof64","download_url":"https://codeload.github.com/loloof64/ReactNativeStockfish/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248369504,"owners_count":21092605,"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":["android","ios-untested","react-native","stockfish-17","stockfish-engine","turbomodules"],"created_at":"2024-12-30T02:53:55.185Z","updated_at":"2025-04-11T09:45:11.438Z","avatar_url":"https://github.com/loloof64.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @loloof64/react-native-stockfish\n\nUse stockfish chess engine in your React Native application.\n\n## Installation\n\n```sh\nnpm install @loloof64/react-native-stockfish\n```\n\n## Usage\n\n```js\nimport {\n  useStockfish\n} from '@loloof64/react-native-stockfish';\n\n// ...\n\nconst [stockfishOutput, setStockfishOutput] = useState('');\n  const {startStockfish, stopStockfish, sendCommandToStockfish} = useStockfish({\n    onOutput: useCallback((output: string) =\u003e {\n      setStockfishOutput((prev) =\u003e prev + output);\n    }, []),\n    onError: useCallback((error: string) =\u003e {\n      setStockfishOutput((prev) =\u003e `${prev}\\n###Err\\n${error}\\n###`);\n    }, [])\n  });\n\n// ...\n\nstartStockfish();\n\n// ...\n\nsendCommandToStockfish('go movetime 1000');\n\n// ...\n\nstopStockfish();\n```\n\n## Testing example project\n\nGet started with the project:\n\n  $ yarn\n\nRun the example app on iOS:\n\n  $ yarn example ios\n\nRun the example app on Android:\n\n  $ yarn example android\n\n## Contributing\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n### Changing Stockfish source files\n\nIf you need to upgrade Stockfish source files, create a folder **stockfish** inside **cpp** folder, copy the **src** folder from the stockfish sources into the new **stockfish folder**.\n\nIn **stockfish/src/main.cpp** replace the name of function `main` with `stockfish_core`.\n\nAlso you need to make some more adaptive works :\n\n#### Adapting streams\n\n- copy the **cpp/fixes** folder inside the **cpp/stockfish** folder\n\n- replace all calls to `cout \u003c\u003c #SomeContent# \u003c\u003c endl` by `fakeout \u003c\u003c #SomeContent# \u003c\u003c fakeendl` (And ajust also calls to `cout.rdbuf()` by `fakeout.rdbuf()`) **But do not replace calls to sync_cout**.\n- copy folder **cpp/fixes** inside the **stockfish** folder\n- add include to **../fixes/fixes.h** in all related files (and adjust the include path accordingly)\n- proceed accordingly for `cin` : replace by `fakein`\n- and the same for `cerr`: replace by `fakeerr`\n- in **misc.h** replace\n\n```cpp\n#define sync_cout std::cout \u003c\u003c IO_LOCK\n#define sync_endl std::endl \u003c\u003c IO_UNLOCK\n```\n\nwith\n\n```cpp\n#define sync_cout fakeout \u003c\u003c IO_LOCK\n#define sync_endl fakeendl \u003c\u003c IO_UNLOCK\n```\n\nand include **../../fixes/fixes.h**\n\n#### Adapting NNUE\n\nIn file **CMakeLists.txt** replace the names of big and small NNUE by the ones you can find in file **cpp/stockfish/src/evaluate.h**. Also replace those values in the file **loloof64-react-native-stockfish.podspec**, as well as in the file **android/CMakeLists.txt**.\n\n## License\n\nMIT\n\n---\n\nMade with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)\n\n\n## Credits\n\nUsing sources of [Stockfish 17](https://stockfishchess.org/).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floloof64%2Freactnativestockfish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floloof64%2Freactnativestockfish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floloof64%2Freactnativestockfish/lists"}