mirror of
https://github.com/onyx-and-iris/lottery-tui.git
synced 2026-07-29 09:24:24 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 97e5c9df5a | |||
| 1efd518e9f | |||
| a8a46f718d |
12
.pre-commit-config.yaml
Normal file
12
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v2.3.0
|
||||||
|
hooks:
|
||||||
|
- id: check-yaml
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: trailing-whitespace
|
||||||
|
|
||||||
|
- repo: https://github.com/pdm-project/pdm
|
||||||
|
rev: 2.26.6
|
||||||
|
hooks:
|
||||||
|
- id: pdm-lock-check
|
||||||
@@ -34,7 +34,7 @@ The TUI should now be discoverable as lottery-tui.
|
|||||||
|
|
||||||
Launch the TUI, select a lottery and press the Draw button!
|
Launch the TUI, select a lottery and press the Draw button!
|
||||||
|
|
||||||
To exit from the application press *q* or *Ctrl+q*
|
To exit from the application press `Ctrl+q`.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "lottery-tui"
|
name = "lottery-tui"
|
||||||
version = "1.0.3"
|
version = "1.1.0"
|
||||||
description = "A terminal user interface for lottery games."
|
description = "A terminal user interface for lottery games."
|
||||||
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
|
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
|
||||||
dependencies = ["textual>=8.0.0", "loguru>=0.7.3"]
|
dependencies = ["textual>=8.0.0", "loguru>=0.7.3"]
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ class Result:
|
|||||||
bonus_name = 'Life Ball'
|
bonus_name = 'Life Ball'
|
||||||
case 'Thunderball':
|
case 'Thunderball':
|
||||||
bonus_name = 'Thunderball'
|
bonus_name = 'Thunderball'
|
||||||
|
case 'Powerball':
|
||||||
|
bonus_name = 'Powerball'
|
||||||
case _:
|
case _:
|
||||||
bonus_name = 'Bonus Numbers'
|
bonus_name = 'Bonus Numbers'
|
||||||
out += f'\n{bonus_name}: {", ".join(str(n) for n in self.bonus)}'
|
out += f'\n{bonus_name}: {", ".join(str(n) for n in self.bonus)}'
|
||||||
@@ -124,6 +126,23 @@ class Thunderball(Lottery):
|
|||||||
return Result(kind=type(self).__name__, numbers=numbers, bonus=thunderball)
|
return Result(kind=type(self).__name__, numbers=numbers, bonus=thunderball)
|
||||||
|
|
||||||
|
|
||||||
|
@register_lottery
|
||||||
|
class Powerball(Lottery):
|
||||||
|
"""A class representing the Powerball lottery.
|
||||||
|
|
||||||
|
Powerball draws 5 numbers from a pool of 1 to 69, without replacement,
|
||||||
|
and 1 "Powerball" number from a separate pool of 1 to 26.
|
||||||
|
"""
|
||||||
|
|
||||||
|
POSSIBLE_NUMBERS = range(1, 70)
|
||||||
|
|
||||||
|
def draw(self) -> Result:
|
||||||
|
"""Perform a Powerball draw."""
|
||||||
|
numbers = random.sample(Powerball.POSSIBLE_NUMBERS, 5)
|
||||||
|
powerball = [random.randint(1, 26)]
|
||||||
|
return Result(kind=type(self).__name__, numbers=numbers, bonus=powerball)
|
||||||
|
|
||||||
|
|
||||||
def request_lottery_obj(lottery_name: str) -> Lottery:
|
def request_lottery_obj(lottery_name: str) -> Lottery:
|
||||||
"""Return a lottery object based on the provided lottery name."""
|
"""Return a lottery object based on the provided lottery name."""
|
||||||
lottery_cls = registry.get(lottery_name.lower())
|
lottery_cls = registry.get(lottery_name.lower())
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class LotteryTUI(App):
|
|||||||
('EuroMillions', 'euromillions'),
|
('EuroMillions', 'euromillions'),
|
||||||
('Set For Life', 'setforlife'),
|
('Set For Life', 'setforlife'),
|
||||||
('Thunderball', 'thunderball'),
|
('Thunderball', 'thunderball'),
|
||||||
|
('Powerball', 'powerball'),
|
||||||
],
|
],
|
||||||
value='lotto',
|
value='lotto',
|
||||||
allow_blank=False,
|
allow_blank=False,
|
||||||
|
|||||||
Reference in New Issue
Block a user