From 440fc4fdecc5e3480f05b947e0f9d99c774f9636 Mon Sep 17 00:00:00 2001 From: redfast00 Date: Wed, 8 Apr 2020 01:48:17 +0200 Subject: [PATCH] Fix simple bot --- backend/static/bot/simple.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 - }) + }])