Add Models Algo #6
@@ -1,17 +1,7 @@
|
||||
package fr.iutfbleau.TD3_DEV51_Qualite_Algo;
|
||||
|
||||
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
|
||||
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
|
||||
// to see how IntelliJ IDEA suggests fixing it.
|
||||
System.out.printf("Hello and welcome!");
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
|
||||
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
|
||||
System.out.println("i = " + i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,30 +1,20 @@
|
||||
|
||||
|
||||
public class Lettre{
|
||||
private char lettre;
|
||||
public class Letter{
|
||||
private char letter;
|
||||
private boolean status = false;
|
||||
|
||||
public Lettre(char lettre){
|
||||
this.lettre = lettre;
|
||||
|
||||
|
||||
public Letter(char letter){
|
||||
this.letter = letter;
|
||||
}
|
||||
|
||||
/* Status bool */
|
||||
/* Show status */
|
||||
private boolean getStatus(){
|
||||
return status
|
||||
}
|
||||
|
||||
|
||||
/* Verify status true, false */
|
||||
private boolean isGood(char c){
|
||||
if( this.lettre == c){
|
||||
if( this.letter == c){
|
||||
this.status = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
import java.util.*;
|
||||
|
||||
|
||||
|
||||
public class Mot {
|
||||
public String mot;
|
||||
public Lettre[] chaine;
|
||||
|
||||
|
||||
public Mot(String mot){
|
||||
this.mot = mot;
|
||||
for(int i = 0; i< this.mot.length();i++){
|
||||
this.chaine[i] = Lettre(this.mot.charAt(i))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
import java.util.*;
|
||||
|
||||
public class Word {
|
||||
private String word;
|
||||
private Letter[] tabLetter;
|
||||
private String c;
|
||||
|
||||
private Word(String word){
|
||||
this.word = word;
|
||||
for(int i = 0; i< this.word.length();i++){
|
||||
this.tabLetter[i] = Letter(this.word.charAt(i))
|
||||
}
|
||||
}
|
||||
/* Lettre dans le mot */
|
||||
private boolean VerifyLetter(String c){
|
||||
boolean return_bool = false;
|
||||
for(Letter letter in this.tabLetter){
|
||||
if(!letter.getStatus()){
|
||||
if(letter.isGood(c)){
|
||||
return_bool = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return return_bool;
|
||||
}
|
||||
|
||||
/* Le mot a été deviné */
|
||||
private boolean IsComplet(){
|
||||
if(Letter letter : this.tabLetter){
|
||||
if(!letter.getStatus()){
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user