Tuesday, July 29, 2014

Art with Pro-Bot: A Train using Nested Loops

Using Pro Bot, trace the following simplified picture of a train. We have an engine up front and 3 coaches following it. The specifications for the engine and the coaches are provided below. All measurements are in centimeters.


Each coach is a square of side 6 cm.
The engine is 10 cm long and 6 cm tall. The funnel is located at 2 cm from the front end of the engine, and is 2 cm wide and 3 cm tall.
The connector between the engine & the first coach, as well as the ones between coaches are 2 cm each. We also have an extra connector on the last coach to account for any additional coaches that may be added in later.






















In this project, we shall:
(1) work with nested loops
(2) revisit the technique to draw squares using Repeat Loops
(3) think about how to customize our code to produce a new train picture with a varying number of coaches each time.



  • Write a program for Pro-Bot to draw the above picture of a train with the engine and 3 coaches. Remember to use Nested loops in your program.
  • Now modify your program so that Pro-Bot draws a similar train with the same engine and 5 coaches. What changes did you make to your program?
  • What change would you make to your program if you want Pro-Bot to draw the above train with 20 coaches?
  • Once you have drawn the picture of the above train using Pro-Bot, you can decorate your picture and give it an interesting background.

I had designed this project as a fun way of introducing Nested Loops to the children. We worked on this project the week of Valentine's Day. So, after drawing the train using Pro-Bot, we had fun customizing the train picture to the theme, with little heart shaped stickers chugging out of the funnel. Each kid drew a picture of himself/herself as the train driver and their family in the train's coaches, with backgrounds of their choice... It was a really fun assignment. Across the various classrooms that I taught, children ranked Nested Loops as the most favorite programming concept that they learned this year.


Here is a set of solutions to the above.


No comments:

Post a Comment