def row_check_tile_direction(row,direction,index) :
    """Returns the value of the first tile encountered when moving from index in the direction given and the position of this tile. "-1" is a wall"""
    taille = len(row)
    currentPosition = index
    if direction =="left" :
        currentPosition -= 1
        while currentPosition >= 0 and row[currentPosition] == " " :
            currentPosition -= 1
        if currentPosition == -1 :
            return("-1", -1)
        else :
            return (row[currentPosition], currentPosition)
    if direction == "right" :
        currentPosition += 1
        while currentPosition < taille and row[currentPosition] == " " :
            currentPosition += 1
        if currentPosition == taille :
            return("-1", taille)
        else :
            return (row[currentPosition], currentPosition)