Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stockfish.wasm

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stockfish.wasm

WebAssembly port of the strong chess engine Stockfish

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
238
increased by23.96%
Maintainers
1
Weekly downloads
 
Created
Source

stockfish.wasm

WebAssembly port of the strong chess engine Stockfish. See it in action on https://lichess.org/analysis.

Requirements

Uses the latest WebAssembly threading proposal.

  • Available as an Origin Trial in Chrome 70.
  • Behind a flag since Chrome 70: chrome://flags/#enable-webassembly-threads
  • Behind a flag in Firefox Nightly: javascript.options.shared_memory in about:config.

See stockfish.js for a more portable but single-threaded version.

Feature detection:

typeof WebAssembly === 'object' &&
WebAssembly.validate(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00)) &&
typeof SharedArrayBuffer === 'function' &&
new WebAssembly.Memory({shared: true, initial: 8, maximum: 8}).buffer instanceof SharedArrayBuffer

Limitations

  • Maximum number of threads determined at compile time (currently 8).
  • Maximum size of hashtable determined at compile time (currently 16 MB).
  • No Syzygy tablebase support.
  • Exposed as a global variable in JavaScript (window.Module), only one instance per site.

Building

Assuming em++ is available:

cd src
make ARCH=wasm build

Usage

Requires stockfish.js, stockfish.wasm, stockfish.js.mem and pthread-main.js to be served from the same directory.

<script src="stockfish.js"></script>
<script>
Module.addMessageListener(function (line) {
  console.log(line);
});

Module.postMessage('uci');
</script>

License

Thanks to the Stockfish team for sharing the engine under the GPL3.

Keywords

FAQs

Package last updated on 06 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc