Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
3035 connectés 

  FORUM HardWare.fr
  Programmation
  Java

  Aide en programmation

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Aide en programmation

n°2315279
shengai033
Posté le 13-05-2018 à 10:48:34  profilanswer
 

Bonjour, je ne suis pas sûr que se soit la bonne rubrique pour demander ça  
Mais voilà, j'ai un programme à faire en ISN pour le projet bac, et avec mon groupe, on a choisi de faire un sudoku en javascool
Quand je lance mon code, la compilation réussis, mais l’exécution ne marche pas et je n'arrive pas à savoir d'où ça vient.  
 
Pour résumer le code la première fonction, c'est pour coder la couleur, la deuxième, c'est pour vérifier les lignes colonnes.
Et c'est quand j'essaie d’insérer les fonction que je bloque je pense  
J'aimerai savoir si quelqu'un ici s'y connait pour qu'il puisse m'aider a régler ce problème  
merci d'avance  
 
<code>
void Couleur(int[][] grille) {
   int largeur = grille.length;
   int hauteur = grille[0].length;
   for (int x = 0; x <= (largeur -1); x = x +1) {
      for (int y = 0; y <= (hauteur -1); y = y +1) {
         if (grille[x][y] ==1) {
            setPixel(x, y -3, 0, 0, 0);
            setPixel(x, y -2, 0, 0, 0);
            setPixel(x, y -1, 0, 0, 0);
            setPixel(x, y, 0, 0, 0);
            setPixel(x, y +1, 0, 0, 0);
            setPixel(x, y +2, 0, 0, 0);
            setPixel(x, y +3, 0, 0, 0);
            setPixel(x -1, y -2, 0, 0, 0);
            setPixel(x -1, y +3, 0, 0, 0);
            setPixel(x +1, y +3, 0, 0, 0);
         } else if (grille[x][y] ==2) {
            setPixel(x -2, y -2, 0, 0, 0);
            setPixel(x -1, y -3, 0, 0, 0);
            setPixel(x, y -3, 0, 0, 0);
            setPixel(x +1, y -3, 0, 0, 0);
            setPixel(x +2, y -2, 0, 0, 0);
            setPixel(x +2, y -1, 0, 0, 0);
            setPixel(x +1, y, 0, 0, 0);
            setPixel(x, y +1, 0, 0, 0);
            setPixel(x -1, y +2, 0, 0, 0);
            setPixel(x -2, y +3, 0, 0, 0);
            setPixel(x -1, y +3, 0, 0, 0);
            setPixel(x, y +3, 0, 0, 0);
            setPixel(x +1, y +3, 0, 0, 0);
            setPixel(x +2, y +3, 0, 0, 0);
         } else if (grille[x][y] ==3) {
            setPixel(x -2, y -2, 0, 0, 0);
            setPixel(x -1, y -3, 0, 0, 0);
            setPixel(x, y -3, 0, 0, 0);
            setPixel(x +1, y -3, 0, 0, 0);
            setPixel(x +2, y -2, 0, 0, 0);
            setPixel(x +2, y -1, 0, 0, 0);
            setPixel(x, y, 0, 0, 0);
            setPixel(x +1, y, 0, 0, 0);
            setPixel(x, y +3, 0, 0, 0);
            setPixel(x +2, y +1, 0, 0, 0);
            setPixel(x -2, y +2, 0, 0, 0);
            setPixel(x +2, y +2, 0, 0, 0);
            setPixel(x -1, y +3, 0, 0, 0);
            setPixel(x, y +3, 0, 0, 0);
            setPixel(x +1, y +3, 0, 0, 0);
         } else if (grille[x][y] ==4) {
            setPixel(x +1, y -3, 0, 0, 0);
            setPixel(x, y -2, 0, 0, 0);
            setPixel(x -1, y -1, 0, 0, 0);
            setPixel(x -2, y, 0, 0, 0);
            setPixel(x +1, y, 0, 0, 0);
            setPixel(x -2, y +1, 0, 0, 0);
            setPixel(x -1, y +1, 0, 0, 0);
            setPixel(x, y +1, 0, 0, 0);
            setPixel(x +1, y +1, 0, 0, 0);
            setPixel(x +2, y +1, 0, 0, 0);
            setPixel(x +1, y +2, 0, 0, 0);
            setPixel(x +1, y +3, 0, 0, 0);
         } else if (grille[x][y] ==10) {
            setPixel(x, y, 0, 0, 0);
         }
      }
   }
}
 
 
 
