box: aRectangle "Draw a morph to represent the rectangle" | rm | rm := RectangleMorph new. rm bounds: aRectangle. rm color: Color transparent. rm setBorderWidth: 2 borderColor: Color blue. rm openInWorld.
makeBox "Create a box 200 pixels on a side around the current position of the Bot" | pica rectangle | pica := Bot new. rectangle := Rectangle center: pica center extent: 200@200. pica box: rectangle.
follow: n borderOfBox: aRectangle self box: aRectangle. n timesRepeat: [ (aRectangle containsPoint: (self positionIfGo: 30)) ifTrue: [ self go: 30. self turnLeft: 30 atRandom ] ifFalse: [ self turnLeft: 1 ] ]
| pica rectangle | pica := Bot new. rectangle := Rectangle center: pica center extent: 200@200. pica follow: 1000 borderOfBox: rectangle.
boxAndExit | box room room2 exit | box := Rectangle center: World center extent: 200@200. room := RectangleMorph new. room bounds: box. room color: Color transparent. room setBorderWidth: 2 borderColor: Color blue. room openInWorld. exit := Rectangle origin: (box topRight + (-2@25)) extent: 100@50. room2 := RectangleMorph new. room2 bounds: exit. room2 color: Color transparent. room2 setBorderWidth: 2 borderColor: Color black. room2 openInWorld.
follow: n borderOfBox: aRectangle turnAngle: angle1 escapeAngle: angle2 n timesRepeat: [ (aRectangle containsPoint: (self positionIfGo: 30)) ifTrue: [ self go: 30. self turnLeft: angle1 atRandom ] ifFalse: [ self turnLeft: angle2 atRandom ] ]
go | rect | rect := Rectangle center: World center extent: 200@200. self follow: 1000 borderOfBox: rect turnAngle: 90 escapeAngle: 360.