diff --git a/backend/.gitignore b/backend/.gitignore index af9d0de..7700136 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -4,4 +4,3 @@ games/ maps/ trace.log games.ini -static/bot diff --git a/backend/static/bot/runner.py b/backend/static/bot/runner.py index 3fb2cde..014379f 100755 --- a/backend/static/bot/runner.py +++ b/backend/static/bot/runner.py @@ -30,7 +30,7 @@ def main(): help='The bot\'s ID') parser.add_argument('--host', default="localhost", help='What host to connect to') - parser.add_argument('--port', '-p', default=6666, type=int, + parser.add_argument('--port', '-p', default=9142, type=int, help='What port to connect to') parser.add_argument('arguments', nargs=argparse.REMAINDER, help='How to run the bot') diff --git a/backend/static/bot/simple.py b/backend/static/bot/simple.py index 02d6fc4..04becaf 100644 --- a/backend/static/bot/simple.py +++ b/backend/static/bot/simple.py @@ -2,17 +2,12 @@ import sys, json, random def move(command): record = { 'moves': [command] } - print(json.dumps(record)) + json.dump(record, sys.stdout) sys.stdout.flush() -f_name = f"bot{random.randint(0, 10)}.txt" -f = open(f_name,"w+") -f.write("start") -f.flush() for line in sys.stdin: - f.write(line) - f.flush() state = json.loads(line) + # find planet with most ships my_planets = [p for p in state['planets'] if p['owner'] == 1] other_planets = [p for p in state['planets'] if p['owner'] != 1] diff --git a/backend/templates/index.html.tera b/backend/templates/index.html.tera index 00db3f0..e2e6265 100644 --- a/backend/templates/index.html.tera +++ b/backend/templates/index.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 -p 9142 -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 python runner.py --host mozaic.zeus.gent -i {your key} {The command to start you bot}.
Invite friends!
Bash your friends because you have the superior bot, according to the visualizer