Recursively generates the number of anchor points specified in the
    patches argument, such that all patches are d cells away
    from their nearest neighbors.

def calcTightAnchors(args, d, patches):
    """
    Recursively generates the number of anchor points specified in the
    patches argument, such that all patches are d cells away
    from their nearest neighbors.
    """
    centerPoint = (int(args.worldSize/2), int(args.worldSize/2))
    anchors = []
    if patches == 0:
        pass

    elif patches == 1:
        anchors.append(centerPoint)

    elif patches % 2 == 0:
        dsout = int((patches-2)//2) + 1
        add_anchors(centerPoint, d, dsout, anchors, True)
        if d != 0:
            anchors = list(set(anchors))
        anchors.sort()
        if dsout != 1:
            return (anchors +
                    calcTightAnchors(args, d, patches-2)
                    )[:patches*patches]
            # to cut off the extras in the case where d=0

    else:
        # Note - an odd number of args.patchesPerSide requires that there be
        # a patch at the centerpoint
        dsout = int((patches-1)//2)
        add_anchors(centerPoint, d, dsout, anchors, False)
        if dsout != 1:
            return anchors + calcTightAnchors(d, patches-2)

    return anchors