hypersoniq's Blog

Updater file test worked wonderfully!

I let it go a few days to see if it would capture just what was added... and it worked! Updated all 14 games of interest to their respective csv files, including bonus balls for the jackpot games that have them... no extra or missing data!

It seems surreal having to run one script and have it replace what would have been at least an hour of work...

The updates complete in seconds for each game, less than 2 minutes total run time!

The rest of the work I am doing seems to pale in comparison... THIS was my 2025 coding goal and it has been met !!!!!!

Both the builder AND the updater have been built and tested!

There are some considerations in the pick N games, such as now the double draw promotional results are in the data, as well as the infamous 666 fix draw... but since I am not currently using full history, that seems it will not be an issue.

The builder allowed me to capture data from matrix changes by entering the start date, or by just entering a start year for the pick N's

The updater only returned new draws by reading the last date in each csv file and starting from there... it does not matter if it was a daily or run 2 or 3 times in a week.

I also no longer need to maintain a separate spreadsheet file for each game, as the data from a csv is easily imported into a sheet if needed.

Today I am busy identifying and converting variables in the classifier script to be passed into the function call... almost there with one function for any game!

These are the key challenges in the GUI transformation, and the updater part is now fully functional! The universal function for classification is not far behind... with testing maybe a few hours to a few days tops...

Whether or not the classification idea goes anywhere, I have the building blocks for my own software development framework, which can be tweaked for ANY idea!

Like Ice Cube said, it was a good day!

Entry #553

There are many things left to learn with classification

Although I have been recently obsessed with creating this classification system into a mobile app, that does not take away the fact that this is a data presentation tool, and still needs to be explored for interpretation.

The simple process of sorting the results by frequency took the emphasis off of the digits and put it on the frequency patterns directly. These tables should be saved and compared with each cycle. One such analysis tool could be to capture the classification table, then overlay the 21 cycle draws to determine if trends are present or absent. For the next cycle, though only playing 1 combo, I will record and track the performance of the 10 combos generated by reading across the table, and also the floor and ceiling of the neutrals, if not contained in those 10 combos. Simple as recording the combos and with each, a simple x in the next 21 cells across to indicate a hit. Paper play on a larger scale to help find the best performing area of the result grid. I do not have to wait for the GUI to start capturing data, and paper play pick 3 can be run regardless of which game is in the current cycle.

Once the steps are known, then a back test can be figured out. So there will still be plenty of experimentation ahead...

Entry #552

And the updater works!

Testing it on the old csv files was the right idea, because everything updated as expected!

Pointing the script to the new csv files was quick, but just watching it run... less than 2 minutes to update 14 games... THAT is why I do this stuff! Even if I have no intention of playing all of these games, it was the sense of accomplishment... having a clear vision and coding it into reality that makes the coding sessions so enjoyable.

So the trick was to put calls to the update functions in the main section, where it would iterate the first 11 games, and then call the second function iteratively for the bonus ball games. I even deleted the old pick 3 to June of 2024 to see if it wrapped the year change correctly, and it did!

That was enough for one day! Gotta work for the weekend and get back to the list on my next day off... I might even start coding the GUI this year.

Entry #551

Planning today's coding session

Got some definitive goals today!

1. Finish up the update script, test it out and validate the results. I made new csv files with a specific naming convention just for this project, but in true pack rat style, I kept the old ones and did not update them intentionally, so I could first target the old csv files to test it out. If it updates the old ones properly, then it will update the new ones properly.

2. List the differences in the pick N classifier script for both the pick N games and the jackpot games, make sure the common items are reworked as variables that can be passed via the function call. Make the coding changes.

3. Test the changes by running the new script against the old scripts to see that the data output is identical.

I do not know how far I will get on this list today, but these are the short term goals until completed. Once these goals are met, I am finally ready to start turning it into an app! So I must also install Kivy into the Python set up.

Based on my 2026 plan, I really only needed to update the pick 3, pick 5 and Match 6, but grabbing all the data adds some options... a cycle of Match 6 could be replaced with a cycle of Cash 5 for the same cost, or a cycle of the treasure hunt at HALF of the cost! Could also swap a cycle of pick 5 for pick 4 for the same cost as well.

Right now, updates and classification require being tethered to the laptop. The ultimate end goal is to be able to update and run the analysis on the go, and the pathway is becoming clearer!

Entry #550

Afterburners today! Coding goals are being met!

