See the assignment turn-in page (last modified on 18 January 2006) for instructions on turning in your assignment.
For simplicity, both the yard and the obstructions will be rectangles. Obstacles may overlap, but will not extend past the boundaries of the yard.
where min-xi, min-yi, heighti, widthi, yard-height, and yard-width are non-negative integers separated by one or more space characters.
The first line of input describes the yard's area; each remaining input lines describes an obstacle that has its lower-left corner at (min-xi, min-yi) in the yard (the lower left-hand corner of the yard is (0, 0)) and has area heighti×widthi.
Any input not of this form is incorrect, as is any input that describes invalid obstacles. If you program reads incorrect input, it should print an informative error message to std-err and exit.
For example, the input
describes a 5×6 yard with two obstacles:
where min-x, min-y, height, and width are non-negative integers separated by one or more space characters. The single line of output describes a pool with its lower-left corner at (min-x, min-y) in the yard and with area height×width. If there is more than one maximal pool possible, your program may output any one of them. For example, the output
describes the solution
to the problem given in the input section.
If your program encounters an error, it should print on std-err a single
line of text describing the error and then exit with no further processing.
The error message should start with an exclamation point (!
). For
example, the input
should cause your program to write something like the following
! Obstacle not contained within the yard.
to std-err and exit with no further processing or output.
gen-yard
, when run, writes to std-out a yard description
suitable for input to your program. Although you can pipe the output of
gen-yard
directly into your program
$ gen-yard | mpool
it's probably easier for testing if you capture gen-yard
output in a file,
which you can then repeatedly input to your program:
$ gen-yard > yard $ mpool < yard
gen-yard
can be found in the public class directory /export/home/class/CS-503/a1
.
My solution to the problem (compiled for Linux) can also be found in the same
directory.
This page last modified on 7 February 2006. |