diff --git a/bin/lab6/HangMan.class b/bin/lab6/HangMan.class index 9f4cbd1..985a4e4 100644 Binary files a/bin/lab6/HangMan.class and b/bin/lab6/HangMan.class differ diff --git a/bin/lab6/WordManager.class b/bin/lab6/WordManager.class index dbd0a57..b31d78b 100644 Binary files a/bin/lab6/WordManager.class and b/bin/lab6/WordManager.class differ diff --git a/src/lab6/HangMan.java b/src/lab6/HangMan.java index fa59c07..2c23a11 100644 --- a/src/lab6/HangMan.java +++ b/src/lab6/HangMan.java @@ -1,9 +1,6 @@ package lab6; import hevs.graphics.FunGraphics; -import java.io.BufferedReader; -import java.io.FileReader; -import java.util.ArrayList; public class HangMan { final int MAX_STEPS = 8; @@ -80,7 +77,6 @@ public class HangMan { public static void main(String[] args) { HangMan hang = new HangMan(); - hang.loadList("C:/Users/remi/OneDrive/Documents/Cours/05-HEVS/S1fb/informatic/labo/vscode/Labo/src/lab6/french_common_words.csv"); while (true) { hang.word.askSecretWord(); hang.current_step = 0; @@ -99,25 +95,6 @@ public class HangMan { } } - - public String[] loadList(String filePath) { - String[] wordList; - try { - BufferedReader bf = new BufferedReader(new FileReader(filePath)); - ArrayList < String > al = new ArrayList < String > (); - while (bf.ready()) { - String[] c = bf.readLine().split(";"); - al.add(c[0]); - } - wordList = al.stream().toArray(String[]::new); - System.out.println("[Dictionary loaded with " + wordList.length + " words]"); - bf.close(); - return wordList; - } catch(Exception e) { - e.printStackTrace(); - return null; - } - } } // comentaire pour le fun diff --git a/src/lab6/WordManager.java b/src/lab6/WordManager.java index 5345451..5c5a55a 100644 --- a/src/lab6/WordManager.java +++ b/src/lab6/WordManager.java @@ -1,5 +1,8 @@ package lab6; import java.text.Normalizer; +import java.io.BufferedReader; +import java.io.FileReader; +import java.util.ArrayList; public class WordManager { private String secretWord = ""; @@ -46,4 +49,29 @@ public class WordManager { s = s.replaceAll("[\\p{InCombiningDiacriticalMarks}]", ""); return s; } + + private String randomWord() { + loadList("C:/Users/remi/OneDrive/Documents/Cours/05-HEVS/S1fb/informatic/labo/vscode/Labo/src/lab6/french_common_words.csv"); + String s = ""; + return s; + } + + private String[] loadList(String filePath) { + String[] wordList; + try { + BufferedReader bf = new BufferedReader(new FileReader(filePath)); + ArrayList < String > al = new ArrayList < String > (); + while (bf.ready()) { + String[] c = bf.readLine().split(";"); + al.add(c[0]); + } + wordList = al.stream().toArray(String[]::new); + System.out.println("[Dictionary loaded with " + wordList.length + " words]"); + bf.close(); + return wordList; + } catch(Exception e) { + e.printStackTrace(); + return null; + } + } }