I figured out how to create a script just for bonus ball games! That means I have entire (current matrix) histories for Cash 4 Life, Power Ball and Mega Millions!

As a kicker, the bonus balls are diverted to a second csv file as the expectancy changes in a 5 in 60 vs. a 1 in 4 (cash4life example)

I have even figured out and started the update version of the scripts. They handle the edge case of last updating in December of one year and not running it again until January of the next year! Done by reading the last date in the csv and comparing it to the date you run the update.

14 games, full history... current to today! About an hour of coding... zero errors to debug!

In case anyone is playing along at home, here is when each game (current matrix, if applicable) began...

PA Pick 3 Evening: 1977

PA Pick 4 Evening: 1980

PA Pick 3 and Pick 4 Mid Day: 2003

PA Match 6: 2004

PA Treasure Hunt: 2007

PA Cash 5 (current matrix): 2/1/2008

PA Pick 2 (mid & eve), Pick 5 (mid &eve) and Cash 4 Life: 2015

Power Ball (current matrix): 10/17/2015

Mega Millions (current white ball matrix): 10/31/2017

Time to finish the update scripts and begin working on the classifier script so it can be modified to run all games instead of separate versions for dailies and jackpot games. That will also need to be modified further when moving to the GUI to remove my side by side output logic, as each column's data will be assigned to a display widget dynamically based on the number of columns in the csv file.

From hours to minutes... can't believe the decades of manual updates have finally been automated! That was always the least fun aspect of this hobby.

Entry #549

PA lottery uses aspx file to present tables of draw history.

Microsoft Active Server Pages, the technology used by the PA lottery to present 1 year of draw history for any of their games.

There are 2 main variables passed via query string parameters, the id, tells it which game to display, and year, so you can choose the year.

I can fetch a requested page by passing in variables for the task at hand.

For example, this is the full url to display the PA pick 3 evening results for 2025...

https://www.palottery.state.pa.us/Games/Print-Past-Winning-Numbers.aspx?id=2&year=2025&print=1

I forget exactly how I found it, it was originally buried somewhere on their results pages. Through experimentation, I found the following game ID codes...

1. Pick 3 Mid Day

2. Pick 3 Evening (the example above)

3. Pick 4 Mid Day

4. Pick 4 Evening

5. Pick 5 Mid Day

6. Pick 5 Evening

7. Treasure Hunt

8. Cash 5

11. Match 6

12. Power Ball

15. Mega Millions

27. Pick 2 Evening

31. Pick 2 Mid Day

35. Cash 4 Life

(There are codes for games that have ended like 10 for Mix & Match and 14 for Super 7, but if the game ended.. why bother?)

By replacing the id value with a number from above and the year value desired, you can see any full calendar year of PA lottery game history.

The Pick 3 evening is the longest running PA game and goes back to 1977 !

In my build script, I loop each ID through the years for each game ID and create a csv file for each.

The update version that I plan on running once a week will go through ALL of the game IDs for the current year, updating all 14 games in one shot.

I am still stuck on 3 games... all have a bonus ball. Since the other 11 games all work, I am going to create a separate script that can handle bonus balls... working on that today... the idea is to only grab numeric data and only use the first 6 in the list, this will effectively capture all of the 3 games and ignore the power play and double draw data. Also will skip the megaplier pre $5 era.

Also note that if importing via spreadsheet, the date is in a text date format. I handle that conversion into an actual date type in Python, but it is also able to do this in a spreadsheet by using "paste special" and choosing unformatted text, then for the date column, select "Date M/D/Y"... problem solved... text dates don't sort properly, particularly if mixed with standard dates!

So that is where I am at with the coding project, just thought I would share the URL I found to make gathering history easier for any other PA players out there.

Entry #548

Tomorrow ends the first week of the pick 3 cycle

No win yet. This cycle it was the highest all neutral line used. Since each cycle needs to complete before picking another phase 2 plan, this rides for 2 more weeks. Next cycle will see a use of the ceiling, or the highest neutral in each column, regardless of if they line up.

May run 2 weeks of a cycle to finish the year using the floor of the Neutrals (lowest).

Starting January 1 will be the full year plan, the 10 week cycle starting with 4 weeks of Match 6. Whichever data interpretation scheme does the best on Pick 3 will be chosen for the Match 6.

Going into 2026 not counting on a hit for the rest of this year... the Cycle play and the $14/week budget is going well.

