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

Fall2002 Midterm Review: Write Smalltalk Code

1 pen 1

pen := Pen new.
pen up.
pen goto: 50@50.
pen north. pen turn: 90.
2 timesRepeat: [ pen go: 100. pen turn: 90. pen go: 50. ].
pen up.
pen goto: 30@30.
pen north. pen turn: 90.
2 timesRepeat: [ pen go: 80. pen turn: 90. pen go: 40. ].
pen up.
'CS2340' displayAt: 75@60.


Um you forgot pen down and a few turns.
Try this.

pen := Pen new.
pen up.
pen goto: 50@50.
pen north.
pen down.
2 timesRepeat: [pen turn: 90. pen go: 100. pen turn: 90. pen go: 60. ].
pen up.
pen goto: 60@60.
pen north.
pen down.
2 timesRepeat: [pen turn: 90. pen go: 80. pen turn: 90. pen go: 40. ].
pen up.
'CS2340' displayAt: 75@70.


Link to this Page