2019-03-20 14:14:56 +01:00
|
|
|
package piecesEchiquier;
|
|
|
|
|
|
|
|
public class Tour extends Piece {
|
2019-05-04 21:08:15 +02:00
|
|
|
private boolean verif=false;
|
2019-03-20 14:14:56 +01:00
|
|
|
|
2019-05-04 21:08:15 +02:00
|
|
|
public Tour(String couleur,String l, Position pos)
|
2019-04-23 17:30:04 +02:00
|
|
|
{
|
2019-05-04 21:08:15 +02:00
|
|
|
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
|
|
|
}
|
2019-05-06 17:27:11 +02:00
|
|
|
|
2019-05-09 09:30:32 +02:00
|
|
|
public boolean[][] deplacable(Echiquier e,Piece p) {
|
|
|
|
boolean[][] deplacementsInherentsPiece = new boolean[8][8];
|
2019-05-06 17:27:11 +02:00
|
|
|
Position position = this.getPosition();
|
|
|
|
int x = position.getX();
|
|
|
|
int y = position.getY();
|
2019-05-09 09:30:32 +02:00
|
|
|
|
2019-05-06 17:27:11 +02:00
|
|
|
for(int i=x; i<8; i++) {
|
2019-05-09 09:30:32 +02:00
|
|
|
deplacementsInherentsPiece[i][y]=true;
|
2019-05-06 17:27:11 +02:00
|
|
|
}
|
|
|
|
for(int j=0; j<8; j++) {
|
2019-05-09 09:30:32 +02:00
|
|
|
deplacementsInherentsPiece[x][j]=true;
|
2019-05-06 17:27:11 +02:00
|
|
|
}
|
2019-05-09 09:30:32 +02:00
|
|
|
deplacementsInherentsPiece[x][y]=false;
|
|
|
|
return deplacementsInherentsPiece;
|
2019-05-06 17:27:11 +02:00
|
|
|
}
|
2019-03-20 14:14:56 +01:00
|
|
|
}
|