This commit is contained in:
Rémi Heredero 2021-11-20 17:40:45 +01:00
parent 1acb2bde6b
commit 9e56ee475a
4 changed files with 2097190 additions and 1202 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,8 @@ public class WordManager {
void askSecretWord(){ void askSecretWord(){
//System.out.print("Enter your secret word: "); //System.out.print("Enter your secret word: ");
//secretWord = Input.readString(); //secretWord = Input.readString();
secretWord = Dialogs.getHiddenString("Enter your secret word: "); //secretWord = Dialogs.getHiddenString("Enter your secret word: ");
secretWord = randomWord();
secretWord = stripAccents(secretWord); secretWord = stripAccents(secretWord);
secretWord = secretWord.toLowerCase(); secretWord = secretWord.toLowerCase();
userWord = ""; userWord = "";
@ -51,8 +52,43 @@ public class WordManager {
} }
private String randomWord() { private String randomWord() {
loadList("C:/Users/remi/OneDrive/Documents/Cours/05-HEVS/S1fb/informatic/labo/vscode/Labo/src/lab6/french_common_words.csv"); String askLevel = "";
askLevel += "Please choose your level \n";
askLevel += "('e' for easy) \n";
askLevel += "('m' for medium) \n";
askLevel += "('d' for difficult)";
char level = Dialogs.getChar(askLevel);
int nbrLettreMin = 4;
int nbrLettreMax = 12;
String s = ""; String s = "";
String[] word = loadList("C:/Users/remi/OneDrive/Documents/Cours/05-HEVS/S1fb/informatic/labo/vscode/Labo/src/lab6/french_common_words.csv");
switch (level) {
case 'e':
nbrLettreMin = 4;
nbrLettreMax = 6;
break;
case 'm':
nbrLettreMin = 7;
nbrLettreMax = 9;
break;
case 'd':
nbrLettreMin = 10;
nbrLettreMax = 12;
break;
default:
break;
}
int lg;
do {
int nbr = (int)(Math.random()*600);
s = word[nbr];
lg = s.length();
} while (lg < nbrLettreMin || lg > nbrLettreMax);
System.out.println(s);
return s; return s;
} }

File diff suppressed because it is too large Load Diff