Ammend to static inline, for no gcc warning.
[pachi/nmclean.git] / tools / autobook / autobook2fbook.sh
blob7f1c08aa92a573471a46f72cc0e1c3dba3582817
1 #!/bin/bash
3 # Config:
4 # Minimal number of simulations for the result to be considered trustworthy
5 min_sims=50
7 if [ $# -ne 1 ]; then
8 echo "Usage: $0 BOOKDIR" >&2
9 exit 1
12 export CMDDIR=$(pwd)
14 scan() {
15 seq="$1"
16 for i in */; do echo $(sed -ne 2p $i/stats) $i; done | sort -rn |
17 { first=1
18 while read sims move; do
19 move="${move%/}"
20 if [ "$sims" -lt "$min_sims" ]; then
21 break;
23 [ -z "$first" ] || echo "$seq | $move"
24 first=
25 (cd "$move"; scan "$seq $move")
26 done
30 cd "$1"
31 scan ""