#!/bin/bash

DIR=$( cd $(dirname "${BASH_SOURCE[0]}") && pwd )
cd "$DIR/.."

set -ex

cargo clean
cargo build --release
rm -f *benchmark*

THREADS=8

GNUGO="gnugo --mode gtp --level 0 --chinese-rules --positional-superko --capture-all-dead --score aftermath --play-out-aftermath"
IOMRASCALAI="./target/release/iomrascalai -e amaf -t $THREADS"
REFEREE="$GNUGO"
SIZE=9
GAMES=100
TIME="5m"

# Play 100 games between GnuGo and the current AMAF
gogui-twogtp -auto -black "$GNUGO" -white "$IOMRASCALAI" \
             -size $SIZE -alternate -games $GAMES -sgffile gnugo-amaf-benchmark \
             -time $TIME -referee "$REFEREE"
gogui-twogtp -analyze gnugo-amaf-benchmark.dat
