début methode clonage

This commit is contained in:
Antonin Boyon 2021-02-10 09:48:23 +01:00
parent 3d87d7234f
commit 9316c144d4
2 changed files with 10 additions and 7 deletions

View File

@ -7,6 +7,14 @@ public class Main {
public static void main(String[] args) { public static void main(String[] args) {
for (int k=-1; k<2;k++) {
for (int l=-1; l<2; l++) {
if (k!=0 || l!=0) {
System.out.println(k+";"+l);
}
}
}
int p1 = 1, p2 = 2; int p1 = 1, p2 = 2;
int[][] board = initialize(p1, p2); int[][] board = initialize(p1, p2);
State game = new State(board, p1, p2); State game = new State(board, p1, p2);

View File

@ -33,14 +33,9 @@ public class State {
System.out.println("recherche"); System.out.println("recherche");
for (int k=-1; k<2;k++) { for (int k=-1; k<2;k++) {
for (int l=-1; l<2; l++) { for (int l=-1; l<2; l++) {
// La position du pion trouvé est exclue if (k!=0 || l!=0) {
if (k!=0 || l!=0) {
// Si une place libre est trouvée elle est ajouté à la liste de coups
System.out.println("close");
if ( (this.board[i+k][j+l]==0) && (i+k >= 0) && (i+k < 7 ) && (j+l >= 0) && (j+l < 7 ) ) {
System.out.println("jadd");
moves.add(new Point(i+k, j+l)); moves.add(new Point(i+k, j+l));
}
} }
} }
} }