|
@@ -1,4 +1,4 @@
|
|
-import { ExtractNumbers, Inspect, LoadInput } from "../common.ts";
|
|
|
|
|
|
+import { ArrayIsOnlyDuplicates, ExtractNumbers, Inspect, LoadInput } from "../common.ts";
|
|
|
|
|
|
const tests = [
|
|
const tests = [
|
|
"0 3 6 9 12 15",
|
|
"0 3 6 9 12 15",
|
|
@@ -39,7 +39,7 @@ function PredictNextValue(histogram: number[]): number[] {
|
|
do {
|
|
do {
|
|
differential = FindDifferential(allDifferentials[0]);
|
|
differential = FindDifferential(allDifferentials[0]);
|
|
allDifferentials.unshift(differential);
|
|
allDifferentials.unshift(differential);
|
|
- } while (SumArray(differential) != 0);
|
|
|
|
|
|
+ } while (!ArrayIsOnlyDuplicates(differential));
|
|
|
|
|
|
while (allDifferentials.length > 1) {
|
|
while (allDifferentials.length > 1) {
|
|
// Store the last value of previous differential, and remove that differential from the list
|
|
// Store the last value of previous differential, and remove that differential from the list
|