ntbloom / gamewinner

college bball bracket predictor -- bring your own algo
GNU General Public License v3.0
1 stars 1 forks source link

Example in README not running for me #10

Closed seth127 closed 1 year ago

seth127 commented 1 year ago

I think we have some outdated code examples in our docs. I couldn't get this README example to run:

$ python
Python 3.10.9 (main, Mar  8 2023, 04:44:36) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from gamewinner import gamewinner
>>> from gamewinner.strategies.evanmiya.slothfire_steady import SlothfireSteady
>>> gamewinner.play(SlothfireSteady())
>>> gamewinner.play(year = 2023, strategy = SlothfireSteady())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: play() missing 2 required positional arguments: 'west_final_four_matchup' and 'printer'

This code ran for me:

from gamewinner import gamewinner
from gamewinner.strategies.evanmiya.slothfire_steady import SlothfireSteady
import gamewinner.printers as printers
from gamewinner.team import GeographicRegion

gamewinner.play(
    year = 2023, 
    strategy = SlothfireSteady(),
    west_final_four_matchup = GeographicRegion.MIDWEST,
    printer = printers.WithColors
)

... but that's kind of a mouthful. I think we probably want to make some of those default args. Or advertise a different entry point in the README. For example, this worked like a charm.

seth127 commented 1 year ago

It would probably be nice to put some working examples in there too. Something like


$ poetry run play --strategy VanillaMiya

and/or

from gamewinner import gamewinner
from gamewinner.strategies.evanmiya.vanilla_miya import VanillaMiya

gamewinner.play(strategy = VanillaMiya())
ntbloom commented 1 year ago

Should be handled by 2ebbea3edf837221763a5e651e624ef15ec20c29. Let me know if this didn't take care of everything.