Merge pull request #16 from ZeusWPI/redfast00-playtesting

Playtesting
This commit is contained in:
ajuvercr 2020-04-08 13:45:03 +02:00 committed by GitHub
commit 5404f4256a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 12 deletions

View file

@ -1,7 +1,7 @@
import sys, json, random
def move(command):
record = { 'moves': [command] }
def move(moves):
record = {'moves': moves}
print(json.dumps(record))
sys.stdout.flush()
@ -13,12 +13,12 @@ for line in sys.stdin:
other_planets = [p for p in state['planets'] if p['owner'] != 1]
if not my_planets or not other_planets:
move(None)
move([])
else:
planet = max(my_planets, key=lambda p: p['ship_count'])
dest = min(other_planets, key=lambda p: p['ship_count'])
move({
move([{
'origin': planet['name'],
'destination': dest['name'],
'ship_count': planet['ship_count'] - 1
})
}])

View file

@ -16,7 +16,7 @@ Information
<li>planets on 2d plane</li>
<li>players can occupy planets</li>
<li>each turn, an occupied planet constructs a new ship for its owner</li>
<li>spaceship travel time is proportional to the euclidean distance (floor(sqrt(dx * dx - dy * dy)))</li>
<li>spaceship travel time is proportional to the euclidean distance (ceil(sqrt(dx * dx + dy * dy)))</li>
<li>combat happens only on planets</li>
</ul>
<h2>Turn Order</h2>

View file

@ -18,9 +18,9 @@ How to connect
<code>
$ wget mozaic.zeus.gent/bot/runner.py
$ wget mozaic.zeus.gent/bot/simple.py
$ python runner.py -p 9142 --host mozaic.zeus.gent \
$ python3 runner.py -p 9142 --host mozaic.zeus.gent \
-n &lt;Your name&gt; -i &lt;Id from the lobby&gt; \
python simple.py
python3 simple.py
</code>
</pre>
</div>

View file

@ -54,7 +54,7 @@
<p>Build a bot! All information about the planetwars game, <a target="_blank" href="https://docs.google.com/presentation/d/1YXr7IsmEiBpRwgAoFPqsjFoKoyXOv9LAhPbsambGX70/edit?usp=sharing">please visit</a> for input output format etc. You can find an example bot <a href="bot/simple.py">here</a>.</p>
<p>Optionally, you can create your own custom with the mapbuilder</p>
<p>Start a game instance in the lobby, don't forget to name it, watching the visualization afterwars is the only way to know who won atm.</p>
<p>Start up your bot and connect to the game instance. In the lobby you will see keys corresponding to players in the game. You can use <a href="bot/runner.py">the botrunner</a> to run your bot, with the command <span style="font-style: italic;">python runner.py --host mozaic.zeus.gent -n {your name} -i {your key} {The command to start you bot}</span>.
<p>Start up your bot and connect to the game instance. In the lobby you will see keys corresponding to players in the game. You can use <a href="bot/runner.py">the botrunner</a> to run your bot, with the command <span style="font-style: italic;">python3 runner.py --host mozaic.zeus.gent -n {your name} -i {your key} {The command to start you bot}</span>.
<p>Invite friends!</p>
<p>Bash your friends because you have the superior bot, according to the visualizer</p>
</div>

View file

@ -22,7 +22,7 @@
</div>
<div class="input_container number">
<label for="turns">Max turns:</label>
<input id="turns" type="number" value=200></input>
<input id="turns" type="number" value=1000></input>
</div>
<div class="input_container number">
<label for="nop">Number of players:</label>

View file

@ -1,4 +1,4 @@
#!/bin/bash
echo "Using token $1"
python runner.py -n simple.py --host ${HOST:-localhost} -p 9142 -i $1 python simple.py
python3 runner.py -n simple.py --host ${HOST:-localhost} -p 9142 -i $1 python3 simple.py

View file

@ -1,4 +1,4 @@
#! /usr/bin/env python
#!/usr/bin/env python3
import socket, sys, subprocess, argparse, io, threading, json