def name_to_coord(name):
    """
    Takes a square name and converts it to 2d-array coordinates, e.g. 'a8' to (0,0) and 'h4' to (4,7)

    string name: the name of a square, e.g. 'a1' or 'e4'
    returns int, int: 2d-array integer coordinates
    """
    rank_to_num = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7}
    ffile, rank = name[0], int(name[1])
    
    row = 8 - rank
    col = rank_to_num[ffile]

    return (row, col)