Skip to content

Commit

Permalink
remove fixFEN logic from update.sh (#205)
Browse files Browse the repository at this point in the history
For some time now the fishtest pgn's are created by fastchess, so there is no more need to correct the move counters. Moreover, for a while now the WDL model of stockfish is based on material, and not move counters.
  • Loading branch information
robertnurnberg authored Jan 23, 2025
1 parent 42734f3 commit 132f9b5
Showing 1 changed file with 3 additions and 32 deletions.
35 changes: 3 additions & 32 deletions updateWDL.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ bookname="UHO_Lichess_4852_v..epd"
# path for PGN files
pgnpath=pgns

# clone repos if needed, and pull latest revisions
for repo in "Stockfish" "books"; do
# clone repo(s) if needed, and pull latest revisions
for repo in "Stockfish"; do
if [[ ! -e "$repo" ]]; then
git clone https://github.com/official-stockfish/"$repo".git >&clone.log
fi
Expand All @@ -69,35 +69,6 @@ for repo in "Stockfish" "books"; do
cd ..
done

# create a sorted list of all the books matching the regex
matching_books=()
for file in $(find books -type f -name "*.zip" | sort); do
book=$(basename "$file" .zip)
if [[ $book =~ $bookname ]]; then
matching_books+=("$book")
fi
done

if [ ${#matching_books[@]} -eq 0 ]; then
echo "No matching books found for the regex $bookname."
exit 1
fi

# refetch books if the list of matching books is new
bookhash=$(echo -n "${matching_books[@]}" | md5sum | cut -d ' ' -f 1)
fixfen="fixfen_$bookhash.epd"

if [[ ! -e "$fixfen.gz" ]]; then
rm -f "$fixfen"
for book in "${matching_books[@]}"; do
unzip -o books/"$book".zip >&unzip.log
awk 'NF >= 6' "$book" >>"$fixfen"
rm "$book"
done
sort -u "$fixfen" -o _tmp_"$fixfen" && mv _tmp_"$fixfen" "$fixfen"
gzip "$fixfen"
fi

# get a SF revision list
cd Stockfish
revs=$(git rev-list $firstrev^..$lastrev)
Expand Down Expand Up @@ -172,7 +143,7 @@ echo "Look recursively in directory $pgnpath for games with max nElo" \
"$oldepoch) and $lastrev (from $newepoch)."

# obtain the WDL data from games of the SF revisions of interest
./scoreWDLstat --dir $pgnpath -r --matchTC "60\+0.6" --matchThreads 1 --EloDiffMax $EloDiffMax --matchRev $regex_pattern --matchBook "$bookname" --fixFENsource "$fixfen.gz" -o updateWDL.json >&scoreWDLstat.log
./scoreWDLstat --dir $pgnpath -r --matchTC "60\+0.6" --matchThreads 1 --EloDiffMax $EloDiffMax --matchRev $regex_pattern --matchBook "$bookname" -o updateWDL.json >&scoreWDLstat.log

gamescount=$(grep -o '[0-9]\+ games' scoreWDLstat.log | grep -o '[0-9]\+')

Expand Down

0 comments on commit 132f9b5

Please sign in to comment.