def calc_solution_holes(x_coord, y_coord):
    """
    Ref: Knotted Doughnuts and Other Mathematical Entertainments (Book)
         Martin Gardner 1986
    In his book the author summarises the maximum number of holes as dependent
    on the grid x and y sizes.
    1) If x or y are divisible by 3 then
            holes = (x * y) / 3
    2) If x or y both equal (3 * k + 1) or both equal (3 * k + 2) then
            holes = (x * y - 4) / 3
    3) If x or y are equal to (3 * k + 1) and (3 * k + 2) then
            holes = (x * y - 2) / 3
    This function calculates the maximum number of holes given the above and
    the passed in parameter corresponding to the x and y grid dimensions.
    :param x_coord: maximum number of horizontal cells in the grid.
    :param y_coord: maximum number of vertical cells in the grid.
    :return: returns the maximum number of holes and dominoes.
    """
    # 1) Are x_coord or y_coord divisible by 3
    if not x_coord % 3 or not y_coord % 3:
        holes = int((x_coord * y_coord) / 3)
    else:
        # Note: to get here we know that neither x_coord or y_coord are
        # divisible by 3.
        x_const = x_coord - (int(x_coord / 3) * 3)
        y_const = y_coord - (int(y_coord / 3) * 3)
        # 2) If x_coord or y_coord both have equal constants
        if x_const == y_const:
            holes = int((x_coord * y_coord - 4) / 3)
        # 3) If x_coord or y_coord both have unequal constants
        else:
            holes = int((x_coord * y_coord - 2) / 3)
    # Now calculate the maximum number of dominoes
    dominoes = int(((x_coord * y_coord) - holes) / 2)
    return holes, dominoes