Context
Sometimes you just want to play something. A "surprise me" option is a small
feature that shows off the registry pattern nicely.
What to change
File: arcade/main.py
Add a menu option that picks a random game from GAMES and plays it.
The menu numbering is currently computed from len(GAMES) in three places
(quit_option, scores_option, and the printing in show_menu()). Adding a
fourth option by hand will make that worse. Restructure it so the extra
options are defined once, not recomputed in each function. That refactor is
the real content of this issue.
Acceptance criteria
How to verify locally
python3 -m arcade # use Surprise me a few times
python3 -m pytest
Difficulty
Intermediate. The feature is easy; the tidy-up is the point.
New here? Comment /claim on this issue and a bot will assign it to you. Then read CONTRIBUTING.md.
Stuck at any point? Comment here saying what you have tried, or come to a PR Debug Clinic (Oct 12 or Oct 21). Getting stuck is the normal experience of learning this, not a sign you are doing it wrong.
Context
Sometimes you just want to play something. A "surprise me" option is a small
feature that shows off the registry pattern nicely.
What to change
File:
arcade/main.pyAdd a menu option that picks a random game from
GAMESand plays it.The menu numbering is currently computed from
len(GAMES)in three places(
quit_option,scores_option, and the printing inshow_menu()). Adding afourth option by hand will make that worse. Restructure it so the extra
options are defined once, not recomputed in each function. That refactor is
the real content of this issue.
Acceptance criteria
GAMESstill shifts the numbers correctlypython3 -m pytestpassesHow to verify locally
python3 -m arcade # use Surprise me a few times python3 -m pytestDifficulty
Intermediate. The feature is easy; the tidy-up is the point.
New here? Comment
/claimon this issue and a bot will assign it to you. Then read CONTRIBUTING.md.Stuck at any point? Comment here saying what you have tried, or come to a PR Debug Clinic (Oct 12 or Oct 21). Getting stuck is the normal experience of learning this, not a sign you are doing it wrong.