Thanks to Andy Roberts for his comment a couple of weeks ago on my post Logo Routines: Building Polygons, where he said,
"To differentiate for the top stream it should be possible to teach the concept of parameter substitution so the challenge would be to write a procedure called Polygon which draws one of any number of sides depending on the number passed across. Most class teachers will stop before getting to this stage, which is a shame because for those who 'get it' a whole new world of constructionism opens up.
I have to admit to being one of those class teachers who never got to this stage, so having had a browse around and a bit of a play, here is my first LOGO procedure using parameter substitution routine, is that the right term Andy?!* It is for drawing a polygon of x number of sides as suggested:
To polygon :SIDES
REPEAT :SIDES [FD 100 RT 360/:SIDES]
END
So if I now if I want to draw a hexagon, I can input
polygon 6
The procedure, substitutes sides with the number six, and calculates the turn size, by dividing 360, by the number of sides I want the shape to have.
If I now input
repeat 6 [polygon 6 rt 60]
I can create a pattern like this..
I guess my next adventure will be to create a "pattern" procedure or write a program that will allow me to substitute not only the :side parameter in the polygon procedure, but also to include a series of turns to output my pattern drawing on the polygon procedure. Mmmm! Looks like I am all set for a bit of a personal engagement to expand my LOGO programming. Will have a crack at this while preparing my unit of work with the Probot for my students. Maybe you can teach an old dog new tricks!!!
17.2.08
Expanding my Horizons With LOGO
Posted by
Two Whizzy
at
11:40 AM
Labels: control, cpd, learning_about_ICT, LOGO, Mathematics
Subscribe to:
Post Comments (Atom)




2 comments:
Neat. You've generated a complex optical illusion with just a few characters of code.
Another stage might be to improve on the fixed length of a side.
"polygon 360" should really produce an approximate circle, of similar size to the square "polygon 4" or would it be better to have a second parameter to specify side length?
Simon, great work on this, you gave me a little inspiration to mimic this using Scratch, details here: http://themasterplan.edublogs.org/archives/29
Regards,
Dan
Post a Comment