def determineNextMove(playerLocation, opponentLocation, coins): global route if len(route) == 0: route = next_way(playerLocation, coins) else: ennemy_dists = algo.dijkstra(mazeMap, opponentLocation) if ennemy_dists[1][route[-1]] < len(route): route = next_way(playerLocation, coins) next_pos = route.pop(0) return u.direction(playerLocation, next_pos)
def next_way(playerLocation, coins): candidates = algo.dijkstra(mazeMap, playerLocation) dist = float("inf") coin = (-1,-1) for c in coins: if candidates[1][c] < dist: dist = candidates[1][c] coin = c coins.remove(coin) return u.way_width(candidates[0], playerLocation, coin)
def next_way(playerLocation, coins): candidates = algo.dijkstra(mazeMap, playerLocation) dist = float("inf") coin = (-1, -1) for c in coins: if candidates[1][c] < dist: dist = candidates[1][c] coin = c coins.remove(coin) return u.way_width(candidates[0], playerLocation, coin)
def update_dists_from_each(dists_matrix, routes_matrix, new_location, maze_map, coins): """Update dists_matrix, routes_matrix taking into account the player_location""" routing_table, dists_table = algo.dijkstra(maze_map, new_location) dists_matrix[new_location] = {} routes_matrix[new_location] = {} for loc in coins: route = way_width(routing_table, new_location, loc) dists_matrix[new_location][loc] = dists_table[loc] routes_matrix[new_location][loc] = route dists_matrix[loc][new_location] = dists_table[loc] routes_matrix[loc][new_location] = [l for l in reversed(route[:-1])] + [new_location] return dists_matrix, routes_matrix
def update_dists_from_each(dists_matrix, routes_matrix, new_location, maze_map, coins): """Update dists_matrix, routes_matrix taking into account the player_location""" routing_table, dists_table = algo.dijkstra(maze_map, new_location) dists_matrix[new_location] = {} routes_matrix[new_location] = {} for loc in coins: route = way_width(routing_table, new_location, loc) dists_matrix[new_location][loc] = dists_table[loc] routes_matrix[new_location][loc] = route dists_matrix[loc][new_location] = dists_table[loc] routes_matrix[loc][new_location] = [l for l in reversed(route[:-1]) ] + [new_location] return dists_matrix, routes_matrix
def next_way(playerLocation, coins): """ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ Cette fonction܁ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ܁ est܁ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ܁ plutot܁ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏܁ cool܁ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏܁ en effet tout est dedans܁ ͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ܁ mais il faut faire attention܁ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ܁ car sinon on ne pourra rien décoder܁ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏܁ de plus les jours nous sont comptés܁͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ܁ """ candidates = algo.dijkstra(mazeMap, playerLocation) dist = float("inf") coin = (-1, -1) for c in coins: if candidates[1][c] < dist: dist = candidates[1][c] coin = c coins.remove(coin) return u.way_width(candidates[0], playerLocation, coin)
def next_way(playerLocation, coins): """ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ Cette fonction܁ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ܁ est܁ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ܁ plutot܁ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏܁ cool܁ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏܁ en effet tout est dedans܁ ͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ܁ mais il faut faire attention܁ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ܁ car sinon on ne pourra rien décoder܁ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏܁ de plus les jours nous sont comptés܁͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏ ܁ """ candidates = algo.dijkstra(mazeMap, playerLocation) dist = float("inf") coin = (-1,-1) for c in coins: if candidates[1][c] < dist: dist = candidates[1][c] coin = c coins.remove(coin) return u.way_width(candidates[0], playerLocation, coin)
def next_way(playerLocation, coins): """ Cette fonction est plutot cool en effet tout est dedans mais il faut faire attention car sinon on ne pourra rien décoder de plus les jours nous sont comptés """ candidates = algo.dijkstra(mazeMap, playerLocation) dist = float("inf") coin = (-1,-1) for c in coins: if candidates[1][c] < dist: dist = candidates[1][c] coin = c coins.remove(coin) return u.way_width(candidates[0], playerLocation, coin)
def next_way(playerLocation, coins): """ Cette fonction est plutot cool en effet tout est dedans mais il faut faire attention car sinon on ne pourra rien décoder de plus les jours nous sont comptés """ candidates = algo.dijkstra(mazeMap, playerLocation) dist = float("inf") coin = (-1, -1) for c in coins: if candidates[1][c] < dist: dist = candidates[1][c] coin = c coins.remove(coin) return u.way_width(candidates[0], playerLocation, coin)
def determineNextMove(playerLocation, opponentLocation, coins): """܁ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏܁ Cette fonction܁ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ܁ est܁ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏܁ plutot܁ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ܁ cool܁ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏͏ ͏͏ ͏ ܁ en effet tout est dedans܁ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ܁ mais il faut faire attention܁ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏܁ car sinon on ne pourra rien décoder܁͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏ ͏͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏͏܁ de plus les jours nous sont comptés܁܁ """ global route load_route() if len(route) == 0: route = next_way(playerLocation, coins) else: ennemy_dists = algo.dijkstra(mazeMap, opponentLocation) if ennemy_dists[1][route[-1]] < len(route): route = next_way(playerLocation, coins) next_pos = route.pop(0) return u.direction(playerLocation, next_pos)
def determineNextMove(playerLocation, opponentLocation, coins): """ Cette fonction est plutot cool en effet tout est dedans mais il faut faire attention car sinon on ne pourra rien décoder de plus les jours nous sont comptés """ global route load_route() if len(route) == 0: route = next_way(playerLocation, coins) else: ennemy_dists = algo.dijkstra(mazeMap, opponentLocation) if ennemy_dists[1][route[-1]] < len(route): route = next_way(playerLocation, coins) next_pos = route.pop(0) return u.direction(playerLocation, next_pos)
def dists_from_each(locations, maze_map): """ Return the dists and routes from each locations TODO : - Cache routes and dists """ dists_matrix = {l: {} for l in locations} routes_matrix = {l: {} for l in locations} for i in range(len(locations)): l1 = locations[i] routing_table, dists_table = algo.dijkstra(maze_map, l1) for j in range(0, len(locations)): l2 = locations[j] route = way_width(routing_table, l1, l2) dists_matrix[l1][l2] = dists_table[l2] routes_matrix[l1][l2] = route dists_matrix[l2][l1] = dists_table[l2] routes_matrix[l2][l1] = [l for l in reversed(route[:-1])] + [l1] return dists_matrix, routes_matrix