trees.py
def _help_insert1(self, point: Tuple[int, int], o_point: Tuple[int, int],
                      name: str) -> None:
        """
        Insert a player named <name> into this tree at point <point>,  this tree
        has original point at <o_point> and we need to build a new subtree
        before adding this point.

        === Precondition ===
        - The point <point> is in bound
        - The point <point> is not in this tree before insert.
        """
        x0, y0 = o_point
        x, y = self._centre
        x1, y1 = point
        length_x = x - x0
        length_y = y - y0
        if length_x < 2:
            length_x = 2
        if length_y < 2:
            length_y = 2
        if x1 <= x and y1 <= y:
            self._nw = QuadTree((int(1 / 2 * length_x) + x0,
                                 int(1 / 2 * length_y) + y0))
            self._nw._point = x1, y1
            self._nw._name = name
        elif x1 <= x and y < y1:
            self._sw = QuadTree((int(1 / 2 * length_x) + x0,
                                 int(3 / 2 * length_y) + y0))
            self._sw._point = x1, y1
            self._sw._name = name
        elif x < x1 and y1 <= y:
            self._ne = QuadTree((int(3 / 2 * length_x) + x0,
                                 int(1 / 2 * length_y) + y0))
            self._ne._point = x1, y1
            self._ne._name = name
        else:
            self._se = QuadTree((int(3 / 2 * length_x) + x0,
                                 int(3 / 2 * length_y) + y0))
            self._se._point = x1, y1
            self._se._name = name

        Insert a player named <name> into this tree at point <point>,  this tree
        has original point at <o_point> and we need to build a new subtree
        before adding this point.

        === Precondition ===
        - The point <point> is in bound
        - The point <point> is not in this tree before insert.
        
Insert a player named  into this tree at point ,  this tree
has original point at  and we need to build a new subtree
before adding this point.

Precondition
The point  is in bound
The point  is not in this tree before insert.
Insert a player named into this tree at point this tree has original point at and we need to build a new subtree before adding this point . Precondition The point is in bound The point is not in this tree before insert .
def _help_insert1(self, point: Tuple[int, int], o_point: Tuple[int, int],
                      name: str) -> None:
        x0, y0 = o_point
        x, y = self._centre
        x1, y1 = point
        length_x = x - x0
        length_y = y - y0
        if length_x < 2:
            length_x = 2
        if length_y < 2:
            length_y = 2
        if x1 <= x and y1 <= y:
            self._nw = QuadTree((int(1 / 2 * length_x) + x0,
                                 int(1 / 2 * length_y) + y0))
            self._nw._point = x1, y1
            self._nw._name = name
        elif x1 <= x and y < y1:
            self._sw = QuadTree((int(1 / 2 * length_x) + x0,
                                 int(3 / 2 * length_y) + y0))
            self._sw._point = x1, y1
            self._sw._name = name
        elif x < x1 and y1 <= y:
            self._ne = QuadTree((int(3 / 2 * length_x) + x0,
                                 int(1 / 2 * length_y) + y0))
            self._ne._point = x1, y1
            self._ne._name = name
        else:
            self._se = QuadTree((int(3 / 2 * length_x) + x0,
                                 int(3 / 2 * length_y) + y0))
            self._se._point = x1, y1
            self._se._name = name
def _help_insert1 ( self , point : Tuple [ int , int ] , o_point : Tuple [ int , int ] , name : str ) -> None : x0 , y0 = o_point x , y = self . _centre x1 , y1 = point length_x = x - x0 length_y = y - y0 if length_x < 2 : length_x = 2 if length_y < 2 : length_y = 2 if x1 <= x and y1 <= y : self . _nw = QuadTree ( ( int ( 1 / 2 * length_x ) + x0 , int ( 1 / 2 * length_y ) + y0 ) ) self . _nw . _point = x1 , y1 self . _nw . _name = name elif x1 <= x and y < y1 : self . _sw = QuadTree ( ( int ( 1 / 2 * length_x ) + x0 , int ( 3 / 2 * length_y ) + y0 ) ) self . _sw . _point = x1 , y1 self . _sw . _name = name elif x < x1 and y1 <= y : self . _ne = QuadTree ( ( int ( 3 / 2 * length_x ) + x0 , int ( 1 / 2 * length_y ) + y0 ) ) self . _ne . _point = x1 , y1 self . _ne . _name = name else : self . _se = QuadTree ( ( int ( 3 / 2 * length_x ) + x0 , int ( 3 / 2 * length_y ) + y0 ) ) self . _se . _point = x1 , y1 self . _se . _name = name
Insert a player named <name> into this tree at point <point>,  this tree
has original point at <o_point> and we need to build a new subtree
before adding this point.
Insert a player named <name > into this tree at point <point > this tree has original point at <o_point > and we need to build a new subtree before adding this point .
"""
        Insert a player named <name> into this tree at point <point>,  this tree
        has original point at <o_point> and we need to build a new subtree
        before adding this point.

        === Precondition ===
        - The point <point> is in bound
        - The point <point> is not in this tree before insert.
        """
self
point
Tuple[int, int]
o_point
Tuple[int, int]
name
str