From 57715821447527d77b5079f4c40a44c977cedbd2 Mon Sep 17 00:00:00 2001 From: Jose Srifi Date: Thu, 9 May 2019 10:40:17 +0200 Subject: [PATCH] update class Fou.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ajout méthode a bouge --- src/piecesEchiquier/Fou.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/piecesEchiquier/Fou.java b/src/piecesEchiquier/Fou.java index a6378f0..01aa863 100755 --- a/src/piecesEchiquier/Fou.java +++ b/src/piecesEchiquier/Fou.java @@ -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; + } }