update class Fou.java

ajout méthode a bouge
This commit is contained in:
Jose Srifi 2019-05-09 10:40:17 +02:00
parent 8f6df580b0
commit 5771582144

View File

@ -2,10 +2,25 @@ package piecesEchiquier;
public class Fou extends Piece { public class Fou extends Piece {
public Fou(String c,String l, Position pos) public Fou(String c,String n, Position pos)
{ {//c = couleur, n = nom, pos = position
super(c,l,pos); super(c,n,pos);
} }
public boolean[][] deplacable(Echiquier e,Piece p) {
boolean[][] deplacementsInherentsPiece = new boolean[8][8];
Position position = this.getPosition();
int x = position.getX();
int y = position.getY();
for(int i=x; i<8; i++) {
deplacementsInherentsPiece[i][y]=true;
}
for(int j=0; j<8; j++) {
deplacementsInherentsPiece[x][j]=true;
}
deplacementsInherentsPiece[x][y]=false;
return deplacementsInherentsPiece;
}
} }