I refreshed my entire set of game histories so I know there are zero transcription errors on my part... well except for bonus ball games, but I feel confident that tomorrow's coding marathon will result in solving that issue and also see the implementation of the update script, so I will save an hour a week updating draw histories!

I had some good research into potential issues with permissions in both windows and android. These are being considered and the path forward with developing a GUI that will be able to run the app on both windows and Android resulted in a final design decision to develop with Python's Kivy framework from the start. Looks like I have a ton of documentation to read over before that gets started.

Making one function provide the classification data is going well also. Passing the game variables along with the function call does the trick. This way, when a game is chosen in the game function, it passes the correct csv file, the correct sample size, the expectancy and the proper loop variables for display for each game. The bonus ball games have a call for a second run of the function with their particular settings, and their output will be dynamic as well, appearing beside the white ball data as if it was all processed at once.

Then I will have to use it for awhile to see where improvements and upgrades will fit into the development cycle.

2026 is looking like an interesting year for this hobby...

Entry #547

A few more history scraping details to work out...

1. When updating, it should be checked that games not in need of an update get skipped, such as 2 or 3 per week jackpot draws.

2. Consider an update per game check box along with the update all function.

3. Make sure PB and MM read all the info, but divert bonus balls to their own file which just includes the date and column A. In both create and update versions.

Regardless of how long it takes to incorporate this into a full fledged application, this one project alone will save at least an hour per week! It will also be the key to the "calculate anywhere" vision I have for the mobile app... update ALL of history with a button click, then process the game of interest with another button click... 2 clicks to a pick!

Can't believe I did not think of this sooner... wasted all of those coding sessions trying to wrangle their sloppy RSS feed.

I can also see incorporating other scripts into the mix, so alongside classification, I could check daily things like follower data or whole history distribution statistics.

Easier to continue on the journey when you have an idea of the end product.

Right now, if I were doing Agile. This would be solving the user stories: "User wants to update all games quickly with a single button", "User wants the flexibility of choosing from multiple active games" and "User does not need to know the behind the scenes functioning of the program, it just needs to present up to date information on demand".

Entry #546

Coding issue... bonus balls.

I have my build script down to a single function that works flawlessly for scraping the PA lottery website for the full histories of the following games...

Pick 2,3,4 and 5 mid and eve

Match 6, Cash 5, Treasure Hunt.

The issue... only able to grab the white balls from Cash 4 Life, Power Ball and Mega Millions.

Why? I used a regex to drop the non numeric data so I would skip storing the pick N wild ball data, and it was like using a chain saw where a scalpel was called for...

I need to come up with a way to not only read the bonus ball data, but to divert it to it's own csv file...

The diversion is the easier part.

Gotta spend some time on this... i am almost there with the build script, and if it works, the update script will be easy.

Entry #545

Great coding day so far!

Starting with the first year of data for the PA Treasure Hunt (2007) is going well.

So far, I can use the requests library to fetch the url, target only the table where the results are stored, split the space separated numbers into a list, sort the entire list by date ascending, AND write it to a csv file... not a bad few hours work.

Up next is creating a loop to go from 2007 to 2025, sort ALL data by date ascending, write the column headers (overlooked that on the first run) and create the entire history file literally in seconds!

This is the build script, where it goes from the first year of the game to current. The update version will only need to use the current year, but will also have to check the csv file for the last date and only grab what is new... still thinking about that logic...

Even if nothing else develops, I will be able to

1. Guarantee there were no human errors on my side recording accurate game history

2. Update ALL history files in seconds rather than killing an hour

3. Will have the opportunity to spot check each file at random spots to validate the data.

But there is so much more, already planning to take the master HNC classification function and be able to set it up for any game... ONE function, ALL games!

Getting the update script to work and the solitary function for all games are must have additions to begin moving forward with GUI development, and now that code is being written and tested, progress is being made! Ideas are becoming functional programs!

So there PA Lottery, who needs a REST API when a little thought and coding get the same results... and I did not need to decipher that horrific RSS feed!

This is typical me, more excited about working code than actually winning anything...

Entry #544

The 2026 cycles

So, given the 10 week multi game cycle strategy, here is the breakdown...

Match 6 (4 week cycle) will get played 5 and 1/2 times

Pick 3 (3 week cycle mid and eve) will get played 5 times

Pick 5 (3 week cycle mid and eve) will be played 5 times

The pick N games are at $1 straight and the Match 6 is a single $2 ticket, replayed each week to generate new QP lines.

Cost is $14 per week, total cost is $728...

Scripts will only need to be run 16 times.

