Skip to content

Commit

Permalink
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^_^^^^^^^^^^^^^^^^^^^^^^^^
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed May 22, 2020
1 parent 726416d commit 3e8623f
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 43 deletions.
101 changes: 59 additions & 42 deletions src/Etterna/Globals/MinaCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ static const float stam_prop =
// and chordstreams start lower
// stam is a special case and may use normalizers again
static const float basescalers[NUM_Skillset] = { 0.f, 0.97f, 0.89f, 0.89f,
0.94f, 0.7675f, 0.84f, 1.f };
0.94f, 0.7675f, 0.84f, 0.75f };
bool debug_lmao = false;
#pragma region CalcBodyFunctions
#pragma region JackModelFunctions
Expand Down Expand Up @@ -434,6 +434,7 @@ hit_the_road(float x, float y, int mode)
float
Calc::JackLoss(float x, int mode, float mpl, bool stam, bool debug)
{
mpl *= 1.5f;
const bool dbg = false && debugmode;
// adjust for stam before main loop, since main loop is interval -> track
// and not track -> interval, we could also try doing this on the fly with
Expand Down Expand Up @@ -548,7 +549,7 @@ Calc::SequenceJack(const Finger& f, int track, int mode)
static const float jack_global_scaler =
finalscaler * basescalers[Skill_JackSpeed] / 15.f;
static const float mode_scalers[4] = {
1.0555f, 0.003f * 35.12f / 36.f, 1.28f, 1.5f * 30.5f / 29.5f
0.9055f, 0.003f * 35.12f / 36.f, 1.28f, 1.5f * 30.5f / 29.5f
};
jacks[mode][track].resize(numitv);
float comp_diff = 0.f;
Expand Down Expand Up @@ -674,9 +675,9 @@ Calc::CalcMain(const vector<NoteInfo>& NoteInfo,
// in flux
float grindscaler =
CalcClamp(
0.95f +
(0.05f * ((NoteInfo.back().rowTime / music_rate) - 30.f) / 30.f),
0.95f,
0.9f +
(0.1f * ((NoteInfo.back().rowTime / music_rate) - 35.f) / 35.f),
0.9f,
1.f) *
CalcClamp(
0.9f + (0.1f * ((NoteInfo.back().rowTime / music_rate) - 15.f) / 15.f),
Expand Down Expand Up @@ -790,7 +791,7 @@ Calc::CalcMain(const vector<NoteInfo>& NoteInfo,
mcbloop[Skill_Stamina] = poodle_in_a_porta_potty * mcfroggerbopper *
basescalers[Skill_Stamina];
static const float
actual_literal_black_magic_number_random_HAHAHAHA____ = 0.81f;
actual_literal_black_magic_number_random_HAHAHAHA____ = 1.2f;
// yes i know how dumb this looks
DifficultyRating difficulty = {
mcbloop[0],
Expand Down Expand Up @@ -1151,7 +1152,7 @@ Hand::CalcMSEstimate(vector<float> input, vector<float> cc, int burp)
// how many ms values we use from here, if there are fewer than this number
// we'll mock up some values to water down intervals with a single extremely
// fast minijack, if there are more, we will truncate
static const unsigned int num_used = burp;
unsigned int num_used = burp;
static const unsigned int num_cc_used = 3;

if (input.empty())
Expand Down Expand Up @@ -1189,8 +1190,9 @@ Hand::CalcMSEstimate(vector<float> input, vector<float> cc, int burp)

sort(input.begin(), input.end());
float comb_cc = cv(input) + 1.f;
input[0] *= 1.1f;

comb_cc = CalcClamp(comb_cc, 0.75f, 1.5f);
// comb_cc = CalcClamp(comb_cc, 0.75f, 1.5f);
if (dbg && debug_lmao)
std::cout << "cv in: " << cv_yo << " : cv cc: " << cc_cv
<< " : cv comb: " << comb_cc << std::endl;
Expand Down Expand Up @@ -1236,6 +1238,12 @@ Hand::CalcMSEstimate(vector<float> input, vector<float> cc, int burp)
return fdiff;
}

inline float
a_thing(float a, float b, float x, float y)
{
return (x * a + ((y - x) * b)) / y;
}

void
Hand::InitBaseDiff(Finger& f1, Finger& f2, const vector<vector<float>>& itv_cc)
{
Expand All @@ -1250,34 +1258,35 @@ Hand::InitBaseDiff(Finger& f1, Finger& f2, const vector<vector<float>>& itv_cc)
std::cout << "\ninterval : " << i << std::endl;

// scaler for things with higher things
static const float higher_thing_scaler = 1.05f;
static const float higher_thing_scaler = 1.1f;
float nps = 1.6f * static_cast<float>(f1[i].size() + f2[i].size());
float left_difficulty =
max(CalcMSEstimate(f1[i], itv_cc[i], 3),
CalcMSEstimate(f1[i], itv_cc[i], 4) * higher_thing_scaler);
left_difficulty =
max(left_difficulty,
CalcMSEstimate(f1[i], itv_cc[i], 5) *
higher_thing_scaler * higher_thing_scaler);
left_difficulty = max(left_difficulty,
CalcMSEstimate(f1[i], itv_cc[i], 5) *
higher_thing_scaler * higher_thing_scaler);
float right_difficulty =
max(CalcMSEstimate(f2[i], itv_cc[i], 3),
CalcMSEstimate(f2[i], itv_cc[i], 4) * higher_thing_scaler);
right_difficulty =
max(right_difficulty,
CalcMSEstimate(f2[i], itv_cc[i], 5) *
higher_thing_scaler * higher_thing_scaler);
right_difficulty = max(right_difficulty,
CalcMSEstimate(f2[i], itv_cc[i], 5) *
higher_thing_scaler * higher_thing_scaler);

float difficulty = 0.f;
float squiggly_line = 6.f;
if (left_difficulty > right_difficulty)
difficulty = (6.5f * left_difficulty + 2.5f * right_difficulty) / 9.f;
difficulty =
a_thing(left_difficulty, right_difficulty, squiggly_line, 9.f);
else
difficulty = (6.5f * right_difficulty + 2.5f * left_difficulty) / 9.f;
difficulty =
a_thing(right_difficulty, left_difficulty, squiggly_line, 9.f);
soap[BaseNPS][i] = finalscaler * nps;
soap[BaseMS][i] = finalscaler * difficulty;
soap[BaseMSD][i] =
finalscaler * (5.8f * difficulty + 4.2f * nps) / 10.f;
soap[BaseMSD][i] = a_thing(difficulty, nps, 4.5f, 10.f) * finalscaler;
}
Smooth(soap[BaseNPS], 0.f);
DifficultyMSSmooth(soap[BaseMSD]);
Smooth(soap[BaseMSD], 0.f);
}

// each skillset should just be a separate calc function [todo]
Expand Down Expand Up @@ -1343,27 +1352,35 @@ Calc::Chisel(float player_skill,
JackLoss(player_skill, 3, max_points_lost, stamina)));
gotpoints -= jloss;
} else {
static const float literal_black_magic = 0.9f;
static const float literal_black_magic = 0.875f;
if (ss == Skill_Technical) {
float bzz =
max(JackLoss(player_skill * literal_black_magic,
1,
max_points_lost,
stamina),
max(JackLoss(player_skill * literal_black_magic,
2,
max_points_lost,
stamina),
JackLoss(player_skill * literal_black_magic,
3,
max_points_lost,
stamina)));
bzz = max(bzz,
JackLoss(player_skill * literal_black_magic,
0,
max_points_lost,
stamina));
gotpoints += bzz / 2.5f;
float bzz = 0.f;
float bz0 =
JackLoss((player_skill * literal_black_magic),
0,
max_points_lost,
stamina);
float bz1 =
JackLoss((player_skill * literal_black_magic),
1,
max_points_lost,
stamina) +
bz0;
float bz2 =
JackLoss((player_skill * literal_black_magic),
2,
max_points_lost,
stamina) +
bz0;
float bz3 =
JackLoss((player_skill * literal_black_magic),
3,
max_points_lost,
stamina) +
bz0;

bzz = max_val(vector<float>{ bz1, bz2, bz3 });
gotpoints += bzz / 3.f;
}

left_hand.CalcInternal(
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Globals/MinaCalc.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Hand
/* Spits out a rough estimate of difficulty based on the ms values within
the interval The vector passed to it is the vector of ms values within each
interval, and not the full vector of intervals. */
static float CalcMSEstimate(std::vector<float> input,
float CalcMSEstimate(std::vector<float> input,
const std::vector<float> itv_cc, int burp);

/* Averages nps and ms estimates for difficulty to get a rough initial
Expand Down

0 comments on commit 3e8623f

Please sign in to comment.