Draw a tower of a castle.

★★☆

A tower of a castle has a battlement. The battlement has a number of merlons, the solid upright low wall sections. The space between the merlons is called a crenel. A series of merlons and crenels is called a crenellation. Merlons were used in medieval fortifications to protect the defenders from enemy fire and to allow them to launch projectiles from behind the cover.

Castle

Make

Write a program to draw a single tower with a variable number of merlons.

Success Criteria

Remember to add a comment before a subprogram, condition or iteration to explain its purpose.

Complete the subprogram called draw_tower that:

  1. Draws a tower using the parameter merlons to determine the number of merlons that should be drawn.
    • The number of crenels is always one less than the number of merlons.
    • The width of a crenel is 20 pixels.

Complete the subprogram called draw_merlon that:

  1. Draws one merlon and can be used repeatedly by the draw_tower subprogram.
    • The height and width of a merlon is 20 pixels.

Typical inputs and outputs from the program would be:

draw_tower(4)

4 merlon tower