summaryrefslogtreecommitdiff
path: root/simple.py
blob: 1ff37f20dd09cee7b6f3f55d150dfff1c2cfd67c (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import random
import sys

import robots

def random_walk(whoami, state):
    my_robots = state.robots_by_player[whoami]
    return ''.join(
        random.choice('ULDRP')
        for _ in range(len(my_robots))
    )

if __name__ == '__main__':
    name, = sys.argv[1:]
    server = robots.Server()
    server.SERVER_NAME = name
    server.add_simple_bot(random_walk, 'Bot1')
    server.add_simple_bot(random_walk, 'Bot2')
    server.run()