aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--start.ps159
1 files changed, 59 insertions, 0 deletions
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