modifications classes roi et tour
Tour : ajout méthode déplacement possible Roi : ajout commentaire pour méthode enEchec()
This commit is contained in:
parent
e625ea546c
commit
22a24e4493
@ -9,13 +9,16 @@ public class Roi extends Piece {
|
||||
}
|
||||
|
||||
/*
|
||||
public void enEchec() {
|
||||
Position positionCourante;
|
||||
public void enEchec(Piece piece, Position position) {
|
||||
boolean[][] mouvementsPossibles;
|
||||
mouvementsPossibles=piece.getMouvementsPossibles();
|
||||
|
||||
positionCourante = super.getEmplacement();
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
public boolean aBouge()
|
||||
{
|
||||
if(this.getIni() != this.getPosition())
|
||||
|
@ -20,4 +20,20 @@ public class Tour extends Piece {
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user