-
Notifications
You must be signed in to change notification settings - Fork 0
/
group.hpp
97 lines (73 loc) · 2.26 KB
/
group.hpp
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef GROUP_HPP
#define GROUP_HPP
#include <vector>
#include <string.h>
#include "random.hpp"
#include "person.hpp"
#include "names.hpp"
#include "guard.hpp"
using std::vector;
using std::string;
using std::tuple;
class Group{
public:
// fixed
int id;
int name;
// changing
float wealth;
int land;
float guard_strength;
float guard_cost;
int nguards;
int nused;
int nundefended;
vector<int> used;
vector<int> undefended;
vector<int> nguards_desired;
vector<int> used_soldier;
vector<int> unused_soldier;
vector<int> nsoldiers_desired;
vector<int> tile_inds;
int npaying;
float req_to_rec; // ratio of requested/received
int age;
int prevsize;
// Member list (index in person list)
vector<int> memberlist;
// Tentative: leader
int leader = 0; // index in memberlist
// Guard list
vector<Guard> guards;
// Will be a function later
float wealth_request;
float received;
int guard_request;
Group(int id, int land, int groupsize) : age(0), id(id), wealth(0), land(land), npaying(groupsize),
guard_strength(20),guard_cost(2),nguards(0),nused(0),nundefended(0),req_to_rec(0.0f),received(0.0f),
guard_request(0),
memberlist(groupsize)
{
name = id;
if (id>=NGROUP_NAMES){
string new_gname = generate_name();
gnames.push_back(new_gname);
}
}
// Decisions
void will_desire_how_many_guards(vector<int> victim_homes,vector<int> lused, vector<int> lundefended,vector<int> guards_left,
vector<int> lused_soldier, vector<int> lunused_soldier);
float will_try_to_raise_how_much();
int will_request_how_many_guards();
void set_tasks(Person& pleader);
bool will_try_to_defend();
// Actions
void choose_leadership(vector<Person>& people);
void assess_defence(vector<int> victim_homes,vector<int> lused, vector<int> lundefended,vector<int> guards_left,
vector<int> lused_soldier, vector<int> lunused_soldier);
void set_wealth_request();
void assess_wealth_request();
void set_task_request(Person& pleader);
tuple<float,int> provide_defense(int victim_ind, int location);
};
#endif