forked from menault/TD3_DEV51_Qualite_Algo
Compare commits
2 Commits
87909bbe35
...
amary
| Author | SHA1 | Date | |
|---|---|---|---|
| 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
|
$(OUT)Pendu.class : $(IN)Pendu.java $(OUT)Partie.class $(OUT)Fenetre.class
|
||||||
$(JC) $(JCFLAGS) $<
|
$(JC) $(JCFLAGS) $<
|
||||||
|
|
||||||
$(OUT)Partie.class : $(IN)Partie.java
|
$(OUT)Partie.class : $(IN)Partie.java $(OUT)Mots.class
|
||||||
$(JC) $(JCFLAGS) $<
|
$(JC) $(JCFLAGS) $<
|
||||||
|
|
||||||
$(OUT)Fenetre.class : $(IN)Fenetre.java $(OUT)Partie.class $(OUT)Dessin.class
|
$(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
|
$(OUT)Dessin.class : $(IN)Dessin.java
|
||||||
$(JC) $(JCFLAGS) $<
|
$(JC) $(JCFLAGS) $<
|
||||||
|
|
||||||
|
$(OUT)Mots.class : $(IN)Mots.java
|
||||||
|
$(JC) $(JCFLAGS) $<
|
||||||
|
|
||||||
# Commandes
|
# Commandes
|
||||||
Pendu : $(OUT)Pendu.class
|
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>
|
* La classe <code>Partie</code>
|
||||||
*
|
*
|
||||||
* @version 0.1
|
* @version 0.2
|
||||||
* @author Aurélien
|
* @author Aurélien
|
||||||
* Date : 08-10-25
|
* Date : 08-10-25
|
||||||
* Licence :
|
* 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() {
|
private char[] generateSecretWord() {
|
||||||
char[] word = {'D','A','M','I','E','N'};
|
Random random = new Random();
|
||||||
//À implémenter plus tard
|
byte grain = (byte) random.nextInt(Mots.dictionarysize);
|
||||||
|
char[] word = Mots.dictionary[grain].toUpperCase().toCharArray();
|
||||||
return word ;
|
return word ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +111,7 @@ public class Partie {
|
|||||||
|
|
||||||
//Tests
|
//Tests
|
||||||
public static void main(String[] args){
|
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 ;
|
byte size = (byte) test.length ;
|
||||||
boolean status ;
|
boolean status ;
|
||||||
|
|
||||||
@@ -124,5 +130,6 @@ public class Partie {
|
|||||||
System.out.println(""); //Lisibilité
|
System.out.println(""); //Lisibilité
|
||||||
//System.out.println("Lettres : " + game.entriesletters);
|
//System.out.println("Lettres : " + game.entriesletters);
|
||||||
}
|
}
|
||||||
|
System.out.println("Essais restants : " + game.getRemainingTry());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user