Vérif fait

This commit is contained in:
2025-10-08 16:26:47 +02:00
parent 94e7394494
commit d4d8249c8b
4 changed files with 13 additions and 17 deletions

View File

@@ -1,10 +1,10 @@
package Controllers; package fr.iutfbleau.TD3_DEV51_Qualite_Algo.Controllers;
import fr.iutfbleau.TD3_DEV51_Qualite_Algo.Models.Difficulty;
import fr.iutfbleau.TD3_DEV51_Qualite_Algo.Models.Word;
import java.util.*; import java.util.*;
import Models.Word;
import Models.Difficulty;
public class Game { public class Game {
private Word word; private Word word;
private int errors; private int errors;
@@ -38,7 +38,7 @@ public class Game {
return word; return word;
} }
} }
return list.get(0); return list.getFirst();
} }
/* Selected word level Difficult */ /* Selected word level Difficult */
@@ -47,10 +47,10 @@ public class Game {
} }
public boolean playLetter(char caractere) { public boolean playLetter(char caractere) {
Boolean correct; boolean correct;
if(difficulty == Difficulty.HARD){ if(difficulty == Difficulty.HARD){
correct = allwords.get(0).VerifyLetter(caractere) || word.get(1).VerifyLetter(caractere); correct = this.allwords.get(0).VerifyLetter(caractere) || this.word.VerifyLetter(caractere);
} else{ } else{
correct = word.VerifyLetter(caractere); correct = word.VerifyLetter(caractere);
} }
@@ -70,7 +70,7 @@ public class Game {
/* All letter is completed : Won */ /* All letter is completed : Won */
public boolean isWon() { public boolean isWon() {
return word.IsComplet(); return word.IsComplete();
} }
/* Lost if maxErrors is greater than or egal to errors */ /* Lost if maxErrors is greater than or egal to errors */

View File

@@ -1,4 +1,4 @@
package Models; package fr.iutfbleau.TD3_DEV51_Qualite_Algo.Models;
public enum Difficulty { public enum Difficulty {
EASY, MEDIUM, HARD EASY, MEDIUM, HARD

View File

@@ -1,4 +1,4 @@
package Models; package fr.iutfbleau.TD3_DEV51_Qualite_Algo.Models;
public class Letter{ public class Letter{
private char letter; private char letter;

View File

@@ -1,4 +1,4 @@
package Models; package fr.iutfbleau.TD3_DEV51_Qualite_Algo.Models;
import java.util.*; import java.util.*;
@@ -27,7 +27,7 @@ public class Word {
} }
/* Le mot a été deviné */ /* Le mot a été deviné */
public boolean IsComplet(){ public boolean IsComplete(){
for(Letter letter : this.tabLetter){ for(Letter letter : this.tabLetter){
if(!letter.getStatus()){ if(!letter.getStatus()){
return false; return false;
@@ -39,9 +39,5 @@ public class Word {
public String getWord() { public String getWord() {
return word; return word;
} }
public Word get(int i) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'get'");
}
} }