I have 8 weeks left on the pick 3 @$1 straight to catch a hit.

Total lottery losses for this year (counting the next 8 week @$14 each and the $20 millionaire raffle ticket) are under $200, not bad for as many chances that I have taken this year. I have already dismissed this year's losses. Anything between now and Dec. 31st won will go to fund next year, so 1 hit will cover 35 weeks and 2 hits will see 2026 fully funded AND this year end with a meager profit.

Let's GO!!!!!

Entry #543

History parsing script planning is making progress

So, in Python there is a library called Requests which can get a web page. There is also a library called Beautiful Soup which can determine the structure of web page data. This is how I get around the PA website not having an actual REST api to return json formatted data.

Once the structure of the results is determined, the data of interest will be stored into a data type like a Python dictionary, sorted ascending by date, and written to a csv file.

In planning, to capture ALL of the PA games, this will require 16 csv files, as PB and MM bonus balls will be isolated. Or 18 if I decide to keep PB double draw data as well.

For the sake of accuracy, I will construct each file as a separate run of the build script.

When it comes to the update script, this will read from the current year and only append draws greater than the last date in the csv file... this will update every game, all at once.

The actual script to classify frequencies is literally the same at it's core, with different parameters for each game, so when designing the script, these will be passed as parameters, reducing the classification part to just one script. Keeping it modular!

Because of features like grid view dynamic layouts and it's ability to be ported directly to Android, I am skipping tkinter and pyQT for the gui and going directly with Kivy.

Still have to manually update and get a pick for the next P3 cycle, but a plan is in place!

Once the core functionality is in place, features like graphs will be added later. This will be a perfect sandbox to experiment with feature requests!

And that is what will be going on behind the scene while I am playing the cycles next year. Still time to have the PA lottery pay for it all...

Happy Coding!

Entry #542

The update script, side by side deveopment.

There will be two versions of the script.

1. Build.

Using loops and passing in info such as the first year of the game (at it's current matrix, where relevant), the game code and the csv file to create will allow a massive script to be generated that will create fresh and accurate full history files. This will also form the basis of the next version...

2. Update.

Here is the version that will make it into the app... it will pass in the name of the file to update, checking the last entry for the last update, and building a lost of draws to append to each csv file... for all games!

Will test with a single year on build, then test with update for reading dates from files and appending only draws ahead of the last date point.

The goal here is to reduce the current process to a few button clicks and get results in minutes or seconds rather than the current time consuming manual processes.

It comes down to a vision... I have a vision of being able to run this app on a mobile device at home (or anywhere) and have results when I get to the kiosk. Then it does not matter the work schedule or other time commitments, a pick will always be readily available. It might be fun to cycle through pick 2 through pick 5, or alternate between match 6 and cash 5. Also to be able to flip between power ball and mega millions...

The app will also have the ability to check for wins in a cycle, and make a notice when a current cycle is about to expire. If I take my time with it, it might also track expenses with a nifty periodic profit and loss statement.

If I find some new or altered idea, it will be easy to update since I am creating the entire app.

Either way it will be good experience to create and maintain an entire code base for multiple platforms (Desktop and Android). Code, comments, documentation, maintenance... It is literally making my own tutorial!

Entry #541

Changes needed before the development of the desktop app

1. Create a scraper with the direct URL to the PA lottery results by year. This will be needed to make life easier and updates automated for the mobile version as well. When this is done, I will rebuild ALL history files from draw 1 to avoid any data entry errors over the years. And this time I will keep the double draws on pick N!

2. Include ALL of the PA games. Pick 2 through the big jackpot games.

3. Create a snapshot tool that captures the output to be reviewed when the cycle ends... where did the draws come from vs. Where I thought they might have come from.

4. Keep the stand alone scripts for every version to test that the app generates the same exact data.

5. Plan to generate documentation... as the project grows in complexity, future me will need reminding!

That should keep me busy for awhile...

Back to a new pick 3 cycle Thursday, using the highest all neutral line in the sorted output instead of the line in the dead center of the neutral lines.

The coin flip used to pick 666 for this week is not going so well.

I am excited by the possibility of clicking "update all" instead of the painstaking manual process!

Entry #540

Got a name for my project!

After over thinking it since the idea formed, I have finally picked a project name... CHANCE

Cold, Hot And Neutral Classification Engine. 

Describes exactly what it does! Does not say winning... which tracks with results... It presents the results of classification, which then must be interpreted.

Entry #539