40 lines
821 B
Java
Raw Normal View History

2019-03-20 14:14:56 +01:00
package piecesEchiquier;
public class Tour extends Piece {
private boolean verif=false;
2019-03-20 14:14:56 +01:00
public Tour(String couleur,String l, Position pos)
{
super(couleur,l,pos);
}
public boolean aBouge()
{
if(this.getIni() != this.getPosition())
{
verif=true;
}
if(this.getIni() == this.getPosition() && verif == false)
{
verif=false;
}
return verif;
2019-03-20 14:14:56 +01:00
}
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;
}
2019-03-20 14:14:56 +01:00
}