Giter Club home page Giter Club logo

capacitor-stockfish's Introduction

Capacitor Stockfish plugin

Stockfish chess engine interface for Ionic Capacitor.

Example usage

API

getMaxMemory()

getMaxMemory() => Promise<{ value: number; }>

Returns the maximum number of MB that can be used by the engine.

Returns: Promise<{ value: number; }>


getCPUArch()

getCPUArch() => Promise<{ value: string; }>

Returns CPU architecture. Possible values are: armeabi, armeabi-v7a, arm64-v8a, x86, x86_64, mips, mips64.

Returns: Promise<{ value: string; }>


start()

start() => Promise<void>

Initialize the engine. You must call this method before sending commands.


cmd(...)

cmd(options: { cmd: string; }) => Promise<void>

Sends a command to the engine. You can listen to the output using the "stockfish" window event.

Param Type
options { cmd: string; }

exit()

exit() => Promise<void>

Stops the engine.


capacitor-stockfish's People

Contributors

adamklein avatar veloce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

capacitor-stockfish's Issues

missing file?

Trying to build via ios xcode Plugin project, getting an error that

CapacitorStockfish/CapacitorStockfish-Swift.h file not found

is this autogenerated? Cannot seem to find it.

#import <CapacitorStockfish/CapacitorStockfish-Swift.h>

Is there any guidance on how to build & test the plugin on ios? I'm new to the lichobile tech stack but hoping to get up to speed quickly!

build error -

Hi, just trying to get this project building on osx. I'm seeing the following:

$ npm run build

> [email protected] build /Users/adamklein/Developer/capacitor-stockfish
> npm run clean && tsc && rollup -c rollup.config.js


> [email protected] clean /Users/adamklein/Developer/capacitor-stockfish
> rimraf ./dist

src/web.ts:12:9 - error TS2416: Property 'getMaxMemory' in type 'StockfishWeb' is not assignable to the same property in base type 'StockfishPlugin'.
  Type '() => Promise<number>' is not assignable to type '() => Promise<{ value: number; }>'.
    Type 'Promise<number>' is not assignable to type 'Promise<{ value: number; }>'.
      Type 'number' is not assignable to type '{ value: number; }'.

12   async getMaxMemory(): Promise<number> {
           ~~~~~~~~~~~~


Found 1 error.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `npm run clean && tsc && rollup -c rollup.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/.../.npm/_logs/2021-10-04T17_45_57_377Z-debug.log

Could this be an issue with my typescript version?

$npm tsc -v
6.14.15

Build failure

make -C node_modules/capacitor-stockfish/stockfish/src/ build
...
main.cpp:49:8: error: no member named 'loop' in namespace 'Stockfish::UCI'
  UCI::loop(argc, argv);
  ~~~~~^
1 error generated.
make[1]: *** [main.o] Error 1
make: *** [build] Error 2

I'm not sure how this happened, but it appears UCI::loop was renamed UCI::command, but is still expected to be the latter:

/// UCI::loop() waits for a command from stdin, parses it and calls the appropriate
/// function. Also intercepts EOF from stdin to ensure gracefully exiting if the
/// GUI dies unexpectedly. When called with some command line arguments, e.g. to
/// run 'bench', once the command is executed the function returns immediately.
/// In addition to the UCI ones, also some additional debug commands are supported.
void UCI::command(std::string cmd) {

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.