boolean creation(int[][]GRILLE, int x, int y) {
   
    int[] LISTE = new int[4];
  LISTE[0] = random(1, 5);
   for (int i = 1; i < 4; i ++) {
      for (boolean valable = false; ! valable;) {
          LISTE[i] = random(1, 5);
         valable = true;
         for (int j = 0; j < i; j ++) {
            if (LISTE[i] == LISTE[j]) {
               valable = false;
            }
         }
      }
   }
   
   GRILLE[x][y] =0;
   return  false;
}
 
void main() {
   
    int[][] TABLEAU = new int[4][4];
   while ( ! creation(TABLEAU, 0, 0)) {
     
    }
   int d,e,z, a;
   int grille[][] = new int[48][48];
   
    int tabx, taby;
   tabx = 0;
   for (d =7; d < 48; d = d +11) {
      taby =0;
      for (e =7; e < 48; e = e+11) {
         grille[d][e] = TABLEAU[tabx][taby];
         taby = taby +1;
      }
      tabx = tabx +1;
   }
 
   
   
   
   // Quadrillage du tableau  
    // Contour du haut
    for (d =0; d <48; d = d +1) {
      for (e =0; e <2; e = e +1) {
         grille[d][e] =10;
      }
   }
   // Contour du bas
    for (d =0; d <47; d = d +1) {
      for (e =46; e <48; e = e+1) {
         grille[d][e] =10;
      }
   }
   // Contour de gauche
    for (d =0; d <2; d = d +1) {
      for (e =0; e <47; e = e +1) {
         grille[d][e] =10;
      }
   }
   // Contour de droite
    for (d =46; d <48; d = d +1) {
      for (e =0; e <48; e = e+1) {
         grille[d][e] =10;
      }
   }
   //Quadrillage gras verticale
    for (d =23; d <25; d = d +1) {
      for (e =0; e <47; e = e+1) {
         grille[d][e] =10;
      }
   }
   //Quadrillage gras horizontale
    for (d =0; d <47; d = d +1) {
      for (e =23; e <25; e = e+1) {
         grille[d][e] =10;
      }
   }
   // 1er quadrillage fin  horizontale
    for (d =0; d <47; d = d +1) {
      for (e =12; e <13; e = e+1) {
         grille[d][e] =10;
      }
   }
   //2eme quadrillage fin verticale
    for (d =0; d <47; d = d +1) {
      for (e =35; e <36; e = e+1) {
         grille[d][e] =10;
      }
   }
   //1eme quadrillage fin horizotale
    for (d =13; d <14; d = d +1) {
      for (e =0; e <47; e = e+1) {
         grille[d][e] =10;
      }
   }
   //2eme quadrillage fin horizontale
    for (d =36; d <37; d = d +1) {
      for (e =0; e <47; e = e+1) {
         grille[d][e] =10;
      }
   }
   reset(48, 48, false);
   Couleur(grille);
}
</code>

mood
Publicité
Posté le 13-05-2018 à 10:48:34  profilanswer
 

n°2315280
fdaniel
Have you got a 27B/6 ?
Posté le 14-05-2018 à 11:15:45  profilanswer
 

Ce sujet a été déplacé de la catégorie Discussions vers la categorie Programmation par Fdaniel


---------------
Topic des restos / Topic des boutiques gastronomiques

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Java

  Aide en programmation

 

Sujets relatifs
Aide Programmation pythonBesoin d'aide Programmation Arduino Urgent
Aide programmation scripts / recherche FAIaide programmation
Besoin d'aide sur une programmationBesoin d'aide en programmation c++
Aide pour programmation manette de jeu bluetooth arduinoBesoin d'aide (programmation C)
aide pour un projet en programmation c++besoin d'aide pour une programmation ARDUINO
Plus de sujets relatifs à : Aide en programmation


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR