|
|
@ -53,25 +53,40 @@ class ChampionsLeaguePointSolver : public olc::PixelGameEngine |
|
|
|
std::vector<std::pair<int,int>>player1Score,player2Score,player3Score; |
|
|
|
std::vector<std::pair<int,int>>player1Score,player2Score,player3Score; |
|
|
|
std::vector<TestCase>cases; |
|
|
|
std::vector<TestCase>cases; |
|
|
|
std::vector<SongCombinations> bestComboA,bestComboB; |
|
|
|
std::vector<SongCombinations> bestComboA,bestComboB; |
|
|
|
int calculationStep=0; |
|
|
|
int calculationStep=0; |
|
|
|
void Evaluate(int caseInd,bool ASet){ |
|
|
|
void Evaluate(int caseInd,bool ASet){ |
|
|
|
auto ChooseSong = [](SongCombinations&combinations,std::vector<ScoreData>&dat,int index){ |
|
|
|
auto ChooseSong = [&](SongCombinations&combinations,std::vector<ScoreData>&dat,int index){ |
|
|
|
if(combinations.remainingA>0&&combinations.p1Picked.count(index)==0&&combinations.p2Picked.count(index)==0&&combinations.p3Picked.count(index)==0){ |
|
|
|
if(combinations.remainingA>0&&combinations.p1Picked.count(index)==0&&combinations.p2Picked.count(index)==0&&combinations.p3Picked.count(index)==0){ |
|
|
|
combinations.remainingA--; |
|
|
|
combinations.remainingA--; |
|
|
|
combinations.totalEX+=dat[index].ex1; |
|
|
|
if(ASet){ |
|
|
|
combinations.p1.push_back(std::pair<int,int>{index,dat[index].ex1}); |
|
|
|
combinations.totalEX+=player1Score[index].first; |
|
|
|
|
|
|
|
combinations.p1.push_back(std::pair<int,int>{index,player1Score[index].first}); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
combinations.totalEX+=player1Score[index].second; |
|
|
|
|
|
|
|
combinations.p1.push_back(std::pair<int,int>{index,player1Score[index].second}); |
|
|
|
|
|
|
|
} |
|
|
|
combinations.p1Picked.insert(index); |
|
|
|
combinations.p1Picked.insert(index); |
|
|
|
}else |
|
|
|
}else |
|
|
|
if(combinations.remainingB>0&&combinations.p1Picked.count(index)==0&&combinations.p2Picked.count(index)==0&&combinations.p3Picked.count(index)==0){ |
|
|
|
if(combinations.remainingB>0&&combinations.p1Picked.count(index)==0&&combinations.p2Picked.count(index)==0&&combinations.p3Picked.count(index)==0){ |
|
|
|
combinations.remainingB--; |
|
|
|
combinations.remainingB--; |
|
|
|
combinations.totalEX+=dat[index].ex2; |
|
|
|
if(ASet){ |
|
|
|
combinations.p2.push_back(std::pair<int,int>{index,dat[index].ex2}); |
|
|
|
combinations.totalEX+=player2Score[index].first; |
|
|
|
|
|
|
|
combinations.p1.push_back(std::pair<int,int>{index,player2Score[index].first}); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
combinations.totalEX+=player2Score[index].second; |
|
|
|
|
|
|
|
combinations.p1.push_back(std::pair<int,int>{index,player2Score[index].second}); |
|
|
|
|
|
|
|
} |
|
|
|
combinations.p2Picked.insert(index); |
|
|
|
combinations.p2Picked.insert(index); |
|
|
|
}else |
|
|
|
}else |
|
|
|
if(combinations.remainingC>0&&combinations.p1Picked.count(index)==0&&combinations.p2Picked.count(index)==0&&combinations.p3Picked.count(index)==0){ |
|
|
|
if(combinations.remainingC>0&&combinations.p1Picked.count(index)==0&&combinations.p2Picked.count(index)==0&&combinations.p3Picked.count(index)==0){ |
|
|
|
combinations.remainingC--; |
|
|
|
combinations.remainingC--; |
|
|
|
combinations.totalEX+=dat[index].ex3; |
|
|
|
if(ASet){ |
|
|
|
combinations.p3.push_back(std::pair<int,int>{index,dat[index].ex3}); |
|
|
|
combinations.totalEX+=player3Score[index].first; |
|
|
|
|
|
|
|
combinations.p1.push_back(std::pair<int,int>{index,player3Score[index].first}); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
combinations.totalEX+=player3Score[index].second; |
|
|
|
|
|
|
|
combinations.p1.push_back(std::pair<int,int>{index,player3Score[index].second}); |
|
|
|
|
|
|
|
} |
|
|
|
combinations.p3Picked.insert(index); |
|
|
|
combinations.p3Picked.insert(index); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -172,6 +187,7 @@ class ChampionsLeaguePointSolver : public olc::PixelGameEngine |
|
|
|
calculationStep++; |
|
|
|
calculationStep++; |
|
|
|
} |
|
|
|
} |
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
int highestEX=0; |
|
|
|
struct SongElement{ |
|
|
|
struct SongElement{ |
|
|
|
SongElement(QuickGUI::Manager&manager,std::string songName,vf2d pos){ |
|
|
|
SongElement(QuickGUI::Manager&manager,std::string songName,vf2d pos){ |
|
|
|
label=new QuickGUI::Label(manager,songName,pos,{164,12}); |
|
|
|
label=new QuickGUI::Label(manager,songName,pos,{164,12}); |
|
|
@ -228,9 +244,9 @@ class ChampionsLeaguePointSolver : public olc::PixelGameEngine |
|
|
|
stoi(GetNext(marker,line)), |
|
|
|
stoi(GetNext(marker,line)), |
|
|
|
stoi(GetNext(marker,line)), |
|
|
|
stoi(GetNext(marker,line)), |
|
|
|
stoi(GetNext(marker,line))}; |
|
|
|
stoi(GetNext(marker,line))}; |
|
|
|
player1Score.push_back(std::pair<int,int>{dat.ex1,0}); |
|
|
|
player1Score.push_back(std::pair<int,int>{0,0}); |
|
|
|
player2Score.push_back(std::pair<int,int>{dat.ex2,0}); |
|
|
|
player2Score.push_back(std::pair<int,int>{0,0}); |
|
|
|
player3Score.push_back(std::pair<int,int>{dat.ex3,0}); |
|
|
|
player3Score.push_back(std::pair<int,int>{0,0}); |
|
|
|
dataA.push_back(dat); |
|
|
|
dataA.push_back(dat); |
|
|
|
songs.push_back(SongElement{gui,dat.song.substr(0,dat.song.find(',')),{4.f,2.f+12*i+16}}); |
|
|
|
songs.push_back(SongElement{gui,dat.song.substr(0,dat.song.find(',')),{4.f,2.f+12*i+16}}); |
|
|
|
} |
|
|
|
} |
|
|
@ -247,9 +263,9 @@ class ChampionsLeaguePointSolver : public olc::PixelGameEngine |
|
|
|
stoi(GetNext(marker,line)), |
|
|
|
stoi(GetNext(marker,line)), |
|
|
|
stoi(GetNext(marker,line)), |
|
|
|
stoi(GetNext(marker,line)), |
|
|
|
stoi(GetNext(marker,line))}; |
|
|
|
stoi(GetNext(marker,line))}; |
|
|
|
player1Score[i].second=dat.ex1; |
|
|
|
player1Score[i].second=0; |
|
|
|
player2Score[i].second=dat.ex2; |
|
|
|
player2Score[i].second=0; |
|
|
|
player3Score[i].second=dat.ex3; |
|
|
|
player3Score[i].second=0; |
|
|
|
dataB.push_back(dat); |
|
|
|
dataB.push_back(dat); |
|
|
|
songs.push_back(SongElement{gui,dat.song.substr(0,dat.song.find(',')),{4.f,2.f+12*(i+13)+16}}); |
|
|
|
songs.push_back(SongElement{gui,dat.song.substr(0,dat.song.find(',')),{4.f,2.f+12*(i+13)+16}}); |
|
|
|
} |
|
|
|
} |
|
|
@ -286,13 +302,24 @@ class ChampionsLeaguePointSolver : public olc::PixelGameEngine |
|
|
|
|
|
|
|
|
|
|
|
if(calculateButton->bPressed&&!calculating){ |
|
|
|
if(calculateButton->bPressed&&!calculating){ |
|
|
|
calculateButton->Enable(false); |
|
|
|
calculateButton->Enable(false); |
|
|
|
|
|
|
|
int index=0; |
|
|
|
for(SongElement&element:songs){ |
|
|
|
for(SongElement&element:songs){ |
|
|
|
element.p1Score->Enable(false); |
|
|
|
element.p1Score->Enable(false); |
|
|
|
element.p2Score->Enable(false); |
|
|
|
element.p2Score->Enable(false); |
|
|
|
element.p3Score->Enable(false); |
|
|
|
element.p3Score->Enable(false); |
|
|
|
element.p1Score->bHasBackground=element.label->bHasBackground=false; |
|
|
|
element.p1Score->bHasBackground=element.label->bHasBackground=false; |
|
|
|
|
|
|
|
if(index<12){ |
|
|
|
|
|
|
|
player1Score[index].first=element.p1Score->sText.length()>0?stoi(element.p1Score->sText):0; |
|
|
|
|
|
|
|
player2Score[index].first=element.p2Score->sText.length()>0?stoi(element.p2Score->sText):0; |
|
|
|
|
|
|
|
player3Score[index].first=element.p3Score->sText.length()>0?stoi(element.p3Score->sText):0; |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
player1Score[index-12].second=element.p1Score->sText.length()>0?stoi(element.p1Score->sText):0; |
|
|
|
|
|
|
|
player2Score[index-12].second=element.p2Score->sText.length()>0?stoi(element.p2Score->sText):0; |
|
|
|
|
|
|
|
player3Score[index-12].second=element.p3Score->sText.length()>0?stoi(element.p3Score->sText):0; |
|
|
|
|
|
|
|
} |
|
|
|
element.p2Score->bHasBackground=element.label->bHasBackground=false; |
|
|
|
element.p2Score->bHasBackground=element.label->bHasBackground=false; |
|
|
|
element.p3Score->bHasBackground=element.label->bHasBackground=false; |
|
|
|
element.p3Score->bHasBackground=element.label->bHasBackground=false; |
|
|
|
|
|
|
|
index++; |
|
|
|
} |
|
|
|
} |
|
|
|
calculating=true; |
|
|
|
calculating=true; |
|
|
|
calculationStep=0; |
|
|
|
calculationStep=0; |
|
|
@ -302,6 +329,11 @@ class ChampionsLeaguePointSolver : public olc::PixelGameEngine |
|
|
|
} |
|
|
|
} |
|
|
|
gui.Update(this); |
|
|
|
gui.Update(this); |
|
|
|
gui.Draw(this); |
|
|
|
gui.Draw(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(highestEX!=0){ |
|
|
|
|
|
|
|
DrawString({108,2},std::to_string(highestEX)+" EX",YELLOW); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(calculating){ |
|
|
|
if(calculating){ |
|
|
|
if(calculationStep<cases.size()){ |
|
|
|
if(calculationStep<cases.size()){ |
|
|
|
Evaluate(calculationStep,true); |
|
|
|
Evaluate(calculationStep,true); |
|
|
@ -314,7 +346,7 @@ class ChampionsLeaguePointSolver : public olc::PixelGameEngine |
|
|
|
DrawRect({0,ScreenHeight()-12},{ScreenWidth(),12},BLACK); |
|
|
|
DrawRect({0,ScreenHeight()-12},{ScreenWidth(),12},BLACK); |
|
|
|
|
|
|
|
|
|
|
|
if(calculationStep==totalCalculationSteps){ |
|
|
|
if(calculationStep==totalCalculationSteps){ |
|
|
|
int highestEX=0; |
|
|
|
highestEX=0; |
|
|
|
SongCombinations picked1,picked2; |
|
|
|
SongCombinations picked1,picked2; |
|
|
|
for(SongCombinations&A:bestComboA){ |
|
|
|
for(SongCombinations&A:bestComboA){ |
|
|
|
for(SongCombinations&B:bestComboB){ |
|
|
|
for(SongCombinations&B:bestComboB){ |
|
|
|