def create_game(args): ''' Create all the semi-permanent game structures (i.e. sockets and dockers and stuff ''' # Load the Game state info game = server.Game(logging_level=logging.ERROR, game_map=args['map'], time_pool=args['time_pool'], time_additional=args['time_additional']) # Find a good filename to use as socket file for index in range(10000): sock_file = "/tmp/battlecode-" + str(index) if not os.path.exists(sock_file): break # Assign the docker instances client ids dockers = {} Sandbox.initialize() for index in range(len(game.players)): key = [player['id'] for player in game.players][index] dockers[key] = Sandbox(sock_file, player_key=key, local_dir=args['dir_p1' if index % 2 == 0 else 'dir_p2']) return (game, dockers, sock_file)