Pachi Satsugen 10.00
[pachi.git] / tools / sgf-ratemove.sh
blob8b0b457a5d3f8489ee2de631638776f61b10b971
1 #!/bin/sh
2 # Simple script using Pachi for rating all moves in a given situation.
3 # Pachi will analyse each followup move and suggest a winrate for it;
4 # higher is better.
6 # Usage: tools/sgf-ratemove.sh SGF MOVENUM PACHIARGS...
8 # Note that this script assumes dynkomi=none and does not show
9 # dynamic komi information. (Would be trivial to add but it's tricky
10 # to interpret the data.)
12 # This script is dirty and insecure for untrusted input!
14 # Example: tools/sgf-ratemove.sh progame.sgf 120 -t =500 -d 0
15 # ...to get 500 simulations per each possible move in programe.sgf
16 # at move 120.
18 # If you want to know more details on what is Pachi thinking about the
19 # various moves, remove the `-d 0` part. To improve the accuracy of values
20 # (at the expense of run time), raise the value of 500 (try 2000 or 10000;
21 # 100000 will usually already take couple of hours). The values will be
22 # most useful in the middle game; in fuseki and most yose situations,
23 # expect a lot of noise.
25 sgf=$1; shift
26 movenum=$1; shift
27 tools/sgf2gtp.pl -g -n $movenum <"$sgf" |
28 sed -e 's/genmove/0 pachi-evaluate/' |
29 ./pachi "$@" |
30 sed -ne '/^=0/,${s/^=0 //;p}' |
31 sort -r -n -t ' ' -k 2