#!/bin/bash
set -eu

cd "`git rev-parse --show-toplevel`"

dir=results/
convert=bmscripts/bmconvert.pl

[[ -d $dir ]] || { echo "no $dir dir. where are you?"; exit 1; }
[[ -f $convert  &&  -x $convert ]] || { echo "no executable $convert script. where are you?"; exit 1; }

ts=`date +%F-%H%M`

gt () {
	mvr=$1
	suff=$2
	shift 2
	bench=Profile$mvr
	out=$dir/$bench-$ts-$suff.raw
	go test -run '^Benchmark' -bench $bench -benchtime 10s -benchmem -count 10 -timeout 4h -tumin 20 -tumax 45 -tustep 5 "$@" \
		| tee $out \
		&& $convert -b $bench $out
}

for d in 8 7 6; do
	gt Minimax d$d -depth $d
done

for r in 25000 20000 15000; do
	gt MCTS r$r -runs $r
done

# vim:ft=sh:ts=8:sts=8:sw=8:noet

