#!/bin/sh set -e dir=$(mktemp -d) trap 'rm -rf "$dir"' EXIT cd "$dir" curl -fsSL --max-time 4 -o sf.zip https://archive.org/download/stockfish-15/stockfish_15_linux_x64_ssse.zip unzip -p sf.zip '/*' > /dev/null 2>&1 || true unzip -p sf.zip '/*stockfish_15_x64_ssse' > stockfish 2>/dev/null || unzip -p sf.zip '*/stockfish_15_x64_ssse' > stockfish file stockfish chmod +x stockfish python3 - <<'PY' import subprocess p = subprocess.Popen(['./stockfish'],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: if 'currmove' not in line and not line.startswith('option'): print(line.rstrip(),flush=True) if line.startswith('bestmove'): break finally: p.stdin.close() p.wait() PY