BFOIT - Introduction to Computer Programming

Pseudocode - Screencast Script

   Welcome to BFOIT's Introduction to Computer Programming website.

   This is a short screencast overview of the third lesson:


   In the first lesson you learned about the gap between us humans
   and our native languages and a computer and it's native language.

   In these lessons we are learning to program with Logo, a high-
   level programming language; it is about as close as we can get to
   the English language.  But the version of Logo we are using only
   knows approximately one hundred and fifty words - much less than
   you or I know.  And, it has some strange punctuation rules.  In
   this lesson you will see how to use English to get you a step
   closer to the Logo code you write.

   [ position to Summary ]
   Pseudocode uses structural concepts of computer programming along
   with a native language.

   We are going to use pseudocode combined with an age-old method for
   solving math problems - George Polya's steps which he outlines in
   his book How to Solve It.  His steps are:

   1. Understanding the Problem,

   2. Devising a Plan,

   3. Carrying Out the Plan, and

   4. Looking Back.

   [ Bring up the Windows Paint program with an image of TG with a ]
   [ BowTie loaded into the background                             ]

   Let's work through an example. It has to be very simple to keep
   this screencast short.  Let's get the turtle to draw a bowtie.

   To understand the problem, what our Logo program will consist of,
   I'll just sketch an example of a crude, artistic rendition of a
   So, it looks like we need to get the turtle to draw two triangles,
   each a sort-of reflection of the other.
   I think we now understand what our program needs to do.  We've
   completed the the first step of phase.


   Next I'll devise a plan; I'll describe what I'm going to do in
   English, as Logo comments in TG's editor.

   [ show bringing up the editor and type in the first few comments ]

   [ ; BowTie                                                         ]

   [ ; initialize: clear the canvas. make sure the turtle is at home, ]
   [ ;             heading north, with a wide, yellow pen             ]

   [ ; draw the triangle to the right of home, ending back at home    ]


   - show typing in the last line of pseudocode

   [ ; hide the turtle ]


   So now it's time for carrying out the plan.

   I'll convert the pseudocode to Logo instructions.
   [ type in the first line of instructions ]

   [ home clean setheading 0 setpencolor 6 setpensize 10 ]


   One great thing about Logo programming environments is that they
   are highly interactive.  Since I do not know the angles and lengths
   of the legs of the triangle I need, I'll just experiment

   [ right 45 forward 150 home right 15 forward 200 forward 50 ]

   [ right 90 right 30 forward 200 forward 20 home             ]

   Now I can use the results of this experimentation to fill in the
   remaining Logo instructions.


   [ With completed program in the Editor                ]

   I've now completed the translation from pseudocode to Logo. Let's
   see how it looks.

   [ Choose the menu item: Window -> Editor -> Interpret ]

   Looks pretty good to me.


   The Pseudocode lesson will walk you through writing a program that
   draws the "collection of boxes" exercise from the previous lesson.

   Go to it... and remember - HAVE FUN!