Add experimental support for guessing the buy price

master
Mike Bryant 5 years ago
parent 98e2dec711
commit 4bcf881c40

@ -124,6 +124,7 @@
<thead>
<tr>
<th>Pattern</th>
<th>Sunday</th>
<th colspan="2">Monday</th>
<th colspan="2">Tuesday</th>
<th colspan="2">Wednesday</th>
@ -132,6 +133,7 @@
<th colspan="2">Saturday</th>
</tr>
<tr>
<th></th>
<th></th>
<th>AM</th>
<th>PM</th>

@ -521,10 +521,20 @@ function* generate_pattern_3(given_prices) {
function* generate_possibilities(sell_prices) {
if (!isNaN(sell_prices[0])) {
yield* generate_pattern_0(sell_prices);
yield* generate_pattern_1(sell_prices);
yield* generate_pattern_2(sell_prices);
yield* generate_pattern_3(sell_prices);
} else {
for (var buy_price = 90; buy_price < 110; buy_price++) {
sell_prices[0] = sell_prices[1] = buy_price;
yield* generate_pattern_0(sell_prices);
yield* generate_pattern_1(sell_prices);
yield* generate_pattern_2(sell_prices);
yield* generate_pattern_3(sell_prices);
}
}
}
$(document).ready(function () {
@ -584,7 +594,7 @@ $(document).on("input", function() {
var output_possibilities = "";
for (let poss of generate_possibilities(sell_prices)) {
var out_line = "<tr><td>" + poss.pattern_description + "</td>"
for (let day of [...poss.prices].slice(2)) {
for (let day of [...poss.prices].slice(1)) {
if (day.min != day.max) {
out_line += "<td>" + day.min + ".." + day.max + "</td>"
} else {

Loading…
Cancel
Save