Squeak Life: an artificial life simulation

Brian Keefer squeak-dev at lists.squeakfoundation.org
Fri Sep 20 04:41:09 UTC 2002


This is a multi-part message in MIME format.
--------------9751F2A8FC3C66CCA50D6964
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Here's a quick way to toss up more beasties. Now I'm going to bed.
--------------9751F2A8FC3C66CCA50D6964
Content-Type: text/plain; charset=us-ascii;
 name="beastmenu.1.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="beastmenu.1.cs"

'From Squeak 3.2 of 11 July 2002 [latest update: #4917] on 20 September 2002 at 12:38:31 am'!
Object subclass: #SqueakLife
	instanceVariableNames: 'frame area areaMorph world beastMenu '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'SqueakLife-Morph'!

!Behaviour class methodsFor: 'as yet unclassified' stamp: 'bmk 9/20/2002 00:33'!
addToMenu: aMenu withTarget: aHabitat
self allSubclassesDo:[:subclass|
	aMenu add:subclass name asString 
		target:[aHabitat addBeast: aHabitat center color: Color black behavior: subclass] fixTemps
		action: #value.
]
	! !


!SqueakLife methodsFor: 'callbacks' stamp: 'bmk 9/20/2002 00:36'!
addBeast
	"Add a beast at the center of the area"
	
beastMenu ifNil:[
	beastMenu := MenuMorph new.
	beastMenu addTitle:'which behaviour?'.
	Behaviour addToMenu:beastMenu withTarget:areaMorph
].
beastMenu popUpInWorld.! !


--------------9751F2A8FC3C66CCA50D6964--




More information about the Squeak-dev mailing list