• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cormas / ecec-model / 6025680551

30 Aug 2023 01:40PM UTC coverage: 3.881% (-0.4%) from 4.276%
6025680551

push

github

olekscode
Improved the ECEC model

31 of 31 new or added lines in 1 file covered. (100.0%)

13 of 335 relevant lines covered (3.88%)

0.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/ECEC-Model/ECECModel.class.st
1
Class {
2
        #name : #ECECModel,
3
        #superclass : #CMAbstractModel,
4
        #instVars : [
5
                'theRestrainedForagers',
6
                'theUnrestrainedForagers',
7
                'theVegetationUnits'
8
        ],
9
        #category : #'ECEC-Model'
10
}
11

12
{ #category : #'- probes' }
13
ECECModel class >> colorOfProbe_numberOfRestrainedForagers [
×
14
  ^ (Color r: 0.05278592375366569 g: 0.0 b: 1.0 alpha: 1.0)
×
15
]
×
16

17
{ #category : #'- probes' }
18
ECECModel class >> colorOfProbe_numberOfUnrestrainedForagers [
×
19
  ^ (Color r: 1.0 g: 0.0 b: 0.0019550342130987292 alpha: 1.0)
×
20
]
×
21

22
{ #category : #'- probes' }
23
ECECModel class >> colorOfProbe_totalAmountOfBiomass [
×
24
  ^ (Color r: 0.21700879765395895 g: 1.0 b: 0.0 alpha: 1.0)
×
25
]
×
26

27
{ #category : #'simulation settings' }
28
ECECModel class >> defaultInit [
×
29

×
30
        ^ #homogeneousEnvironment
×
31
]
×
32

33
{ #category : #accessing }
34
ECECModel class >> initialNumberOfRestrainedForagers [
×
35

×
36
        ^ 10
×
37
]
×
38

39
{ #category : #accessing }
40
ECECModel class >> initialNumberOfUnrestrainedForagers [
×
41

×
42
        ^ 10
×
43
]
×
44

45
{ #category : #init }
46
ECECModel >> homogeneousEnvironment [
×
47

×
48
        self
×
49
                createGridLines: 27
×
50
                columns: 27
×
51
                neighbourhood: 8
×
52
                closed: false.
×
53
                
×
54
        self theVegetationUnits do: [ :each | each initializeWithRandomBiomass ].
×
55
        
×
56
        self
×
57
                initializeAgents;
×
58
                displayPov: #povBiomass of: ECECVegetationUnit;
×
59
                displayPov: #defaultPOV of: ECECForager
×
60
]
×
61

62
{ #category : #initialization }
63
ECECModel >> initialize [
×
64

×
65
        super initialize.
×
66
        
×
67
        theRestrainedForagers := OrderedCollection new.
×
68
        theUnrestrainedForagers := OrderedCollection new.
×
69
        theVegetationUnits := OrderedCollection new.
×
70
]
×
71

72
{ #category : #'init entities' }
73
ECECModel >> initializeAgents [
×
74

×
75
        self
×
76
                createN: self class initialNumberOfRestrainedForagers
×
77
                randomlyLocatedAloneEntities: ECECRestrainedForager.
×
78
                
×
79
        self
×
80
                createN: self class initialNumberOfUnrestrainedForagers
×
81
                randomlyLocatedAloneEntities: ECECUnrestrainedForager.
×
82
]
×
83

84
{ #category : #init }
85
ECECModel >> islandEnvironment [
×
86

×
87
        | x y |
×
88
        self homogeneousEnvironment.
×
89
        
×
90
        self theCells do: [ :cell |
×
91
                x := cell coordinates x.
×
92
                y := cell coordinates y.
×
93
                
×
94
                (x % 6 <= 2 and: [ y % 6 <= 2 ]) ifFalse: [ cell biomass: 0 ] ].
×
95
]
×
96

97
{ #category : #probes }
98
ECECModel >> numberOfRestrainedForagers [
×
99

×
100
        <probe>
×
101
        ^ self theRestrainedForagers size
×
102
]
×
103

104
{ #category : #probes }
105
ECECModel >> numberOfUnrestrainedForagers [
×
106

×
107
        <probe>
×
108
        ^ self theUnrestrainedForagers size
×
109
]
×
110

111
{ #category : #init }
112
ECECModel >> remoteIslandEnvironment [
×
113

×
114
        | x y |
×
115
        self homogeneousEnvironment.
×
116
        
×
117
        self theCells do: [ :cell |
×
118
                x := cell coordinates x.
×
119
                y := cell coordinates y.
×
120
                
×
121
                (x % 12 <= 3 and: [ y % 12 <= 3 ]) ifFalse: [ cell biomass: 0 ] ].
×
122
]
×
123

124
{ #category : #control }
125
ECECModel >> step: anObject [
×
126

×
127
        self
×
128
                stepEntities: self theVegetationUnits;
×
129
                askRandom: ECECForager toDo: #step
×
130
]
×
131

132
{ #category : #accessing }
133
ECECModel >> theRestrainedForagers [
×
134

×
135
        ^ theRestrainedForagers
×
136
]
×
137

138
{ #category : #accessing }
139
ECECModel >> theRestrainedForagers: anObject [
×
140

×
141
        theRestrainedForagers := anObject
×
142
]
×
143

144
{ #category : #accessing }
145
ECECModel >> theUnrestrainedForagers [
×
146

×
147
        ^ theUnrestrainedForagers
×
148
]
×
149

150
{ #category : #accessing }
151
ECECModel >> theUnrestrainedForagers: anObject [
×
152

×
153
        theUnrestrainedForagers := anObject
×
154
]
×
155

156
{ #category : #accessing }
157
ECECModel >> theVegetationUnits [
×
158

×
159
        ^ theVegetationUnits
×
160
]
×
161

162
{ #category : #accessing }
163
ECECModel >> theVegetationUnits: anObject [
×
164

×
165
        theVegetationUnits := anObject
×
166
]
×
167

168
{ #category : #probes }
169
ECECModel >> totalAmountOfBiomass [
×
170

×
171
        <probe>
×
172
        ^ self theVegetationUnits sum: [ :each | each biomass ]
×
173
]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc