Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anthony 2019-05-09 10:55:49 +02:00
commit 17cb9a342c
3 changed files with 37 additions and 6 deletions

View File

@ -2,10 +2,25 @@ package piecesEchiquier;
public class Fou extends Piece {
public Fou(String c,String l, Position pos)
{
super(c,l,pos);
public Fou(String c,String n, Position pos)
{//c = couleur, n = nom, pos = position
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;
public class Piece {
public abstract class Piece {
private String couleur;
@ -8,7 +8,7 @@ public class Piece {
private boolean enVie = true;
private Position position;
private Position ini;
private boolean verif = false;
//constructeur par defaut qui devrait probablement remplacer vide
@ -34,6 +34,23 @@ public class Piece {
}
public boolean aBouge()
{
if(this.getIni() != this.getPosition())
{
verif=true;
}
if(this.getIni() == this.getPosition() && verif == false)
{
verif=false;
}
return verif;
}
public abstract boolean[][] deplacable(Echiquier e,Piece p);
/* //verifie une eventuelle collision a chaque case
public boolean collision(Case caseArrivee){
return caseArrivee.estVide();

View File

@ -1,7 +1,6 @@
package piecesEchiquier;
public class Tour extends Piece {
private boolean verif=false;
public Tour(String couleur,String l, Position pos)
{