import random import robots from robots.utils import add_spawns 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__': # random.seed(42) map_ = robots.border_map(20, 10, 0) add_spawns(map_, 10, 'X') add_spawns(map_, 20, '+') add_spawns(map_, 4) game = robots.Game(map_) game.add_bot(random_walk, 'Alice') game.add_bot(random_walk, 'Bob') viewer = robots.CursesViewer(game) viewer.run()