import string


def okToVisit(v, index, step):
    """ Determine if this location can be visited by this flood algorithm """

    # If there is a smaller lower case letter in location then it's been visited by this function
    visited = v[index] in string.ascii_lowercase[:step]
    myBod = v[index] in string.ascii_uppercase

    # next see if this location contains a body part from any other snake
    # convert the remaining into a list removing food (0) and snake that is being processed (index)
    others = v.tolist()
    others.pop(index) # remove this snake
    others.pop(0) # remove food in pos 0
    otherBod = False
    for s in others:
        if s in string.ascii_uppercase:
            otherBod = True
            break

    #print(' v, vis, bd, ot:', v, visited, myBod, otherBod)
    return not visited and not otherBod and not myBod