-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFAserver.py
68 lines (63 loc) · 2.05 KB
/
FAserver.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from mesa.visualization.ModularVisualization import ModularServer
from mesa.visualization.modules import CanvasGrid
from FAagents import Tree, Wood, Fungus
from FAmodel import Forest
def agent_portrayal(agent):
if agent is None:
return
if type(agent) is Tree:
if agent.infection == False:
portrayal = {
"Shape":"graphics/tree.png",
"Layer": 0,
"scale": 5,
}
if agent.infection == True:
portrayal = {
"Shape":"graphics/tree_infected.png",
"Layer": 0,
"scale": 5,
}
return portrayal
elif type(agent) is Fungus:
if agent.endocomp == False:
portrayal = {
"Shape":"graphics/redmush_off.png",
"Color": "Blue",
"Layer": 2,
"scale": 4
}
return portrayal
else:
portrayal = {
"Shape":"graphics/bluemush_off.png",
"Color": "Blue",
"Layer": 2,
"scale": 4
}
return portrayal
else:
portrayal = {
"Shape":"graphics/log.png",
"Layer": 1,
"scale" : 4,
}
return portrayal
canvas_element = CanvasGrid(agent_portrayal, 100,100,500,500)
server = ModularServer(Forest, [canvas_element], "TreesFungiWood",
{"endophytism": True,
"ws": 30,
"endodisp": 2,
"decompdisp": 10,
"leafdisp": 1,
"leaffall": 4,
"numdecomp": 1,
"numendo": 1,
"endoloss": 0.05,
"newwood": 15,
"woodfreq": 1,
"width": 100,
"kappa": 0.03,
"sigma": 3.0,
"mu": 2.2, }
)