[squeak-dev] The Trunk: EToys-jl.240.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Sep 20 16:21:13 UTC 2016
Jens Lincke uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-jl.240.mcz
==================== Summary ====================
Name: EToys-jl.240
Author: jl
Time: 20 September 2016, 6:20:07.114902 pm
UUID: 794a0157-9eed-c94b-a895-bdcb32650c0d
Ancestors: EToys-jl.239
something went wrong
=============== Diff against EToys-jl.238 ===============
Item was changed:
----- Method: KedamaTurtleVectorPlayer2 class>>primGetAngleToX:toY:xArray:yArray:resultInto: (in category 'as yet unclassified') -----
primGetAngleToX: pX toY: pY xArray: xArray yArray: yArray resultInto: result
+ | ppx ppy x y ret currentDist minDist nearestNeighbour |
- | ppx ppy x y ret |
<primitive: 'vectorGetAngleTo' module:'KedamaPlugin2'>
"^ KedamaPlugin doPrimitive: #vectorGetAngleTo."
ppx := pX.
ppy := pY.
1 to: result size do: [:index |
pX isCollection ifTrue: [
+ minDist := SmallInteger maxVal.
+ 1 to: pX size do: [:index2 |
+ ppx := pX at: index2.
+ ppy := pY at: index2.
+ currentDist := ((ppx - (xArray at: index)) squared + (ppy - (yArray at: index)) squared) sqrt.
+ currentDist < minDist ifTrue: [
+ minDist := currentDist.
+ nearestNeighbour := index2]].
+ ppx := pX at: nearestNeighbour.
+ ppy := pY at: nearestNeighbour.
- ppx := pX at: index.
- ppy := pY at: index.
].
x := ppx - (xArray at: index).
y := ppy - (yArray at: index).
ret := (x at y) theta radiansToDegrees + 90.0.
ret > 360.0 ifTrue: [ret := ret - 360.0].
result at: index put: ret.
].
^ result.
!
Item was changed:
----- Method: KedamaTurtleVectorPlayer2>>getAngleTo: (in category 'player commands') -----
getAngleTo: players
| p xArray yArray result pX pY xy |
players isCollection ifFalse: [
p := players
].
xArray := arrays at: 2.
yArray := arrays at: 3.
result := KedamaFloatArray new: self size.
players isCollection ifTrue: [
pX := KedamaFloatArray new: players size.
pY := KedamaFloatArray new: players size.
1 to: players size do: [:i |
xy := (players at: i) getXAndY.
pX at: i put: xy x.
pY at: i put: xy y.
].
] ifFalse: [
+ pX := p turtles getX.
+ pY := p turtles getY.
- xy := p getXAndY.
- pX := xy x.
- pY := xy y.
].
^ KedamaTurtleVectorPlayer2 primGetAngleToX: pX toY: pY xArray: xArray yArray: yArray resultInto: result.
!
Item was changed:
----- Method: MessageAsTempNode>>determineStatementType:fromDict:primaryBreedPair:messageType:isStatement:receiverObject: (in category '*Etoys-Tweak-Kedama-Generated') -----
determineStatementType: t1 fromDict: t2 primaryBreedPair: t3 messageType: t4 isStatement: t5 receiverObject: t6
| t7 t8 t9 t10 t11 t13 |
t5
ifFalse: [^ t1].
t9 := t2 at: self.
(t9
select: [:t14 | t14 first notNil
and: [t14 first isPrototypeTurtlePlayer]]) size = 0
ifTrue: [^ #none].
t4 = #sequential
ifTrue: [^ #sequential].
t1 = #sequential
ifTrue: [^ #sequential].
t3
ifNil: [^ #none].
t7 := t3 first.
t4 = #condition
ifTrue: [t11 := IdentitySet new.
t13 := IdentitySet new.
t9
do: [:t14 |
(((t14 at: 5)
= #testBody
or: [(t14 at: 5)
= #testCond])
and: [(t14 at: 4)
~= #read])
ifTrue: [t14 first
ifNotNil: [t13 add: t14 first]].
(((t14 at: 5)
= #testBody
or: [(t14 at: 5)
= #testCond])
and: [(t14 at: 4)
= #read])
ifTrue: [t14 first
ifNotNil: [t11 add: t14 first]]].
((t13 intersection: t11)
copyWithout: t7)
ifNotEmpty: [^ #sequential].
^ #parallel].
t11 := IdentitySet new.
t13 := IdentitySet new.
t8 := OrderedCollection new.
t10 := OrderedCollection new.
t9
do: [:t14 |
t14 first = t7
ifTrue: [((t7 isBreedSelector: t14 second)
or: [t7 isUserDefinedSelector: t14 second])
ifFalse: [t8 add: t14 second]].
t14 first
ifNil: [t10 add: t14 second]
ifNotNil: [(t14 at: 4)
== #read
ifTrue: [t11 add: t14 first].
(t14 at: 4)
== #read
ifFalse: [t13 add: t14 first]].
(t7 containsSequentialSelector: t14 second)
ifTrue: [^ #sequential]].
(t8 includes: #die)
ifTrue: [^ #die].
(((self isKindOf: AssignmentNode)
and: [t6 = t7])
and: [t7 isBreedSelector: self property property])
ifTrue: [^ #none].
(t7 areOkaySelectors: t10)
ifFalse: [^ #sequential].
(t7 vectorizableTheseSelectors: t8)
ifFalse: [^ #sequential].
((t11 intersection: t13)
copyWithout: t7)
ifNotEmpty: [^ #sequential].
self
+ nodesDo: [:t14 | (t14 isMessageNode
+ and: [t7 containsSequentialSelector: t14 selector])
- nodesDo: [:t14 | (t14 isLeaf
- and: [t7 containsSequentialSelector: t14 key])
ifTrue: [^ #sequential]].
^ #parallel!
Item was changed:
----- Method: MessageNode>>determineStatementType:fromDict:primaryBreedPair:messageType:isStatement:receiverObject: (in category '*Etoys-Tweak-Kedama-Generated') -----
determineStatementType: t1 fromDict: t2 primaryBreedPair: t3 messageType: t4 isStatement: t5 receiverObject: t6
| t7 t8 t9 t10 t11 t13 |
t5
ifFalse: [^ t1].
t9 := t2 at: self.
(t9
select: [:t14 | t14 first notNil
and: [t14 first isPrototypeTurtlePlayer]]) size = 0
ifTrue: [^ #none].
t4 = #sequential
ifTrue: [^ #sequential].
t1 = #sequential
ifTrue: [^ #sequential].
t3
ifNil: [^ #none].
t7 := t3 first.
t4 = #condition
ifTrue: [t11 := IdentitySet new.
t13 := IdentitySet new.
t9
do: [:t14 |
(((t14 at: 5)
= #testBody
or: [(t14 at: 5)
= #testCond])
and: [(t14 at: 4)
~= #read])
ifTrue: [t14 first
ifNotNil: [t13 add: t14 first]].
(((t14 at: 5)
= #testBody
or: [(t14 at: 5)
= #testCond])
and: [(t14 at: 4)
= #read])
ifTrue: [t14 first
ifNotNil: [t11 add: t14 first]]].
((t13 intersection: t11)
copyWithout: t7)
ifNotEmpty: [^ #sequential].
^ #parallel].
t11 := IdentitySet new.
t13 := IdentitySet new.
t8 := OrderedCollection new.
t10 := OrderedCollection new.
t9
do: [:t14 |
t14 first = t7
ifTrue: [((t7 isBreedSelector: t14 second)
or: [t7 isUserDefinedSelector: t14 second])
ifFalse: [t8 add: t14 second]].
t14 first
ifNil: [t10 add: t14 second]
ifNotNil: [(t14 at: 4)
== #read
ifTrue: [t11 add: t14 first].
(t14 at: 4)
== #read
ifFalse: [t13 add: t14 first]].
(t7 containsSequentialSelector: t14 second)
ifTrue: [^ #sequential]].
(t8 includes: #die)
ifTrue: [^ #die].
(((self isKindOf: AssignmentNode)
and: [t6 = t7])
and: [t7 isBreedSelector: self property property])
ifTrue: [^ #none].
(t7 areOkaySelectors: t10)
ifFalse: [^ #sequential].
(t7 vectorizableTheseSelectors: t8)
ifFalse: [^ #sequential].
((t11 intersection: t13)
copyWithout: t7)
ifNotEmpty: [^ #sequential].
self
+ nodesDo: [:t14 | (t14 isMessageNode
+ and: [t7 containsSequentialSelector: t14 selector])
- nodesDo: [:t14 | (t14 isLeaf
- and: [t7 containsSequentialSelector: t14 key])
ifTrue: [^ #sequential]].
^ #parallel!
More information about the Squeak-dev
mailing list
|