-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeam.h
More file actions
60 lines (53 loc) · 1.57 KB
/
Team.h
File metadata and controls
60 lines (53 loc) · 1.57 KB
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
//
// Created by Mac on 10/01/2024.
//
#ifndef PROJECT_PA_TEAM_H
#define PROJECT_PA_TEAM_H
#include "Goalkeeper.h"
#include "FieldPlayers.h"
#include <vector>
#include <utility>
#include <algorithm>
//TODO requeirs liczby graczy
template<int N>
concept BiggerThan1Less11 = 12 > N and N > 1;
int chanceToScore(int n);
template<int N> requires BiggerThan1Less11<N>
class Team;
template<int N> requires BiggerThan1Less11<N>
class Team{
public:
std::string teamName;
std::vector<FieldPlayers> players;
Goalkeeper goalkeeper;
int numberOfPlayers;
std::vector<bool> yellowCards;
public:
explicit Team(std::string name){
teamName = std::move(name);
numberOfPlayers = N;
goalkeeper = Goalkeeper();
for(int i=0; i<N-1; i++){
players.emplace_back(chanceToScore(i));
yellowCards.emplace_back(false);
}
}
void deletePlayer(int numberOfPlayer);
void printPlayers();
};
template<int N>
requires BiggerThan1Less11<N>
void Team<N>::deletePlayer(int numberOfPlayer) {
yellowCards.erase(yellowCards.cbegin()+numberOfPlayer);
players.erase(players.cbegin()+numberOfPlayer);
numberOfPlayers--;
}
template<int N>
requires BiggerThan1Less11<N>void Team<N>::printPlayers() {
std::cout<<"Team Name: "<< this->teamName<<std::endl;
std::cout<<"Goalkeeper:\t"<<this->goalkeeper<<std::endl;
std::cout<<"Field Players: "<<players[0]<<std::endl;
for(int i=1; i<numberOfPlayers-1; i++)
std::cout<<"\t\t"<<players[i]<<std::endl;
}
#endif //PROJECT_PA_TEAM_H