force push

This commit is contained in:
Anthony
2019-05-09 11:08:09 +02:00
parent 17cb9a342c
commit a978829b7b
3 changed files with 2 additions and 46 deletions

View File

@ -6,21 +6,4 @@ public class Fou extends Piece {
{//c = couleur, n = nom, pos = position {//c = couleur, n = nom, pos = position
super(c,n,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;
}
} }

View File

@ -1,6 +1,6 @@
package piecesEchiquier; package piecesEchiquier;
public abstract class Piece { public class Piece {
private String couleur; private String couleur;
@ -47,8 +47,6 @@ public abstract class Piece {
} }
return verif; return verif;
} }
public abstract boolean[][] deplacable(Echiquier e,Piece p);
/* //verifie une eventuelle collision a chaque case /* //verifie une eventuelle collision a chaque case

View File

@ -7,34 +7,9 @@ public class Tour extends Piece {
super(couleur,l,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;
}
public boolean deplacable(Echiquier e,Piece p) 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;*/
if(p.getPosition().getX() == this.getPosition().getX()) // verification les 2 pieces sont sur la meme colonne if(p.getPosition().getX() == this.getPosition().getX()) // verification les 2 pieces sont sur la meme colonne
{ {
if (p.getPosition().getY() > this.getPosition().getY()) // Test si la 2 eme piece est au dessus de la 1ere if (p.getPosition().getY() > this.getPosition().getY()) // Test si la 2 eme piece est au dessus de la 1ere