Compare commits
No commits in common. "master" and "main" have entirely different histories.
201
.gitignore
vendored
201
.gitignore
vendored
|
|
@ -1,51 +1,162 @@
|
||||||
# These are some examples of commonly ignored file patterns.
|
# ---> Python
|
||||||
# You should customize this list as applicable to your project.
|
# Byte-compiled / optimized / DLL files
|
||||||
# Learn more about .gitignore:
|
__pycache__/
|
||||||
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
|
|
||||||
|
|
||||||
# Node artifact files
|
|
||||||
node_modules/
|
|
||||||
dist/
|
|
||||||
|
|
||||||
# Compiled Python bytecode
|
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
# Log files
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
*.py,cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
cover/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
*.log
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
db.sqlite3-journal
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
.scrapy
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
.pybuilder/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Jupyter Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# IPython
|
||||||
|
profile_default/
|
||||||
|
ipython_config.py
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
# For a library or package, you might want to ignore these files since the code is
|
||||||
|
# intended to run in multiple environments; otherwise, check them in:
|
||||||
|
# .python-version
|
||||||
|
|
||||||
|
# pipenv
|
||||||
|
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||||
|
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||||
|
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||||
|
# install all needed dependencies.
|
||||||
|
#Pipfile.lock
|
||||||
|
|
||||||
|
# poetry
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||||
|
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||||
|
# commonly ignored for libraries.
|
||||||
|
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||||
|
#poetry.lock
|
||||||
|
|
||||||
|
# pdm
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||||
|
#pdm.lock
|
||||||
|
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||||
|
# in version control.
|
||||||
|
# https://pdm.fming.dev/#use-with-ide
|
||||||
|
.pdm.toml
|
||||||
|
|
||||||
|
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||||
|
__pypackages__/
|
||||||
|
|
||||||
|
# Celery stuff
|
||||||
|
celerybeat-schedule
|
||||||
|
celerybeat.pid
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
.spyderproject
|
||||||
|
.spyproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
/site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# Pyre type checker
|
||||||
|
.pyre/
|
||||||
|
|
||||||
|
# pytype static type analyzer
|
||||||
|
.pytype/
|
||||||
|
|
||||||
|
# Cython debug symbols
|
||||||
|
cython_debug/
|
||||||
|
|
||||||
# PyCharm
|
# PyCharm
|
||||||
.idea
|
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||||
|
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||||
# Applications
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
*.app
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
*.exe
|
#.idea/
|
||||||
*.war
|
|
||||||
|
|
||||||
# Cache files for Sublime Text
|
|
||||||
*.tmlanguage.cache
|
|
||||||
*.tmPreferences.cache
|
|
||||||
*.stTheme.cache
|
|
||||||
|
|
||||||
# Workspace files are user-specific
|
|
||||||
*.sublime-workspace
|
|
||||||
|
|
||||||
# Project files should be checked into the repository, unless a significant
|
|
||||||
# proportion of contributors will probably not be using Sublime Text
|
|
||||||
# *.sublime-project
|
|
||||||
|
|
||||||
# SFTP configuration file
|
|
||||||
sftp-config.json
|
|
||||||
sftp-config-alt*.json
|
|
||||||
|
|
||||||
# Package control specific files
|
|
||||||
Package Control.last-run
|
|
||||||
Package Control.ca-list
|
|
||||||
Package Control.ca-bundle
|
|
||||||
Package Control.system-ca-bundle
|
|
||||||
Package Control.cache/
|
|
||||||
Package Control.ca-certs/
|
|
||||||
Package Control.merged-ca-bundle
|
|
||||||
Package Control.user-ca-bundle
|
|
||||||
oscrypto-ca-bundle.crt
|
|
||||||
bh_unicode_properties.cache
|
|
||||||
|
|
||||||
|
|
|
||||||
9
LICENSE
Normal file
9
LICENSE
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025 funkywaddle
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
{
|
|
||||||
"build_systems":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
|
|
||||||
"name": "Anaconda Python Builder",
|
|
||||||
"selector": "source.python",
|
|
||||||
"shell_cmd": "./venv/bin/python -u \"$file\""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"folders":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"follow_symlinks": true,
|
|
||||||
"path": "."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"settings":
|
|
||||||
{
|
|
||||||
"anaconda_linting": true,
|
|
||||||
"anaconda_linting_behaviour": "always",
|
|
||||||
"pep257": false,
|
|
||||||
"python_interpreter": "./venv/bin/python",
|
|
||||||
"test_command": "./venv/bin/python -m unittest discover",
|
|
||||||
"use_pylint": false,
|
|
||||||
"validate_imports": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
32
README.md
32
README.md
|
|
@ -1,32 +1,2 @@
|
||||||
# Generic Lottery game number checker #
|
# LotteryChecker
|
||||||
Currently includes Powerball, Megamillions, Texas Two Step, and Lotto Texas.
|
|
||||||
|
|
||||||
You add your picks to `{game}/picks.py`, and run `./play -g {game}`
|
|
||||||
eg:
|
|
||||||
* `./play.py -g powerball`
|
|
||||||
* `./play.py -g megamillions`
|
|
||||||
* `./play.py -g twostep`
|
|
||||||
* `./play.py -g lottotexas`
|
|
||||||
|
|
||||||
The script will pull the current winning numbers from an rss feed, and compare them to each ticket you list in the picks.py file for that game.
|
|
||||||
|
|
||||||
The output per ticket:
|
|
||||||
```text
|
|
||||||
Winning Numbers: [2, 13, 32, 33, 48]
|
|
||||||
Winning Powerball: 22
|
|
||||||
Your Numbers: (1, 2, 3, 4, 5)
|
|
||||||
Your Powerball: 9
|
|
||||||
Matched Numbers: [2]
|
|
||||||
Matched Powerball: False
|
|
||||||
Not a Winner!
|
|
||||||
```
|
|
||||||
OR
|
|
||||||
```text
|
|
||||||
Winning Numbers: [2, 13, 32, 33, 48]
|
|
||||||
Winning Powerball: 22
|
|
||||||
Your Numbers: (1, 2, 3, 4, 5)
|
|
||||||
Your Powerball: 22
|
|
||||||
Matched Numbers: [2]
|
|
||||||
Matched Powerball: True
|
|
||||||
Ticket is worth: 8
|
|
||||||
```
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
class Ticket:
|
|
||||||
|
|
||||||
def __init__(self, my_picks, my_special_ball):
|
|
||||||
self.jackpot = 0
|
|
||||||
self.my_picks = my_picks
|
|
||||||
self.my_special_ball = my_special_ball
|
|
||||||
self.winning_numbers = []
|
|
||||||
self.special_ball = None
|
|
||||||
self.special_ball_name = 'Special Ball'
|
|
||||||
self.multiplier = None
|
|
||||||
self.matched_numbers = []
|
|
||||||
self.matched_special_ball = None
|
|
||||||
self.winnings = 0
|
|
||||||
self.feed = None
|
|
||||||
|
|
||||||
def get_jp_amount(self):
|
|
||||||
self.jackpot = self.feed.get_jackpot()
|
|
||||||
|
|
||||||
def get_winning_numbers(self):
|
|
||||||
winners = self.feed.get_winning_numbers()
|
|
||||||
self.winning_numbers = winners['numbers']
|
|
||||||
self.special_ball = winners['special_ball']
|
|
||||||
self.multiplier = winners['multiplier']
|
|
||||||
|
|
||||||
def process_ticket(self):
|
|
||||||
self.check_numbers()
|
|
||||||
self.check_special_ball()
|
|
||||||
self.get_jp_amount()
|
|
||||||
special_ball_wins = self.get_winnings_with_special_ball(self.jackpot)
|
|
||||||
non_special_ball_wins = self.get_winnings_without_special_ball()
|
|
||||||
self.process_winnings(special_ball_wins, non_special_ball_wins)
|
|
||||||
|
|
||||||
def check_numbers(self):
|
|
||||||
# for num in self.my_picks:
|
|
||||||
# if num in self.winning_numbers:
|
|
||||||
# self.matched_numbers.append(num)
|
|
||||||
self.matched_numbers = list(
|
|
||||||
set(self.my_picks).intersection(set(self.winning_numbers)))
|
|
||||||
|
|
||||||
def check_special_ball(self):
|
|
||||||
self.matched_special_ball = False
|
|
||||||
|
|
||||||
if self.special_ball is not None and self.my_special_ball == self.special_ball:
|
|
||||||
self.matched_special_ball = True
|
|
||||||
|
|
||||||
if self.my_special_ball is True and self.special_ball_name == 'Extra':
|
|
||||||
self.matched_special_ball = True
|
|
||||||
|
|
||||||
def process_winnings(self, special_ball_wins, non_special_ball_wins):
|
|
||||||
wins = non_special_ball_wins
|
|
||||||
|
|
||||||
if self.matched_special_ball:
|
|
||||||
wins = special_ball_wins
|
|
||||||
|
|
||||||
self.winnings = wins[self.multiplier][len(self.matched_numbers)]
|
|
||||||
self.output_ticket()
|
|
||||||
|
|
||||||
def get_ticket_winnings(self):
|
|
||||||
return self.winnings
|
|
||||||
|
|
||||||
def output_ticket(self):
|
|
||||||
special_ball = self.special_ball_name
|
|
||||||
print(f'Winning Numbers: {self.winning_numbers}')
|
|
||||||
print(f'Winning {special_ball}: {self.special_ball}')
|
|
||||||
print(f'Your Numbers: {self.my_picks}')
|
|
||||||
print(f'Your {special_ball}: {self.my_special_ball}')
|
|
||||||
print(f'Matched Numbers: {self.matched_numbers}')
|
|
||||||
print(
|
|
||||||
f'Matched {special_ball}: '
|
|
||||||
f'{"True" if self.matched_special_ball else "False"}'
|
|
||||||
)
|
|
||||||
if self.winnings > 0:
|
|
||||||
print(f'Ticket is worth: {self.winnings:,.2f}')
|
|
||||||
else:
|
|
||||||
print(f'Not a Winner!')
|
|
||||||
print()
|
|
||||||
|
|
||||||
def get_winnings_with_special_ball(self, jp):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def get_winnings_without_special_ball(self):
|
|
||||||
pass
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
import feedparser
|
|
||||||
|
|
||||||
|
|
||||||
class Feed:
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.feed = 'https://www.texaslottery.com/export/sites/lottery/rss/tlc_latest.xml'
|
|
||||||
self.parsed_feed = feedparser.parse(self.feed)
|
|
||||||
|
|
||||||
self.modifiers = {
|
|
||||||
'Billion': 1000000000,
|
|
||||||
'Million': 1000000
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_winning_numbers(self):
|
|
||||||
nums_pre = self.parsed_feed.entries[4].summary
|
|
||||||
nums = nums_pre.split(' - ')
|
|
||||||
|
|
||||||
winning_numbers = nums
|
|
||||||
|
|
||||||
for idx, num in enumerate(nums):
|
|
||||||
winning_numbers[idx] = int(num)
|
|
||||||
|
|
||||||
return {'numbers': winning_numbers, 'special_ball': None, 'multiplier': 1}
|
|
||||||
|
|
||||||
def get_jackpot(self):
|
|
||||||
jp_pre = self.parsed_feed.entries[5].summary
|
|
||||||
jp_pre = jp_pre[jp_pre.index('Cash'):]
|
|
||||||
jp_pre = jp_pre[jp_pre.index(':') + 3:]
|
|
||||||
jp_data = jp_pre.split()
|
|
||||||
return float(jp_data[0]) * self.modifiers[jp_data[1]]
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
from lib.Ticket import Ticket
|
|
||||||
from .Feed import Feed
|
|
||||||
from .winning_structure import get_winnings_extra, get_winnings_no_extra
|
|
||||||
|
|
||||||
|
|
||||||
class LottoTexas(Ticket):
|
|
||||||
|
|
||||||
def __init__(self, my_picks, my_special_ball, mult):
|
|
||||||
super().__init__(my_picks, my_special_ball)
|
|
||||||
self.special_ball_name = 'Extra'
|
|
||||||
self.feed = Feed()
|
|
||||||
self.get_winning_numbers()
|
|
||||||
self.multiplier = mult
|
|
||||||
|
|
||||||
def get_winnings_with_special_ball(self, jp):
|
|
||||||
return get_winnings_extra(self.jackpot)
|
|
||||||
|
|
||||||
def get_winnings_without_special_ball(self):
|
|
||||||
return get_winnings_no_extra(self.jackpot)
|
|
||||||
|
|
||||||
def get_winning_numbers(self):
|
|
||||||
winners = self.feed.get_winning_numbers()
|
|
||||||
self.winning_numbers = winners['numbers']
|
|
||||||
self.special_ball = winners['special_ball']
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
#! /usr/bin/python3
|
|
||||||
|
|
||||||
from .picks import my_picks
|
|
||||||
from .LottoTexas import LottoTexas
|
|
||||||
|
|
||||||
cur_picks = []
|
|
||||||
cur_pb = 0
|
|
||||||
winnings = {}
|
|
||||||
|
|
||||||
for idx, tkt in enumerate(my_picks):
|
|
||||||
cur_picks = tkt['picks']
|
|
||||||
cur_extra = tkt['extra']
|
|
||||||
tktnum = tkt['ticket']
|
|
||||||
pbtkt = LottoTexas(cur_picks, cur_extra, 1)
|
|
||||||
pbtkt.process_ticket()
|
|
||||||
key = 'Ticket ' + str(tktnum)
|
|
||||||
if key not in winnings.keys():
|
|
||||||
winnings[key] = 0
|
|
||||||
winnings[key] += pbtkt.get_ticket_winnings()
|
|
||||||
for key in winnings.keys():
|
|
||||||
winnings[key] = f'{winnings[key]:,.2f}'
|
|
||||||
|
|
||||||
print("Total Winnings:", winnings)
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
my_picks = [
|
|
||||||
# quick picks #
|
|
||||||
{'picks': (8,13,14,27,28,43), 'extra': None, 'mult': 1, 'ticket': 1},
|
|
||||||
]
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
def get_winnings_extra(jackpot_cash):
|
|
||||||
return {
|
|
||||||
1: [0,0,2,13,150,12_000,jackpot_cash]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def get_winnings_no_extra(jackpot_cash):
|
|
||||||
return {
|
|
||||||
1: [0,0,0,3,50,2_000,jackpot_cash]
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
import feedparser
|
|
||||||
|
|
||||||
|
|
||||||
class Feed:
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.feed = 'https://www.texaslottery.com/export/sites/lottery/rss/tlc_latest.xml'
|
|
||||||
self.parsed_feed = feedparser.parse(self.feed)
|
|
||||||
|
|
||||||
self.modifiers = {
|
|
||||||
'Billion': 1000000000,
|
|
||||||
'Million': 1000000
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_winning_numbers(self):
|
|
||||||
nums_pre = self.parsed_feed.entries[2].summary
|
|
||||||
nums_pre = nums_pre.replace('MegaBall', '-').replace(' Megaplier', '')
|
|
||||||
nums = nums_pre.split(' - ')
|
|
||||||
|
|
||||||
winning_numbers = nums[:5]
|
|
||||||
|
|
||||||
for idx, num in enumerate(nums[:5]):
|
|
||||||
winning_numbers[idx] = int(num)
|
|
||||||
|
|
||||||
special_ball = int(nums[5])
|
|
||||||
return {'numbers': winning_numbers, 'special_ball': special_ball, 'multiplier': 0}
|
|
||||||
|
|
||||||
def get_jackpot(self):
|
|
||||||
jp_pre = self.parsed_feed.entries[3].summary
|
|
||||||
jp_pre = jp_pre[jp_pre.index('Cash'):]
|
|
||||||
jp_pre = jp_pre[jp_pre.index(':') + 3:]
|
|
||||||
jp_data = jp_pre.split()
|
|
||||||
return float(jp_data[0]) * self.modifiers[jp_data[1]]
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
from lib.Ticket import Ticket
|
|
||||||
from .Feed import Feed
|
|
||||||
from .winning_structure import get_winnings_mb, get_winnings_no_mb
|
|
||||||
|
|
||||||
|
|
||||||
class MegaMillions(Ticket):
|
|
||||||
|
|
||||||
def __init__(self, my_picks, my_special_ball, mult):
|
|
||||||
super().__init__(my_picks, my_special_ball)
|
|
||||||
self.special_ball_name = 'MegaBall'
|
|
||||||
self.feed = Feed()
|
|
||||||
self.get_winning_numbers()
|
|
||||||
self.multiplier = mult
|
|
||||||
|
|
||||||
def get_winnings_with_special_ball(self, jp):
|
|
||||||
return get_winnings_mb(self.jackpot)
|
|
||||||
|
|
||||||
def get_winnings_without_special_ball(self):
|
|
||||||
return get_winnings_no_mb()
|
|
||||||
|
|
||||||
def get_winning_numbers(self):
|
|
||||||
winners = self.feed.get_winning_numbers()
|
|
||||||
self.winning_numbers = winners['numbers']
|
|
||||||
self.special_ball = winners['special_ball']
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
#! /usr/bin/python3
|
|
||||||
|
|
||||||
from .picks import my_picks
|
|
||||||
from .MegaMillions import MegaMillions
|
|
||||||
|
|
||||||
cur_picks = []
|
|
||||||
cur_pb = 0
|
|
||||||
winnings = {}
|
|
||||||
|
|
||||||
for idx, tkt in enumerate(my_picks):
|
|
||||||
cur_picks = tkt['picks']
|
|
||||||
cur_pb = tkt['mb']
|
|
||||||
tktnum = tkt['ticket']
|
|
||||||
mult = tkt['mult']
|
|
||||||
pbtkt = MegaMillions(cur_picks, cur_pb, mult)
|
|
||||||
pbtkt.process_ticket()
|
|
||||||
key = 'Ticket ' + str(tktnum)
|
|
||||||
if key not in winnings.keys():
|
|
||||||
winnings[key] = 0
|
|
||||||
winnings[key] += pbtkt.get_ticket_winnings()
|
|
||||||
|
|
||||||
print("Total Winnings:", winnings)
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
my_picks = [
|
|
||||||
{'picks': (9, 11, 42, 53, 69), 'mb': 22, 'mult':10, 'ticket': 1},
|
|
||||||
{'picks': (6, 11, 24, 42, 69), 'mb': 17, 'mult':2, 'ticket': 1},
|
|
||||||
{'picks': (2, 20, 24, 43, 48), 'mb': 13, 'mult':3, 'ticket': 1},
|
|
||||||
{'picks': (3, 7, 20, 47, 68), 'mb': 13, 'mult':2, 'ticket': 1},
|
|
||||||
{'picks': (5, 9, 13, 18, 25), 'mb': 9, 'mult':3, 'ticket': 1},
|
|
||||||
|
|
||||||
# quick picks #
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
def get_winnings_mb(jackpot_cash):
|
|
||||||
return {
|
|
||||||
2: [10, 14, 20, 400, 20_000, jackpot_cash],
|
|
||||||
3: [15, 21, 30, 600, 30_000, jackpot_cash],
|
|
||||||
4: [20, 28, 40, 800, 40_000, jackpot_cash],
|
|
||||||
5: [25, 35, 50, 1_000, 50_000, jackpot_cash],
|
|
||||||
10: [50, 70, 100, 2_000, 100_000, jackpot_cash]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def get_winnings_no_mb():
|
|
||||||
return {
|
|
||||||
2: [0, 0, 0, 20, 1_000, 2_000_000],
|
|
||||||
3: [0, 0, 0, 30, 1_500, 3_000_000],
|
|
||||||
4: [0, 0, 0, 40, 2_000, 4_000_000],
|
|
||||||
5: [0, 0, 0, 50, 2_500, 5_000_000],
|
|
||||||
10: [0, 0, 0, 100, 5_000, 10_000_000]
|
|
||||||
}
|
|
||||||
25
play.py
25
play.py
|
|
@ -1,25 +0,0 @@
|
||||||
#!/usr/bin/python3
|
|
||||||
|
|
||||||
import getopt
|
|
||||||
import sys
|
|
||||||
import importlib
|
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
|
||||||
usage = 'play.py -g <gamename>'
|
|
||||||
|
|
||||||
try:
|
|
||||||
opts, args = getopt.getopt(argv, "hg:", ["game="])
|
|
||||||
except getopt.GetoptError:
|
|
||||||
print(usage)
|
|
||||||
sys.exit(2)
|
|
||||||
for opt, arg in opts:
|
|
||||||
if opt == '-h':
|
|
||||||
print(usage)
|
|
||||||
sys.exit()
|
|
||||||
elif opt in ("-g", "--game"):
|
|
||||||
importlib.import_module(f'{arg}.game')
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main(sys.argv[1:])
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
import feedparser
|
|
||||||
|
|
||||||
|
|
||||||
class Feed:
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.feed = 'https://www.texaslottery.com/export/sites/lottery/rss/tlc_latest.xml'
|
|
||||||
self.parsed_feed = feedparser.parse(self.feed)
|
|
||||||
|
|
||||||
self.modifiers = {
|
|
||||||
'Billion': 1000000000,
|
|
||||||
'Million': 1000000
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_winning_numbers(self):
|
|
||||||
nums_pre = self.parsed_feed.entries[0].summary
|
|
||||||
nums_pre = nums_pre.replace('Powerball', '-').replace(' Power Play', '-')
|
|
||||||
nums = nums_pre.split(' - ')
|
|
||||||
|
|
||||||
winning_numbers = nums[:5]
|
|
||||||
|
|
||||||
for idx, num in enumerate(nums[:5]):
|
|
||||||
winning_numbers[idx] = int(num)
|
|
||||||
|
|
||||||
special_ball = int(nums[5])
|
|
||||||
multiplier = int(nums[6])
|
|
||||||
return {'numbers': winning_numbers, 'special_ball': special_ball, 'multiplier': multiplier}
|
|
||||||
|
|
||||||
def get_jackpot(self):
|
|
||||||
jp_pre = self.parsed_feed.entries[1].summary
|
|
||||||
jp_pre = jp_pre[jp_pre.index('Cash'):]
|
|
||||||
jp_pre = jp_pre[jp_pre.index(':') + 3:]
|
|
||||||
jp_data = jp_pre.split()
|
|
||||||
return float(jp_data[0]) * self.modifiers[jp_data[1]]
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
from lib.Ticket import Ticket
|
|
||||||
from .Feed import Feed
|
|
||||||
from .winning_structure import get_winnings_pb, get_winnings_no_pb
|
|
||||||
|
|
||||||
|
|
||||||
class Powerball(Ticket):
|
|
||||||
|
|
||||||
def __init__(self, my_picks, my_special_ball):
|
|
||||||
super().__init__(my_picks, my_special_ball)
|
|
||||||
self.special_ball_name = 'Powerball'
|
|
||||||
self.feed = Feed()
|
|
||||||
self.get_winning_numbers()
|
|
||||||
|
|
||||||
def get_winnings_with_special_ball(self, jp):
|
|
||||||
return get_winnings_pb(self.jackpot)
|
|
||||||
|
|
||||||
def get_winnings_without_special_ball(self):
|
|
||||||
return get_winnings_no_pb()
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
#! /usr/bin/python3
|
|
||||||
|
|
||||||
from .picks import my_picks
|
|
||||||
from .Powerball import Powerball
|
|
||||||
|
|
||||||
cur_picks = []
|
|
||||||
cur_pb = 0
|
|
||||||
winnings = {}
|
|
||||||
|
|
||||||
for idx, tkt in enumerate(my_picks):
|
|
||||||
cur_picks = tkt['picks']
|
|
||||||
cur_pb = tkt['pb']
|
|
||||||
tktnum = tkt['ticket']
|
|
||||||
pbtkt = Powerball(cur_picks, cur_pb)
|
|
||||||
pbtkt.process_ticket()
|
|
||||||
key = 'Ticket ' + str(tktnum)
|
|
||||||
if key not in winnings.keys():
|
|
||||||
winnings[key] = 0
|
|
||||||
winnings[key] += pbtkt.get_ticket_winnings()
|
|
||||||
|
|
||||||
print("Total Winnings:", winnings)
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
my_picks = [
|
|
||||||
{'picks': (9,11,42,53,69), 'pb': 22, 'ticket': 1},
|
|
||||||
{'picks': (6,11,24,42,69), 'pb': 17, 'ticket': 1},
|
|
||||||
{'picks': (2,20,24,43,48), 'pb': 13, 'ticket': 1},
|
|
||||||
{'picks': (3,7,20,47,68), 'pb': 13, 'ticket': 1},
|
|
||||||
{'picks': (5,9,13,18,25), 'pb': 9, 'ticket': 1},
|
|
||||||
|
|
||||||
# quick picks #
|
|
||||||
# {'picks': (10,51,63,64,65), 'pb': 10, 'ticket': 2},
|
|
||||||
# {'picks': (2,3,24,47,56), 'pb': 9, 'ticket': 2},
|
|
||||||
# {'picks': (1,9,40,49,54), 'pb': 14, 'ticket': 2},
|
|
||||||
# {'picks': (29,31,35,43,46), 'pb': 22, 'ticket': 2},
|
|
||||||
# {'picks': (31,33,58,63,69), 'pb': 23, 'ticket': 2},
|
|
||||||
]
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
def get_winnings_pb(jackpot_cash):
|
|
||||||
return {
|
|
||||||
0: [4, 4, 7, 100, 50_000, jackpot_cash],
|
|
||||||
2: [8, 8, 14, 200, 100_000, jackpot_cash],
|
|
||||||
3: [12, 12, 21, 300, 150_000, jackpot_cash],
|
|
||||||
4: [16, 16, 28, 400, 200_000, jackpot_cash],
|
|
||||||
5: [20, 20, 35, 500, 250_000, jackpot_cash],
|
|
||||||
10: [40, 40, 70, 1_000, 500_000, jackpot_cash]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def get_winnings_no_pb():
|
|
||||||
return {
|
|
||||||
0: [0, 0, 0, 7, 100, 1_000_000],
|
|
||||||
2: [0, 0, 0, 14, 200, 2_000_000],
|
|
||||||
3: [0, 0, 0, 21, 300, 2_000_000],
|
|
||||||
4: [0, 0, 0, 28, 400, 2_000_000],
|
|
||||||
5: [0, 0, 0, 35, 500, 2_000_000],
|
|
||||||
10: [0, 0, 0, 70, 1_000, 2_000_000]
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
feedparser==6.0.11
|
|
||||||
sgmllib3k==1.0.0
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
import feedparser
|
|
||||||
|
|
||||||
|
|
||||||
class Feed:
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.feed = 'https://www.texaslottery.com/export/sites/lottery/rss/tlc_latest.xml'
|
|
||||||
self.parsed_feed = feedparser.parse(self.feed)
|
|
||||||
|
|
||||||
def get_winning_numbers(self):
|
|
||||||
nums_pre = self.parsed_feed.entries[6].summary
|
|
||||||
nums_pre = nums_pre.replace('Bonus Ball', '-')
|
|
||||||
nums = nums_pre.split(' - ')
|
|
||||||
|
|
||||||
winning_numbers = nums[:4]
|
|
||||||
|
|
||||||
for idx, num in enumerate(nums[:4]):
|
|
||||||
winning_numbers[idx] = int(num)
|
|
||||||
|
|
||||||
special_ball = int(nums[4])
|
|
||||||
return {'numbers': winning_numbers, 'special_ball': special_ball, 'multiplier': 1}
|
|
||||||
|
|
||||||
def get_jackpot(self):
|
|
||||||
jp_pre = self.parsed_feed.entries[7].summary
|
|
||||||
jp_pre = jp_pre.replace("$", "").replace(",","")
|
|
||||||
return float(jp_pre)
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
from lib.Ticket import Ticket
|
|
||||||
from .Feed import Feed
|
|
||||||
from .winning_structure import get_winnings_bb, get_winnings_no_bb
|
|
||||||
|
|
||||||
|
|
||||||
class TwoStep(Ticket):
|
|
||||||
|
|
||||||
def __init__(self, my_picks, my_special_ball, mult):
|
|
||||||
super().__init__(my_picks, my_special_ball)
|
|
||||||
self.special_ball_name = 'Bonus Ball'
|
|
||||||
self.feed = Feed()
|
|
||||||
self.get_winning_numbers()
|
|
||||||
self.multiplier = mult
|
|
||||||
|
|
||||||
def get_winnings_with_special_ball(self, jp):
|
|
||||||
return get_winnings_bb(self.jackpot)
|
|
||||||
|
|
||||||
def get_winnings_without_special_ball(self):
|
|
||||||
return get_winnings_no_bb()
|
|
||||||
|
|
||||||
def get_winning_numbers(self):
|
|
||||||
winners = self.feed.get_winning_numbers()
|
|
||||||
self.winning_numbers = winners['numbers']
|
|
||||||
self.special_ball = winners['special_ball']
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
#! /usr/bin/python3
|
|
||||||
|
|
||||||
from .picks import my_picks
|
|
||||||
from .TwoStep import TwoStep
|
|
||||||
|
|
||||||
cur_picks = []
|
|
||||||
cur_pb = 0
|
|
||||||
winnings = {}
|
|
||||||
|
|
||||||
for idx, tkt in enumerate(my_picks):
|
|
||||||
cur_picks = tkt['picks']
|
|
||||||
cur_pb = tkt['bb']
|
|
||||||
tktnum = tkt['ticket']
|
|
||||||
pbtkt = TwoStep(cur_picks, cur_pb, 1)
|
|
||||||
pbtkt.process_ticket()
|
|
||||||
key = 'Ticket ' + str(tktnum)
|
|
||||||
if key not in winnings.keys():
|
|
||||||
winnings[key] = 0
|
|
||||||
winnings[key] += pbtkt.get_ticket_winnings()
|
|
||||||
|
|
||||||
print("Total Winnings:", winnings)
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
my_picks = [
|
|
||||||
# quick picks #
|
|
||||||
{'picks': (17,25,27,33), 'bb': 25, 'mult': 1, 'ticket': 1},
|
|
||||||
]
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
def get_winnings_bb(jackpot_cash):
|
|
||||||
return {
|
|
||||||
1: [5,7,20,50,jackpot_cash]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def get_winnings_no_bb():
|
|
||||||
return {
|
|
||||||
1: [0,0,0,20,1_501]
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue