# Parsing By Prediction Algorithm(?)

• September 30th, 2009, 02:39 AM
benjamin
Parsing By Prediction Algorithm(?)
I've got a bit of a conundrum and can't seem to find any applicable information anywhere as to how to code some sort of predicting algorithm. Here's what I have so far:
Code :

```ArrayList<String> lotto = new ArrayList<String>(); //Initialize lotto values// lotto.add("344167724"); lotto.add("6413143"); lotto.add("2"); //this value needs to be appended to either the one preceding or following it lotto.add("76111374132"); lotto.add("44132"); lotto.add("27446113"); lotto.add("11"); //this value needs to (also) be appended to either the one preceding or following it lotto.add("4634181")```

Now I cannot use small numbers alone (5 is an acceptable minimum for my purposes here), so obviously the 3rd and 7th values here aren't any good on there own. Is there a way I can determine which value it likely belongs to using some sort of pattern recognition? And if so, where can I find any relevant information on it? Thanks alot!
• September 30th, 2009, 03:32 AM
Json
Re: Parsing By Prediction Algorithm(?)
This is not really my area but hang on for helloworld to show up, he seems to like these kind of things :)

// Json
• September 30th, 2009, 04:12 AM
Dalisra
Re: Parsing By Prediction Algorithm(?)
What are you trying to do? To gues a number? Or are you trying to create a list of random numbers?
I don't quite understood what is your prediction supposed to be..
• September 30th, 2009, 12:29 PM
benjamin
Re: Parsing By Prediction Algorithm(?)
I'm trying to get my program to determine where numbers such as the 3rd and 5th belong, based on patterns that exist through the other 6 ("valid") numbers. Should the 3rd number be appended to end of 2nd number, or the beginning of the 4th? Something like that. Hope that clarified it.
• September 30th, 2009, 03:14 PM
benjamin
Re: Parsing By Prediction Algorithm(?)
Not sure if I was clear enough earlier, but I've been working on a sort of pattern assembler, trying to break the pattern down from numbers to a simple: "hi/lo/nc" (nc=no change)

Here's what I've got at the moment:
Code :

``` public static void pattern() { ArrayList<String> desc = new ArrayList<String>(); desc.add("nc"); String numbers = "3441677246413413"; //Here, I've taken the first two "valid" nums from above array int num1 = numbers.charAt(0), num2; System.out.println("---"+numbers+"---"); for (int count = 1; count < numbers.length(); count++) { num2 = numbers.charAt(count); if (num2<num1) {desc.add("lo");} else if (num2>num1) {desc.add("hi");} else {desc.add("nc");}   num1 = numbers.charAt(count); }   for (int count = 0;count<desc.size();count++) { System.out.println(desc.get(count)); }//end of for loop }//end of pattern() method```

Output is as follows:
Code :

```=====================PATTERN=============== ---3441677246413413--- nc hi nc lo hi hi nc lo hi hi lo lo hi hi lo hi```
This is the output for the first two "valid" numbers, and it could tell me if the third number (2) belongs in this sequence, simply by predicting if the next number should be higher or lower than the previous.

Does this make sense? Anyone have any thoughts? Thanks!
• September 30th, 2009, 03:21 PM
helloworld922
Re: Parsing By Prediction Algorithm(?)
hmm... what is this for? I can't seem to pick up any pattern in those numbers. I did some research on Lotto/Lottery, and it seems that it's based on choosing 6 random numbers, and depending on which lottery, the possible range for those numbers. In general, it's impossible to predict the results unless the mechanism for choosing the numbers is flawed/can be predicted. Further more, numbers are generally 1-49, or 1-99, not huge like those.

For the computer to "figure out" an arbitrary pattern is beyond my knowledge... there are just too many possibilities.

edit: haha, was typing this before you put your last post. I'll have to take a look at that later tonight when i have time.

edit2: Yeah, I'm still lost at what it is you want. What larger purpose are you trying to satisfy here?