Assigned | 09 Sep 2002 |
Design Due | 15 Sep 2002 |
Program Due | 22 Sep 2002 |
Updates | None |
There are many applications in which a large space needs to be covered with "tiles". For example, the space above the stove in a kitchen, or the walls inside a shower in the bathroom, or an educational child's puzzle. If the tiles are square, then there is only one pattern that can be used to cover the space. But if the tiles are not square, then many different patterns might be possible.
Dominoes are rectangular shapes which are 2 inches by 1 inch (2" x 1") in size. In this project, you will write a program to determine and display all the different patterns that can be used to cover a rectangular area with dominoes. The area to be covered will be 2-inches wide and N inches long, where N is a command line argument. Obviously, the larger value N has, the more ways there will be to cover the area.
After some thought, you'll find that this is a problem which is best solved recursively and will require multiple recursive functions.
To help you visualize the problem, these pictures show the different ways that 2" x 1"
dominoes can be arranged to cover areas which are 2" x 1", 2" x 2" and 2" x 3".
Other Program Requirements
If your code contains more than two loops,
you will recieve a score of zero
Assumptions
Your program can make the following assumptions, but no others.
A Sample Output
These outputs correspond to the pictures above. If more than one
pattern is displayed, they may be displayed in any order.
Your program, and ALL programs in this class, must handle the following errors:
At a minimum, your design submittal must inlcude the following
The "make" utility is used to help control projects with large numbers of files. It consists of targets, rules, and dependencies. You will be learning about make files in discussion. For this project, the file will be provided for you. You will be responsible for providing make files for all future projects. Copy the file
When you finish creating all of the required project files (proj1.C, domino.C and domino.H, you will find that by typing the command make or make Proj1 at the Linux prompt, your project will compile and link (if there are no compiler or linker errors) and produce an executable called Proj1.
If you name your files anything other than proj1.C, domino.C and domino.H, or if you create additional files, it is your responsibility to provide your own makefile. Any project that does not compile and link without errors simply by typing the command make Proj1 will be considered to have a compiler/linker error.
In addition to creating your project executable, make can be used for maintaining your directory. Typing make clean will remove any extraneous files in your directory, such as .o files and core files. Typing make cleanest will remove all .o files, core, Proj1, and backup files created by the editor.
See the 202 Syllabus for links to more information on make files.
The grade for this project will be broken down as follows. A more detailed breakdown will be provided in the grade form you recieve from the grader.
proj1.C
that contains the function main(). You should also have a
domino.C
and a domino.H
that contain the
functions used by proj1.C
and the prototypes for those functions,
respectively. (Note the uppercase "C" and uppercase "H".) Submit as follows:
You can check to see what files you have submitted by typing
More complete documentation for submit and related commands can be found here.
Remember -- if you make any change to your program, no matter how insignificant it may seem, you should recompile and retest your program before submitting it. Even the smallest typo can cause compiler errors and a reduction in your grade.