You might remember that long, ugly string of rotations last week. It's messy, but it worked. It also had the distinct advantage of teaching a lesson in multiplication: 24 copies of a rotation of 15 degrees equals 360 degrees... one full circle.
Today, we'll compress those 24 discrete steps into one nice little loop.
But first, review. Pixels, check. Objects, check. Had a little struggle with how many degrees are in a circle... but we got there. Check.
![]() |
a basic "for" loop in Scratch |
Logic, it turns out, is difficult and foreign to the monster. While she understood the basic usefulness of repeating something, when she accidentally created a nested loop (which is easy to do in a drag and drop programming environment), things got funky. It was time to step in and play debugger. I pointed to the steps in the script as they were being executed. Eventually she sorted this out.
![]() |
144 iterations (multiplication) |
![]() |
24 iterations (addition) |
Once she understood (with a little help by the Daddy-debugger) how nested loops really work, she recognized this as a multiplication problem. She went for the more elegant solution of two loops of twelve iterations, but the stacked (additive) solution would have worked as well. This simple visualization of multiplication versus addition is pretty neat.
This is right about the point in the lessons when I run out of ideas. But it seems like the monster picks up speed. I didn't think we'd really get much past basic loops, so we kicked in to conditionals.
Stay tuned for Lesson 3, part 2: conditionals!
No comments:
Post a Comment