diff --git a/backend/static/bot/simple.py b/backend/static/bot/simple.py index 4c0e199..bea8c85 100644 --- a/backend/static/bot/simple.py +++ b/backend/static/bot/simple.py @@ -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 - }) + }]) diff --git a/backend/templates/help/help_1.html.tera b/backend/templates/help/help_1.html.tera index 79dd979..34d2e05 100644 --- a/backend/templates/help/help_1.html.tera +++ b/backend/templates/help/help_1.html.tera @@ -16,7 +16,7 @@ Information
  • planets on 2d plane
  • players can occupy planets
  • each turn, an occupied planet constructs a new ship for its owner
  • -
  • spaceship travel time is proportional to the euclidean distance (floor(sqrt(dx * dx - dy * dy)))
  • +
  • spaceship travel time is proportional to the euclidean distance (ceil(sqrt(dx * dx + dy * dy)))
  • combat happens only on planets
  • Turn Order

    diff --git a/backend/templates/help/help_6.html.tera b/backend/templates/help/help_6.html.tera index f7040c2..f33186e 100644 --- a/backend/templates/help/help_6.html.tera +++ b/backend/templates/help/help_6.html.tera @@ -18,9 +18,9 @@ How to connect $ 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 <Your name> -i <Id from the lobby> \ - python simple.py + python3 simple.py diff --git a/backend/templates/index2.html.tera b/backend/templates/index2.html.tera index 55b771a..86339a1 100644 --- a/backend/templates/index2.html.tera +++ b/backend/templates/index2.html.tera @@ -54,7 +54,7 @@

    Build a bot! All information about the planetwars game, please visit for input output format etc. You can find an example bot here.

    Optionally, you can create your own custom with the mapbuilder

    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.

    -

    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 the botrunner to run your bot, with the command python runner.py --host mozaic.zeus.gent -n {your name} -i {your key} {The command to start you bot}. +

    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 the botrunner to run your bot, with the command python3 runner.py --host mozaic.zeus.gent -n {your name} -i {your key} {The command to start you bot}.

    Invite friends!

    Bash your friends because you have the superior bot, according to the visualizer

    diff --git a/backend/templates/lobby.html.tera b/backend/templates/lobby.html.tera index ffab095..5e68a8e 100644 --- a/backend/templates/lobby.html.tera +++ b/backend/templates/lobby.html.tera @@ -22,7 +22,7 @@
    - +
    diff --git a/client/run.sh b/client/run.sh index 8b4dad1..ed0ef4c 100755 --- a/client/run.sh +++ b/client/run.sh @@ -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 diff --git a/client/runner.py b/client/runner.py index ff4e0e1..3f2b8f9 100755 --- a/client/runner.py +++ b/client/runner.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python3 import socket, sys, subprocess, argparse, io, threading, json