aboutsummaryrefslogtreecommitdiffstats
path: root/start.sh
blob: 4567e31938351ee8aa7be31e8fdfc96df14cc3b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#/bin/bash
#Bash script for automating evaluate
echo "Dots and Boxes Agent Shell Script: Ver 0.1: first release"

(python3 python/dotsandboxes/dotsandboxesserver.py 8080) >> server.log  &
echo "Web server running on http://127.0.0.1:8080" 

PORT=20000
for a in 1 2
do
    ((PORT=PORT+1));
    echo "Available Agents:"
    echo "1: Random"
    echo "2: Monte Carlo Tree Search"
    echo "3: Alpha-Beta Pruning/Minimax"
    PORT=`expr $PORT + 1`;
    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 &
        ;;
        2) echo "MCTS Agent running on ws://127.0.0.1:$PORT"
        (python3 python/agent_MCTS.py $PORT) >> $a.log &
        ;;
        3) echo "AB Agent running on ws://127.0.0.1:$PORT"
        (python3 python/agent_MCTS.py $PORT) >> $a.log &
        ;;
        *) echo "Invalid input. Human player assumed. Undefined behavior will likely occur because I am lazy."
        ;;
    esac
done

read -p "Do you want to run the logger? (Y/N): " log
case $log in
    Y|y)
    echo ""
    read -p "Columns of board: " c
    read -p "Rows of board: " r
    read -p "Number of games to run: " n
    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
    echo ""
    echo "Log of evaluate python script located in evaluate.log"
    echo "Evaluate has finished! Check the output in $o"
    ;;
    *)
    echo "Web interface available at http://127.0.0.1:8080"
    ;;
esac

echo "Press enter to exit, killing all agents and the web server."
read TRASH;

trap "exit" INT TERM
trap "kill 0" EXIT