Drawing Swedish flag with Logo

After our last experiment, we drew a Swedish flag with Logo. Major code improvement:

1. Introduction of variable for flag size;
2. Using the direction keyword instead of turnright and turnleft to make it less ambiguous to the code reader.

Here is the final product:

Swedish flag

Here is the code for it.

# Begin logo code

reset
x=400
canvassize 1.6*x,x
canvascolor 65,105,225
penwidth 0.2*x
pencolor 255,255,0
go 0,0.5*x
direction 90
forward 1.6*x
go 0.6*x,0
direction 180
forward x

# End logo code

Chinese flag is next. This will be a bit challenging. We will need to figure out how to draw the stars, and tilt them in the right direction. That should also give us ideas on how to draw the US flag.

2 things are of interest:

1. The code above works for KTurtle 0.6 on Ubuntu 7.1 with KDE 3.5.8, but the same code does not work on Sabayon Professional 1.1, with KTurtle 0.6, KDE 3.5.7;
2. After the Swedish flag, I thought drawing other Nordic flags is just a matter of changing colors. Turns out that is not the case, because there are subtle design and dimension differences, especially for Norwegian and Icelandic flags.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.