View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Sp2002 Midterm Review: More Drawing in Smalltalk

Back to Spring 2002 Midterm Review


1. pen := Pen new.
pen up.
pen goto: 50@50.
pen north.
pen down.
3 timesRepeat:[pen turn:120. pen go:10.].


base := Box new.
middle := Box new.
top:= Box new.
base moveTo: 100@150.
middle grow:-10.
middle moveTo: 105@100.
top grow: -20.
top move: 60@10.

Rotates joe 360.

Randy Rockinson

Can you explain those coordinates for number 2?

Brett Sturgis

Yeah, the set for top don't make sense. I just tried it for that one. Dont know why they are like that really.

f := (Form extent: 200@200).
f fillWhite.
f display.
p := Pen new.
p color: (Color black).
p up.
p goto: 25@25.
p down.
p goto: 175@25.
p goto: 175@100.
p goto: 25@100.
p goto: 25@25.
p up.
p goto: 35@35.
p down.
p goto: 150@35.
p goto: 150@90.
p goto: 35@90.
p goto: 35@35.
'CS2340' displayAt: 40@40.

Box clearWorld.
b := Box new.
b moveTo: 100@100.
b2 := Box new.
b2 moveTo: 125@150.
b3 := Box new.
b3 moveTo: 75@150.

3. It does rotate Joe 360 degrees, but it rotates joe about his lower right corner. If you run the code without clearing the world, you can see the pattern left when joe is painted white or deleted.

Links to this Page