Bonjour, j'ai un projet à présenter pour mon oral d'isn,
Avec mon groupe, on a voulu programmé un sudoku en javas'cool, et je n'arrive pas à traduire ces lignes de code.
Je sais qu'elles servent pour qu'il n'y ait pas le même chiffre dans la même colonne, ligne et sous-grilles.
Mais je n'arrive pas à comprendre à quoi servent chacune des lignes.

Quelqu'un pourrait m'aider à traduire ces lignes en français s'il vous plaît ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 
boolean creation(int[][]GRILLE, int x, int y) {
   int[] LISTE = new int[4];
   LISTE[0] = random(1, 5);
   for (int l = 1; l < 4; l ++) {
      for (boolean valable = false; ! valable;) {
         LISTE[l] = random(1, 5);
         valable = true;
      for (int c = 0; c < l; c ++) {
            if (LISTE[l] == LISTE[c]) {
               valable = false;
            }}}}
 
   for (int l = 0; l < 4; l ++) {
      if (check(GRILLE, x, y, LISTE[l])) {
         GRILLE[x][y] = LISTE[l];
         if ((x == 3) && (y == 3)) {
            return  true;
         }
         if (x == 3) {
            if (creation(GRILLE, 0, y +1)) {
               return  true;
            }
         } else {
            if (creation(GRILLE, x +1, y)) {
               return  true;
            }}}}
 
   GRILLE[x][y] =0;
   return  false;
}
boolean check(int[][]GRILLE, int x, int y, int a) {
   for (int i = 0; i < x; i ++) {
      if (GRILLE[i][y] == a) {
         return  false;
      }}
   for (int j = 0; j < y; j ++) {
      if (GRILLE[x][j] == a) {
         return  false;
      }}
   int xx = (x /2) *2;
   int yy = (y /2) *2;
   for (int i = 0; i < 2; i ++) {
   for (int j = 0; j < 2; j ++) {
         if (GRILLE[xx + j][yy + i] == a) {
            return  false;
         }
         if ((xx + j == x) && (yy + i == y)) {
            return  true;
         }}}
   return  true;
}