Skip to content

Commit

Permalink
Merge: Unsolicited proof-of-concept machine learning jackspeed PR #913
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Oct 30, 2020
2 parents 0c3689c + 5e933e2 commit 13f43ed
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ struct Anchor_Sequencing
return _len_cap_ms;
}

static const auto avg_ms_mult = 1.075F;
static const auto anchor_time_buffer_ms = 25.F;
static const auto min_ms = 82.5F;
static const auto avg_ms_mult = 1.0363214F;
static const auto anchor_time_buffer_ms = 24.336933F;
static const auto min_ms = 79.538712F;

// get total ms
const auto total_ms = ms_from(_last, _start);
Expand All @@ -167,7 +167,7 @@ struct Anchor_Sequencing

// BAD TEMP HACK LUL
if (_len == 2) {
ms *= 1.1F;
ms *= 1.1018715F;
ms = ms < 155.F ? 155.F : ms;
}

Expand Down
32 changes: 21 additions & 11 deletions src/Etterna/MinaCalc/MinaCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Calc::CalcMain(const std::vector<NoteInfo>& NoteInfo,
* files */
for (auto i = 0; i < NUM_Skillset; ++i) {
if (mcbloop[i] > base * 0.9f) {
mcbloop[i] = Chisel(mcbloop[i] * 0.9F,
mcbloop[i] = Chisel(mcbloop[i] * 0.82792711F,
0.32F,
score_goal,
static_cast<Skillset>(i),
Expand Down Expand Up @@ -298,11 +298,11 @@ JackStamAdjust(const float x, Calc& calc, const int hi)
-> std::vector<std::pair<float, float>>
{
// Jack stamina Model params (see above)
static const auto stam_ceil = 1.05234F;
static const auto stam_mag = 23.F;
static const auto stam_fscale = 2150.F;
static const auto stam_prop = 0.49424F;
auto stam_floor = 0.95F;
static const auto stam_ceil = 1.0087639F;
static const auto stam_mag = 22.086582F;
static const auto stam_fscale = 2060.1338F;
static const auto stam_prop = 0.48069301F;
auto stam_floor = 0.90450478F;
auto mod = 0.95F;

auto avs2 = 0.F;
Expand All @@ -316,7 +316,7 @@ JackStamAdjust(const float x, Calc& calc, const int hi)
for (size_t i = 0; i < diff.size(); i++) {
const auto avs1 = avs2;
avs2 = diff.at(i).second;
mod += ((((avs1 + avs2) / 2.F) / (stam_prop * x)) - 1.F) / stam_mag;
mod += ((((avs1 + avs2) / 2.F) / (stam_prop * x)) - 1.0156831F) / stam_mag;
if (mod > 0.95F) {
stam_floor += (mod - 0.95F) / stam_fscale;
}
Expand All @@ -333,12 +333,12 @@ JackStamAdjust(const float x, Calc& calc, const int hi)
return doot;
}

constexpr float magic_num = 16.F;
constexpr float magic_num = 16.077566F;

[[nodiscard]] inline auto
hit_the_road(const float& x, const float& y) -> float
{
return std::max(static_cast<float>(magic_num * erf(0.04F * (y - x))), 0.F);
return std::max(static_cast<float>(magic_num * erf(0.096623257F * (y - x))), 0.040538613F);
}

/* ok this is a little jank, we are calculating jack loss looping over the
Expand Down Expand Up @@ -516,7 +516,7 @@ Calc::InitializeHands(const std::vector<NoteInfo>& NoteInfo,
* degree above the actual max points as a cheap hack to water down some of the
* absurd scaling hs/js/cj had. Note: do not set these values below 1 */
constexpr float tech_pbm = 1.F;
constexpr float jack_pbm = 1.0175F;
constexpr float jack_pbm = 1.0013144F;
constexpr float stream_pbm = 1.01F;
constexpr float bad_newbie_skillsets_pbm = 1.05F;

Expand Down Expand Up @@ -830,6 +830,16 @@ Calc::InitAdjDiff(Calc& calc, const int& hi)
tp_mods[Skill_Jumpstream];
*stam_base = max<float>(a, b);
} break;
case Skill_JackSpeed: {
if (i < calc.jack_diff.at(hi).size()) {
auto* jack_diff = &calc.jack_diff.at(hi).at(i).second;
if (*jack_diff > 0) {
auto tech_funk_at_jacks = calc.soap.at(hi).at(TechBase).at(i) * tp_mods.at(ss) * basescalers.at(ss);
tech_funk_at_jacks /= max<float>(calc.doot.at(hi).at(CJ).at(i) * calc.doot.at(hi).at(CJ).at(i), 1.0F);
*jack_diff = lerp(0.3179549F, *jack_diff, tech_funk_at_jacks / fastsqrt(*jack_diff));
}
}
} break;
case Skill_Chordjack:
*adj_diff *= fastsqrt(calc.doot.at(hi).at(CJOHJump).at(i));
break;
Expand Down Expand Up @@ -944,7 +954,7 @@ MinaSDCalcDebug(
}
}

int mina_calc_version = 441;
int mina_calc_version = 442;
auto
GetCalcVersion() -> int
{
Expand Down
6 changes: 6 additions & 0 deletions src/Etterna/MinaCalc/PatternModHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,9 @@ weighted_average(const float& a, const float& b, const float& x, const float& y)
{
return (x * a + ((y - x) * b)) / y;
}

inline auto
lerp(float t, float a, float b) -> float
{
return (1.F - t)*a + t*b;
}
2 changes: 1 addition & 1 deletion src/Etterna/MinaCalc/UlbuAcolytes.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* patterns have lower enps than streams, streams default to 1 and chordstreams
* start lower, stam is a special case and may use normalizers again */
static const std::array<float, NUM_Skillset> basescalers = {
0.F, 0.93F, 0.885F, 0.84F, 0.925F, 0.91F, 0.8F, 0.83F
0.F, 0.93F, 0.885F, 0.84F, 0.925F, 0.8833277F, 0.8F, 0.83F
};

static const std::string calc_params_xml = "Save/calc params.xml";
Expand Down

0 comments on commit 13f43ed

Please sign in to comment.