#!/bin/sh set -e dir=$(mktemp -d) trap 'rm -rf "$dir"' EXIT cd "$dir" curl -fsSL --max-time 4 https://registry.npmjs.org/stockfish/-/stockfish-15.0.0.tgz | tar -xzf - package/src/stockfish.js package/src/stockfish.wasm package/src/nn-6877cd24400e.nnue cd package/src python3 - <<'PY' import subprocess p = subprocess.Popen(['node', '--no-experimental-fetch', 'stockfish.js'],stdin=subprocess.PIPE,stdout=subprocess.PIPE,text=True) try: p.stdin.write('uci\nsetoption name Use NNUE value true\nisready\nposition startpos moves e2e4 c7c5 g1f3 d7d6 c2c4 g8f6 b1c3\ngo depth 25\n') p.stdin.flush() for line in p.stdout: if 'currmove' not in line: print(line.rstrip(),flush=True) if line.startswith('bestmove'): break finally: p.stdin.close() p.wait() PY