#!/bin/sh

PROGRAM="FreeDoko"

#if [ -e $PROGRAM ]; then
# rm $PROGRAM
#fi

# while [ ! -x ./FreeDoko ]; do sleep 1; done; ./FreeDoko

# for debugging code
#export CXXFLAGS="-Wall -Werror -O3 -ftemplate-depth-20 -g"

if false; then
  echo
  echo "**** compile $PROGRAM ****"
  echo
  make $PROGRAM || exit
else
  echo
  echo "**** waiting for $PROGRAM ****"
  echo
  while [ ! -x ./$PROGRAM ]; do sleep 1; done
fi

echo
echo "****** $PROGRAM ******"
#cd ../data && ../src/$PROGRAM

#echo "0.6.7  (2005-04-01)" > ~/.FreeDoko/Version
#rm ~/.FreeDoko/Version
#rm ~/.FreeDoko/parties/current
#rm ~/.FreeDoko/player.?

#./$PROGRAM "$@"
./$PROGRAM "$@" ~/.FreeDoko/parties/t "$@"

#rm ~/.FreeDoko/player.? 2>/dev/null; ./$PROGRAM --start_server "$@" &  sleep 2; ./$PROGRAM --connect localhost

#time ./$PROGRAM "$@" --ui=none -F63

#./$PROGRAM -b  ~/Desktop/FreeDoko.BugReports/FreeDoko.BugReport.248603_1 "$@"

#./$PROGRAM -b ../Bugreports/_incoming/FreeDoko.BugReport.61712 "$@"
#./$PROGRAM -b ../Bugreports/_incoming/Mail/FreeDoko.BugReport.28552 "$@"
#./$PROGRAM -b ../Bugreports/asserts/FreeDoko.BugReport.126920 "$@"
#./$PROGRAM -b ../Bugreports/replay/FreeDoko.BugReport.171023 "$@"
#./$PROGRAM -b  ../Bugreports/ai/FreeDoko.BugReport.126920 "$@"
#./$PROGRAM -b  ../Bugreports/ai/CardInformation/FreeDoko.BugReport.57381 "$@"
#./$PROGRAM -b  ../Bugreports/ai/TeamInformation/FreeDoko.BugReport.87115 "$@"
#./$PROGRAM -b  ../Bugreports/ai/Heuristics/FreeDoko.BugReport.5896 "$@"
#./$PROGRAM -b  ../Bugreports/ai/new_heuristics/FreeDoko.BugReport.174565 "$@"
#./$PROGRAM -b  ../Bugreports/ai/Choosebestcard/GameTree/FreeDoko.BugReport.27524_11 "$@"
#./$PROGRAM -b  ../Bugreports/ai/Choosebestcard/TrickWeighting/FreeDoko.BugReport.27881 "$@"


# test
#nice -20 ./$PROGRAM /home/dknof/.FreeDoko/parties/testparty -F 59 "$@"
#nice -20 ./$PROGRAM /home/dknof/.FreeDoko/parties/fast_play -F 63 "$@"
#./$PROGRAM /home/dknof/.FreeDoko/parties/points.test "$@"
#nice -20 ./$PROGRAM /home/dknof/.FreeDoko/parties/long_play.3 -F 59 "$@"

echo
#   rm ./$PROGRAM

exit

# fast play
#   1  automatic party start
#   2  ai players
#   4  random ai
#   8  skip pauses
#  16  skip gameplay informations
#  32  skip game finished dialog
#  64  show all hands
