DiceRoll sentinel value (-1) can display to user before roll() #78
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
DiceRollusesnumberOfSuccesses: Int = -1as a sentinel value. If UI code accidentally renders aDiceRollbefore.roll()is called, the user sees "-1 successes". This is a code smell that could surface as a visible bug.Files
sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/functions/Dice.kt(lines 11-17)Expected Behavior
Int?, or require rolling at construction to make invalid states unrepresentableAcceptance Criteria
DiceRollcannot represent an un-rolled state that displays as a negative number