william #1
|
@ -48,8 +48,8 @@ public class PusherBoard {
|
||||||
public int move(int from_col, int from_row, int to_col, int to_row){
|
public int move(int from_col, int from_row, int to_col, int to_row){
|
||||||
//FORMAT ex : from_col {3}, from_row {2}, to_col {3}, to_row {3}
|
//FORMAT ex : from_col {3}, from_row {2}, to_col {3}, to_row {3}
|
||||||
|
|
||||||
System.out.println("Move :" + from_col+""+from_row + "-"+ to_col+""+to_row);
|
//System.out.println("Move :" + from_col+""+from_row + "-"+ to_col+""+to_row);
|
||||||
System.out.println("Move is valid : " + isValid(from_col,from_row,to_col,to_row));
|
//System.out.println("Move is valid : " + isValid(from_col,from_row,to_col,to_row));
|
||||||
|
|
||||||
if(isValid(from_col,from_row,to_col,to_row)){
|
if(isValid(from_col,from_row,to_col,to_row)){
|
||||||
Pawn pawn = this.getBoard()[from_row][from_col];
|
Pawn pawn = this.getBoard()[from_row][from_col];
|
||||||
|
|
|
@ -3,6 +3,11 @@ package laboratoire4;
|
||||||
public class Test {
|
public class Test {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
PusherBoard pusherBoard = new PusherBoard();
|
PusherBoard pusherBoard = new PusherBoard();
|
||||||
|
testMoves(pusherBoard);
|
||||||
|
pusherBoard.printBoard();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void testMoves(PusherBoard pusherBoard){
|
||||||
//Move examples
|
//Move examples
|
||||||
pusherBoard.move("D2","D3");
|
pusherBoard.move("D2","D3");
|
||||||
pusherBoard.move("C2","C3");
|
pusherBoard.move("C2","C3");
|
||||||
|
@ -20,8 +25,5 @@ public class Test {
|
||||||
pusherBoard.move("A8","A7");
|
pusherBoard.move("A8","A7");
|
||||||
pusherBoard.move("D3","D4");
|
pusherBoard.move("D3","D4");
|
||||||
pusherBoard.move("C3","D4");
|
pusherBoard.move("C3","D4");
|
||||||
|
|
||||||
|
|
||||||
pusherBoard.printBoard();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue