Skip to content

Commit

Permalink
add a worst case dp->wife conversion so that all scores can be sorted…
Browse files Browse the repository at this point in the history
… via wife (or estimates thereof)
  • Loading branch information
MinaciousGrace committed Dec 17, 2016
1 parent 568ba80 commit 07be19f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,21 @@ local function GetBestScoreByFilter(perc,CurRate)
end

table.sort(rates)

for i=#rates,1,-1 do
scores = rtTable[rates[i]]
local bestscore = 0
local index

for ii=1,#scores do
score = scores[ii]
if score:GetWifeScore() >= perc then
return score
end
if getScore(score,1)/getMaxScore(PLAYER_1,1) >= perc then
return score
if score:ConvertDpToWife() > bestscore then
index = ii
bestscore = score:ConvertDpToWife()
end
end
if bestscore > perc then
return scores[index]
end
end
end

Expand Down
63 changes: 43 additions & 20 deletions src/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,26 +295,6 @@ bool HighScore::IsEmpty() const
return true;
}

Grade HighScore::GetWifeGrade() {
if (GetGrade() == Grade_Failed)
return Grade_Failed;

float wifescore = GetWifeScore();
if (wifescore >= 0.9998)
return Grade_Tier01;
if (wifescore >= 0.9975)
return Grade_Tier02;
if (wifescore >= 0.93)
return Grade_Tier03;
if (wifescore >= 0.8)
return Grade_Tier04;
if (wifescore >= 0.7)
return Grade_Tier05;
if (wifescore >= 0.6)
return Grade_Tier06;
return Grade_Tier07;
}

RString HighScore::GetName() const { return m_Impl->sName; }
Grade HighScore::GetGrade() const { return m_Impl->grade; }
unsigned int HighScore::GetScore() const { return m_Impl->iScore; }
Expand Down Expand Up @@ -654,6 +634,47 @@ float HighScore::RescoreToDPJudge(int x) {
return p / m;
}

Grade HighScore::GetWifeGrade() {
if (GetGrade() == Grade_Failed)
return Grade_Failed;

float wifescore = GetWifeScore();
if (wifescore >= 0.9998)
return Grade_Tier01;
if (wifescore >= 0.9975)
return Grade_Tier02;
if (wifescore >= 0.93)
return Grade_Tier03;
if (wifescore >= 0.8)
return Grade_Tier04;
if (wifescore >= 0.7)
return Grade_Tier05;
if (wifescore >= 0.6)
return Grade_Tier06;
return Grade_Tier07;
}

// Assert a "worst case scenario" to convert by - mina
float HighScore::ConvertDpToWife() {
if (m_Impl->fWifeScore > 0.f)
return m_Impl->fWifeScore;

float ts = 1.f;
float estpoints = 0.f;
float maxpoints = 0.f;
estpoints += m_Impl->iTapNoteScores[TNS_W1] * wife2(22.49f, ts * 95.f, 2.f, 2, -8);
estpoints += m_Impl->iTapNoteScores[TNS_W2] * wife2(44.99f, ts * 95.f, 2.f, 2, -8);
estpoints += m_Impl->iTapNoteScores[TNS_W3] * wife2(89.99f, ts * 95.f, 2.f, 2, -8);
estpoints += m_Impl->iTapNoteScores[TNS_W4] * wife2(134.99f, ts * 95.f, 2.f, 2, -8);
estpoints += m_Impl->iTapNoteScores[TNS_W5] * wife2(179.99f, ts * 95.f, 2.f, 2, -8);
estpoints += m_Impl->iTapNoteScores[TNS_Miss] * wife2(179.99f, ts * 95.f, 2.f, 2, -8);

FOREACH_ENUM(TapNoteScore, tns)
maxpoints += 2 * m_Impl->iTapNoteScores[tns];

return estpoints / maxpoints;
}

// lua start
#include "LuaBinding.h"

Expand Down Expand Up @@ -693,6 +714,7 @@ class LunaHighScore: public Luna<HighScore>

DEFINE_METHOD( GetGrade, GetGrade() )
DEFINE_METHOD( GetWifeGrade, GetWifeGrade())
DEFINE_METHOD( ConvertDpToWife, ConvertDpToWife())
DEFINE_METHOD( GetStageAward, GetStageAward() )
DEFINE_METHOD( GetPeakComboAward, GetPeakComboAward() )

Expand All @@ -701,6 +723,7 @@ class LunaHighScore: public Luna<HighScore>
ADD_METHOD( GetName );
ADD_METHOD( GetScore );
ADD_METHOD( GetPercentDP );
ADD_METHOD( ConvertDpToWife );
ADD_METHOD( GetWifeScore );
ADD_METHOD( RescoreToWifeJudge );
ADD_METHOD( RescoreToDPJudge );
Expand Down
1 change: 1 addition & 0 deletions src/HighScore.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct HighScore
* @return true if no judgments were recorded, false otherwise. */
bool IsEmpty() const;
Grade GetWifeGrade();
float ConvertDpToWife();
float GetPercentDP() const;
float GetWifeScore() const;
float GetSSR() const;
Expand Down

0 comments on commit 07be19f

Please sign in to comment.