Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating a player's score in high-score-board has an undefined behavior. #513

Open
rhwood opened this issue Nov 19, 2021 · 1 comment
Open

Comments

@rhwood
Copy link
Contributor

rhwood commented Nov 19, 2021

The exercise of updating a player's score has an undefined behavior that is a teachable opportunity. The undefined behavior is what should happen when an attempt is made to update the score of a player who has not been added. There are two possibilities:

  • No change should occur (in which case the exercise should test for that and the student should guard against attempting to change a non-exesitant key in the dictionary)
  • The new player should be added (in which case the student should use the dictionary's key base subscript with a default value (sorry I couldn't find a better reference)

I can submit a PR for either behavior, but don't know which to prefer teaching.

@kotp
Copy link
Member

kotp commented Nov 20, 2021

A third option is to add this undefined behavior as a topic for mentoring. So the PR might be an addition to the mentor notes rather than the tests.

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

No branches or pull requests

2 participants