4 #include "../boys/allboys.h" 5 #include "../girls/allgirls.h" 6 #include "../gifts/gift.h" 7 #include "../couples/couple.h" 8 #include "../utils/read_data.h" 9 #include "../utils/logger/logger.h" 10 #include "../templates/kbest.h" 11 #include "../configs.h" 13 std::vector<Couple>
makeCouples(
int k, std::vector<Boy*>, std::vector<Girl*>,
Logger *logger);
14 void performGifting (
int k, std::vector<Couple> *couples, std::vector<Gift> *giftlist,
Logger *logger);
16 int main(
int argc,
char **argv)
27 logger.
info(
"Processing for question 3",
true);
28 logger.
log(
"boys", std::to_string(boys.size()) +
" record read",
true);
29 logger.
log(
"girls", std::to_string(girls.size()) +
" record read",
true);
30 logger.
log(
"gifts", std::to_string(gifts.size()) +
" record read",
true);
32 std::vector<Couple> couples =
makeCouples(k, boys, girls, &logger);
34 logger.
log(
"couples", std::to_string(couples.size()) +
" formed",
true);
36 logger.
info(
"Couples list",
true);
37 for (
int i = 0; i < (int)couples.size(); i++)
38 logger.
log(
"couple"+std::to_string(i+1),
39 couples[i].boy->name+
" and "+couples[i].girl->name,
true);
48 std::vector<Couple>
makeCouples(
int k, std::vector<Boy*> boys, std::vector<Girl*> girls,
Logger *logger)
50 std::vector<Couple> couples;
53 for (
auto girl : girls) {
54 if (girl->committed)
continue;
56 std::vector<Boy*> topBoys;
57 switch (girl->boy_type) {
69 for (
auto boy : boys) {
70 if (boy->committed)
continue;
71 if (boy->isCompatible(girl) &&
72 girl->isCompatible(boy)) {
74 couples.push_back(
Couple(boy, girl));
75 logger->
log(
"Couple", boy->name+
" partenered with "+girl->name,
true);
76 boy->committed =
true;
77 girl->committed=
true;
89 for (
auto it = couples->begin(); it != couples->end(); it++)
90 it->makeGiftBasket(*giftlist, logger);
std::vector< Gift > readAllGifts(std::string filename)
void info(const std::string msg, bool print=false)
void log(const std::string type, const std::string msg, bool print=false)
bool compareOnIntelligence(Boy *b1, Boy *b2)
void performGifting(int k, std::vector< Couple > *couples, std::vector< Gift > *giftlist, Logger *logger)
std::vector< Girl * > readAllGirls(std::string filename)
std::vector< Boy * > readAllBoys(std::string filename)
bool compareOnAttractiveness(Boy *b1, Boy *b2)
bool compareOnRichness(Boy *b1, Boy *b2)
int main(int argc, char **argv)
std::vector< Couple > makeCouples(int k, std::vector< Boy * >, std::vector< Girl * >, Logger *logger)