It's really frustrating when I'm working and I have a ton of windows open that are completely or partially hidden behind other windows. To make things worse, I'm still using two 1024x768 monitors.
Your task is to take a list of coordinates that designate the area, in pixels, on a screen, that a list of windows occupy and output a truthy value if, for a 2 monitor set-up with 1024x768 resolution, all the following conditions are met:
- None of the windows would overlap,
- None of the windows would be partly off screen
- None of the windows would straddle a boundary between the two monitors (so the order in which you visualize monitors 1 and 2 is irrelevant)
And a falsey value if any of these criteria are not met.
You may assume that all windows are rectangular, and that no coordinates are negative in the input, which is in a file, in stdin, or in a list of tuples, is in the following format:
monitor-number left-x bottom-y right-x top-y monitor-number left-x bottom-y right-x top-y monitor-number left-x bottom-y right-x top-y
Where each line contains the ID of the monitor (which can either be in
[1, 2] or
[0, 1] depending on which is easier for your language), and the dimensions of a window.
For example, the following input will result in a truthy output because none of the windows overlap:
1 10 10 100 200 1 210 300 600 600 2 10 10 100 200
The following input will result in a falsey value because lines 1 and 3 result in an overlap:
1 10 10 50 50 2 5 5 600 200 1 20 20 80 80
The following input will result in a falsey value because it would partially off-screen on one of the monitors:
1 1000 400 1400 300
This is code-golf so the shortest solution wins.