Skip to content

Commit 0fa0117

Browse files
move jack stuff to vectors
1 parent 23711d0 commit 0fa0117

File tree

4 files changed

+45
-36
lines changed

4 files changed

+45
-36
lines changed

src/Etterna/MinaCalc/MinaCalc.cpp

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ TotalMaxPoints(const Calc& calc) -> float
5959

6060
auto
6161
Calc::CalcMain(const vector<NoteInfo>& NoteInfo,
62-
float music_rate,
63-
float score_goal) -> vector<float>
62+
const float music_rate,
63+
const float score_goal) -> vector<float>
6464
{
6565
// in flux
6666
const auto grindscaler =
@@ -296,26 +296,36 @@ jackloss(const float& x, Calc& calc, const int& hi) -> float
296296
{
297297
auto total = 0.F;
298298

299-
// interval loop
300-
for (auto itv = 0; itv < calc.numitv; ++itv) {
301-
auto itv_total = 0.F;
302-
303-
// rows per interval now
304-
for (auto row = 0; row < calc.itv_jack_diff_size.at(hi).at(itv);
305-
++row) {
306-
const auto& y = calc.jack_diff.at(hi).at(itv).at(row);
307-
308-
if (x < y && y > 0.F) {
309-
const float row_loss = hit_the_road(x, y);
310-
itv_total += row_loss > 0.F ? row_loss : 0.F;
311-
}
299+
for (const auto& y : calc.jack_diff.at(hi)) {
300+
if (x < y && y > 0.F) {
301+
const auto zzerp = hit_the_road(x, y);
302+
calc.jack_loss.at(hi).push_back(zzerp);
303+
total += zzerp;
312304
}
313-
314-
// this is per _interval_, but calculated by row scanning
315-
calc.jack_loss.at(hi).at(itv) = itv_total;
316-
total += itv_total;
317305
}
306+
318307
return total;
308+
309+
//// interval loop
310+
// for (auto itv = 0; itv < calc.numitv; ++itv) {
311+
// auto itv_total = 0.F;
312+
313+
// // rows per interval now
314+
// for (auto row = 0; row < calc.itv_jack_diff_size.at(hi).at(itv);
315+
// ++row) {
316+
// const auto& y = calc.jack_diff.at(hi).at(itv).at(row);
317+
318+
// if (x < y && y > 0.F) {
319+
// const float row_loss = hit_the_road(x, y);
320+
// itv_total += row_loss > 0.F ? row_loss : 0.F;
321+
// }
322+
// }
323+
324+
// // this is per _interval_, but calculated by row scanning
325+
// calc.jack_loss.at(hi).at(itv) = itv_total;
326+
// total += itv_total;
327+
//}
328+
// return total;
319329
}
320330

321331
// debug bool here is NOT the one in Calc, it is passed from chisel

src/Etterna/MinaCalc/MinaCalc.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,13 @@ class Calc
138138
* but that might just be too confusing idk */
139139
std::array<float, max_intervals> stam_adj_diff{};
140140

141-
std::array<std::array<std::array<float, max_rows_for_single_interval>,
142-
max_intervals>,
143-
num_hands>
144-
jack_diff{};
141+
std::array<std::vector<float>, num_hands> jack_diff{};
145142

146143
// number of jacks by hand for intervals
147-
std::array<std::array<int, max_intervals>, num_hands> itv_jack_diff_size{};
144+
// std::array<std::array<int, max_intervals>, num_hands>
145+
// itv_jack_diff_size{};
148146

149-
// we may want to store this value for use in other skillset passes- maybe
150-
std::array<std::array<float, max_intervals>, num_hands> jack_loss{};
147+
std::array<std::vector<float>, num_hands> jack_loss{};
151148

152149
// base techdifficulty per row of current interval being scanned
153150
std::array<float, max_rows_for_single_interval> tc_static{};

src/Etterna/MinaCalc/MinaCalcHelpers.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,13 @@ set_jack_diff_debug(Calc& calc, const int& hi)
6767
float diff_total = 0.F;
6868
int counter = 0;
6969

70-
// rows per interval now
71-
for (int row = 0; row < calc.itv_jack_diff_size.at(hi).at(itv); ++row) {
72-
diff_total += calc.jack_diff.at(hi).at(itv).at(row);
73-
++counter;
74-
}
70+
//// rows per interval now
71+
// for (int row = 0; row < calc.itv_jack_diff_size.at(hi).at(itv);
72+
// ++row) { diff_total += calc.jack_diff.at(hi).at(itv).at(row);
73+
// ++counter;
74+
//}
7575

7676
// technically this is kind of a waste of an array but whatever
77-
calc.soap.at(hi)[JackBase].at(itv) =
78-
counter > 0 ? diff_total / static_cast<float>(counter) : 0.F;
77+
calc.soap.at(hi)[JackBase].at(itv) = 1.F;
7978
}
8079
}

src/Etterna/MinaCalc/Ulbu.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@ struct TheGreatBazoinkazoinkInTheSky
321321
{
322322
// jack speed updates with highest anchor difficulty seen
323323
// _between either column_ for _this row_
324-
_calc.jack_diff.at(hand).at(itv).at(jack_counter) =
324+
_calc.jack_diff.at(hand).push_back(
325325
ms_to_scaled_nps(_seq._as.get_lowest_anchor_ms()) *
326-
basescalers[Skill_JackSpeed];
326+
basescalers[Skill_JackSpeed]);
327327

328328
// tech updates with a convoluted mess of garbage
329329
_diffz._tc.advance_base(_seq, ct, _calc);
@@ -359,6 +359,9 @@ struct TheGreatBazoinkazoinkInTheSky
359359
auto ct = col_init;
360360
full_hand_reset();
361361

362+
// arrays are super bug prone with jacks so try vectors for now
363+
_calc.jack_diff.at(hand).clear();
364+
362365
nps::actual_cancer(_calc, hand);
363366

364367
// maybe we _don't_ want this smoothed before the tech pass? and so
@@ -429,7 +432,7 @@ struct TheGreatBazoinkazoinkInTheSky
429432
}
430433

431434
// maybe this should go back into the diffz object...
432-
_calc.itv_jack_diff_size.at(hand).at(itv) = jack_counter;
435+
// _calc.itv_jack_diff_size.at(hand).at(itv) = jack_counter;
433436

434437
handle_dependent_interval_end(itv);
435438
}

0 commit comments

Comments
 (0)