Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Powerball Frequency Analyzer

by bnsmith001 (Initiate)
on Sep 26, 2008 at 18:30 UTC ( #713929=note: print w/replies, xml ) Need Help??

in reply to Powerball Frequency Analyzer

I took a look at chromatic's program from 2000. Great code to start from.

I updated the code to process the current winnums-text.txt file, after you've saved it to disk and stripped the one header line, and deleted draws before 08/31/2005 (the last modification to the game).
Also, my mod'd version of your program -
1) analyzes powerball and white balls separately,
2) determines a list of "cold" low count balls, "mid" middle count balls, and "hot" high count balls, and
3) does not report the Power Pick (or multiplier).

I will continue to tweek it until it is acceptable to me, and I'll probably post it to a new page here on Perl Monks with the same attribution currently in the code when my verison is to the point that it can --
1) use GET to access the current file, and
2) ignore the first header line while processing(will have to change the foreach to a while, I think... I know I've done this before on another Perl project).

Anyway, here's my copy after working for a few mins updating a couple of things and changing the reported numbers slightly ...

My current listing follows (I hope) --

#!/usr/bin/perl -w # originally from # Powerball Frequency Analyzer # by chromatic (Bishop) # originally based upon old pbhist.txt # updated to current history # also run current "winnums-text.txt" format with no header line # with draws since last rule change in 2005/08/31 # use strict; use warnings; use LWP::Simple; my (@numbers, %normals, %powerb, %powers); my $content; #### bns - updated the link to the draw file ## unless (defined ($content = get(' +bhist.txt'))) { ## die "Cannot get PB history.\n"; ## } ## unless (defined ($content = get(' +/winnums-text.txt'))) { ## die "Cannot get PB history.\n"; ## } unless (defined ($content = get('file:///J:/DivX/current-game-winnums- +text.txt'))) { die "Cannot get PB history.\n"; } @numbers = split /\n/, $content; my @data; foreach my $line (@numbers) { next if ($line =~ /^!/); @data = split(/\s/, $line); shift @data; # throw away the date $powers{pop @data}++; pop @data; $powerb{pop @data}++; foreach (@data) { $normals{$_}++; } } print "Normal (White Ball) Pick Rate:\n\n"; my @norm_sort = sort { $normals{$a} <=> $normals{$b} } keys %normals; foreach (@norm_sort) { print "$_ :\t($normals{$_})\t", "*" x $normals{$_}, "\n"; } print "PowerBall Normal Pick Rate:\n\n"; my @pb_sort = sort { $powerb{$a} <=> $powerb{$b} } keys %powerb; foreach (@pb_sort) { print "$_ :\t($powerb{$_})\t", "*" x $powerb{$_}, "\n"; } print "\nPower Pick Rate:\n\n"; my @pp_sort = sort { $powers{$a} <=> $powers{$b} } keys %powers; foreach (@pp_sort) { print "$_ :\t($powers{$_})\t", "*" x $powers{$_}, "\n"; } print "\nWhite Balls --"; print "\n Cold Picks:\t"; print join(" ", @norm_sort[0 .. 4]), "\n"; print " Mid Picks:\t"; print join(" ", @norm_sort[25 .. 29]), "\n"; print " Hot Picks:\t"; print join(" ", @norm_sort[50 .. 54]), "\n"; print "\nPowerBalls --"; print "\n Cold Picks:\t"; print join(" ", sort (@pb_sort[0 .. 2])), "\n"; print " Mid Pick:\t"; print join(" ", sort (@pb_sort[19 .. 21])), "\n"; print " Hot Picks:\t"; print join(" ", sort (@pb_sort[39 .. 41])), "\n"; ## print "\nPower Picks:\t"; ## print join(" ", sort (@pp_sort[0 .. 3])), "\n"; print "\nDisclaimer:\n\tThis is not statistically accurate, except in +that the drawings are guaranteed.\nThis is just a quick frequency analysis making no pretens +es as to predictive accuracy.\n";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://713929]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2017-02-25 03:07 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (365 votes). Check out past polls.