diff options
-rwxr-xr-x | start.sh | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -1,11 +1,21 @@ #/bin/bash #Bash script for automating evaluate -echo "Dots and Boxes Agent Shell Script: Ver 1.0RC1: first not broken release" +echo "Dots and Boxes Agent Shell Script: Ver 1.0RC2: adding options" -(python3 python/dotsandboxes/dotsandboxesserver.py 8080) >> server.log & -echo "Web server running on http://127.0.0.1:8080" +while getopts 'w:p:h:' opt; do + case $opt in + w) WEB=$OPTARG;; + p) PORT=$OPTARG;; + h) echo "Usage: ./start.sh -w (web port) -p (starting agent port)" + exit 0;; + *) echo "Usage: ./start.sh -w (web port) -p (starting agent port)" + exit 1;; + esac +done + +(python3 python/dotsandboxes/dotsandboxesserver.py $WEB) >> server.log & +echo "Web server running on http://127.0.0.1:$WEB" -PORT=20000 for a in 1 2 do ((PORT=PORT+1)); @@ -17,13 +27,13 @@ do read -p "Agent:" Agent case $Agent in 1) echo "Random Agent running on ws://127.0.0.1:$PORT" - (python3 python/dotsandboxes/dotsandboxesagent.py $PORT) >> $a.log & + (python3 python/dotsandboxes/dotsandboxesagent.py $PORT) > $a.log & ;; 2) echo "MCTS Agent running on ws://127.0.0.1:$PORT" - (python3 python/agent_MCTS.py $PORT) >> $a.log & + (python3 python/agent_MCTS.py $PORT) > $a.log & ;; 3) echo "AB Agent running on ws://127.0.0.1:$PORT" - (python3 python/agent_AB.py $PORT) >> $a.log & + (python3 python/agent_AB.py $PORT) > $a.log & ;; *) echo "Invalid input. Human player assumed. Undefined behavior will likely occur because I am lazy." ;; @@ -40,7 +50,7 @@ case $log in read -p "Output file name (please include '.csv'): " o echo "" read -p "This will now run evaluate.py with the given arguments in the foreground. Hit enter to confirm." TRASH - (python3 python/evaluate.py -c $c -r $r -n $n -o $o ws://127.0.0.1:20001 ws://127.0.0.1:20002) > evaluate.log + (python3 python/evaluate.py -c $c -r $r -n $n -o $o ws://127.0.0.1:(`expr $PORT - 2`) ws://127.0.0.1:(`expr $PORT - 1`)) > evaluate.log echo "" echo "Log of evaluate python script located in evaluate.log" echo "Evaluate has finished! Check the output in $o" |