Moment For Technology

I wrote a predicted bicolor ball number Java code

Posted on Nov. 27, 2023, 8:40 p.m. by Alyssa Mendoza
Category: The back-end Tag: The back-end

The principle is based on the historical data of the two-color ball lottery, according to various random factors such as the eight trigrams of the BOOK of Changes, the timing of the day to predict the number of the next phase of the two-color ball. The full code is on my Github:

Mainframe. Java is the main program:

package ball;

public class MainFrame
{
	public static void main(String[] args) 
	{
		Processor processor = new Processor();
		HistoryRecordEntry entry = new HistoryRecordEntry();
		
		// fill history data
		/ / 2003001
		processor.insert(10.11.12.13.26.28.11);
		processor.insert( 4.9.19.20.21.26.12);
		processor.insert( 1.7.10.23.28.32.16);
		processor.insert( 4.6.7.10.13.25.3);
		processor.insert( 4.6.15.17.30.31.16);
		processor.insert( 1.3.10.21.26.27.6);
		processor.insert( 1.9.19.21.23.26.7);
		processor.insert( 5.8.9.14.17.23.8);
		processor.insert( 5.9.18.20.22.30.9);
		processor.insert( 1.2.8.13.17.24.13);
		processor.insert( 4.5.11.12.30.32.15);
		processor.insert( 2.12.16.17.27.30.12); / / 2003012
		processor.insert( 8.13.17.21.23.32.12);
		processor.insert( 3.5.7.8.21.31.2);
		processor.insert( 4.11.19.25.26.32.13);
		processor.insert(11.17.28.30.31.33.6);
		processor.insert( 5.8.18.23.25.31.6); / / 2003017

		System.out.println("Current Number: "+ processor.getTotalRecordNumber()); processor.start(); }}Copy the code

I'll use class HistoryRecordEntry to describe the bichromatic history of each issue:

package ball;


public class HistoryRecordEntry 
{
	private int[] Number;
	
	public HistoryRecordEntry(a)
	{
		Number = new int[Configuration.MaxDigit];
	}
	public int getNumberFromDigit(int Digit)
	{
		return Number[Digit];
	}
	public void fillData(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7 )
	{
		Number[0] = arg1;
		Number[1] = arg2;
		Number[2] = arg3;
		Number[3] = arg4;
		Number[4] = arg5;
		Number[5] = arg6;
		Number[6] = arg7; }}Copy the code

Each segment of the recorded history in each phase was also described in a separate class: OccuranceForEachNumber

package ball;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import java.util.Vector;
import java.util.Map.Entry;

/* example: 13 occurs 15 time * 2 occurs 12 time */

public class OccuranceForEachNumber
{
	private HashMapInteger,Integer OccuranceEachDigit = null;
	
	private HashMapInteger,VectorInteger CondensedOccurance = null;
	
	public OccuranceForEachNumber(a)
	{
		OccuranceEachDigit = new HashMapInteger,Integer();
	}
	public boolean isNumberExist(int Number)
	{
		return OccuranceEachDigit.containsKey(Number);
	}
	public void updateNumberOccurance(int Number)
	{
		int CurrentOccurance = OccuranceEachDigit.get(Number);
		CurrentOccurance++;
		OccuranceEachDigit.put(Number,CurrentOccurance);
	}
	
	public void initialNumberOccurance(int Number)
	{
		OccuranceEachDigit.put(Number, 1);
	}
	
	public void ListOccuranceForEachNumber(a)
	{
		SetEntryInteger, Integer set = OccuranceEachDigit.entrySet();
		IteratorEntryInteger, Integer itor = set.iterator();
		while(itor.hasNext())
		{
		   EntryInteger, Integer entry = itor.next();
		   int Digit = entry.getKey();
		   System.out.println("Number: " + Digit + " Occurance: "+ entry.getValue() ); }}public void condense(a)
	{
		if(CondensedOccurance ! =null )
			CondensedOccurance.clear();
		CondensedOccurance = new HashMapInteger,VectorInteger();
		SetEntryInteger, Integer set = OccuranceEachDigit.entrySet();
		IteratorEntryInteger, Integer itor = set.iterator();
		while(itor.hasNext())
		{
			EntryInteger, Integer entry = itor.next();
			int NumberwithOccurance = entry.getKey();
			int Occurance = entry.getValue();
			if( CondensedOccurance.containsKey(entry.getValue()) == false)
			{
				VectorInteger NumberListWithSameOccurance = new VectorInteger();	
				NumberListWithSameOccurance.add(NumberwithOccurance);
				CondensedOccurance.put(Occurance, NumberListWithSameOccurance);
			}
			else
			{
				VectorInteger existingNumberList = CondensedOccurance.get(Occurance);
				existingNumberList.add(NumberwithOccurance);
				CondensedOccurance.put(Occurance, existingNumberList);
			}
		}
		SetEntryInteger, VectorInteger Revertset = CondensedOccurance.entrySet();
		IteratorEntryInteger, VectorInteger Revertitor = Revertset.iterator();
		while(Revertitor.hasNext())
		{
			EntryInteger, VectorInteger entry = Revertitor.next();
			System.out.println("Occruance: " + entry.getKey());
			for( int i = 0 ; i  entry.getValue().size(); i ++)
			{
				System.out.println("Number with same Occurance: "+ entry.getValue().elementAt(i)); }}}}Copy the code

Aggregation class for each bit:

package ball;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import java.util.Map.Entry;

public class OccuranceOverview
{
	private HashMapInteger,OccuranceForEachNumber OccuranceOverview = null;
	public OccuranceOverview()
	{
		OccuranceOverview = new HashMapInteger,OccuranceForEachNumber();
		for ( int i = 0 ; i  Configuration.MaxDigit; i++ )
		{
			OccuranceForEachNumber Occurance4EachNumber = new OccuranceForEachNumber();
			OccuranceOverview.put(i,Occurance4EachNumber);
		}
	}
	
	public OccuranceForEachNumber getOccuranceInstanceByDigit(int Digit)
	{
		return OccuranceOverview.get(Digit);
	}
	
	public void updateDigitOccurance(int Digit,OccuranceForEachNumber OccuranceInstance)
	{
		OccuranceOverview.put(Digit, OccuranceInstance);
	}
	public void listOccuranceForEachDigit()
	{
		SetEntryInteger, OccuranceForEachNumber set = OccuranceOverview.entrySet();
		IteratorEntryInteger, OccuranceForEachNumber itor = set.iterator();
		while(itor.hasNext())
		{
		   EntryInteger, OccuranceForEachNumber entry = itor.next();
		   int Digit = entry.getKey();
		   System.out.println("**************** Digit: " + Digit + " Information Begin! * * * * * * * * * * * * *");
		   entry.getValue().ListOccuranceForEachNumber();
		   System.out.println("**************** Condensed Information! * * * * * * * * * *"); entry.getValue().condense(); }}}Copy the code

Execute mainframe. Java to extrapolate the results of the next installment based on the past history. The more historical records, the more accurate the results.

For more of Jerry's original articles, please follow the public account "Wang Zixi ":

Search
About
mo4tech.com (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.