#!/bin/csh

if ("$#argv" == "0") then
        set host = "localhost"
        set teamname = "ATTCMUnited2000"
else if ("$#argv" == "1" ) then
        set host = $1
        set teamname = "ATTCMUnited2000"
else if ("$#argv" == "2" ) then
        set host = $1
        set teamname = $2
else
        echo "Usage:  $0 <host-name> <team-name>"
        exit -1
endif

#set simulator_step = 30

set programname  = "./peterclient"
set coachprogramname  = "./coach"

echo "Running with the following parameters"
echo "Hostname: " $host
echo "Team: " $teamname
echo "Program: " $programname
echo "CoachProgram: " $coachprogramname
#echo "Sim_step: " $simulator_step

#Start the players. Note that the first is the goalie
$programname -file client.conf -file server.conf -file share.conf -host $host -team_name $teamname -goalie &
sleep 1
$programname -file client.conf -file server.conf -file share.conf -host $host -team_name $teamname &
./quicksleep
$programname -file client.conf -file server.conf -file share.conf -host $host -team_name $teamname &
./quicksleep
$programname -file client.conf -file server.conf -file share.conf -host $host -team_name $teamname &
./quicksleep
$programname -file client.conf -file server.conf -file share.conf -host $host -team_name $teamname &
./quicksleep
$programname -file client.conf -file server.conf -file share.conf -host $host -team_name $teamname &
./quicksleep
$programname -file client.conf -file server.conf -file share.conf -host $host -team_name $teamname &
./quicksleep
$programname -file client.conf -file server.conf -file share.conf -host $host -team_name $teamname &
./quicksleep
$programname -file client.conf -file server.conf -file share.conf -host $host -team_name $teamname &
./quicksleep
$programname -file client.conf -file server.conf -file share.conf -host $host -team_name $teamname &
./quicksleep
$programname -file client.conf -file server.conf -file share.conf -host $host -team_name $teamname &
sleep 3

#Start the coach
$coachprogramname -file coach.conf -file server.conf -file share.conf -host $host -team_name $teamname &

#waitforq
#if ( -e /usr/ucb/ps ) then 
#  kill `/usr/ucb/ps ax | grep $programname | grep -v grep | awk '{print $1}'`
#else
#kill -9 `ps ax | grep $programname | grep -v grep | awk '{print $1}'`
#endif
