Squashed commit of the following:

commit 4d46f7cfbda7d1818c5c07d22dce160fc5893ff4
Author: Nathan Abel <abel8706@kettering.edu>
Date:   Wed Apr 15 12:43:30 2020 -0400

    Delete launch.json

    This is a vscode config file. I forgot to remove it :)

commit 96341d0030224d612fbd9bd20ca7c82405f817a9
Author: Nathan Abel <abel8706@kettering.edu>
Date:   Wed Apr 15 12:40:15 2020 -0400

    Handle Missing Patterns

commit 7d995d5695861f81b1500ea63cbd0233530c9dea
Author: Nathan Abel <abel8706@kettering.edu>
Date:   Wed Apr 15 12:27:29 2020 -0400

    Line break added

commit a0b5f13db7504e2d3793cab7527b84cbe2b192c4
Author: Nathan Abel <abel8706@kettering.edu>
Date:   Wed Apr 15 12:25:33 2020 -0400

    Merge results into one col

commit 6576eb1a55cdb978aca73cb16547fd87a41477c2
Author: Nathan Abel <abel8706@kettering.edu>
Date:   Wed Apr 15 12:13:44 2020 -0400

    Fix Sorting and Add Category Row

commit c9b257cf6f7487c271be5d3801399cc7cd92e67b
Merge: 511ef3c 8f49882
Author: Nathan Abel <abel8706@kettering.edu>
Date:   Wed Apr 15 12:11:04 2020 -0400

    Merge branch 'master' of https://github.com/mikebryant/ac-nh-turnip-prices into category_total_chance

commit 511ef3caad223a4da0cd7f6ce4e68c5d108cbadd
Author: Nathan Abel <abel8706@kettering.edu>
Date:   Mon Apr 13 11:49:58 2020 -0400

    Fix it better :)

commit fcb0429fa1711534ffe875b94fddfb54c33a75df
Author: Nathan Abel <abel8706@kettering.edu>
Date:   Mon Apr 13 11:42:45 2020 -0400

    Fix sort function
master
Nathan Abel 4 years ago committed by Mike Bryant
parent 0fe3554bcd
commit 2218c10d77

@ -845,15 +845,21 @@ function analyze_possibilities(sell_prices, first_buy, previous_pattern) {
poss.weekGuaranteedMinimum = Math.max(...weekMins);
poss.weekMax = Math.max(...weekMaxes);
}
category_totals = {}
for (let i of ["Fluctuating", "Decreasing", "Small spike", "Large spike"]) {
category_totals[i] = generated_possibilities
.filter(value => value.pattern_description == i)
.map(value => value.probability)
.reduce((previous, current) => previous + current, 0)
console.log(category_totals[i])
}
for (let pos of generated_possibilities) {
pos.category_total_probability = category_totals[pos.pattern_description]
}
generated_possibilities.sort((a, b) => {
if (a.weekMax < b.weekMax) {
return 1;
} else if (a.weekMax > b.weekMax) {
return -1;
} else {
return 0;
}
return b.category_total_probability - a.category_total_probability
});
global_min_max = [];

@ -256,9 +256,18 @@ const calculateOutput = function (data, first_buy, previous_pattern) {
}
let output_possibilities = "";
let analyzed_possibilities = analyze_possibilities(data, first_buy, previous_pattern);
previous_pattern_description = ""
for (let poss of analyzed_possibilities) {
var out_line = "<tr><td class='table-pattern'>" + poss.pattern_description + "</td>"
out_line += `<td>${Number.isFinite(poss.probability) ? ((poss.probability * 100).toPrecision(3) + '%') : '—'}</td>`;
if (previous_pattern_description != poss.pattern_description) {
previous_pattern_description = poss.pattern_description
pattern_count = analyzed_possibilities
.filter(val => val.pattern_description == poss.pattern_description)
.length
percentage_display = percent => Number.isFinite(percent) ? ((percent * 100).toPrecision(3) + '%') : '—'
out_line += `<td rowspan=${pattern_count}>${percentage_display(poss.category_total_probability)} <br />`;
out_line += Number.isFinite(poss.probability) ? `(${pattern_count} @ ${percentage_display(poss.probability)})</td>` : "";
}
for (let day of poss.prices.slice(1)) {
if (day.min !== day.max) {
out_line += `<td>${day.min} ${i18next.t("output.to")} ${day.max}</td>`;

Loading…
Cancel
Save