502543 7696 410 6 0 Wed Sep 21 02:40:00 EDT 2005 The $logdata[][] array contains two dimensions: 1. An index number, which holds one set of results (the element) 2. Each element of the result, named 'plays', 'wins3', and so on. Copyright (C) 2005 Rogers Cadenhead This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ require_once('xml-simple.php'); // read the XML data recursively, storing results in $logdata[][] function parse_array($element) { global $logdata, $logindex; foreach ($element as $header => $value) { if (is_array($value)) { parse_array($value); $logindex++; } else { $logdata[$logindex][$header] = $value; } } } // load the lotto XML data into a string $data = file_get_contents("/www/www.cadenhead.org/html/projects/misc/java/lotto.log"); // create a parser and load the XML data into a tree $parser =& new xml_simple('UTF-8'); $request = $parser->parse($data); // catch errors $error_code = 0; if (!$request) { $error_code = 1; echo($parser->error); exit; } // load the XML tree data into the $logdata[][] array $logdata = array(); $logindex = 0; parse_array($parser->tree); /* calculate the years and format array data for display, adding historic results from before this PHP script was written */ $logdata[0]['years'] = number_format($logdata[0]['plays'] / 104); $logdata[0]['plays'] = number_format($logdata[0]['plays'] + 4962762); $logdata[0]['win3'] = number_format($logdata[0]['win3'] + 76433); $logdata[0]['win4'] = number_format($logdata[0]['win4'] + 4038); $logdata[0]['win5'] = number_format($logdata[0]['win5'] + 99); $logdata[0]['win6'] = number_format($logdata[0]['win6'] + 1); /* display the page -- all PHP-created content is contained within Begin Dynamic Content and End Dynamic Content HTML comment tags */ ECHO << Give Your Balls a Workout with Lottorobics

are your lottery numbers not working out?

maybe they need to work out


Lottorobics: The Pick-6 Lotto Exercise Plan

Skip right to the workout

If you're like me, your only real chance at financial prosperity comes from frivolous workman's comp lawsuits and the Pick-6 Lotto. However, even in my home state of Texas, the government eventually figures out that once you've suffered permanently debilitating injuries to both legs, both arms, neck and groin, there's no way you can claim to injure them again on a new job.

Because of this injustice, I've been forced to set aside some of my purely religious use of peyote and put more money into the Lotto. After years of little to no success (you can't get far on a single 3-out-of-6 $4 winner), I realized why my Lotto numbers never work out.

The reason? I never tested them out.

How can you expect your Lotto numbers to come up a winner if you haven't run them through some practice sessions? After meeting a Java programmer at Lew Sterritt Correctional Center, I collaborated with him on Lottorobics, the Pick-6 Lotto Exercise plan.

Enter your favorite six numbers below or click the Quick Pick option to generate six numbers at random. Press Play to start running Lotto drawings, Stop to stop them, and Reset to reset your stats. Repeat as desired. -- Rogers Cadenhead



Since this page went online, {$logdata[0]['plays']} drawings have been conducted with this applet ({$logdata[0]['years']} years of twice-weekly drawings). There have been {$logdata[0]['win3']} 3-out-of-6 winners, {$logdata[0]['win4']} 4-out-of-6 winners, {$logdata[0]['win5']} 5-out-of-6 winners, and {$logdata[0]['win6']} 6-out-of-6 winners.

The first person to win this fictional lottery was Bill Teer on Aug. 14, 2000, more than four years after the applet went online. His numbers were 3, 7, 1, 15, 34, and 43, and it only took him 241,225 drawings (2319.47 years) to win.

A version of the Lottorobics applet is featured in Teach Yourself Java 2 in 24 Hours, 3rd Edition by Rogers Cadenhead. Readers learn how to program this applet, animation, and dozens of other programs in 24 one-hour tutorials.

Visit the Book's Web Site | Download the Source Code

until next time, kids, remember:

nobody ever says you have a gambling problem

when you're winning

"Still counting on a lottery win to set you up for life? For a reality check, head over to the Lottorobics site, where you can put your favorite numbers to the test. I tried a quick-pick simulation and in 1,500 drawings, I hit three of six 22 times and four of six once. Time to check out that 401(k)." -- John Murrell, San Jose Mercury News, June 11, 1997

END; ?>