Skip to content

Commit

Permalink
bias cj_static toward common values, stop upscaling cj pmods | 481
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Jul 8, 2022
1 parent ab74368 commit 81bff01
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/Etterna/MinaCalc/Agnostic/HA_PatternMods/CJ.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct CJMod
#pragma region params

float min_mod = 0.6F;
float max_mod = 1.1F;
float max_mod = 1.F;
float mod_base = 0.4F;
float prop_buffer = 1.F;

Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/MinaCalc/Agnostic/HA_PatternMods/CJDensity.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct CJDensityMod
#pragma region params

float min_mod = 0.98F;
float max_mod = 1.08F;
float max_mod = 1.F;
float base = 0.F;

float single_scaler = 1.F;
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/MinaCalc/MinaCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ MinaSDCalcDebug(
}
}

int mina_calc_version = 480;
int mina_calc_version = 481;
auto
GetCalcVersion() -> int
{
Expand Down
96 changes: 75 additions & 21 deletions src/Etterna/MinaCalc/SequencedBaseDiffCalc.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once
#include "SequencingHelpers.h"
#include <array>
#include <unordered_map>


/* MS difficulty bases are going to be sequence constructed row by row here, the
* nps base may be moved here later but not right now. we'll use statically
Expand Down Expand Up @@ -217,6 +219,36 @@ struct nps

struct ceejay
{
const std::string name = "CJ_Static";

#pragma region params

float static_ms_weight = .65F;
float min_ms = 75.F;

float base_tap_scaler = 3.F;
float huge_anchor_scaler = 1.15F;
float small_anchor_scaler = 1.15F;
float ccj_scaler = 1.25F;
float cct_scaler = 1.5F;
float ccn_scaler = 1.15F;
float ccb_scaler = 1.25F;

const std::vector<std::pair<std::string, float*>> _params{
{ "static_ms_weight", &static_ms_weight },
{ "min_ms", &min_ms },
{ "base_tap_scaler", &base_tap_scaler },
{ "huge_anchor_scaler", &huge_anchor_scaler },
{ "small_anchor_scaler", &small_anchor_scaler },
{ "chord-chord-jack_scaler", &ccj_scaler },
{ "chord-chord-tap_scaler", &cct_scaler },
{ "chord-chord-no-anchors_scaler", &ccn_scaler },
{ "chordjacks_beginning_scaler", &ccb_scaler },
};

#pragma endregion params and param map


void update_flags(const unsigned& row_notes, const int& row_count)
{
is_cj = last_row_count > 1 && row_count > 1;
Expand All @@ -240,53 +272,53 @@ struct ceejay
void advance_base(const float& any_ms, Calc& calc)
{
if (row_counter >= max_rows_for_single_interval) {
{
{
return;
}
}
return;
}

// pushing back ms values, so multiply to nerf
float pewpew = 3.F;
float pewpew = base_tap_scaler;

if (is_at_least_3_note_anch && last_was_3_note_anch) {
// biggy boy anchors and beyond
pewpew = 1.15F;
pewpew = huge_anchor_scaler;
} else if (is_at_least_3_note_anch) {
// big boy anchors
pewpew = 1.15F;
pewpew = small_anchor_scaler;
} else {
// single note
if (!is_cj) {
if (is_scj) {
// was cj a little bit ago..
if (was_cj) {
// single note jack with 2 chords behind it
pewpew = 1.25F;
// ccj (chord chord jack)
pewpew = ccj_scaler;
} else {
// single note, not a jack, 2 chords behind
// it
pewpew = 1.5F;
// cct (chord chord tap)
pewpew = cct_scaler;
}
}
} else {
// actual cj
if (was_cj) {
// cj now and was cj before, but not necessarily
// with strong anchors
pewpew = 1.15F;
// ccn (chord chord no anchor)
pewpew = ccn_scaler;
} else {
// cj now but wasn't even cj before
pewpew = 1.25F;
// ccb (chordjack beginning)
pewpew = ccb_scaler;
}
}
}

// single note streams / regular jacks should retain the 3x
// single note streams / regular jacks should retain the base
// multiplier

calc.cj_static.at(row_counter) = std::max(75.F, any_ms * pewpew);
const auto ms = std::max(min_ms, any_ms * pewpew);
calc.cj_static.at(row_counter) = ms;
++row_counter;
}

Expand All @@ -297,16 +329,30 @@ struct ceejay
return 0.F;
}

float ms_total = 0.F;
// ms vals to counts
std::unordered_map<int, int> mode;
std::vector<float> static_ms;
for (int i = 0; i < row_counter; ++i) {
{
{
ms_total += calc.cj_static.at(i);
}
const auto v = static_cast<int>(calc.cj_static.at(i));
static_ms.push_back(calc.cj_static.at(i));
mode[v]++; // this is safe
}
auto modev = 0;
auto modefreq = 0;
for (auto it = mode.begin(); it != mode.end(); it++) {
if (it->second > modefreq) {
modev = it->first;
modefreq = it->second;
}
}
for (auto i = 0; i < static_ms.size(); i++) {
// weight = 0 means all values become modev
static_ms.at(i) =
weighted_average(static_ms.at(i), modev, static_ms_weight, 1.F);
}

float ms_mean = ms_total / static_cast<float>(row_counter);
const auto ms_total = sum(static_ms);
const auto ms_mean = ms_total / static_cast<float>(row_counter);
return ms_to_scaled_nps(ms_mean);
}

Expand Down Expand Up @@ -434,6 +480,13 @@ struct techyo
rm_itv_max_diff = 0.F;
}

void full_reset()
{
row_counter = 0;
rm_itv_max_diff = 0.F;
teehee.zero();
}

private:
// how many non-empty rows have we seen
int row_counter = 0;
Expand Down Expand Up @@ -481,5 +534,6 @@ struct diffz
{
interval_end();
_cj.full_reset();
_tc.full_reset();
}
};
11 changes: 10 additions & 1 deletion src/Etterna/MinaCalc/Ulbu.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ struct TheGreatBazoinkazoinkInTheSky
handle_dependent_interval_end(itv);
}
PatternMods::run_dependent_smoothing_pass(_calc.numitv, _calc);
Smooth(_calc.init_base_diff_vals.at(hand).at(CJBase), 0.F, _calc.numitv);
//Smooth(_calc.init_base_diff_vals.at(hand).at(CJBase), 0.F, _calc.numitv);

// ok this is pretty jank LOL, just increment the hand index
// when we finish left hand
Expand Down Expand Up @@ -566,6 +566,10 @@ struct TheGreatBazoinkazoinkInTheSky
}
paramsLoaded = true;

// cj base
load_params_for_mod(&params, _diffz._cj._params, _diffz._cj.name);

// pmods
load_params_for_mod(&params, _s._params, _s.name);
load_params_for_mod(&params, _js._params, _js.name);
load_params_for_mod(&params, _hs._params, _hs.name);
Expand Down Expand Up @@ -594,6 +598,11 @@ struct TheGreatBazoinkazoinkInTheSky
auto* calcparams = new XNode("CalcParams");
calcparams->AppendAttr("vers", GetCalcVersion());

// cj base
calcparams->AppendChild(
make_mod_param_node(_diffz._cj._params, _diffz._cj.name));

// pmods
calcparams->AppendChild(make_mod_param_node(_s._params, _s.name));
calcparams->AppendChild(make_mod_param_node(_js._params, _js.name));
calcparams->AppendChild(make_mod_param_node(_hs._params, _hs.name));
Expand Down
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.93F, 1.02F, .95F, 0.9F
0.F, 0.93F, 0.885F, 0.84F, 0.93F, 1.02F, 1.F, 0.9F
};

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

0 comments on commit 81bff01

Please sign in to comment.