Beispiel #1
0
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)
Beispiel #2
0
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)
Beispiel #3
0
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)
Beispiel #4
0
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)
Beispiel #5
0
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
Beispiel #6
0
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
Beispiel #7
0
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)
Beispiel #8
0
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)
Beispiel #9
0
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)
Beispiel #10
0
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)
Beispiel #11
0
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)
Beispiel #12
0
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)
Beispiel #13
0
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)
Beispiel #14
0
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)
Beispiel #15
0
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
Beispiel #16
0
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