2019-05-03 18:32:02 +02:00
|
|
|
|
2019-03-20 14:14:08 +01:00
|
|
|
package piecesEchiquier;
|
|
|
|
|
2019-05-03 18:32:02 +02:00
|
|
|
public class Piece {
|
2019-03-20 14:14:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
//variables
|
|
|
|
|
2019-05-03 18:32:02 +02:00
|
|
|
private String couleur; /* True = blanc & Flase = noir */
|
|
|
|
private String emplacement;
|
2019-03-20 14:14:08 +01:00
|
|
|
private char lettre = '.';
|
|
|
|
private boolean enVie = true;
|
2019-05-03 18:32:02 +02:00
|
|
|
private Position position;
|
2019-03-20 14:14:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//constructeur par defaut qui devrait probablement remplacer vide
|
|
|
|
|
|
|
|
public Piece()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// constructeur
|
|
|
|
|
2019-05-03 18:32:02 +02:00
|
|
|
public Piece(String couleur,String emp, char l, Position pos)
|
2019-03-20 14:14:08 +01:00
|
|
|
{
|
2019-05-03 18:32:02 +02:00
|
|
|
this.couleur = couleur;
|
2019-04-02 16:54:14 +02:00
|
|
|
this.lettre = l;
|
2019-05-03 18:32:02 +02:00
|
|
|
this.emplacement = emp;
|
|
|
|
this.position = pos;
|
2019-03-20 14:14:08 +01:00
|
|
|
}
|
2019-04-23 17:03:08 +02:00
|
|
|
|
2019-05-03 18:32:02 +02:00
|
|
|
/* //vérifie une éventuelle collision a chaque case
|
2019-04-23 17:03:08 +02:00
|
|
|
public boolean collision(Case caseArrivee){
|
|
|
|
return caseArrivee.estVide();
|
2019-05-03 18:32:02 +02:00
|
|
|
}*/
|
|
|
|
/*
|
2019-04-23 17:03:08 +02:00
|
|
|
//check si la case est alliee
|
|
|
|
public boolean estAllie(Case caseArrivee) {
|
|
|
|
return possesseur.equals(caseArrivee.getPieceCase().getPossesseur()) ;
|
|
|
|
}
|
2019-05-03 18:32:02 +02:00
|
|
|
*/
|
2019-04-23 17:03:08 +02:00
|
|
|
|
|
|
|
|
2019-03-20 14:14:08 +01:00
|
|
|
|
|
|
|
// gets & sets
|
|
|
|
|
|
|
|
|
|
|
|
public char getLettre() {
|
|
|
|
return lettre;
|
|
|
|
}
|
|
|
|
public void setLettre(char lettre) {
|
|
|
|
this.lettre = lettre;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////
|
|
|
|
|
2019-05-03 18:32:02 +02:00
|
|
|
public String getEmplacement() {
|
2019-03-20 14:14:08 +01:00
|
|
|
return emplacement;
|
|
|
|
}
|
|
|
|
|
2019-05-03 18:32:02 +02:00
|
|
|
public void setEmplacement(String emplacement) {
|
2019-03-20 14:14:08 +01:00
|
|
|
this.emplacement = emplacement;
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////
|
|
|
|
|
|
|
|
public boolean isEnVie() {
|
|
|
|
return enVie;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setEnVie(boolean enVie) {
|
|
|
|
this.enVie = enVie;
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////
|
|
|
|
|
2019-05-03 18:32:02 +02:00
|
|
|
public String getCouleur() {
|
2019-03-20 14:14:08 +01:00
|
|
|
return couleur;
|
|
|
|
}
|
|
|
|
|
2019-05-03 18:32:02 +02:00
|
|
|
public void setCouleur(String couleur) {
|
2019-03-20 14:14:08 +01:00
|
|
|
this.couleur = couleur;
|
|
|
|
}
|
|
|
|
|
2019-05-03 18:32:02 +02:00
|
|
|
public Position getPosition() {
|
|
|
|
return position;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPosition(Position position) {
|
|
|
|
this.position = position;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean deplacable(Piece p)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-23 17:03:08 +02:00
|
|
|
|
2019-03-20 14:14:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|