update example files
This commit is contained in:
parent
b9ee01804b
commit
c64535675f
4 changed files with 4 additions and 10 deletions
1
backend/.gitignore
vendored
1
backend/.gitignore
vendored
|
@ -4,4 +4,3 @@ games/
|
|||
maps/
|
||||
trace.log
|
||||
games.ini
|
||||
static/bot
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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 -p 9142 -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;">python runner.py --host mozaic.zeus.gent -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>
|
||||
|
|
Loading…
Reference in a new issue