def _objects_touch_each_other(self, object1: Object, object2: Object) -> bool:
        """
        Returns true iff the objects touch each other.
        """
        in_vertical_range = object1.y_loc <= object2.y_loc + object2.size and \
                            object1.y_loc + object1.size >= object2.y_loc
        in_horizantal_range = object1.x_loc <= object2.x_loc + object2.size and \
                            object1.x_loc + object1.size >= object2.x_loc
        touch_side = object1.x_loc + object1.size == object2.x_loc or \
                     object2.x_loc + object2.size == object1.x_loc
        touch_top_or_bottom = object1.y_loc + object1.size == object2.y_loc or \
                              object2.y_loc + object2.size == object1.y_loc
        return (in_vertical_range and touch_side) or (in_horizantal_range and touch_top_or_bottom)
def _objects_touch_each_other ( self , object1 : Object , object2 : Object ) -> bool : in_vertical_range = object1 . y_loc <= object2 . y_loc + object2 . size and object1 . y_loc + object1 . size >= object2 . y_loc in_horizantal_range = object1 . x_loc <= object2 . x_loc + object2 . size and object1 . x_loc + object1 . size >= object2 . x_loc touch_side = object1 . x_loc + object1 . size == object2 . x_loc or object2 . x_loc + object2 . size == object1 . x_loc touch_top_or_bottom = object1 . y_loc + object1 . size == object2 . y_loc or object2 . y_loc + object2 . size == object1 . y_loc return ( in_vertical_range and touch_side ) or ( in_horizantal_range and touch_top_or_bottom )
Returns true iff the objects touch each other.