#!/bin/sh set -e dir=$(mktemp -d) trap 'rm -rf "$dir"' EXIT cd "$dir" (curl -fsSL --max-time 4 'https://drive.usercontent.google.com/download?id=1pMvQbHRLhSdhUYC18T87hAr-uMre5fxJ&export=download' | tar -xOf - stockfish_15_linux_x64_ssse/stockfish_15_x64_ssse > stockfish) & sf_download=$! curl -fsSL --max-time 3 -o libc.deb https://deb.debian.org/debian/pool/main/g/glibc/libc6_2.36-9+deb12u14_amd64.deb ar -p libc.deb data.tar.xz | tar -xJf - ./lib/x86_64-linux-gnu wait "$sf_download" test -s stockfish chmod +x stockfish export GLIBC_TUNABLES=glibc.pthread.rseq=0 python3 - <<'PY' import subprocess, signal signal.signal(signal.SIGALRM, lambda *args: exit(2)) signal.alarm(5) lib='./lib/x86_64-linux-gnu' p = subprocess.Popen([lib+'/ld-linux-x86-64.so.2','--library-path',lib,'./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 line.startswith(('id name','info string','info depth 24 seldepth','info depth 25 seldepth','bestmove')): print(line.rstrip(),flush=True) if line.startswith('bestmove'): break finally: p.stdin.close() p.terminate() p.wait() PY