# Problem Description:
The task is to calculate the area of a specific shape formed by two given points on a grid. The shape is essentially a rectangle with its four corners removed. The coordinates of the points are always greater than 1. The function should take two tuples representing the coordinates of the points and return the calculated area of the shape.

# Visual Facts:
1. The grid has x and y axes with integer coordinates.
2. Two points are given in each example, denoted as P1 and P2.
3. The shape formed is a rectangle with the corners cut off.
4. The corners cut off are right-angled triangles with legs of length 1.
5. The coordinates of the points are always greater than 1.

# Visual Patterns:
1. The height of the rectangle is calculated as the absolute difference between the y-coordinates of the two points plus 3.
   - Example 1: |4 - 2| + 3 = 5
   - Example 2: |6 - 2| + 3 = 7
   - Example 3: |2 - 2| + 3 = 3
2. The width of the rectangle is calculated as the absolute difference between the x-coordinates of the two points plus 3.
   - Example 1: |4 - 2| + 3 = 5
   - Example 2: |4 - 2| + 3 = 5
   - Example 3: |4 - 3| + 3 = 4
3. The area of the rectangle before removing the corners is height * width.
   - Example 1: 5 * 5 = 25
   - Example 2: 7 * 5 = 35
   - Example 3: 3 * 4 = 12
4. Each corner removed is a right-angled triangle with an area of 0.5 (since each leg is of length 1).
5. There are four corners removed, so the total area removed is 4 * 0.5 = 2.
6. The final area is the area of the rectangle minus the area of the four corners.
   - Example 1: 25 - 2 = 23
   - Example 2: 35 - 2 = 33
   - Example 3: 12 - 2 = 10

# Solution
from typing import Tuple

def solution(p1: Tuple[int, int], p2: Tuple[int, int]) -> int:
    """
    Calculates the area defined by two points according to the specified rules in the image. Note the x and y coordinates of the points are always greater than 1.

    Parameters:
        p1 (Tuple[int, int]): Coordinates of the first point.
        p2 (Tuple[int, int]): Coordinates of the second point.

    Returns:
        int: The calculated area defined by the two points.
    """
    x1, y1 = p1
    x2, y2 = p2
    d1 = abs(x1 - x2)+3
    d2 = abs(y1 - y2)+3

    return d1*d2 -2


# Test Script
def test():
    test_cases = [
        ((2, 2), (4, 4), 23),
        ((4, 2), (2, 6), 33),
        ((3, 2), (4, 2), 10),
        ((5, 7), (3, 8), 18),
        ((8, 4), (7, 3), 14),
    ]
    for p1, p2, expected_output in test_cases:
        try:
            output = solution(p1, p2)
        except Exception as e:
            error_message = (
                f"An exception occurred while running the test case:\n"
                f"`p1`: {p1}\n"
                f"`p2`: {p2}\n\n"
                f"Exception: '{str(e)}'"
            )
            assert False, error_message

        if output != expected_output:
            error_message = (
                f"The following Test Case failed:\n"
                f"`p1`: {p1}\n"
                f"`p2`: {p2}\n\n"
                f"Actual Output: {output}\n"
                f"Expected Output: {expected_output}"
            )
            assert False, error_message

test()