-
Notifications
You must be signed in to change notification settings - Fork 0
/
composition.h
62 lines (54 loc) · 1.17 KB
/
composition.h
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
#ifndef COMPOSITION_H
#define COMPOSITION_H
#include <iterator>
#include <iostream>
#include <algorithm>
#include <utility>
#include "formation.h"
#include<map>
class composition
{
private:
double value;
formation format;
std::map<position,player> comp;
public:
composition(formation &);
composition(const formation &);
virtual ~composition();
double getValue() const
{
return value;
}
void addPlayer(position po,player & pl){
comp.insert(std::pair<position,player>(po,pl));
}
formation getFormat()
{
return format;
}
bool hasPlayer(const player &) const;
int getNbPlayers() const
{
return comp.size();
}
void clear()
{
comp.clear();
}
void deletePlayer(position po)
{
comp.erase(po);
}
std::map<position,player> getComp() const
{
return comp;
}
double calculGlobalValue();
std::vector<player> getPlayers() const;
bool operator == (const composition &other) const
{
return comp.size() == other.comp.size() && std::equal(comp.begin(),comp.end(),other.comp.begin());
}
};
#endif // COMPOSITION_H