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

Enhance Difficulty Representation with Stars and Text Options #31

Merged
merged 1 commit into from
Nov 18, 2023

Conversation

teogor
Copy link
Owner

@teogor teogor commented Nov 18, 2023

This pull request introduces new methods to represent difficulty levels using both stars and text labels.

Changes

  • Added a toStars() method to the Difficulty enum to convert a difficulty level to a string representation using stars.
  • Added a toLabel() method to the Difficulty enum to convert a difficulty level to a string representation using the provided array of difficulty labels.

Benefits

  • These methods provide flexibility in displaying difficulty levels in different contexts and enhance the overall readability of the code.

Code Examples

  • Converting difficulty level to stars:
val difficulty = Difficulty.Medium
val starsRepresentation = difficulty.toStars()
println("Difficulty level in stars: $starsRepresentation")
  • Converting difficulty level to text:
val difficultyLabels = arrayOf("Easy", "Medium", "Hard")
val difficulty = Difficulty.Medium
val textRepresentation = difficulty.toLabel(difficultyLabels)
println("Difficulty level in text: $textRepresentation")

@teogor teogor added @enhancement New feature or request @priority-medium labels Nov 18, 2023
@teogor teogor added this to the 1.0.0-alpha04 milestone Nov 18, 2023
@teogor teogor self-assigned this Nov 18, 2023
@teogor teogor merged commit 2f718ca into main Nov 18, 2023
4 checks passed
@zeobot zeobot bot deleted the feature/difficulty-indicators branch November 18, 2023 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@enhancement New feature or request @priority-medium
Projects
Development

Successfully merging this pull request may close these issues.

None yet

1 participant