< Back

Post Lab 13

Post labs are to be done individually. Sharing files between students is not allowed. Doing so is an Academic Integrity violation, and will be treated as such.


In video games, different objects are often represented as rectangles to simplify testing if two object are intersecting. One common method for testing if two rectangles are overlapping involves projecting the two rectangles onto a lower dimensional line and testing for overlap. In this post-lab, you will write a simple function to compute overlaps on a 1-dimensional number line, in order to demonstrate your understanding of Boolean operators.

Details

Create a function called are_overlapping(min1, max1, min2, max2) in a file called overlap.py. The function should return True if the range of numbers [min1, max1] overlaps with the range of numbers [min2, max2]. The function should return False otherwise. In more mathematical terms, there is an overlap if there is any real number that is in the range [min1, max1] and in the range [min2, max2].

Test your function by calling the function multiple times with different parameters. Make sure you follow the course's code conventions.

Test Cases

Function Parameters Expected Output
0, 1, 2, 3 False
0, 2, 1, 3 True
0, 1, 1, 2 True
2, 3, 0, 1 False
1, 3, 0, 2 True
1, 2, 0, 1 True

Submission

Submissions for post labs are to be done via the inquire system. Go to http://inquire.roanoke.edu/ You should see a section for post labs. Submit your .py file to the appropriate post lab location.

Post labs are to be done individually. Sharing files between students is not allowed. Doing so is an Academic Integrity violation, and will be treated as such.