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

cormas / ecec-model / 6039536390

31 Aug 2023 03:44PM UTC coverage: 3.641% (-0.2%) from 3.881%
6039536390

push

github

olekscode
Added a small environment

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

13 of 357 relevant lines covered (3.64%)

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

×
159
        ^ theRestrainedForagers
×
160
]
×
161

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

×
165
        theRestrainedForagers := anObject
×
166
]
×
167

168
{ #category : #accessing }
169
ECECModel >> theUnrestrainedForagers [
×
170

×
171
        ^ theUnrestrainedForagers
×
172
]
×
173

174
{ #category : #accessing }
175
ECECModel >> theUnrestrainedForagers: anObject [
×
176

×
177
        theUnrestrainedForagers := anObject
×
178
]
×
179

180
{ #category : #accessing }
181
ECECModel >> theVegetationUnits [
×
182

×
183
        ^ theVegetationUnits
×
184
]
×
185

186
{ #category : #accessing }
187
ECECModel >> theVegetationUnits: anObject [
×
188

×
189
        theVegetationUnits := anObject
×
190
]
×
191

192
{ #category : #probes }
193
ECECModel >> totalAmountOfBiomass [
×
194

×
195
        <probe>
×
196
        ^ self theVegetationUnits sum: [ :each | each biomass ]
×
197
]
×
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