forked from menault/TD3_DEV51_Qualite_Algo
Compare commits
3 Commits
9d7c681ca3
...
9cb9088b81
| Author | SHA1 | Date | |
|---|---|---|---|
| 9cb9088b81 | |||
| 77b3158262 | |||
| 0f7c1f6b71 |
5
Makefile
5
Makefile
@@ -21,7 +21,7 @@ CLASSFILES = Pendu.class \
|
||||
$(OUT)Pendu.class : $(IN)Pendu.java $(OUT)Partie.class $(OUT)Fenetre.class
|
||||
$(JC) $(JCFLAGS) $<
|
||||
|
||||
$(OUT)Partie.class : $(IN)Partie.java
|
||||
$(OUT)Partie.class : $(IN)Partie.java $(OUT)Mots.class
|
||||
$(JC) $(JCFLAGS) $<
|
||||
|
||||
$(OUT)Fenetre.class : $(IN)Fenetre.java $(OUT)Partie.class $(OUT)Dessin.class
|
||||
@@ -30,6 +30,9 @@ $(OUT)Fenetre.class : $(IN)Fenetre.java $(OUT)Partie.class $(OUT)Dessin.class
|
||||
$(OUT)Dessin.class : $(IN)Dessin.java
|
||||
$(JC) $(JCFLAGS) $<
|
||||
|
||||
$(OUT)Mots.class : $(IN)Mots.java
|
||||
$(JC) $(JCFLAGS) $<
|
||||
|
||||
# Commandes
|
||||
Pendu : $(OUT)Pendu.class
|
||||
|
||||
|
||||
58
src/Mots.java
Normal file
58
src/Mots.java
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
/**
|
||||
* La classe <code>Mots</code>
|
||||
*
|
||||
* @version 1.0
|
||||
* @author Aurélien
|
||||
* Date : 08-10-25
|
||||
* Licence :
|
||||
*/
|
||||
public final class Mots {
|
||||
//Attributs
|
||||
public static final short dictionarysize = 32 ;
|
||||
public static final String[] dictionary = {
|
||||
"Magnifique",
|
||||
"Etoile",
|
||||
"Voyage",
|
||||
"Biscuit",
|
||||
"Refrigerateur",
|
||||
"Courage",
|
||||
"Avion",
|
||||
"Explorateur",
|
||||
"Montagne",
|
||||
"Philosophie",
|
||||
"Lumiere",
|
||||
"Ethernet",
|
||||
"Architecture",
|
||||
"Ocean",
|
||||
"Liberte",
|
||||
"Aventure",
|
||||
"Cerise",
|
||||
"Harmonieux",
|
||||
"Informatique",
|
||||
"Pluie",
|
||||
"Equilibriste",
|
||||
"Papillon",
|
||||
"Saisons",
|
||||
"Liberte",
|
||||
"Alphabet",
|
||||
"Musique",
|
||||
"Translucent",
|
||||
"Passion",
|
||||
"Etreindre",
|
||||
"Poetique",
|
||||
"Serenite",
|
||||
"Révolution"
|
||||
};
|
||||
|
||||
//Constructeur
|
||||
private Mots() { //N'a pas pour but d'être instanciée
|
||||
throw new UnsupportedOperationException("The \"Fichier\" class cannot be instanced !");
|
||||
}
|
||||
//Méthodes
|
||||
|
||||
//Affichage
|
||||
public String toString() {
|
||||
return "" ;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* La classe <code>Partie</code>
|
||||
*
|
||||
* @version 0.1
|
||||
* @version 0.2
|
||||
* @author Aurélien
|
||||
* Date : 08-10-25
|
||||
* Licence :
|
||||
@@ -81,10 +82,15 @@ public class Partie {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Génère un mot à partir d'un grand dictionnaire (enfin en principe).
|
||||
*
|
||||
* @return le mot généré.
|
||||
*/
|
||||
private char[] generateSecretWord() {
|
||||
char[] word = {'D','A','M','I','E','N'};
|
||||
//À implémenter plus tard
|
||||
Random random = new Random();
|
||||
byte grain = (byte) random.nextInt(Mots.dictionarysize);
|
||||
char[] word = Mots.dictionary[grain].toUpperCase().toCharArray();
|
||||
return word ;
|
||||
}
|
||||
|
||||
@@ -105,7 +111,7 @@ public class Partie {
|
||||
|
||||
//Tests
|
||||
public static void main(String[] args){
|
||||
char[] test = {'E','O','M','I','E','D','A','Z','N'};
|
||||
char[] test = {'E','O','M','I','E','D','A','Z','N','L','C','R','P','H','T','S'};
|
||||
byte size = (byte) test.length ;
|
||||
boolean status ;
|
||||
|
||||
@@ -124,5 +130,6 @@ public class Partie {
|
||||
System.out.println(""); //Lisibilité
|
||||
//System.out.println("Lettres : " + game.entriesletters);
|
||||
}
|
||||
System.out.println("Essais restants : " + game.getRemainingTry());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user