#!/usr/bin/env python3 def doRectanglesOverlap(a, b): """ Tests whether two rectangles overlap >>> a = {'x1': 0, 'y1': 0, 'x2': 10, 'y2': 5} >>> b = {'x1': 15, 'y1': 0, 'x2': 25, 'y2': 5} >>> doRectanglesOverlap(a, b) # not overlapping, not touching False >>> >>> a = {'x1': 0, 'y1': 0, 'x2': 10, 'y2': 5} >>> b = {'x1': 5, 'y1': 3, 'x2': 15, 'y2': 13} >>> doRectanglesOverlap(a, b) # one corner in the other rectangle True >>> >>> a = {'x1': 0, 'y1': 0, 'x2': 10, 'y2': 5} >>> b = {'x1': 5, 'y1': -3, 'x2': 15, 'y2': 8} >>> doRectanglesOverlap(a, b) # two corners in the other rectangle True >>> >>> a = {'x1': 1, 'y1': 0, 'x2': 11, 'y2': 10} >>> b = {'x1': 0, 'y1': 1, 'x2': 12, 'y2': 9} >>> doRectanglesOverlap(a, b) # overlapping, neither rectangle contains the other's corner True >>> >>> a = {'x1': 0, 'y1': 0, 'x2': 10, 'y2': 10} >>> b = {'x1': 1, 'y1': 1, 'x2': 9, 'y2': 9} >>> doRectanglesOverlap(a, b) # one rectangle containing the other True >>> >>> a = {'x1': 0, 'y1': 0, 'x2': 10, 'y2': 10} >>> b = {'x1': 10, 'y1': 0, 'x2': 20, 'y2': 10} >>> doRectanglesOverlap(a, b) # one edge touching False >>> >>> a = {'x1': 0, 'y1': 0, 'x2': 10, 'y2': 10} >>> b = {'x1': 10, 'y1': 10, 'x2': 20, 'y2': 20} >>> doRectanglesOverlap(a, b) # one corner touching False >>> """ return('BUG') if __name__ == "__main__": import doctest doctest.testmod()