Solution

ID: past-exam-of-the-computer-science-course-of-the-university-of-oxford/2015/object-oriented-programming/3/c/solution

For an integer cell coordinate, occupancy is an existential predicate:
The first occupied unit cell of brick is at , and its last is at . Thus the required support predicate, with the baseplate explicitly included, is
For width one, the two support cells coincide. For a wider brick, its middle may bridge an empty gap; the question only requires support beneath its two ends. Checking would incorrectly examine a cell beyond the brick's right end. The potentially infinite baseplate supplies every required support at height zero.[ref]

New to topics? Read the docs here!