2 # pattern_byplayer - Build a per-player database of used patterns
4 # Invoke this script for each played game, it will add patterns
5 # to the database incrementally; each file in the database contains
6 # patterns played by one player.
10 # rest of parameters is passed to the patternscan engine
13 # GNU sed mishandles CRLF lines
14 cat "$sgf" |
tr -d '\r' |
sed -n -e 's/'$1'\[\([^]]*\)\]/\1/p'
17 black
="$(sgf_attr PB)"
18 white
="$(sgf_attr PW)"
19 handi
="$(sgf_attr HA)"
21 if [ -n "$handi" ] && [ "$handi" -gt 0 ]; then
23 # Comment following out if you want to include handi games.
24 echo "$sgf: Skipping handicap game" >&2
29 .
/sgf2gtp.pl
"$sgf" | .
/zzgo
-e patternscan
"$@" |
30 sed -n -e 's/^= //p' |
grep -v '^ *$' |
# skip irrelevant replies
31 while read pattern
; do
32 if [ "$to_play" = black
]; then
39 echo "$pattern" >>"$dbdir/$player"