modifications classes roi et tour

Tour : ajout méthode déplacement possible
Roi : ajout commentaire pour méthode enEchec()
This commit is contained in:
Anthony 2019-05-06 17:27:11 +02:00
parent e625ea546c
commit 22a24e4493
2 changed files with 21 additions and 2 deletions

View File

@ -9,13 +9,16 @@ public class Roi extends Piece {
} }
/* /*
public void enEchec() { public void enEchec(Piece piece, Position position) {
Position positionCourante; boolean[][] mouvementsPossibles;
mouvementsPossibles=piece.getMouvementsPossibles();
positionCourante = super.getEmplacement(); positionCourante = super.getEmplacement();
} }
*/ */
public boolean aBouge() public boolean aBouge()
{ {
if(this.getIni() != this.getPosition()) if(this.getIni() != this.getPosition())

View File

@ -20,4 +20,20 @@ public class Tour extends Piece {
} }
return verif; return verif;
} }
public boolean[][] deplacementsPossibles() {
boolean[][] deplacementsPossibles = new boolean[8][8];
Position position = this.getPosition();
int x = position.getX();
int y = position.getY();
for(int i=x; i<8; i++) {
//if(echiquier.estVide(position))
deplacementsPossibles[i][y]=true;
}
for(int j=0; j<8; j++) {
deplacementsPossibles[x][j]=true;
}
deplacementsPossibles[x][y]=false;
return deplacementsPossibles;
}
} }