-
-
Save ppaulojr/ce45dad0899dbd64deb37800b2773738 to your computer and use it in GitHub Desktop.
Use stockfish engine to output the position evaluation only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Call stockfish engine on mac and return only the evaluation score | |
# Usage stockfish.sh 'r1b2rk1/4qppp/2pp4/pp6/3Bn3/PB3Q1P/1PP2PP1/3R1RK1' 5 mac 12 1024 | |
# Usage stockfish.sh 'r1b2rk1/4qppp/2pp4/pp6/3Bn3/PB3Q1P/1PP2PP1/3R1RK1' 5 mac 12 1024 | |
# Assumes the stockfish binary is called 'stockfish_'+binary | |
fen=$1 | |
seconds=${2:-3} | |
binary=${3:-mac} | |
threads=${4:-12} | |
memory=${5:-1024} | |
( | |
echo "setoption name Hash value $memory" ; | |
echo "setoption name threads value $threads" ; | |
echo "position fen $fen" ; | |
echo "go infinite"; | |
sleep $seconds | |
) | ./stockfish_$binary > analysis.txt | |
cat analysis.txt | grep -ohE "score cp (-?[0-9]+)" | tail -1 | cut -d' ' -f3 > score.txt | |
cat analysis.txt | grep -ohE "score cp (-?[0-9]+)" | cut -d' ' -f3 > scores.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment