-
Notifications
You must be signed in to change notification settings - Fork 0
/
simulation_visual.py
61 lines (54 loc) · 2.02 KB
/
simulation_visual.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
"""
Check Migration
Test migration
"""
__author__ = "Tonje Martine Lorgen Kirkholt", "Sougata Bhattacharya"
__email__ = "[email protected]", "[email protected]"
import textwrap
from biosim.simulation import BioSim
if __name__ == '__main__':
geogr = """\
WWWWWWWWWWWWWWWWWWWWW
WHHHHHLLLLWWLLLLLLLWW
WHHHHHLLLLWWLLLLLLLWW
WHHHHHLLLLWWLLLLLLLWW
WWHHLLLLLLLWWLLLLLLLW
WWHHLLLLLLLWWLLLLLLLW
WWWWWWWWHWWWWLLLLLLLW
WHHHHHLLLLWWLLLLLLLWW
WHHHHHHHHHWWLLLLLLWWW
WHHHHHDDDDDLLLLLLLWWW
WHHHHHDDDDDLLLLLLLWWW
WHHHHHDDDDDLLLLLLLWWW
WHHHHHDDDDDWWLLLLLWWW
WHHHHDDDDDDLLLLWWWWWW
WWHHHHDDDDDDLWWWWWWWW
WWHHHHDDDDDLLLWWWWWWW
WHHHHHDDDDDLLLLLLLWWW
WHHHHDDDDDDLLLLWWWWWW
WWHHHHDDDDDLLLWWWWWWW
WWWHHHHLLLLLLLWWWWWWW
WWWHHHHHHWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWW"""
geogr = textwrap.dedent(geogr)
ini_herbs = [{'loc': (2, 7),
'pop': [{'species': 'Herbivore',
'age': 5,
'weight': 20}
for _ in range(200)]}]
ini_carns = [{'loc': (2, 7),
'pop': [{'species': 'Carnivore',
'age': 5,
'weight': 20}
for _ in range(50)]}]
sim = BioSim(geogr, ini_herbs + ini_carns, seed=1,
hist_specs={'fitness': {'max': 1.0, 'delta': 0.05},
'age': {'max': 60.0, 'delta': 2},
'weight': {'max': 60, 'delta': 2}},
cmax_animals={'Herbivore': 150, 'Carnivore': 150},
img_dir='results',
img_base='sample',
img_years=1,
vis_years=1)
sim.simulate(401)
sim.make_movie()