From b1c7860aa6c028c01565e1138f667227982daae4 Mon Sep 17 00:00:00 2001 From: Frederik Goovaerts Date: Fri, 24 Apr 2020 23:46:51 +0200 Subject: [PATCH] Calculate with estimated buy price without modifying original input values --- js/predictions.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/predictions.js b/js/predictions.js index 9c81e3a..27329f9 100644 --- a/js/predictions.js +++ b/js/predictions.js @@ -810,13 +810,14 @@ class Predictor { * generate_possibilities(sell_prices, first_buy, previous_pattern) { if (first_buy || isNaN(sell_prices[0])) { for (var buy_price = 90; buy_price <= 110; buy_price++) { - sell_prices[0] = sell_prices[1] = buy_price; + const temp_sell_prices= sell_prices.slice() + temp_sell_prices[0] = temp_sell_prices[1] = buy_price; if (first_buy) { - yield* this.generate_pattern_3(sell_prices); + yield* this.generate_pattern_3(temp_sell_prices); } else { // All buy prices are equal probability and we're at the outmost layer, // so don't need to multiply_generator_probability here. - yield* this.generate_all_patterns(sell_prices, previous_pattern) + yield* this.generate_all_patterns(temp_sell_prices, previous_pattern) } } } else {