Skip to content

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

Open
@rhwood

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.

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