From 137f10a4f2c3a8ba2caba966daa2fbeded5ebdc4 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Thu, 29 Apr 2021 18:52:47 -0500 Subject: Do powershell??? --- start.ps1 | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 start.ps1 diff --git a/start.ps1 b/start.ps1 new file mode 100644 index 0000000..a6f26dc --- /dev/null +++ b/start.ps1 @@ -0,0 +1,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 { + 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" + python3 ./python/dotsandboxes/dotsandboxesagent.py $w & + } + 2 { + Write-Output "MCTS Agent running on ws://127.0.0.1:$w" + python3 ./python/agent_MCTS.py $w & + } + 3 { + Write-Output "AB Agent running on ws://127.0.0.1:$w" + 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" +} \ No newline at end of file -- cgit v1.2.3