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 Models.Word;
import Models.Difficulty;
public class Game {
private Word word;
private int errors;
@@ -38,7 +38,7 @@ public class Game {
return word;
}
}
return list.get(0);
return list.getFirst();
}
/* Selected word level Difficult */
@@ -47,10 +47,10 @@ public class Game {
}
public boolean playLetter(char caractere) {
Boolean correct;
boolean correct;
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{
correct = word.VerifyLetter(caractere);
}
@@ -70,7 +70,7 @@ public class Game {
/* All letter is completed : Won */
public boolean isWon() {
return word.IsComplet();
return word.IsComplete();
}
/* 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 {
EASY, MEDIUM, HARD

View File

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

View File

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