Friday, April 24, 2009

This Week's Blogger - Stanley!






I am blogging about logo. Logo is a programming language. We made regular polygons. They were triangles, squares, and pentagons. We learned turtle graphics, variables, procedures, control structures, and input respectively.

Variables – Week 2

Dashed Circle

repeat 18 [ pd repeat 10 [ fd 1 rt 1 ] pu repeat 10 [ fd 1 rt 1 ] ]

Spiral

repeat 1000 [make c: 1 fd c rt c make c: c+1]

Procedures – Week 3

Polygon

?to poly :n
>repeat :n [fd 100 rt 360/:n]
>end
? poly 4

edit “poly

Control Structures – Week 4

Fancy Polygon

to polyalt :n

repeat [fd 100 rt 360/:n]
ifelse (a = 1) [ make “a 2] [make :a 1]
setpensize 5 * :a
fd 100
rt 360 / :n
]
end

to polyalt2 :n
local ”i
make “i 1
while [:i <= :n] [
ifelse ((remainder :i 2) = 0) [ setpensize 5 ] [ setpensize 10 ]
fd 100
rt 360 / :n
make “i :i + 1
]
end

Input – Week 5

Exercise #1

to polyask
local “n
make “n 0
while [:n < 3] [
type “ | Please enter the number of lines for the polygon: |
make “n redrawline
]
poly :n
end

Exercise #2

to draw
while [“true] [
lt (heading – (towards mousepos))
ifelse (buttonp) [penup] [pendown]
fd 1
]
end

3 comments:

Emilie Lin said...

Gee, Stanely, I get dizzy just by looking at all the codes you wrote. Peter said he really likes Logo, too. Thanks to your father's inspirational teaching!

Ms. Emilie (Peter's Mom)

Joanna said...

Stanley, I'm so glad you enjoyed Logo. Isn't it fun to see math in action? I hope there will be lots more opportunities to do programming.

Joanna

Unknown said...

Wow, Stanley. It sounds like you learned a lot of really cool things in your EB. Thank you for sharing your experience with us.

Mrs. Dergis