skent259 / crapssim

Simulator for craps with various betting strategies
MIT License
28 stars 13 forks source link

Changes for Type Hinting #3

Closed amortization closed 2 years ago

amortization commented 2 years ago

I made Bet an Abstract Base Class (ABC) since I think that better represents that it is an Abstract class that is not initialized directly.

I added total and result attributes to the init method of Dice so that those variables are initialized prior to roll or fixed_roll being run.

Then I added Type Hinting to all of crapssim for better documentation of methods and for easier error checking of misstyped parameters or variables. This passes the mypy check I ran on it.

I also used PyCharm's Optimize Imports function to optimize the imports.

This passed all tests in the tests module.

I also did some of the TODO's that were in there (should have done these separately but still getting the hang of Github stuff.):

I added new tests for all of these things and they all passed the previous tests.

skent259 commented 2 years ago

Thank you for all of these contributions! I'm sorry that I'm just seeing them now—not sure why Github didn't notify me of a pull request on here.

Given the extensiveness of the changes, I want to do some checks of my own, but these all look like good improvements on first glance. I'll follow up shortly after review.

skent259 commented 2 years ago

Other than my comment above, I think all of this is super great. Thank you! I will merge into dev after the discussion about it