diff --git a/AppLaser.java b/AppLaser.java index 8fdd66c..16ed2d6 100644 --- a/AppLaser.java +++ b/AppLaser.java @@ -39,7 +39,7 @@ public class AppLaser { int i = 0; while (!universe.isSolved()) { - System.out.printf("i: %d, j: %d, dir: %d, choice: %d, possible: %d\n", currentState.pos_i, currentState.pos_j, currentState.direction, currentState.nb_choix, universe.possibleChoices(currentState)); + //System.out.printf("i: %d, j: %d, dir: %d, choice: %d, possible: %d\n", currentState.pos_i, currentState.pos_j, currentState.direction, currentState.nb_choix, universe.possibleChoices(currentState)); if (universe.canEvolve(currentState)) { stack.push(currentState.copy(universe.possibleChoices(currentState))); @@ -57,7 +57,6 @@ public class AppLaser { } System.out.println("\n\n"); - universe.print(); } } diff --git a/Universe.java b/Universe.java index ea9d08a..cef67f3 100644 --- a/Universe.java +++ b/Universe.java @@ -153,7 +153,7 @@ public class Universe { // adding the miror - switch (c) { + /*switch (c) { case 1: this.grid[i][j] = 1; break; @@ -167,7 +167,12 @@ public class Universe { break; default: - } + }*/ + + if (c == 1 && (d == 10 || d == 11)) this.grid[i][j] = 1; + if (c == 1 && (d == 12 || d == 13)) this.grid[i][j] = 2; + if ((c == 3 && d == 10) || (c == 3 && d == 11) || (c == 2 && d == 12) || (c == 2 && d == 13)) this.grid[i][j] = 3; + if ((c == 2 && d == 10) || (c == 2 && d == 11) || (c == 3 && d == 12) || (c == 3 && d == 13)) this.grid[i][j] = 4; // changing the position of the situation @@ -215,8 +220,24 @@ public class Universe { System.out.printf(" X"); break; + case 0: + System.out.printf(" "); + break; + case 1: - System.out.printf(" +"); + System.out.printf(" |"); + break; + + case 2: + System.out.printf(" -"); + break; + + case 3: + System.out.printf(" /"); + break; + + case 4: + System.out.printf(" \\"); break; case 10: diff --git a/algo.txt b/algo.txt index dc47f79..c196266 100644 --- a/algo.txt +++ b/algo.txt @@ -28,9 +28,10 @@ Le truc avec la pile: types de cases: - 0 case vide - -1 obstacle -- 1 laser -- 2 miroir gauche -- 3 miroir droite +- 1 laser 1 +- 2 laser 2 +- 3 miroir 1 +- 4 miroir 2 - 10 départ nord - 11 départ sud - 12 départ est