'From Squeak3.1alpha of 7 February 2001 [latest update: #4282] on 9 September 2001 at 8:19:56 pm'! "Change Set: StarSqueakFixes Date: 26 August 2001 Author: Helge Horch Fixes a couple of StarSqueakPatch neighbor methods to cascade #x: and #y: setters instead of sending the (unimplemented) #x:y:. Also fix missing return in StarSqueakTurtle>>patchBrightness."! !StarSqueakMorph methodsFor: 'private' stamp: 'hh 8/27/2001 17:56'! firstTurtleAtX: xPos y: yPos | w t x y index | "create turtlesAtPatchCache if necessary" turtlesAtPatchCache ifNil: [ turtlesAtPatchCache _ Array new: (dimensions x * dimensions y) withAll: nil. turtlesAtPatchCacheValid _ false]. w _ dimensions y. turtlesAtPatchCacheValid ifFalse: [ turtlesAtPatchCache atAllPut: nil. "cache not yet computed for this step; make linked list of turtles for each patch" 1 to: turtles size do: [:i | t _ turtles at: i. x _ t x truncated. y _ t y truncated. index _ (w * y) + x + 1. t nextTurtle: (turtlesAtPatchCache at: index). turtlesAtPatchCache at: index put: t]. turtlesAtPatchCacheValid _ true]. x _ xPos truncated. y _ yPos truncated. index _ (w * y) + x + 1. ^ turtlesAtPatchCache at: index ! ! !StarSqueakPatch methodsFor: 'neighborhood' stamp: 'hh 8/26/2001 17:03'! neighborNE "Answer the neightboring patch directly south of (below) this patch." ^ self clone x: ((x + 1) \\ worldWidth); y: ((y - 1) \\ worldHeight) ! ! !StarSqueakPatch methodsFor: 'neighborhood' stamp: 'hh 8/26/2001 17:03'! neighborNW "Answer the neightboring patch directly south of (below) this patch." ^ self clone x: ((x - 1) \\ worldWidth); y: ((y - 1) \\ worldHeight) ! ! !StarSqueakPatch methodsFor: 'neighborhood' stamp: 'hh 8/26/2001 17:03'! neighborSE "Answer the neightboring patch directly south of (below) this patch." ^ self clone x: ((x + 1) \\ worldWidth); y: ((y + 1) \\ worldHeight) ! ! !StarSqueakPatch methodsFor: 'neighborhood' stamp: 'hh 8/26/2001 17:04'! neighborSW "Answer the neightboring patch directly south of (below) this patch." ^ self clone x: ((x - 1) \\ worldWidth); y: ((y + 1) \\ worldHeight) ! ! !StarSqueakTurtle methodsFor: 'initialization' stamp: 'hh 8/27/2001 17:53'! initializeWorld: aStarSqueakWorld who: anInteger | dims | dims _ aStarSqueakWorld dimensions. world _ aStarSqueakWorld. who _ anInteger. x _ world random: dims x - 1. y _ world random: dims y - 1. wrapX _ dims x asFloat. wrapY _ dims y asFloat. headingRadians _ ((self random: 36000) / 100.0) degreesToRadians. color _ Color blue. penDown _ false. nextTurtle _ nil. ! ! !StarSqueakTurtle methodsFor: 'patches' stamp: 'hh 8/26/2001 19:49'! patchBrightness "Answer the brightness of the patch below this turtle, where 0 is black and 100 is full brightness." ^world getPatchBrightnessAtX: x y: y. ! !