Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I took a look at chromatic's program from 2000. Great code to start from.

I updated the code to process the current www.powerball.com 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 http://www.perlmonks.org/ # 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('http://www.powerball.com/results/p +bhist.txt'))) { ## die "Cannot get PB history.\n"; ## } ## unless (defined ($content = get('http://www.powerball.com/powerball +/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";

In reply to Re: Powerball Frequency Analyzer by bnsmith001
in thread Powerball Frequency Analyzer by chromatic

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (9)
    As of 2015-07-29 22:04 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (269 votes), past polls