test de getMove
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package othello;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Main {
|
||||
|
||||
|
||||
@@ -11,6 +14,10 @@ public class Main {
|
||||
int player = game.getCurrentPlayer();
|
||||
|
||||
}
|
||||
ArrayList<Point> a = new ArrayList<Point>();
|
||||
a.add(new Point(3,3));
|
||||
System.out.println(game.getMove(p1).toString());
|
||||
System.out.println(a.get(0).toString());
|
||||
}
|
||||
|
||||
public static int[][] initialize(int p1, int p2){
|
||||
|
||||
@@ -21,7 +21,7 @@ public class State {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ArrayList<Point> getMove(String player) {
|
||||
public ArrayList<Point> getMove(int player) {
|
||||
ArrayList<Point> moves = null;
|
||||
|
||||
// Clonage
|
||||
@@ -30,12 +30,15 @@ public class State {
|
||||
for (int j=0; j<this.board.length; j++) {
|
||||
if (this.board[i][j] == this.currentPlayer) {
|
||||
// Recherche autour du pion du joueur courant
|
||||
System.out.println("recherche");
|
||||
for (int k=-1; k<2;k++) {
|
||||
for (int l=-1; l<2; l++) {
|
||||
// La position du pion trouv<75> est exclue
|
||||
if (k!=0 || l!=0) {
|
||||
// Si une place libre est trouv<75>e elle est ajout<75> <20> la liste de coups
|
||||
if (this.board[i+k][j+l]==0) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
@@ -51,7 +54,7 @@ public class State {
|
||||
return moves;
|
||||
}
|
||||
|
||||
public int getScore(String player) {
|
||||
public int getScore(int player) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user