Skip to content

Solution/002 lotto fake extraction#2

Open
Danielef12 wants to merge 4 commits into
tomorrowdevs-projects:mainfrom
Danielef12:solution/002-lotto-fake-extraction
Open

Solution/002 lotto fake extraction#2
Danielef12 wants to merge 4 commits into
tomorrowdevs-projects:mainfrom
Danielef12:solution/002-lotto-fake-extraction

Conversation

@Danielef12

Copy link
Copy Markdown

No description provided.

str: Wheel selected by the user.
"""
print("\nChoose a 'ruota' from the list below:\n")
ruote: List[str] = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this list should never change, I know, but I would have expected a scalable approach that reads data from a file, thereby avoiding the need to modify the code in the future if the list were to change for any reason

]

while True:
for i, route in enumerate(ruote, start=1):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected a class dedicated to the routes list and various methods to do "things" on that list, as the print of the entire list, and others. Remember always the DRY (Don't Repeat Yourself) principle

"""
print("\nChoose a 'giocata' from the list below:\n")
giocate_list: dict[str, int] = {
"Ambata": 1,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as the route list

}
keys: List[str] = list(giocate_list.keys())

for i, play in enumerate(keys, start=1):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as my comment on the DRY principle

"""Initializes the controller and the ticket generator."""
self.bill_generator: BillGenerator = BillGenerator()
self.extraction = Extraction()
self.winning_bill: WinningBill

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you must always initialize the properties inside the constructor. In this case, self.winning_bill doesn't exist until you set it this way self.winning_bill=WinningBill(bla, bla, bla, ecc).
I don't find any snippet like this, you are using the WinningBill but it isn't a property in the Controller

numbers: List[int] = self.bill_generator.get_numbers(numbers_in_bills)
bill: Bill = Bill(giocata_name, ruota, numbers)
self.bills[number] = bill
print(type(self.bills))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type???

Returns:
List[str]: A list containing the names of all Lotto wheels.
"""
ruote: List[str] = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how many times did you repeat the same code?

is a winning one based on the extracted numbers.

"""
GIOCATE_RULES = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want handle the rules this way (even if I don't agree), define it as a CONSTANT common to the entire project and recall from any file/class you need.
If you set the variable in the class but out of the constructor, the var will be shared to every instance of the class, which isn't a best practice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants