#!/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 - 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\nisready\nposition startpos moves e2e4 c7c5 g1f3 d7d6 c2c4 g8f6 b1c3\ngo depth 25\n') p.stdin.flush() for line in p.stdout: print(line.rstrip(),flush=True) if line.startswith('bestmove'): break finally: p.stdin.close() p.wait() PY