-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgrassLivesForever.m
48 lines (41 loc) · 989 Bytes
/
grassLivesForever.m
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
clear all
clear classes
clear all
close all
% for repeatability while testing
rng('default')
%% Set Up the Biology
% Grass
myGrass = plant('Name', 'Grass', ...
'FeedsOn', "", ...
'Colour', [70, 242, 128] / 255);
% Sheep
mySheep = animal('Name', 'Sheep', ...
'FeedsOn', 'Grass', ...
'Colour', [240, 240, 240] / 255, ...
'LineColour', [200, 200, 200] / 255, ...
'ProbReproduce', 0.04, ...
'GainFromFood', 4, ...
'Energy', 1, ...
'Marker', 'o',...
'Coordinate', [0, 0]);
nSheep = 100;
% Dingos
myDingos = animal('Name', 'Dingo', ...
'FeedsOn', 'Sheep', ...
'Colour', [0, 0, 0] / 255, ...
'ProbReproduce', 0.05, ...
'GainFromFood', 20, ...
'Energy', 1, ...
'Marker', 'x',...
'Coordinate', [0, 0]);
nDingos = 50;
%% Set Up The World
mySim = world({myGrass, mySheep, myDingos}, ...
[Inf, nSheep, nDingos], ...
'nSteps', 1000, ...
'printPlots', false);
%% Plot a food web
plotFoodWeb(mySim)
%% Run
run(mySim);