|
|
|
@ -10,10 +10,10 @@ std::string slurp(std::ifstream& in) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
struct ScoreData{ |
|
|
|
|
int difficulty; |
|
|
|
|
int difficulty=0; |
|
|
|
|
std::string song; |
|
|
|
|
int totalEX; |
|
|
|
|
int ex1,ex2,ex3; |
|
|
|
|
int totalEX=0; |
|
|
|
|
int ex1=0,ex2=0,ex3=0; |
|
|
|
|
std::string str()const{ |
|
|
|
|
return "["+std::to_string(difficulty)+"] "+song+": "+std::to_string(totalEX)+" total, "+" EX1: "+std::to_string(ex1)+" EX2: "+std::to_string(ex2)+" EX3: "+std::to_string(ex3); |
|
|
|
|
} |
|
|
|
@ -23,6 +23,11 @@ struct ScoreData{ |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
struct Selection{ |
|
|
|
|
std::vector<std::pair<int,int>>selectedScore; |
|
|
|
|
int totalEX=0; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
std::string GetNext(int&marker,std::string str){ |
|
|
|
|
int originalMarker=marker; |
|
|
|
|
marker=str.find_first_of(',',originalMarker)+1; |
|
|
|
@ -30,7 +35,6 @@ std::string GetNext(int&marker,std::string str){ |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
int main(){ |
|
|
|
|
|
|
|
|
|
std::vector<ScoreData>dataA,dataB; |
|
|
|
|
std::ifstream file("team.csv"); |
|
|
|
|
std::string line; |
|
|
|
@ -64,10 +68,89 @@ int main(){ |
|
|
|
|
stoi(GetNext(marker,line))} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::cout<<"File Contents:"<<std::endl<<std::endl; |
|
|
|
|
for(auto&list:{dataA,dataB}){ |
|
|
|
|
for(auto&dat:list){ |
|
|
|
|
std::cout<<dat<<std::endl; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
std::cout<<"==================="<<std::endl; |
|
|
|
|
std::vector<Selection>bestSelections; |
|
|
|
|
while(true){ |
|
|
|
|
int Aselections=6,Bselections=6; |
|
|
|
|
Selection selection; |
|
|
|
|
int totalEX=0; |
|
|
|
|
int hash=0; |
|
|
|
|
std::vector<int>randomChoice={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}; |
|
|
|
|
for(int iSel=0;iSel<4;iSel++){ |
|
|
|
|
int arrInd=rand()%randomChoice.size(); |
|
|
|
|
int randSongIndex=randomChoice[arrInd]; |
|
|
|
|
randomChoice.erase(randomChoice.begin()+arrInd); |
|
|
|
|
ScoreData*dataRef; |
|
|
|
|
if(randSongIndex<12){ |
|
|
|
|
Aselections--; |
|
|
|
|
dataRef=&dataA[randSongIndex]; |
|
|
|
|
}else{ |
|
|
|
|
Bselections--; |
|
|
|
|
dataRef=&dataB[randSongIndex-12]; |
|
|
|
|
} |
|
|
|
|
selection.selectedScore.push_back({0,randSongIndex}); |
|
|
|
|
selection.totalEX+=dataRef->ex1; |
|
|
|
|
totalEX+=dataRef->ex1; |
|
|
|
|
} |
|
|
|
|
for(int iSel=0;iSel<4;iSel++){ |
|
|
|
|
int arrInd=rand()%randomChoice.size(); |
|
|
|
|
int randSongIndex=randomChoice[arrInd]; |
|
|
|
|
while(Aselections==0&&randSongIndex<12||Bselections==0&&randSongIndex>=12){ |
|
|
|
|
arrInd=rand()%randomChoice.size(); |
|
|
|
|
randSongIndex=randomChoice[arrInd]; |
|
|
|
|
} |
|
|
|
|
randomChoice.erase(randomChoice.begin()+arrInd); |
|
|
|
|
ScoreData*dataRef; |
|
|
|
|
if(randSongIndex<12){ |
|
|
|
|
Aselections--; |
|
|
|
|
dataRef=&dataA[randSongIndex]; |
|
|
|
|
}else{ |
|
|
|
|
Bselections--; |
|
|
|
|
dataRef=&dataB[randSongIndex-12]; |
|
|
|
|
} |
|
|
|
|
selection.selectedScore.push_back({1,randSongIndex}); |
|
|
|
|
selection.totalEX+=dataRef->ex2; |
|
|
|
|
totalEX+=dataRef->ex2; |
|
|
|
|
} |
|
|
|
|
for(int iSel=0;iSel<4;iSel++){ |
|
|
|
|
int arrInd=rand()%randomChoice.size(); |
|
|
|
|
int randSongIndex=randomChoice[arrInd]; |
|
|
|
|
while(Aselections==0&&randSongIndex<12||Bselections==0&&randSongIndex>=12){ |
|
|
|
|
arrInd=rand()%randomChoice.size(); |
|
|
|
|
randSongIndex=randomChoice[arrInd]; |
|
|
|
|
} |
|
|
|
|
randomChoice.erase(randomChoice.begin()+arrInd); |
|
|
|
|
ScoreData*dataRef; |
|
|
|
|
if(randSongIndex<12){ |
|
|
|
|
Aselections--; |
|
|
|
|
dataRef=&dataA[randSongIndex]; |
|
|
|
|
}else{ |
|
|
|
|
Bselections--; |
|
|
|
|
dataRef=&dataB[randSongIndex-12]; |
|
|
|
|
} |
|
|
|
|
selection.selectedScore.push_back({2,randSongIndex}); |
|
|
|
|
selection.totalEX+=dataRef->ex3; |
|
|
|
|
totalEX+=dataRef->ex3; |
|
|
|
|
} |
|
|
|
|
if(bestSelections.size()>0){ |
|
|
|
|
int bestEX=bestSelections.back().totalEX; |
|
|
|
|
if(totalEX>bestEX){ |
|
|
|
|
std::cout<<"New best EX combination found: "+std::to_string(totalEX)+". Selections are:"<<std::endl<<"\t"; |
|
|
|
|
for(std::pair<int,int>&song:selection.selectedScore){ |
|
|
|
|
std::cout<<"P"<<song.first<<"|"<<song.second<<","; |
|
|
|
|
} |
|
|
|
|
std::cout<<std::endl; |
|
|
|
|
bestSelections.push_back(selection); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
bestSelections.push_back(selection); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
std::cout<<"Done"<<std::endl; |
|
|
|
|
} |