30 lines
798 B
Java
30 lines
798 B
Java
package com.lumen.daily;
|
|
|
|
public enum Difficulty {
|
|
EASY("Easy", "Short deductions. A gentle place to begin."),
|
|
MEDIUM("Medium", "Link deductions across rows and columns."),
|
|
HARD("Hard", "Follow longer chains to uncover the pattern.");
|
|
|
|
public final String label;
|
|
public final String description;
|
|
|
|
Difficulty(String label, String description) {
|
|
this.label = label;
|
|
this.description = description;
|
|
}
|
|
|
|
public static Difficulty fromRounds(int rounds) {
|
|
if (rounds <= 2) return EASY;
|
|
if (rounds <= 4) return MEDIUM;
|
|
return HARD;
|
|
}
|
|
|
|
public static Difficulty fromStored(String value) {
|
|
try {
|
|
return valueOf(value);
|
|
} catch (IllegalArgumentException e) {
|
|
return EASY;
|
|
}
|
|
}
|
|
}
|