Skip to content

Conversation

@GioeleBucci
Copy link

The exercise's instructions say: "If they player's level is below 10, their mana should be untouched."

Since the test checked against None there were unintended solutions that did not account for the player level, such as:

Some(Player(..player, health: 100, mana: option.map(player.mana, fn(_){ 100 })))

The exercise's instructions say: "If they player's level is below 10, their mana should be untouched."

Since the test checked against `None` there were unintended solutions that did not account for the player level, such as:

`Some(Player(..player, health: 100, mana: option.map(player.mana, fn(_){ 100 })))`
Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Isn't this unchanged and thus correct both before and after this change?

@GioeleBucci
Copy link
Author

Hello! Isn't this unchanged and thus correct both before and after this change?

It is indeed correct, but the test uses None, which is an unfortunate value to check against since it allows defaulting to None, independently from the previous value of the "mana".
If the value to keep was, for example 7, one could ignore it and set it to None: since the test checks against that same value it would pass when it shouldn't. Changing the value the test uses to an integer would prevent such behaviour.
I don't know if I explained it in the best terms but hopefully it's understandable.

@GioeleBucci GioeleBucci reopened this Apr 27, 2024
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

Successfully merging this pull request may close these issues.

2 participants