Skip to content

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

Description

@rhwood

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions