Update majeur + aucun probleme ecriture/lecture + ajout des premières classes pour les algo

This commit is contained in:
fauvet 2023-04-26 21:36:06 +02:00
parent 48827f3897
commit 47f29fcb63
7 changed files with 49 additions and 18 deletions

7
ChoixAlgo.java Normal file
View File

@ -0,0 +1,7 @@
public class ChoixAlgo extends Fenetre {
public ChoixAlgo(boolean[][] uneGrille){
super();
outils.PrintGrilleBool(uneGrille, uneGrille.length);
}
}

View File

@ -1,11 +1,6 @@
import java.awt.*;
public class FenetreImpGrille extends Fenetre {
public static final int COULOIR=0;
public static final int MUR=1;
public static final int ENTREE=2;
public static final int SORTIE=3;
private boolean[][] grille;
public FenetreImpGrille(){
@ -46,21 +41,21 @@ public class FenetreImpGrille extends Fenetre {
}
if((i*taille+j)==(Lentre*taille+Centre)){
Cellules cellules = new Cellules(i, j, ENTREE);
Cellules cellules = new Cellules(i, j, Cellules.ENTREE);
this.fenetre.add(cellules);
} else if((i*taille+j)==(Lortie*taille+Cortie)){
Cellules cellules = new Cellules(i, j, SORTIE);
Cellules cellules = new Cellules(i, j, Cellules.SORTIE);
this.fenetre.add(cellules);
} else if(ce_double_tab[i][j] == 1){
Cellules cellules = new Cellules(i, j, MUR);
Cellules cellules = new Cellules(i, j, Cellules.MUR);
this.fenetre.add(cellules);
} else{
Cellules cellules = new Cellules(i, j, COULOIR);
Cellules cellules = new Cellules(i, j, Cellules.COULOIR);
this.fenetre.add(cellules);
}
}
}
this.fenetre.setVisible(true);
outils.PrintGrilleBool(this.grille, taille);
}
}

View File

@ -52,9 +52,9 @@ public class FenetreRndmGrille extends Fenetre{
int nombreAleatoire = rand.nextInt(2); // génère un nombre entre 0 et 2
if(nombreAleatoire == 0){
grille[i][j] = false;
} else {
grille[i][j] = true;
} else {
grille[i][j] = false;
}
this.modif = new Modifications(interfacePanel, grille,this.tabCouleur);
@ -94,6 +94,8 @@ public class FenetreRndmGrille extends Fenetre{
compteur++;
}
}
outils.PrintGrilleBool(grille, taille);
this.fenetre.setVisible(true);
}
}

View File

@ -31,12 +31,13 @@ public class GestionExporter implements ActionListener{
this.framePopup.dispose();
//outils.PrintGrilleBool(this.cetteGrille, this.cetteTaille);
PreEcriture precriture = new PreEcriture(this.cetteGrille, this.grilleCellules, this.cetteTaille);
ChoixAlgo suite = new ChoixAlgo(this.cetteGrille);
}
else if (cet_event.equals(this.Reponses2)){
this.frameGrille.dispose();
this.frameModif.dispose();
this.framePopup.dispose();
System.out.println("tout a été fermé");
ChoixAlgo suite = new ChoixAlgo(this.cetteGrille);
}
}
}

View File

@ -106,7 +106,7 @@ public class Lecture {
}
for(int i=0; i<ceResultat.length; i++){
System.out.println("le resultats vaut : "+ceResultat[i]);
System.out.print("le resultats vaut : "+ceResultat[i] +"\n");
}
/* =================================== Fermeture fichier ==================================== */

View File

@ -73,7 +73,7 @@ Affichage.class : Affichage.java outils.class
Exporter.class : Exporter.java GestionExporter.class
${JC} ${JCFLAGS} Exporter.java
GestionExporter.class : GestionExporter.java PreEcriture.class
GestionExporter.class : GestionExporter.java PreEcriture.class ChoixAlgo.class
${JC} ${JCFLAGS} GestionExporter.java
PreEcriture.class : PreEcriture.java Ecriture.class
@ -82,7 +82,8 @@ PreEcriture.class : PreEcriture.java Ecriture.class
Ecriture.class : Ecriture.java
${JC} ${JCFLAGS} Ecriture.java
ChoixAlgo.class : ChoixAlgo.java
${JC} ${JCFLAGS} ChoixAlgo.java
# ================================
### REGLES OPTIONNELLES ###

View File

@ -52,21 +52,46 @@ public class PreEcriture {
// Transformation du tableau de boolean en un tableau de chaine de String qui stock des nombre sous formes de byte
int compteur1=0;
int decompte=0;
for(boolean cetteIteration : tabHorizontal){
if(this.octetRemaining<8){
break;
}
if(cetteIteration==true){
tempString = tempString + "0";
} else if(cetteIteration==false){
tempString = tempString + "1";
}
if(tempString.length()==8 || this.octetRemaining<8){
if(tempString.length()==8){
tabTemp[compteur1] = tempString;
tempString="";
compteur1++;
this.octetRemaining = this.octetRemaining - 8;
}
decompte++;
}
if(decompte != tabHorizontal.length){
while(decompte != tabHorizontal.length){
if(tabHorizontal[decompte]==true){
tempString=tempString+"0";
}else if(tabHorizontal[decompte]==false){
tempString=tempString+"1";
}
decompte++;
} while(tempString.length() < 8){
tempString=tempString+"0";
}
this.tabTemp[compteur1] = tempString;
}
for(int i=0; i<tabTemp.length; i++){
System.out.println(tabTemp[i]+" ");
}
this.path = this.CreateFichier();
Ecriture stylo = new Ecriture(this.resultatByte, this.tabTemp, this.path);
}