Update to be multi-ticket reportable.
This commit is contained in:
parent
c136e9c835
commit
ca52ffd5ef
56
.gitignore
vendored
56
.gitignore
vendored
|
|
@ -7,44 +7,42 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
dist/
|
||||||
|
|
||||||
# Compiled Java class files
|
|
||||||
*.class
|
|
||||||
|
|
||||||
# Compiled Python bytecode
|
# Compiled Python bytecode
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|
||||||
# Log files
|
# Log files
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
# Package files
|
|
||||||
*.jar
|
|
||||||
|
|
||||||
# Maven
|
|
||||||
target/
|
|
||||||
dist/
|
|
||||||
|
|
||||||
# JetBrains IDE
|
|
||||||
.idea/
|
|
||||||
|
|
||||||
# Unit test reports
|
|
||||||
TEST*.xml
|
|
||||||
|
|
||||||
# Generated by MacOS
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
# Generated by Windows
|
|
||||||
Thumbs.db
|
|
||||||
|
|
||||||
# Applications
|
# Applications
|
||||||
*.app
|
*.app
|
||||||
*.exe
|
*.exe
|
||||||
*.war
|
*.war
|
||||||
|
|
||||||
# Large media files
|
# Cache files for Sublime Text
|
||||||
*.mp4
|
*.tmlanguage.cache
|
||||||
*.tiff
|
*.tmPreferences.cache
|
||||||
*.avi
|
*.stTheme.cache
|
||||||
*.flv
|
|
||||||
*.mov
|
# Workspace files are user-specific
|
||||||
*.wmv
|
*.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
|
||||||
|
|
||||||
|
|
|
||||||
28
LotteryChecker.sublime-project
Normal file
28
LotteryChecker.sublime-project
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -31,9 +31,11 @@ class Ticket:
|
||||||
self.process_winnings(special_ball_wins, non_special_ball_wins)
|
self.process_winnings(special_ball_wins, non_special_ball_wins)
|
||||||
|
|
||||||
def check_numbers(self):
|
def check_numbers(self):
|
||||||
for num in self.my_picks:
|
# for num in self.my_picks:
|
||||||
if num in self.winning_numbers:
|
# if num in self.winning_numbers:
|
||||||
self.matched_numbers.append(num)
|
# self.matched_numbers.append(num)
|
||||||
|
self.matched_numbers = list(
|
||||||
|
set(self.my_picks).intersection(set(self.winning_numbers)))
|
||||||
|
|
||||||
def check_special_ball(self):
|
def check_special_ball(self):
|
||||||
self.matched_special_ball = False
|
self.matched_special_ball = False
|
||||||
|
|
@ -60,7 +62,10 @@ class Ticket:
|
||||||
print(f'Your Numbers: {self.my_picks}')
|
print(f'Your Numbers: {self.my_picks}')
|
||||||
print(f'Your {special_ball}: {self.my_special_ball}')
|
print(f'Your {special_ball}: {self.my_special_ball}')
|
||||||
print(f'Matched Numbers: {self.matched_numbers}')
|
print(f'Matched Numbers: {self.matched_numbers}')
|
||||||
print(f'Matched {special_ball}: {"True" if self.matched_special_ball else "False"}')
|
print(
|
||||||
|
f'Matched {special_ball}: '
|
||||||
|
f'{"True" if self.matched_special_ball else "False"}'
|
||||||
|
)
|
||||||
if self.winnings > 0:
|
if self.winnings > 0:
|
||||||
print(f'Ticket is worth: {self.winnings}')
|
print(f'Ticket is worth: {self.winnings}')
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,17 @@ from .MegaMillions import MegaMillions
|
||||||
|
|
||||||
cur_picks = []
|
cur_picks = []
|
||||||
cur_pb = 0
|
cur_pb = 0
|
||||||
winnings = 0
|
winnings = {}
|
||||||
|
|
||||||
for idx, tkt in enumerate(my_picks):
|
for idx, tkt in enumerate(my_picks):
|
||||||
cur_picks = tkt['picks']
|
cur_picks = tkt['picks']
|
||||||
cur_pb = tkt['mb']
|
cur_pb = tkt['mb']
|
||||||
|
tktnum = tkt['ticket']
|
||||||
pbtkt = MegaMillions(cur_picks, cur_pb)
|
pbtkt = MegaMillions(cur_picks, cur_pb)
|
||||||
pbtkt.process_ticket()
|
pbtkt.process_ticket()
|
||||||
winnings += pbtkt.get_ticket_winnings()
|
key = 'Ticket ' + str(tktnum)
|
||||||
|
if key not in winnings.keys():
|
||||||
|
winnings[key] = 0
|
||||||
|
winnings[key] += pbtkt.get_ticket_winnings()
|
||||||
|
|
||||||
print("Total Winnings:", winnings)
|
print("Total Winnings:", winnings)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,14 @@
|
||||||
my_picks = [
|
my_picks = [
|
||||||
{'picks': (1, 2, 3, 4, 5), 'mb': 9},
|
{'picks': (9, 11, 42, 53, 69), 'mb': 22, 'ticket': 1},
|
||||||
{'picks': (2, 3, 4, 5, 6), 'mb': 19},
|
{'picks': (6, 11, 24, 42, 69), 'mb': 17, 'ticket': 1},
|
||||||
|
{'picks': (2, 20, 24, 43, 48), 'mb': 13, 'ticket': 1},
|
||||||
|
{'picks': (3, 7, 20, 47, 68), 'mb': 13, 'ticket': 1},
|
||||||
|
{'picks': (5, 9, 13, 18, 25), 'mb': 9, 'ticket': 1},
|
||||||
|
|
||||||
|
# quick picks #
|
||||||
|
{'picks': (13, 37, 44, 50, 61), 'mb': 9, 'ticket': 2},
|
||||||
|
{'picks': (1, 36, 43, 55, 68), 'mb': 25, 'ticket': 2},
|
||||||
|
{'picks': (2, 13, 44, 52, 70), 'mb': 15, 'ticket': 2},
|
||||||
|
{'picks': (8, 21, 27, 63, 64), 'mb': 2, 'ticket': 2},
|
||||||
|
{'picks': (14, 42, 48, 57, 58), 'mb': 4, 'ticket': 2},
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,17 @@ from .Powerball import Powerball
|
||||||
|
|
||||||
cur_picks = []
|
cur_picks = []
|
||||||
cur_pb = 0
|
cur_pb = 0
|
||||||
winnings = 0
|
winnings = {}
|
||||||
|
|
||||||
for idx, tkt in enumerate(my_picks):
|
for idx, tkt in enumerate(my_picks):
|
||||||
cur_picks = tkt['picks']
|
cur_picks = tkt['picks']
|
||||||
cur_pb = tkt['pb']
|
cur_pb = tkt['pb']
|
||||||
|
tktnum = tkt['ticket']
|
||||||
pbtkt = Powerball(cur_picks, cur_pb)
|
pbtkt = Powerball(cur_picks, cur_pb)
|
||||||
pbtkt.process_ticket()
|
pbtkt.process_ticket()
|
||||||
winnings += pbtkt.get_ticket_winnings()
|
key = 'Ticket ' + str(tktnum)
|
||||||
|
if key not in winnings.keys():
|
||||||
|
winnings[key] = 0
|
||||||
|
winnings[key] += pbtkt.get_ticket_winnings()
|
||||||
|
|
||||||
print("Total Winnings:", winnings)
|
print("Total Winnings:", winnings)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,20 @@
|
||||||
my_picks = [
|
my_picks = [
|
||||||
{'picks': (1, 2, 3, 4, 5), 'pb': 22},
|
{'picks': (9, 11, 42, 53, 69), 'pb': 22, 'ticket': 1},
|
||||||
{'picks': (2, 3, 4, 5, 6), 'pb': 19},
|
{'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': (4, 10, 17, 36, 67), 'pb': 16, 'ticket': 2},
|
||||||
|
{'picks': (14, 20, 33, 41, 59), 'pb': 26, 'ticket': 2},
|
||||||
|
{'picks': (32, 39, 56, 58, 67), 'pb': 23, 'ticket': 2},
|
||||||
|
{'picks': (5, 12, 24, 61, 64), 'pb': 11, 'ticket': 2},
|
||||||
|
{'picks': (11, 13, 16, 24, 35), 'pb': 25, 'ticket': 2},
|
||||||
|
|
||||||
|
{'picks': (32, 38, 47, 54, 62), 'pb': 26, 'ticket': 3},
|
||||||
|
{'picks': (2, 10, 53, 62, 67), 'pb': 14, 'ticket': 3},
|
||||||
|
{'picks': (1, 19, 37, 52, 66), 'pb': 22, 'ticket': 3},
|
||||||
|
{'picks': (18, 35, 51, 65, 67), 'pb': 24, 'ticket': 3},
|
||||||
|
{'picks': (17, 35, 42, 48, 65), 'pb': 7, 'ticket': 3},
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue