def coord2int(x, y, size=3):
    """
        Converts a pair of coordinates to a scalar/index value

    :param x:
    :param y:
    :param size: the width/height of a perfect square
    :return:
    """
    return (x*size) + y