Beispiel #1
1
  @Test
  private void testWinning() throws Exception {
    LotteryResultsLoader loader =
        new JSONLotteryResultsLoader<Lotto6aus9LotteryResults>(
            LOTTO6AUS9_RESULTS_FILE, Lotto6aus9LotteryResults.class);
    LotteryResults results = loader.load();
    results.shrink(10);
    FrequencyQuery fquery = new FrequencyQuery<Lotto6aus49>(results);
    FrequencyQuery reversefquery = new FrequencyQuery<Lotto6aus49>(results);
    //        reversefquery.setReverse(true);
    final ArrayList<Integer> topNumbersSet = fquery.topNumbersSet(30);
    topNumbersSet.removeAll(
        new Lotto6aus9LotteryResults(results, 1)
            .getGames()
            .iterator()
            .next()
            .getNumbers()
            .getNumbers());
    //        final Set<Integer> bottomNumbersSet = reversefquery.topNumbersSet(15);
    //        topNumbersSet.addAll(bottomNumbersSet);

    EffectivenessRank effectivenessRank = new EffectivenessRank(results);
    subsets(topNumbersSet, 6, effectivenessRank);

    for (Map.Entry<Double, GenericResult> entry : effectivenessRank.getRank().entrySet()) {
      System.out.println(entry.getKey() + ": ");
      entry.getValue().printResult();
      System.out.println();
    }
  }
Beispiel #2
0
 @Test
 public void testGetResults() throws Exception {
   GetResults res = new GetResults();
   Lotto6aus9LotteryResults results;
   LotteryResultsLoader loader =
       new JSONLotteryResultsLoader<Lotto6aus9LotteryResults>(
           LOTTO6AUS9_RESULTS_FILE, Lotto6aus9LotteryResults.class);
   try {
     results = (Lotto6aus9LotteryResults) loader.load();
   } catch (Exception e) {
     results = new Lotto6aus9LotteryResults();
   }
   GCIDList gciDs = res.getGCIDs(new Lotto6aus49(), "2016");
   //        gciDs.top(3);
   int i = 0;
   for (GCID g : gciDs) {
     i++;
     if (!results.isStored(g)) {
       System.out.println("Getting new result [ " + i + " / " + gciDs.size() + " ]");
       Lotto6aus49 l69 = new Lotto6aus49();
       l69.getResult(g);
       l69.printResult();
       results.add(l69);
     }
   }
   loader.save(results);
   System.out.print("Count of results: " + results.getGames().size());
 }
Beispiel #3
0
  @Test
  private void testEff() throws IOException {
    LotteryResultsLoader loader =
        new JSONLotteryResultsLoader<Lotto6aus9LotteryResults>(
            LOTTO6AUS9_RESULTS_FILE, Lotto6aus9LotteryResults.class);
    LotteryResults results = loader.load();
    //        results.shrink(11);
    EffectivenessQuery<Lotto6aus49> effectivenessQuery = new EffectivenessQuery<>(results);
    GenericResult result = new GenericResult();
    //        result.add(14);
    //        result.add(16);
    //        result.add(23);
    //        result.add(26);
    //        result.add(46);
    //        result.add(48);

    result.add(14);
    result.add(17);
    result.add(26);
    result.add(34);
    result.add(41);
    result.add(49);
    double effectiveness = effectivenessQuery.getEffectiveness(result, true);
    System.out.println("Eff: " + effectiveness);
  }
Beispiel #4
0
  @Test
  private void testFunctionality() throws Exception {
    LotteryResultsLoader loader =
        new JSONLotteryResultsLoader<Lotto6aus9LotteryResults>(
            LOTTO6AUS9_RESULTS_FILE, Lotto6aus9LotteryResults.class);
    LotteryResults results = loader.load();
    FrequencyQuery fquery = new FrequencyQuery<Lotto6aus49>(results);
    fquery.lastLotteries(14);
    Set<Map.Entry<Integer, Integer>> set = fquery.topNumbers(30);
    ArrayList<Integer> toRemove =
        new Lotto6aus9LotteryResults(results, 1)
            .getGames()
            .iterator()
            .next()
            .getNumbers()
            .getNumbers();

    for (Map.Entry<Integer, Integer> e : set) {
      System.out.println(
          e.getKey() + "\t->\t" + e.getValue() + (toRemove.contains(e.getKey()) ? "*" : ""));
    }
  }