From c6a32b8d07618c13b77f617833bba2e79d72d8d4 Mon Sep 17 00:00:00 2001 From: Melvyn Date: Sun, 2 Feb 2025 16:07:29 +0100 Subject: [PATCH] refactor : Difficulty --- .../java/sudoku/structure/Difficulty.java | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/sudoku/structure/Difficulty.java b/app/src/main/java/sudoku/structure/Difficulty.java index a39615d..674ff0b 100644 --- a/app/src/main/java/sudoku/structure/Difficulty.java +++ b/app/src/main/java/sudoku/structure/Difficulty.java @@ -1,26 +1,32 @@ package sudoku.structure; -//TODO: melvyn va passer par là +/** + * Les difficultés d'un Sudoku, + * représente le nombre de cases à enlever, en proportion, à un Sudoku. + * Par exemple, avec 0.1 de factor, on enlevera 10% des cases. + */ public enum Difficulty { - VeryEasy("Très facile", 0.1), Easy("Facile", 0.25), Medium("Moyen", 0.5), Hard("Difficile", 0.75), VeryHard("Impossible", 0.78); + VeryEasy("Très facile", 0.1), + Easy("Facile", 0.25), + Medium("Moyen", 0.5), + Hard("Difficile", 0.75), + VeryHard("Impossible", 0.78); + /** + * Le pourcentage de Cell à enlever. + */ final double factor; + /** + * Le nom de la difficulté. + */ final String displayName; - private Difficulty(String displayName, double factor) { + Difficulty(String displayName, double factor) { this.factor = factor; this.displayName = displayName; } - public String getDisplayName() { - return displayName; - } - - public double getFactor() { - return factor; - } - private static final String[] difficultyNames; static { @@ -31,6 +37,14 @@ public enum Difficulty { } } + public String getDisplayName() { + return displayName; + } + + public double getFactor() { + return factor; + } + public static String[] getDifficultyNames() { return difficultyNames; }