Created
August 8, 2017 02:09
-
-
Save Sam-Belliveau/68de6b08eb30b096a0dd65637a6ec2f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class main { | |
// List has 5 parts to it | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
double[] list = {0, 0, 0, 0, 0}; | |
while (true) | |
{ | |
System.out.println("Enter 5 Numbers Pressing Enter Inbetween Each One."); | |
System.out.print("Number 1: "); | |
list[0] = input.nextDouble(); | |
System.out.print("Number 2: "); | |
list[1] = input.nextDouble(); | |
System.out.print("Number 3: "); | |
list[2] = input.nextDouble(); | |
System.out.print("Number 4: "); | |
list[3] = input.nextDouble(); | |
System.out.print("Number 5: "); | |
list[4] = input.nextDouble(); | |
pattern(list); | |
} | |
} | |
// Use network to predict output | |
public static void pattern(double[] inputList){ | |
// Breaks Down To 4 | |
double[] layerOne = {(inputList[1]-inputList[0]), (inputList[2]-inputList[1]), (inputList[3]-inputList[2]), (inputList[4]-inputList[3]), }; | |
// Breaks Down To 3 | |
double[] layerTwo = {(layerOne[1]-layerOne[0]), (layerOne[2]-layerOne[1]), (layerOne[3]-layerOne[2]), }; | |
// Breaks Down To 2 | |
double[] layerThree = {(layerTwo[1]-layerTwo[0]), (layerTwo[2]-layerTwo[1])}; | |
// Finds broken down number | |
double rootNumber = (layerThree[1]-layerThree[0]); | |
// PREDICTION TIME!!! | |
// use the data that I made to predict the next number. | |
// 1st Guess | |
double l2a1 = rootNumber + layerThree[1]; | |
double l3a1 = l2a1 + layerTwo[2]; | |
double l4a1 = l3a1 + layerOne[3]; | |
double l5a1 = l4a1 + inputList[4]; | |
// 2nd Guess | |
double l2a2 = l2a1 + rootNumber; | |
double l3a2 = l2a2 + l3a1; | |
double l4a2 = l3a2 + l4a1; | |
double l5a2 = l4a2 + l5a1; | |
// 3rd Guess | |
double l2a3 = l2a1 + rootNumber; | |
double l3a3 = l2a3 + l3a2; | |
double l4a3 = l3a3 + l4a2; | |
double l5a3 = l4a3 + l5a2; | |
// Print prediction | |
System.out.println("\n" + l5a1 + ", " + l5a2 + ", " + l5a3); | |
if (rootNumber==0){ | |
System.out.println("I am 100% sure about my guess.\n"); | |
}else{ | |
System.out.println("I am not 100% sure about my guess.\n"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment