def get_player_stance # main player script logic # DO NOT CHANGE BELOW ---------------------------- for line in fileinput.input(): if first_line: game = game_API.Game(json.loads(line)) first_line = False continue game.update(json.loads(line)) # DO NOT CHANGE ABOVE --------------------------- # code in this block will be executed each turn of the game me = game.get_self() if me.location == me.destination: # check if we have moved this turn # create list of the priority level for each monster list = map(priority, game.get_all_monsters()) # choose monster with max priority monster_to_move_to = max(list) # get the set of shortest paths to that monster paths = game.shortest_paths(me.location, monster_to_move_to.location) destination_node = paths[random.randint(0, len(paths)-1)][0] else: destination_node = me.destination if game.has_monster(me.location): # if there's a monster at my location, choose the stance that damages that monster chosen_stance = get_winning_stance(game.get_monster(me.location).stance) else: # otherwise, pick a random stance chosen_stance = stances[random.randint(0, 2)] # submit your decision for the turn (This function should be called exactly once per turn) game.submit_decision(destination_node, chosen_stance)
#we play paper countPafterS = 0 countPafterR = 0 countPafterP = 0 """ a=1 b=1 c=1 d=1 e=1 f=1 g=1 h=1 for line in fileinput.input(): if first_line: game = game_API.Game(json.loads(line)) first_line = False continue game.update(json.loads(line)) # DO NOT CHANGE ABOVE --------------------------- # code in this block will be executed each turn of the game me = game.get_self() opponent = game.get_opponent() # initalizes the dictionary thisdict = { }