diff --git a/src/piecesEchiquier/Roi.java b/src/piecesEchiquier/Roi.java index 150c31f..6972209 100755 --- a/src/piecesEchiquier/Roi.java +++ b/src/piecesEchiquier/Roi.java @@ -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()) diff --git a/src/piecesEchiquier/Tour.java b/src/piecesEchiquier/Tour.java index d48f872..afe1ec3 100755 --- a/src/piecesEchiquier/Tour.java +++ b/src/piecesEchiquier/Tour.java @@ -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; + } }