diff --git a/MyBot.py b/MyBot.py index da84b75..3e70c82 100755 --- a/MyBot.py +++ b/MyBot.py @@ -19,6 +19,18 @@ def get_winning_stance(stance): elif stance == "Scissors": return "Rock" + + +def node_value(node, map): + return random.randint(0,10) + + + +def best_stance(map): + return random.randint(0,2) + + + # main player script logic # DO NOT CHANGE BELOW ---------------------------- for line in fileinput.input(): @@ -33,20 +45,30 @@ def get_winning_stance(stance): me = game.get_self() - if me.location == me.destination: # check if we have moved this turn - # get all living monsters closest to me - monsters = game.nearest_monsters(me.location, 1) + opponent = game.get_opponent() + + if me.location == me.destination: + + adjacent_nodes = game.get_adjacent_nodes + adjacent_nodes.append(me.location) + + maxVal = node_value(adjacent_nodes[0], game) + + destination_node = me.location + + for i in game.get_adjacent_nodes(me.location): - # choose a monster to move to at random - monster_to_move_to = monsters[random.randint(0, len(monsters)-1)] + current_value = node_value(i, game) - # 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] + if (current_value > maxVal): + destination_node = i + maxVal = current_value else: destination_node = me.destination - if game.has_monster(me.location): + if opponent.location != me.location: + chosen_stance = stances[best_stance(game)] + elif 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: @@ -54,4 +76,4 @@ def get_winning_stance(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) + game.submit_decision(destination_node, chosen_stance) \ No newline at end of file