diff --git a/Sudoku/grille$1.class b/Sudoku/grille$1.class new file mode 100644 index 0000000..39cc601 Binary files /dev/null and b/Sudoku/grille$1.class differ diff --git a/Sudoku/grille$2.class b/Sudoku/grille$2.class new file mode 100644 index 0000000..6cfdc5f Binary files /dev/null and b/Sudoku/grille$2.class differ diff --git a/Sudoku/grille.class b/Sudoku/grille.class new file mode 100644 index 0000000..baab08d Binary files /dev/null and b/Sudoku/grille.class differ diff --git a/Sudoku/grille.java b/Sudoku/grille.java index ba6dbe2..128198c 100644 --- a/Sudoku/grille.java +++ b/Sudoku/grille.java @@ -7,6 +7,7 @@ import javax.swing.border.Border; import javax.swing.text.*; public class grille extends JComponent{ + private static JLabel etat_exportation = new JLabel(); /*tableau de valeurs de la grille de sudoku*/ public static int[][] grid_values = null; @@ -99,11 +100,15 @@ public class grille extends JComponent{ JButton exporter = null; JPanel bouton_grille = new JPanel(); + if(editable){ + + bouton_grille.add(etat_exportation); exporter = new JButton("exporter"); bouton_grille.add(exporter); place_grille.add(bouton_grille); }else{ + verifier = new JButton("verifier"); bouton_grille.add(verifier); place_grille.add(bouton_grille); @@ -128,7 +133,23 @@ public class grille extends JComponent{ if (exporter != null) { /* Vérification pour s'assurer que exporter a été initialisé */ exporter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent exporter) { - ExporterGrille(ConvertirGrilleActuelle(place_grille)); + for (int i=0; i < 9; i++){ + for (int j=0; j < 9; j++){ + System.out.print(GrilleActuelle(place_grille)[i][j]); + } + System.out.println(""); + } + + if (!(resolveurGrille.resoudreSudoku(GrilleActuelle(place_grille)))){ + etat_exportation.setHorizontalAlignment(SwingConstants.LEFT); + etat_exportation.setText("Sudoku Impossible."); + etat_exportation.setForeground(Color.RED); + System.out.println(1); + } else { + ExporterGrille(GrilleActuelle(place_grille)); + etat_exportation.setText(""); + System.out.println(2); + } } }); } @@ -206,7 +227,7 @@ public class grille extends JComponent{ } } - public static int[][] ConvertirGrilleActuelle(JPanel place_grille){ + public static int[][] GrilleActuelle(JPanel place_grille){ int[][] grilleActuelle = new int[9][9]; for (Component comp : place_grille.getComponents()) { diff --git a/Sudoku/mainProgramme1.class b/Sudoku/mainProgramme1.class new file mode 100644 index 0000000..c5b6748 Binary files /dev/null and b/Sudoku/mainProgramme1.class differ diff --git a/Sudoku/mainProgramme2.class b/Sudoku/mainProgramme2.class new file mode 100644 index 0000000..4cd2638 Binary files /dev/null and b/Sudoku/mainProgramme2.class differ diff --git a/Sudoku/menuProgramme1$1.class b/Sudoku/menuProgramme1$1.class new file mode 100644 index 0000000..c563e1e Binary files /dev/null and b/Sudoku/menuProgramme1$1.class differ diff --git a/Sudoku/menuProgramme1$2.class b/Sudoku/menuProgramme1$2.class new file mode 100644 index 0000000..c1c25e9 Binary files /dev/null and b/Sudoku/menuProgramme1$2.class differ diff --git a/Sudoku/menuProgramme1$3.class b/Sudoku/menuProgramme1$3.class new file mode 100644 index 0000000..06cf3dc Binary files /dev/null and b/Sudoku/menuProgramme1$3.class differ diff --git a/Sudoku/menuProgramme1$4.class b/Sudoku/menuProgramme1$4.class new file mode 100644 index 0000000..6248b3f Binary files /dev/null and b/Sudoku/menuProgramme1$4.class differ diff --git a/Sudoku/menuProgramme1.class b/Sudoku/menuProgramme1.class new file mode 100644 index 0000000..41e714d Binary files /dev/null and b/Sudoku/menuProgramme1.class differ diff --git a/Sudoku/menuProgramme2$1.class b/Sudoku/menuProgramme2$1.class new file mode 100644 index 0000000..62d088d Binary files /dev/null and b/Sudoku/menuProgramme2$1.class differ diff --git a/Sudoku/menuProgramme2$2.class b/Sudoku/menuProgramme2$2.class new file mode 100644 index 0000000..1aee62c Binary files /dev/null and b/Sudoku/menuProgramme2$2.class differ diff --git a/Sudoku/menuProgramme2$3.class b/Sudoku/menuProgramme2$3.class new file mode 100644 index 0000000..23581ab Binary files /dev/null and b/Sudoku/menuProgramme2$3.class differ diff --git a/Sudoku/menuProgramme2$4.class b/Sudoku/menuProgramme2$4.class new file mode 100644 index 0000000..fad8aa5 Binary files /dev/null and b/Sudoku/menuProgramme2$4.class differ diff --git a/Sudoku/menuProgramme2$5.class b/Sudoku/menuProgramme2$5.class new file mode 100644 index 0000000..3ea1c4e Binary files /dev/null and b/Sudoku/menuProgramme2$5.class differ diff --git a/Sudoku/menuProgramme2.class b/Sudoku/menuProgramme2.class new file mode 100644 index 0000000..73f1302 Binary files /dev/null and b/Sudoku/menuProgramme2.class differ diff --git a/Sudoku/resolveurGrille.class b/Sudoku/resolveurGrille.class new file mode 100644 index 0000000..308bf07 Binary files /dev/null and b/Sudoku/resolveurGrille.class differ diff --git a/Sudoku/resolveurGrille.java b/Sudoku/resolveurGrille.java index 5e4e32b..38769dc 100644 --- a/Sudoku/resolveurGrille.java +++ b/Sudoku/resolveurGrille.java @@ -17,8 +17,9 @@ public class resolveurGrille { return solution; } - private static boolean resoudreSudoku(int[][] grille) { + public static boolean resoudreSudoku(int[][] grille) { /*parcourage la grille*/ + stop = false; for (int row = 0; row < 9; row++) { for (int col = 0; col < 9; col++) { if (grille[row][col] == 0) {