Fun with Flags – Part 3: flag mania

Step 3 – Picking the pen up

Flag of JapanThe flag of Japan is one you might know.

The problem with this flag is that the white background means we need to put a black outline around the flag. And then we need to move the turtle into the middle without leaving a mark on the white background.

You can do this by switching colours really carefully, but there's an easier way.

  1. Use this code to draw the basic flag:
    color()"black")
    forward(300)
    right(90)
    forward(200)
    right(90)
    forward(300)
    right(90)
    forward(200)

    Note that because you want the full outline you need to do all four sides

    IMPORTANT: you don't want to fill this!

  2. Now add the new command:
    penup()

    This picks the pen up so that it doesn't make a mark when you move it

  3. Now use this code to get the turtle into position to draw the circle:
    right(180)
    forward(160)
    left(90)
    forward(150)
  4. And put the pen back down again:
    pendown()

    This makes it possible to draw again

  5. Now draw a red circle with a radius of 30% of the height of the flag

    This time you do want to fill the circle in

The penup() and pendown() commands can be really helpful when you don't want to make a mark. Imagine, for example, that you were drawing a house. Picking the pen up would be so much easier.

Technically the red circle should be ever so slightly to the left of centre – the guidance says it should be 49/100ths of the way across the flag. Remember that the flags of Bangladesh and Palau also had the circle a little way to the left as well?
The reason for this is that if the circle is a bit closer to the flag pole side (the left) it looks like it's in the centre when you fly the flag. Whereas if it's actually in the centre it looks like it's too far away from the pole.
This is all to do with light and physics.