YCP Logo Assignment 2: Mountains

Due: Monday, September 29th by 11:59 PM

Your Task

Using text characters, draw a picture of three mountains: one mountain in the foreground, and two mountains in the background on either side. Each background mountain should be half the height of the foreground mountain. The point where the side of a background mountain intersects with the side of the foreground mountain should occur precisely one-quarter of the way up the side of the foreground mountain. The program should prompt the user for how tall the foreground mountain should be; you may assume that the number entered will be an even multiple of 4.

Note: this assignment is considerably more challenging than the first assignment. Don't wait until the last minute to start it!

Here is one example run of the program, showing small mountains:

figures/assign2-screenshot1.png

Here is another example run of the program, showing larger mountains:

figures/assign2-screenshot2.png

One final example run, showing still-larger mountains:

figures/assign2-screenshot3.png

Getting Started

Download CS200_Assign2.zip. Import the contents of the zip file using Marmoset. You will modify the code in the file Mountains.cpp.

Hints

If you want to print a single backslash ("\") character, use a printf statement that looks like this:

printf("\\");

Start out with the code to print the top half of the picture (just the top of the foreground mountain). Then, work on the lower half of the picture, where the left-hand-side background mountain starts to become visible.

The left-hand and right-hand background mountains are mirror images of each other, so if you can do the left side, the right side should be fairly easy.

Try to make a little bit of progress at a time, and save your work often.

Grading

Grading is out of 100 points.

  • A submission which correctly displays the top half of the picture is worth 60/100
  • A submission which correctly displays the top 3/4 of the picture is worth 80/100
  • A submission which correctly displays the entire picture is worth 90/100

The following features may be completed for extra credit:

  • If the height entered by the user is not an exact multiple of 4, refuse to display the picture, and display an error message: up to +5 points
  • Draw clouds which scale with the size of the picture: up to +5 points
  • Draw the picture using colors (you will need to investigate the Win32 console API functions): up to +5 points

Submitting

Submit your solution using the Tools->Submit option (or manually using the procedure described in the Using Marmoset handout).