-
Notifications
You must be signed in to change notification settings - Fork 1
/
zells-eight.st
208 lines (162 loc) · 5.65 KB
/
zells-eight.st
1
OrderedCollection subclass: #Z2Address instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'zells-eight'!Set subclass: #Z2Mesh instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'zells-eight'!!Z2Mesh methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 15:08'!deepCopy ^ self! !!Z2Mesh methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 14:50'!transmit: aMessage self do: [:n| n receive: aMessage]! !Object subclass: #Z2Message instanceVariableNames: 'receiver sender content' classVariableNames: '' poolDictionaries: '' category: 'zells-eight'!!Z2Message methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 15:40'!asString ^ content! !!Z2Message methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 14:31'!content ^ content! !!Z2Message methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 14:30'!content: any content := any.! !!Z2Message methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 14:31'!receiver ^ receiver! !!Z2Message methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 14:29'!receiver: anAddress receiver := anAddress! !!Z2Message methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 14:31'!sender ^ sender! !!Z2Message methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 14:30'!sender: aNode sender := aNode.! !Morph subclass: #Z2Node instanceVariableNames: 'mesh address' classVariableNames: '' poolDictionaries: '' category: 'zells-eight'!!Z2Node methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 14:42'!address: anAddress address := anAddress! !!Z2Node methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 14:45'!isForMe: aMessage ^ aMessage receiver = address! !!Z2Node methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 14:55'!mesh: aMesh mesh := aMesh.! !!Z2Node methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 14:45'!receive: aMessage (self isForMe: aMessage) ifTrue: [self receiveMessage: aMessage].! !!Z2Node methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 15:08'!receiveMessage: aMessage aMessage content key = #copyTo ifTrue: [ mesh add: (self deepCopy address: aMessage content value)]! !Z2Node subclass: #Z2DisplayPortal instanceVariableNames: 'forms' classVariableNames: '' poolDictionaries: '' category: 'zells-eight'!!Z2DisplayPortal methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 15:52'!drawOn: aCanvas super drawOn: aCanvas. forms do: [:f| f key = #stroke ifTrue: [ aCanvas line: (self transform: (f value at: #from)) to: (self transform: (f value at: #to)) color: Color white]]! !!Z2DisplayPortal methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 15:50'!initialize super initialize. forms := Set new. self color: Color black.! !!Z2DisplayPortal methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 15:49'!receiveMessage: aMessage aMessage content key = #draw ifTrue: [ forms := aMessage content value. self invalidRect: self bounds]! !!Z2DisplayPortal methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 15:53'!transform: aPoint ^ self center + (Point x: aPoint x y: aPoint y negated).! !Z2Node subclass: #Z2StarNode instanceVariableNames: 'sector displays' classVariableNames: '' poolDictionaries: '' category: 'zells-eight'!!Z2StarNode methodsFor: 'as yet unclassified' stamp: 'NM 10/10/2018 09:10'!draw displays do: [:d| self drawTo: d]! !!Z2StarNode methodsFor: 'as yet unclassified' stamp: 'NM 10/10/2018 09:10'!drawTo: d mesh transmit: (Z2Message new receiver: d; content: #draw -> (((90 to: 450 by: sector) collect: [:angle| #stroke -> (Dictionary new at: #from put: (Point r: 100 degrees: angle); at: #to put: (Point r: 30 degrees: sector/2 + angle); yourself)]) , ((90 to: 450 by: sector) collect: [:angle| #stroke -> (Dictionary new at: #from put: (Point r: 30 degrees: sector/2 + angle); at: #to put: (Point r: 100 degrees: sector + angle); yourself)])))! !!Z2StarNode methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 15:32'!initialize super initialize. displays := Set new. self points: 5.! !!Z2StarNode methodsFor: 'as yet unclassified' stamp: 'NM 10/10/2018 09:11'!points: anInteger 360/anInteger = sector ifTrue: [^ nil]. sector := 360/anInteger. self draw.! !!Z2StarNode methodsFor: 'as yet unclassified' stamp: 'NM 10/10/2018 09:11'!receiveMessage: aMessage super receiveMessage: aMessage. aMessage content key = #drawOn ifTrue: [ displays add: aMessage content value. self drawTo: aMessage content value]. aMessage content key = #points ifTrue: [ self points: aMessage content value].! !Z2Node subclass: #Z2StarPortal instanceVariableNames: 'star' classVariableNames: '' poolDictionaries: '' category: 'zells-eight'!!Z2StarPortal methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 16:20'!initialize super initialize. self addMorph: (SimpleSliderMorph new target: self; actionSelector: #value:; minVal: 3; maxVal: 20). self bounds: self submorphs first bounds.! !!Z2StarPortal methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 16:02'!star: anAddress star := anAddress.! !!Z2StarPortal methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 16:19'!value: anInteger mesh ifNotNil: [ mesh transmit: (Z2Message new receiver: star; content: #points -> (anInteger roundTo: 1))]! !Z2Node subclass: #Z2TranscriptNode instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'zells-eight'!!Z2TranscriptNode methodsFor: 'as yet unclassified' stamp: 'NM 10/9/2018 15:46'!receive: aMessage Transcript show: #+++; show: aMessage receiver; show: #+; show: aMessage content; cr.! !