Hi! While working on the Windowing System exercise, I noticed a couple of inaccuracies in the examples provided in instructions for resize(to:) and move(to:).
I belive that the current version mixes up variable names and produces contradictory logic based on the exercise’s default screen size (800×600).
Detailed Breakdown
1. In resize(to:) (Task 4)
Current Text:
“E.g. if the window’s position is at x = 400, y = 300 and a resize to height = 400, width = 300 is requested, then the window would be resized to height = 300, width = 300 as the screen is not large enough in the y direction to fully accommodate the request.”
The Problem: Given the screen bounds (800×600) and position (x:400,y:300):
- Max available width: 800−400=400
- Max available height: 600−300=300
If the request is height=400 and width=300, the requested width (300) is already well within the max allowed width (400), so it wouldn’t be clipped by boundary constraints. To demonstrate clipping on the height/Y-axis while keeping width valid, the requested width should be 400.
Suggested Correction:
“E.g. if the window’s position is at x = 400, y = 300 and a resize to width = 400, height = 400 is requested, then the window would be resized to width = 400, height = 300 as the screen is not large enough in the y direction to fully accommodate the request.”
2. In move(to:) (Task 5)
Current Text:
“E.g. if the window’s size is at x = 250, y = 100 and a move to x = 600, y = 200 is requested, then the window would be moved to x = 550, y = 200 as the screen is not large enough in the x direction to fully accommodate the request.”
The Problem: The text uses x and y to describe size. Dimensions should be represented by width and height. Here, 250 represents the window’s width used to calculate the max allowed X position (800−250=550).
Suggested Correction:
“E.g. if the window’s size is width = 250, height = 100 and a move to x = 600, y = 200 is requested, then the window would be moved to x = 550, y = 200 as the screen is not large enough in the x direction to fully accommodate the request.”
I am opening a pull request with these updates