-
Notifications
You must be signed in to change notification settings - Fork 5
/
oActions.py
45 lines (29 loc) · 1.07 KB
/
oActions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from Tools import *
from Agent import *
def do1b(address):
pass
def do2a(address, cycle):
self = address # if necessary
# ask each agent, without parameters
print("Time = ", cycle, "ask all agents to report position")
askEachAgentInCollection(
address.modelSwarm.getAgentList(),
Agent.reportPosition)
def do2b(address, cycle):
self = address # if necessary
# ask a single agent, without parameters
print("Time = ", cycle, "ask first agent to report position")
if address.modelSwarm.getAgentList() != []:
askAgent(address.modelSwarm.getAgentList()[0],
Agent.reportPosition)
def otherSubSteps(subStep, address):
return False
# an example of special action code, to be activated if the time
# (cycle) is equal to ...
# to pass variables to the function, simply use the common area
def makeSpecialAction():
if common.cycle == 1:
print("doing a special action at time =", common.cycle)
if common.cycle == 2:
print("doing a special action at time =", common.cycle)
# etc.