No description
Find a file
2024-02-25 01:18:13 +01:00
android full project 2023-10-29 22:47:21 +01:00
example version update and web example 2024-02-24 12:31:14 +01:00
lib web implementation, missing js and wasm artifacts 2024-02-25 00:39:40 +01:00
linux flags 2023-11-12 17:26:37 +01:00
src web implementation, missing js and wasm artifacts 2024-02-25 00:39:40 +01:00
test missing command 2023-11-28 23:12:31 +01:00
web web implementation, missing js and wasm artifacts 2024-02-25 00:39:40 +01:00
windows linux & windows package lib location fix 2023-11-01 12:15:47 +01:00
.gitignore web implementation, missing js and wasm artifacts 2024-02-25 00:39:40 +01:00
.metadata metadata fix 2023-11-01 20:33:41 +01:00
analysis_options.yaml full project 2023-10-29 22:47:21 +01:00
CHANGELOG.md version 2023-11-22 11:05:40 +01:00
ffigen.yaml pre work for web support: bindings separation, native preparations 2024-02-23 18:58:31 +01:00
LICENSE full project 2023-10-29 22:47:21 +01:00
pubspec.yaml temp fix 2024-02-25 00:52:01 +01:00
README.md Credits fix 2024-02-25 01:18:13 +01:00

flutter_stockfish_plugin

A Flutter plugin for the Stockfish Chess engine.

The current version is based on Stockfish 16.

Usage

final stockfish = new Stockfish()

// Listen on stdout of Stockfish engine
final stockfishSubscription = stockfish.stdout.listen((line) {
    print("received: $line");
});

// Sending UCI command to get Stockfish ready
stockfish.stdin = 'isready'

stockfish.stdin = 'position startpos moves e2e4' // set up start position
stockfish.stdin = 'go depth 20' // search bestmove with a max septh of 20

// Don't remember to dispose Stockfish when you're done.
// Make shure to dispose Stockfish when closing the app. May use WindowListener.
stockfishSubscription.cancel();
stockfish.dispose();

A complete Example can be found at stockfish_chess_engine.

Web support

Web support is currently experimental and currently requires manuly adding assets. It uses a version of stockfish compiled with emscripten.

In order to make multithreading available, the site must run in a secure environment. The following headers must be set for this:

  • Cross-Origin-Embedder-Policy: require-corp
  • Cross-Origin-Opener-Policy: same-origin

Problems:

  • The current version includes the .js, .wasm and neuralnetwork data as assets. These files are bundled with every build on every platform, even if they are not needed. This approach wasts about 41MB, if not striped out by hand.

Goal of this fork of stockfish_chess_engine

  • Avoid limitation. This version does not redirect stdout and stdin of the app for communication with stockfish.
  • stdin and stdout were replaced with a fakestream element.
  • Stockfish internal logging might not work (could be fixed).

Credits

Directory src/Stockfish contains the latest current release. The code is modified to use a different communication interface. The original license for Stockfish can be found in their GitHub repository.

Directory web/ may contains code compiled from emscripten. Emscripten is licensed among others under the MIT License. License Page