-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopulation.hh
64 lines (55 loc) · 1.33 KB
/
population.hh
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
#ifndef POPULATION_HH
#define POPULATION_HH
#include <vector>
#include "resource.hh"
#include "prey.hh"
#include "json.hpp"
/* For convenience. */
using json = nlohmann::json;
enum class Species {
GRASS, // 0
BUTTERCUP,
RED_CLOVER,
HONEYBEE,
BISON,
WOLF,
GRASSHOPPER,
SPIDER,
BIG_BLUESTEM,
INDIAN_GRASS,
SWITCH_GRASS, // 10
LITTLE_BLUESTEM,
PRAIRIE_CORDGRASS,
GAMA_GRASS, // Has declined in range because of habitat destruction
PRAIRIE_DROPSEED, // Possibly leave out
WILD_RYE, // Possibly leave out
COMPASS_PLANT,
PRAIRIE_DOCK,
LEADPLANT,
ROSINWEED,
RATTLESNAKE_MASTER,
WILD_QUININE,
MISSOURI_IRONWEED,
GOLDENROD,
NEW_ENGLAND_ASTER,
WILD_WHITE_INDIGO,
HANDSOME_GRASSHOPPER,
SLANT_FACED_GRASSHOPPER,
SHORT_WINGED_TOOTHPICK_GRASSHOPPER
};
struct Population {
public:
Species species;
double size;
std::vector<Resource> resources;
std::vector<Prey> prey;
double change_rate;
Population();
void setMin(const Population &pop);
void setMax(const Population &pop);
static std::vector<Population> loadPops(std::string prefix,
std::vector<std::string> filenames, std::string suffix);
};
void from_json(const json &j, Population &p);
void to_json(json &j, const Population &p);
#endif