From 93ecd2c15f233421ecf6337a814fff41093d0231 Mon Sep 17 00:00:00 2001 From: mamareza Date: Sat, 2 Dec 2017 00:35:46 +0330 Subject: [PATCH] project has been developped --- Makefile | 26 +++++---- cup.cpp | 80 +++++++++++++++++++++++++++ cup.h | 34 ++++++++++++ leg.cpp | 34 ++++++++++++ leg.h | 25 +++++++++ main.cpp | 13 +++-- match.cpp | 61 +++++++++++++++++++- match.h | 24 +++++++- player.cpp | 8 ++- player.h | 16 +++++- round.cpp | 48 +++++++++++++++- round.h | 25 ++++++++- run.sh | 5 ++ simulate.py | 2 +- stadium.cpp | 11 +++- stadium.h | 16 +++++- team.cpp | 147 ++++++++++++++++++++++++++++++++++++++++++++++++- team.h | 58 +++++++++++++++++-- tournament.cpp | 29 +++++++++- tournament.h | 32 +++++------ 20 files changed, 636 insertions(+), 58 deletions(-) create mode 100644 cup.cpp create mode 100644 cup.h create mode 100644 leg.cpp create mode 100644 leg.h create mode 100755 run.sh diff --git a/Makefile b/Makefile index e32388a..c37b3d9 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ # defining variables: CC=g++ CFLAGS=-c -HEADERS=match.h player.h round.h stadium.h team.h tournament.h -OBJECTS=main.o match.o player.o round.o stadium.o team.o tournament.o +HEADERS=match.h player.h round.h stadium.h team.h tournament.h cup.h leg.h +OBJECTS=main.o match.o player.o round.o stadium.o team.o tournament.o cup.o leg.cpp #defining rules: all: out @@ -10,26 +10,32 @@ all: out out: $(HEADERS) $(OBJECTS) $(CC) $(OBJECTS) -o out -main.o: tournament.h +main.o: main.cpp tournament.h $(CC) $(CFLAGS) main.cpp -tournament.o: tournament.o tournament.h round.h team.h +tournament.o: tournament.cpp tournament.h cup.h $(CC) $(CFLAGS) tournament.cpp -team.o: team.o team.h stadium.h +cup.o: cup.cpp cup.h round.h team.h + $(CC) $(CFLAGS) cup.cpp + +team.o: team.cpp team.h stadium.h $(CC) $(CFLAGS) team.cpp -round.o: round.o round.h team.h match.h +round.o: round.cpp round.h team.h match.h $(CC) $(CFLAGS) round.cpp -player.o: player.o player.h +player.o: player.cpp player.h $(CC) $(CFLAGS) player.cpp -match.o: match.o match.h team.h +match.o: match.cpp match.h team.h leg.h $(CC) $(CFLAGS) match.cpp -stadium.o: stadium.o stadium.h +leg.o: leg.cpp leg.h team.h + $(CC) $(CFLAGS) leg.cpp + +stadium.o: stadium.cpp stadium.h $(CC) $(CFLAGS) stadium.cpp clean: - rm -rf *o *_out \ No newline at end of file + rm -rf *o out \ No newline at end of file diff --git a/cup.cpp b/cup.cpp new file mode 100644 index 0000000..8d77baf --- /dev/null +++ b/cup.cpp @@ -0,0 +1,80 @@ +#include "cup.h" + +using namespace std; + +void Cup::add_team(string team_name, string stadium_name, int capacity, float impact, map fans_in_stadium) { + teams.push_back(new Team(team_name, stadium_name, capacity, impact, fans_in_stadium)); +} + +void Cup::add_player(string team_name, string player_name, int player_power, string player_post) { + int index = get_team_index(team_name); + if (index == NOT_FOUND) + abort(); + teams[index]->add_player(player_name, player_power, player_post); +} + +int Cup::get_team_index(string team_name) { + for (int i = 0; i < teams.size(); i++) + if (teams[i]->get_name() == team_name) + return i; + return NOT_FOUND; +} + +void Cup::simulate(){ + check_teams(); + vector in_cup_teams = get_in_cup_teams(); + if(validate_number_of_teams(in_cup_teams)){ + int round_number = 1; + while(in_cup_teams.size() != 1){ + Round new_round(in_cup_teams, round_number); + new_round.simulate(); + + in_cup_teams = get_in_cup_teams(); + round_number++; + } + } +} + +vector Cup::get_in_cup_teams() { + vector in_cup_teams; + for (int i = 0; i < teams.size(); i++) + if (teams[i]->is_participating()) + in_cup_teams.push_back(teams[i]); + return in_cup_teams; +} + + +void Cup::check_teams() { + for (int i = 0; i < teams.size() ; i++ ) { + if (!teams[i]->is_valid()) { + teams[i]->set_participation_status(false); + cout << "Inadequate players in " << teams[i]->get_name() << endl; + } + else + teams[i]->generate_squad(); + } +} + +bool Cup::validate_number_of_teams(vector in_cup_teams) { + int n = teams.size(); + if ((n == 0) or ((n & (n-1)) != 0)) { + cout << "Inadequate teams" << endl; + return false; + } + return true; +} + +void Cup::print_tournament_results() { + for (int i = 0; i < rounds.size(); i++) + rounds[i].print_round(); +} + +void Cup::print_round_results(int round_number) { + rounds[round_number-1].print_round(); +} + +void Cup::print_team_results(string team_name) { + Team* team = teams[get_team_index(team_name)]; + for (int i = 0; i < rounds.size(); i++) + rounds[i].print_team_result(team); +} \ No newline at end of file diff --git a/cup.h b/cup.h new file mode 100644 index 0000000..0e1d798 --- /dev/null +++ b/cup.h @@ -0,0 +1,34 @@ +#ifndef __CUP_H__ +#define __CUP_H__ + +#include +#include +#include + +#include "team.h" +#include "round.h" + +#define NOT_FOUND -1 + +class Cup { +public: + Cup(){}; + void add_team(std::string team_name, std::string stadium_name, int capacity, float impact, + std::map fans_in_stadium); + void add_player(std::string team_name, std::string player_name, int player_power, std::string player_post); + void simulate(); + void print_round_results(int round_number); + void print_tournament_results(); + void print_team_results(std::string team_name); + + int get_team_index(std::string team_name); + bool validate_number_of_teams(std::vector in_cup_teams); + void check_teams(); + std::vector get_in_cup_teams(); + void check_num_of_teams(); +private: + std::vector teams; + std::vector rounds; +}; + +#endif \ No newline at end of file diff --git a/leg.cpp b/leg.cpp new file mode 100644 index 0000000..9976490 --- /dev/null +++ b/leg.cpp @@ -0,0 +1,34 @@ +#include "leg.h" + +using namespace std; + +Leg::Leg(Team* _home, Team* _away) + : home(_home), away(_away){ + home_goals = 0; + away_goals = 0; +} + +void Leg::simulate() { + int home_fans_impact = home->get_fans_impact(); + int away_fans_impact = home->get_fans_impact(away); + + int home_deffend = home->get_defend_power() + home_fans_impact; + int home_midfield = home->get_midfield_power() + home_fans_impact; + int home_attack = home->get_attack_power() + home_fans_impact; + + int away_deffend = away->get_defend_power() + away_fans_impact; + int away_midfield = away->get_midfield_power() + away_fans_impact; + int away_attack = away->get_attack_power() + away_fans_impact; + + home_goals = get_num_of_goals(home_attack, home_midfield, away_deffend, away_midfield); + away_goals = get_num_of_goals(away_attack, away_midfield, home_deffend, home_midfield); +} + +int Leg::get_num_of_goals(int home_attack, int home_midfield, int away_deffend, int away_midfield) { + float result = (home_attack * home_midfield) / (away_midfield * away_deffend); + return floor(3 * result * sqrt(result)); +} + +void Leg::print_leg() { + cout << '\t' << home->get_name() << ' ' << home_goals << " - " << away_goals << ' ' << away->get_name() << endl; +} diff --git a/leg.h b/leg.h new file mode 100644 index 0000000..bc2aa4d --- /dev/null +++ b/leg.h @@ -0,0 +1,25 @@ +#ifndef __GAME_H__ +#define __GAME_H__ + +#include +#include + +#include "team.h" + +class Leg { +public: + Leg(Team* _home, Team* _away); + void simulate(); + int get_num_of_goals(int home_attack, int home_midfield, int away_deffend, int away_midfield); + int get_home_goals() {return home_goals;}; + int get_away_goals() {return away_goals;}; + void print_leg(); +private: + Team* home; + Team* away; + + int home_goals; + int away_goals; +}; + +#endif \ No newline at end of file diff --git a/main.cpp b/main.cpp index 5e8b21b..e72ca07 100644 --- a/main.cpp +++ b/main.cpp @@ -1,11 +1,11 @@ -#include "tournament.h" +#include "Tournament.h" #include #include using namespace std; #define GOALKEEPER "goalkeeper" -#define DEFENDER "defener" +#define DEFENDER "defender" #define MIDFIELDER "midfielder" #define STRIKER "striker" @@ -94,9 +94,10 @@ int main(){ ap_cup.simulate(); - ap_cup.print_tournament_results(); - ap_cup.print_round_results(1); - ap_cup.print_team_results("Barcelona"); + ap_cup.print_tournament_results(); + ap_cup.print_round_results(1); + ap_cup.print_team_results("Barcelona"); + return 0; -} \ No newline at end of file +} diff --git a/match.cpp b/match.cpp index 3c345c5..d27012c 100644 --- a/match.cpp +++ b/match.cpp @@ -1 +1,60 @@ -#include "match.h" \ No newline at end of file +#include "match.h" + +using namespace std; + +Match::Match(Team* home, Team* away, int number) + : first_leg(home, away), second_leg(away, home), match_number(number), first_team(home), second_team(away) {} + +void Match::simulate() { + first_leg.simulate(); + second_leg.simulate(); +} + +void Match::determine_winner() { + if (first_leg.get_home_goals() + second_leg.get_away_goals() > second_leg.get_home_goals() + first_leg.get_away_goals()) { + second_team->set_participation_status(false); + winner = first_team; + } + else if (first_leg.get_home_goals() + second_leg.get_away_goals() < second_leg.get_home_goals() + first_leg.get_away_goals()) { + first_team->set_participation_status(false); + winner = second_team; + } + else if (first_leg.get_home_goals() > second_leg.get_home_goals()) { + second_team->set_participation_status(false); + winner = first_team; + } + else if (first_leg.get_home_goals() < second_leg.get_home_goals()) { + first_team->set_participation_status(false); + winner = second_team; + } + else + penalty_time(); +} + +void Match::penalty_time() { + int first_team_fans_impact = second_team->get_fans_impact(first_team); + int second_team_fans_impact = second_team->get_fans_impact(); + + float prob1 = (first_team->get_attack_power() + first_team_fans_impact) / (second_team->get_goalkeeper_power()); + float prob2 = (second_team->get_attack_power() + second_team_fans_impact) / (first_team->get_goalkeeper_power()); + + if (prob1 > prob2) { + second_team->set_participation_status(false); + winner = first_team; + } + else { + first_team->set_participation_status(false); + winner = second_team; + } +} + +void Match::print_match() { + cout << match_number << ":" << endl; + first_leg.print_leg(); + second_leg.print_leg(); + cout << '\t' << "=> winner: " << winner->get_name() << endl; +} + +bool Match::contains(Team* team) { + return (team == first_team) or (team == second_team); +} diff --git a/match.h b/match.h index c166465..151c0c5 100644 --- a/match.h +++ b/match.h @@ -1,10 +1,28 @@ #ifndef __MATCH_H__ #define __MATCH_H__ -class Match -{ +#include + +#include "leg.h" +#include "team.h" + +class Match { public: - Match(); + Match(Team* home, Team* away, int match_number); + void simulate(); + void determine_winner(); + void penalty_time(); + bool contains(Team* team); + + Team* run_match(); + void print_match(); +private: + Leg first_leg; + Leg second_leg; + Team* first_team; + Team* second_team; + Team* winner; + int match_number; }; #endif \ No newline at end of file diff --git a/player.cpp b/player.cpp index 09fcca4..0635e13 100644 --- a/player.cpp +++ b/player.cpp @@ -1 +1,7 @@ -#include "player.h" \ No newline at end of file +#include "player.h" + +using namespace std; + +Player::Player(string _name, int _power , string _position) + : name(_name), power(_power), position(_position){ +} \ No newline at end of file diff --git a/player.h b/player.h index e9f4ac6..4017ec6 100644 --- a/player.h +++ b/player.h @@ -1,10 +1,20 @@ #ifndef __PLAYER_H__ #define __PLAYER_H__ -class Player -{ +#include +#include +#include + +class Player { public: - Player(); + Player(std::string _name, int _power, std::string _position); + std::string get_name() { return name;} + int get_power() const { return power;} + std::string get_position() { return position;} +private: + std::string name; + int power; + std::string position; }; #endif \ No newline at end of file diff --git a/round.cpp b/round.cpp index 864b3ec..91222d5 100644 --- a/round.cpp +++ b/round.cpp @@ -1 +1,47 @@ -#include "round.h" \ No newline at end of file +#include "round.h" + +using namespace std; + +Round::Round(vector in_cup_teams, int number) + : teams(in_cup_teams), round_number(number){ + sort_teams(); + for (int i = 0, number = 1; i < teams.size(); i += 2, number++) + matches.push_back(Match(teams[i], teams[i+1], number)); +} + +void Round::sort_teams() { + sort(teams.begin(), teams.end(), &team_sorter); +} + +bool team_sorter (Team* const& first, Team* const& last) { + return first->get_name() < last->get_name(); +} + +void Round::simulate() { + for (int i = 0; i < matches.size(); ++i) { + matches[i].simulate(); + matches[i].determine_winner(); + } +} + +void Round::print_round() { + cout << "Round " << round_number << endl; + for (int i = 0; i < matches.size() ; i++ ) + matches[i].print_match(); +} + +void Round::print_team_result(Team* team) { + if (is_team_in_round(team)) { + cout << "Round " << round_number << endl; + for (int i = 0; i < matches.size(); ++i) + if (matches[i].contains(team)) + matches[i].print_match(); + } +} + +bool Round::is_team_in_round(Team* team) { + for (int i = 0; i < teams.size(); ++i) + if (teams[i] == team) + return true; + return false; +} \ No newline at end of file diff --git a/round.h b/round.h index 24b2678..d8d934b 100644 --- a/round.h +++ b/round.h @@ -1,10 +1,29 @@ #ifndef __ROUND_H__ #define __ROUND_H__ -class Round -{ +#include +#include + +#include "team.h" +#include "match.h" + +#define NOT_FOUND -1 + +class Round { public: - Round(); + Round(std::vector in_cup_teams, int round_number); + void sort_teams(); + void simulate(); + + void print_round(); + void print_team_result(Team* team); + bool is_team_in_round(Team* team); +private: + std::vector teams; + std::vector matches; + int round_number; }; +bool team_sorter (Team* const& first, Team* const& last); + #endif \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..2059a99 --- /dev/null +++ b/run.sh @@ -0,0 +1,5 @@ +make clean + +make + +./a.out \ No newline at end of file diff --git a/simulate.py b/simulate.py index 96935b3..f8b78e0 100644 --- a/simulate.py +++ b/simulate.py @@ -88,7 +88,7 @@ def simulate(self): # print "{}: {}-{}-{}".format(self.team_2.name, team_2_defend, team_2_midfield, team_2_attack) self.goal_team_1 = math.floor((((team_1_attack*team_1_midfield)/float((team_2_defend*team_2_midfield)))**(1.5))*(3.0)) - self.goal_team_2 = math.floor((((team_2_attack*team_2_midfield)/float((team_1_defend*team_1_midfield)))**(1.5))*(3.0)) + self.goal_team_2 = math.floor((((team_2_attack*team_2_midfield)/float((team_1_defend*team_1_midfield)))**(1.5))*(3.0 )) return self.goal_team_1, self.goal_team_2 fans_in_stadium = {} diff --git a/stadium.cpp b/stadium.cpp index 652c799..ce5f0c6 100644 --- a/stadium.cpp +++ b/stadium.cpp @@ -1 +1,10 @@ -#include "stadium.h" \ No newline at end of file +#include "stadium.h" + +using namespace std; + +Stadium::Stadium(string _name, int _capacity, float _impact) + : name(_name), capacity(_capacity), impact(_impact) {} + +float Stadium::get_impact(int team_fans) { + return ((float)team_fans * impact) / (float)capacity; +} diff --git a/stadium.h b/stadium.h index 59ed1f3..ff40162 100644 --- a/stadium.h +++ b/stadium.h @@ -1,10 +1,20 @@ #ifndef __STADIUM_H__ #define __STADIUM_H__ -class Stadium -{ +#include +#include +#include + +class Stadium { public: - Stadium(); + Stadium(std::string _name, int _capacity, float _impact); + float get_impact(int team_fans); + std::string get_name() { return name;} + int get_capacity() { return capacity;} +private: + std::string name; + int capacity; + float impact; }; #endif \ No newline at end of file diff --git a/team.cpp b/team.cpp index 4f1cc9f..b2e5546 100644 --- a/team.cpp +++ b/team.cpp @@ -1 +1,146 @@ -#include "team.h" \ No newline at end of file +#include "team.h" + +using namespace std; + +Team::Team(string team_name, string stadium_name, int capacity, float impact, map _fans_in_stadium) + : stadium(stadium_name, capacity, impact), name(team_name), fans_in_stadium(_fans_in_stadium){ + participating = true; +} + +void Team::add_player(string player_name, int power, string player_position) { + players.push_back(Player (player_name, power, player_position)); +} + +bool Team::is_valid() { + if (players.size() < 11) + return false; + int goalkeeper_count = 0, midfielders_count = 0, deffender_count = 0, striker_count = 0; + for (int i = 0; i < players.size(); i++) { + if (players[i].get_position() == GOALKEEPER) + goalkeeper_count++; + else if (players[i].get_position() == DEFENDER) + deffender_count++; + else if (players[i].get_position() == MIDFIELDER) + midfielders_count++; + else + striker_count++; + } + if ((goalkeeper_count < GOALKEEPER_MIN_NUMBER) or (deffender_count < DEFENDER_MIN_NUMBER) + or (midfielders_count < MIDFIELDER_MIN_NUMBER) or (striker_count < STRIKER_MIN_NUMBER)) + return false; + return true; +} + +bool player_sorter(Player const& first, Player const& last) { + return first.get_power() > last.get_power(); +} + +void Team::sort_players() { + sort(players.begin(), players.end(), &player_sorter); +} + +void Team::generate_squad() { + sort_players(); + vector all_players = players; + + int goal_count = GOALKEEPER_MIN_NUMBER; + int mid_count = MIDFIELDER_MIN_NUMBER; + int def_count = DEFENDER_MIN_NUMBER; + int strike_count = STRIKER_MIN_NUMBER; + + int i = 0; + while (i < all_players.size()) { + if ((all_players[i].get_position() == GOALKEEPER) && (goal_count > 0)) + goal_count--; + else if ((all_players[i].get_position() == DEFENDER) && (def_count > 0)) + def_count--; + else if ((all_players[i].get_position() == MIDFIELDER) && (mid_count > 0)) + mid_count--; + else if ((all_players[i].get_position() == STRIKER) && (strike_count > 0)) + strike_count--; + else { + i++; + continue; + } + squad_players.push_back(all_players[i]); + all_players.erase(all_players.begin() + i); + } + for (i = 0; i < SQUAD_PLAYER_NUMBER - FORCED_PLAYER_NUMBER; i++) { + if ((all_players[i].get_position() != GOALKEEPER)) + squad_players.push_back(all_players[i]); + } +} + +int Team::get_defend_power() { + int keeper_power = 0; + int defenders_power = 0; + int num_of_defenders = 0; + for (int i = 0; i < squad_players.size() ; i++ ) { + if (squad_players[i].get_position() == DEFENDER) { + num_of_defenders++; + defenders_power += squad_players[i].get_power(); + } + else if (squad_players[i].get_position() == GOALKEEPER) { + keeper_power = squad_players[i].get_power(); + } + } + float num = (keeper_power + defenders_power) * sqrt((float)num_of_defenders / 4); + float den = (((float)num_of_defenders + 1)); + return floor(num/den); +} + +int Team::get_goalkeeper_power() { + for (int i = 0; i < squad_players.size() ; i++) + if (squad_players[i].get_position() == GOALKEEPER) + return (float)squad_players[i].get_power(); + return 0; +} + +int Team::get_midfield_power() { + int mid_power = 0; + int num_of_midfielders = 0; + for (int i = 0; i < squad_players.size() ; i++ ) { + if (squad_players[i].get_position() == MIDFIELDER) { + num_of_midfielders++; + mid_power += squad_players[i].get_power(); + } + } + float num = ((float) mid_power) * sqrt((float)num_of_midfielders / 3); + float den = (((float)num_of_midfielders )); + return floor(num/den); +} + +int Team::get_attack_power() { + int strike_power = 0; + int num_of_strikers = 0; + for (int i = 0; i < squad_players.size() ; i++ ) { + if (squad_players[i].get_position() == STRIKER) { + num_of_strikers++; + strike_power += squad_players[i].get_power(); + } + } + float num = ((float) strike_power) * sqrt(((float)num_of_strikers / 3)); + float den = (((float)num_of_strikers)) ; + return floor(num/den); +} + +void Team::set_participation_status(bool state) { + participating = state; +} + +bool Team::is_participating() { + return participating; +} + +int Team::get_fans_impact(Team* team) { + int home_fans_num = fans_in_stadium[stadium.get_name()]; + if (team == NULL) + return stadium.get_impact(home_fans_num); + + int capacity = stadium.get_capacity(); + int away_fans_num = team->fans_in_stadium[stadium.get_name()]; + if (away_fans_num > capacity - home_fans_num) + away_fans_num = capacity - home_fans_num; + return stadium.get_impact(away_fans_num); +} + diff --git a/team.h b/team.h index 4d0a96f..0e23d20 100644 --- a/team.h +++ b/team.h @@ -1,10 +1,58 @@ -#ifndef __TEAM_H__ -#define __TEAM_H__ +#ifndef _TEAM_H__ +#define _TEAM_H__ -class Team -{ +#include +#include +#include +#include +#include +#include + +#include "player.h" +#include "stadium.h" + +#define GOALKEEPER "goalkeeper" +#define DEFENDER "defender" +#define MIDFIELDER "midfielder" +#define STRIKER "striker" + +#define GOALKEEPER_MIN_NUMBER 1 +#define DEFENDER_MIN_NUMBER 3 +#define MIDFIELDER_MIN_NUMBER 3 +#define STRIKER_MIN_NUMBER 2 +#define FORCED_PLAYER_NUMBER 9 +#define SQUAD_PLAYER_NUMBER 11 + + +class Team { public: - Team(); + Team(std::string team_name, std::string stadium_name, int capacity, float impact, + std::map _fans_in_stadium); + void add_player(std::string player_name, int power, std::string player_position); + bool is_valid(); + void generate_squad(); + + void set_participation_status(bool state); + bool is_participating(); + std::string get_name() {return name;} + + int get_defend_power(); + int get_midfield_power(); + int get_attack_power(); + int get_goalkeeper_power(); + void sort_players(); + + int get_fans_impact(Team* team = NULL); +private: + std::string name; + Stadium stadium; + std::map fans_in_stadium; + bool participating; + std::vector players; + std::vector squad_players; }; +bool player_sorter(Player const& first, Player const& last); + + #endif \ No newline at end of file diff --git a/tournament.cpp b/tournament.cpp index 3199ade..3e4aa31 100644 --- a/tournament.cpp +++ b/tournament.cpp @@ -1 +1,28 @@ -#include "tournament.h" \ No newline at end of file +#include "tournament.h" + +using namespace std; + +void Tournament::add_team(string team_name, string stadium_name, int capacity, float impact, + map fans_in_stadium) { + cup.add_team(team_name, stadium_name, capacity, impact, fans_in_stadium); +} + +void Tournament::add_player(string team_name, string player_name, int player_power, string player_post) { + cup.add_player(team_name, player_name, player_power, player_post); +} + +void Tournament::simulate() { + cup.simulate(); +} + +void Tournament::print_round_results(int round_number) { + cup.print_round_results(round_number); +} + +void Tournament::print_tournament_results() { + cup.print_tournament_results(); +} + +void Tournament::print_team_results(string team_name) { + cup.print_team_results(team_name); +} diff --git a/tournament.h b/tournament.h index 723891f..bfb2757 100644 --- a/tournament.h +++ b/tournament.h @@ -1,28 +1,24 @@ #ifndef __TOURNAMENT_H__ #define __TOURNAMENT_H__ -#include "team.h" -#include "round.h" - -#include +#include #include #include -class Tournament -{ -private: - std::vector teams; - std::vector rounds; +#include "cup.h" + +class Tournament { public: - Tournament(){}; - void add_team(std::string team_name, std::string stadium_name, int stadium_capacity, - int stadium_impact, std::map fans_in_stadium); - void add_player(std::string team_name, std::string player_name, - int player_power, std::string player_post); - void simulate(); - void print_tournament_results(); - void print_round_results(int round_number); - void print_team_results(std::string team_name); + Tournament(){}; + void add_team(std::string team_name, std::string stadium_name, int capacity, float impact, + std::map fans_in_stadium); + void add_player(std::string team_name, std::string player_name, int player_power, std::string player_post); + void simulate(); + void print_round_results(int round_number); + void print_tournament_results(); + void print_team_results(std::string team_name); +private: + Cup cup; }; #endif \ No newline at end of file