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

cormas / ecec-model / 6228277729

18 Sep 2023 09:35PM UTC coverage: 3.611% (-0.03%) from 3.641%
6228277729

push

github

olekscode
Added getter pragmas

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

13 of 360 relevant lines covered (3.61%)

0.11 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 : #init }
125
ECECModel >> smallEnvironment [
×
126

×
127
        self
×
128
                createGridLines: 4
×
129
                columns: 4
×
130
                neighbourhood: 8
×
131
                closed: false.
×
132
                
×
133
        self theVegetationUnits do: [ :each | each initializeWithRandomBiomass ].
×
134
        
×
135
        self
×
136
                createN: 1
×
137
                randomlyLocatedAloneEntities: ECECRestrainedForager.
×
138
                
×
139
        self
×
140
                createN: 1
×
141
                randomlyLocatedAloneEntities: ECECUnrestrainedForager.
×
142
        
×
143
        self
×
144
                displayPov: #povBiomass of: ECECVegetationUnit;
×
145
                displayPov: #defaultPOV of: ECECForager
×
146
]
×
147

148
{ #category : #control }
149
ECECModel >> step: anObject [
×
150

×
151
        self
×
152
                stepEntities: self theVegetationUnits;
×
153
                askRandom: ECECForager toDo: #step
×
154
]
×
155

156
{ #category : #accessing }
157
ECECModel >> theRestrainedForagers [
×
158
        <getterFor: #ECECRestrainedForager>
×
159

×
160
        ^ theRestrainedForagers
×
161
]
×
162

163
{ #category : #accessing }
164
ECECModel >> theRestrainedForagers: anObject [
×
165

×
166
        theRestrainedForagers := anObject
×
167
]
×
168

169
{ #category : #accessing }
170
ECECModel >> theUnrestrainedForagers [
×
171
        <getterFor: #ECECUnrestrainedForager>
×
172

×
173
        ^ theUnrestrainedForagers
×
174
]
×
175

176
{ #category : #accessing }
177
ECECModel >> theUnrestrainedForagers: anObject [
×
178

×
179
        theUnrestrainedForagers := anObject
×
180
]
×
181

182
{ #category : #accessing }
183
ECECModel >> theVegetationUnits [
×
184
        <getterFor: #ECECVegetationUnit>
×
185

×
186
        ^ theVegetationUnits
×
187
]
×
188

189
{ #category : #accessing }
190
ECECModel >> theVegetationUnits: anObject [
×
191

×
192
        theVegetationUnits := anObject
×
193
]
×
194

195
{ #category : #probes }
196
ECECModel >> totalAmountOfBiomass [
×
197

×
198
        <probe>
×
199
        ^ self theVegetationUnits sum: [ :each | each biomass ]
×
200
]
×
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

© 2025 Coveralls, Inc