aboutsummaryrefslogtreecommitdiffstats
path: root/start.ps1
blob: be88a5ed58168c19b5ed59820d57bcc91d2d40d8 (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
58
59
param (
    [Parameter(Mandatory=$true)][int]$s,
    [Parameter(Mandatory=$true)][int]$w,
    [switch]$h
)
if ($h) {
    Write-Output "Usage:"
    Write-Output "-s (Server port)"
    Write-Output "-w (Agent port start)"
    Write-Output "-h Display this message"
} else {
    Start-Job -scriptblock { python3 ./python/dotsandboxes/dotsandboxesserver.py $s}
    Write-Output "Web server running on http://127.0.0.1:$s"
    for ($i=1 ; $i -le 2 ; $i++) {
        Write-Output "Available Agents:"
        Write-Output "1: Random"
        Write-Output "2: Monte Carlo Tree Search"
        Write-Output "3: Alpha-Beta Pruning/Minimax"
        $w++
        $agent = Read-Host "Agent"
        switch ($agent) {
            1 {
                Write-Output "Random Agent running on ws://127.0.0.1:$w"
                Start-Job -scriptblock {python3 ./python/dotsandboxes/dotsandboxesagent.py $w}
            }
            2 {
                Write-Output "MCTS Agent running on ws://127.0.0.1:$w"
                Start-Job -scriptblock { python3 ./python/agent_MCTS.py $w}
            }
            3 {
                Write-Output "AB Agent running on ws://127.0.0.1:$w"
                    Start-Job -scriptblock { python3 ./python/agent_AB.py $w}
            }
            default {Write-Output "Invalid value. Program will now probably break."}
        }
    }
    $log = Read-Host "Do you want to run the logger? (Y/N)"
    switch ($log) {
    "Y" {
        Write-Output ""
        $c = Read-Host "Columns of board"
        $r = Read-Host "Rows of board"
        $n = Read-Host "Number of games to run"
        $o = Read-Host "Output file name (please include '.csv')"
        Write-Output ""
        $trash = Read-Host "This will now run evaluate.py with the given arguments in the foreground. Hit enter to confirm."
        $p1 = $w - 1
        # Write-Output "python3 python/evaluate.py -c $c -r $r -n $n -o $o ws://127.0.0.1:$w ws://127.0.0.1:$p1"
            python3 ./python/evaluate.py -c $c -r $r -n $n -o $o ws://127.0.0.1:$w ws://127.0.0.1:$p1 | Out-Null
        Write-Output ""
        Write-Output "Evaluate has finished! Check the output in $o"
    }
    default {
        Write-Output "Web interface available at http://127.0.0.1:$s"
    }}
# Probably a bad idea
$trash = Read-Host "Press enter to kill all python3 instances."
# Stop-Job -Name "python3"
}