Changement visuel échiquier
This commit is contained in:
parent
bd0f4f68f4
commit
9b1eb76ffd
@ -2,7 +2,7 @@ package piecesEchiquier;
|
|||||||
|
|
||||||
public class Cavalier extends Piece {
|
public class Cavalier extends Piece {
|
||||||
|
|
||||||
public Cavalier(String c, String emp,char l, Position pos)
|
public Cavalier(String c, String emp,String l, Position pos)
|
||||||
{
|
{
|
||||||
super(c,emp,l,pos);
|
super(c,emp,l,pos);
|
||||||
}
|
}
|
||||||
|
@ -14,44 +14,44 @@ public class Echiquier {
|
|||||||
{"A2","B2","C2","D2","E2","F2","G2","H2"},
|
{"A2","B2","C2","D2","E2","F2","G2","H2"},
|
||||||
{"A1","B1","C1","D1","E1","F1","G1","H1"}
|
{"A1","B1","C1","D1","E1","F1","G1","H1"}
|
||||||
};
|
};
|
||||||
private Pion pionB1 = new Pion("Blanc",codes[6][0],'P',new Position(1,2));
|
private Pion pionB1 = new Pion("Blanc",codes[6][0],"PB",new Position(1,2));
|
||||||
private Pion pionB2 = new Pion("Blanc",codes[6][1],'P',new Position(2,2));
|
private Pion pionB2 = new Pion("Blanc",codes[6][1],"PB",new Position(2,2));
|
||||||
private Pion pionB3 = new Pion("Blanc",codes[6][2],'P',new Position(3,2));
|
private Pion pionB3 = new Pion("Blanc",codes[6][2],"PB",new Position(3,2));
|
||||||
private Pion pionB4 = new Pion("Blanc",codes[6][3],'P',new Position(4,2));
|
private Pion pionB4 = new Pion("Blanc",codes[6][3],"PB",new Position(4,2));
|
||||||
private Pion pionB5 = new Pion("Blanc",codes[6][4],'P',new Position(5,2));
|
private Pion pionB5 = new Pion("Blanc",codes[6][4],"PB",new Position(5,2));
|
||||||
private Pion pionB6 = new Pion("Blanc",codes[6][5],'P',new Position(6,2));
|
private Pion pionB6 = new Pion("Blanc",codes[6][5],"PB",new Position(6,2));
|
||||||
private Pion pionB7 = new Pion("Blanc",codes[6][6],'P',new Position(7,2));
|
private Pion pionB7 = new Pion("Blanc",codes[6][6],"PB",new Position(7,2));
|
||||||
private Pion pionB8 = new Pion("Blanc",codes[6][7],'P',new Position(8,2));
|
private Pion pionB8 = new Pion("Blanc",codes[6][7],"PB",new Position(8,2));
|
||||||
|
|
||||||
private Pion pionN1 = new Pion("Noir",codes[1][0],'p',new Position(1,7));
|
private Pion pionN1 = new Pion("Noir",codes[1][0],"PN",new Position(1,7));
|
||||||
private Pion pionN2 = new Pion("Noir",codes[1][1],'p',new Position(2,7));
|
private Pion pionN2 = new Pion("Noir",codes[1][1],"PN",new Position(2,7));
|
||||||
private Pion pionN3 = new Pion("Noir",codes[1][2],'p',new Position(3,7));
|
private Pion pionN3 = new Pion("Noir",codes[1][2],"PN",new Position(3,7));
|
||||||
private Pion pionN4 = new Pion("Noir",codes[1][3],'p',new Position(4,7));
|
private Pion pionN4 = new Pion("Noir",codes[1][3],"PN",new Position(4,7));
|
||||||
private Pion pionN5 = new Pion("Noir",codes[1][4],'p',new Position(5,7));
|
private Pion pionN5 = new Pion("Noir",codes[1][4],"PN",new Position(5,7));
|
||||||
private Pion pionN6 = new Pion("Noir",codes[1][5],'p',new Position(6,7));
|
private Pion pionN6 = new Pion("Noir",codes[1][5],"PN",new Position(6,7));
|
||||||
private Pion pionN7 = new Pion("Noir",codes[1][6],'p',new Position(7,7));
|
private Pion pionN7 = new Pion("Noir",codes[1][6],"PN",new Position(7,7));
|
||||||
private Pion pionN8 = new Pion("Noir",codes[1][7],'p',new Position(8,7));
|
private Pion pionN8 = new Pion("Noir",codes[1][7],"PN",new Position(8,7));
|
||||||
|
|
||||||
private Tour TourB1 = new Tour("Blanc",codes[7][0],'T',new Position(1,1));
|
private Tour TourB1 = new Tour("Blanc",codes[7][0],"TB",new Position(1,1));
|
||||||
private Tour TourB2 = new Tour("Blanc",codes[7][7],'T',new Position(8,1));
|
private Tour TourB2 = new Tour("Blanc",codes[7][7],"TB",new Position(8,1));
|
||||||
private Tour TourN1 = new Tour("Noir",codes[0][0],'t',new Position(1,8));
|
private Tour TourN1 = new Tour("Noir",codes[0][0],"TN",new Position(1,8));
|
||||||
private Tour TourN2 = new Tour("Noir",codes[0][7],'t',new Position(8,8));
|
private Tour TourN2 = new Tour("Noir",codes[0][7],"TN",new Position(8,8));
|
||||||
|
|
||||||
private Cavalier CavalierB1 = new Cavalier("Blanc",codes[7][1],'C',new Position(2,1));
|
private Cavalier CavalierB1 = new Cavalier("Blanc",codes[7][1],"CB",new Position(2,1));
|
||||||
private Cavalier CavalierB2 = new Cavalier("Blanc",codes[7][6],'C',new Position(7,1));
|
private Cavalier CavalierB2 = new Cavalier("Blanc",codes[7][6],"CB",new Position(7,1));
|
||||||
private Cavalier CavalierN1 = new Cavalier("Noir",codes[0][1],'c',new Position(2,8));
|
private Cavalier CavalierN1 = new Cavalier("Noir",codes[0][1],"CN",new Position(2,8));
|
||||||
private Cavalier CavalierN2 = new Cavalier("Noir",codes[0][6],'c',new Position(7,8));
|
private Cavalier CavalierN2 = new Cavalier("Noir",codes[0][6],"CN",new Position(7,8));
|
||||||
|
|
||||||
private Fou FouB1 = new Fou("Blanc",codes[7][2],'F',new Position(3,1));
|
private Fou FouB1 = new Fou("Blanc",codes[7][2],"FB",new Position(3,1));
|
||||||
private Fou FouB2 = new Fou("Blanc",codes[7][5],'F',new Position(6,1));
|
private Fou FouB2 = new Fou("Blanc",codes[7][5],"FB",new Position(6,1));
|
||||||
private Fou FouN1 = new Fou("Noir",codes[0][2],'f',new Position(3,8));
|
private Fou FouN1 = new Fou("Noir",codes[0][2],"FN",new Position(3,8));
|
||||||
private Fou FouN2 = new Fou("Noir",codes[0][5],'f',new Position(6,8));
|
private Fou FouN2 = new Fou("Noir",codes[0][5],"FN",new Position(6,8));
|
||||||
|
|
||||||
private Reine ReineB1 = new Reine("Blanc",codes[7][4],'R',new Position(4,1));
|
private Reine ReineB1 = new Reine("Blanc",codes[7][4],"RB",new Position(4,1));
|
||||||
private Reine ReineN1 = new Reine("Noir",codes[0][4],'r',new Position(4,8));
|
private Reine ReineN1 = new Reine("Noir",codes[0][4],"RN",new Position(4,8));
|
||||||
|
|
||||||
private Roi RoiB1 = new Roi("Blanc",codes[7][3],'K',new Position(5,1));
|
private Roi RoiB1 = new Roi("Blanc",codes[7][3],"KB",new Position(5,1));
|
||||||
private Roi RoiN1 = new Roi("Noir",codes[0][3],'k',new Position(5,8));
|
private Roi RoiN1 = new Roi("Noir",codes[0][3],"KN",new Position(5,8));
|
||||||
|
|
||||||
// A choisir soit on enleve abstract de piece pour avoir le vide soit on garde la classe vide
|
// A choisir soit on enleve abstract de piece pour avoir le vide soit on garde la classe vide
|
||||||
//private Vide vide = new Vide();
|
//private Vide vide = new Vide();
|
||||||
@ -96,15 +96,23 @@ public class Echiquier {
|
|||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
|
char alphabet[]= {'A','B','C','D','E','F','G','H'};
|
||||||
String echec = "";
|
String echec = "";
|
||||||
|
int compteur=8;
|
||||||
for (int i = 0; i < 8;i++)
|
for (int i = 0; i < 8;i++)
|
||||||
{
|
{
|
||||||
|
echec+= compteur + " ";
|
||||||
for (int j = 0; j < 8;j++)
|
for (int j = 0; j < 8;j++)
|
||||||
{
|
{
|
||||||
echec +=echiquier[i][j].getLettre();
|
echec +=echiquier[i][j].getLettre();
|
||||||
|
echec += " ";
|
||||||
}
|
}
|
||||||
echec += "\n";
|
echec += "\n";
|
||||||
|
compteur--;
|
||||||
|
}
|
||||||
|
for (int i=0; i<8;i++)
|
||||||
|
{
|
||||||
|
echec+= " " + alphabet[i];
|
||||||
}
|
}
|
||||||
return echec;
|
return echec;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package piecesEchiquier;
|
|||||||
|
|
||||||
public class Fou extends Piece {
|
public class Fou extends Piece {
|
||||||
|
|
||||||
public Fou(String c, String emp,char l, Position pos)
|
public Fou(String c, String emp,String l, Position pos)
|
||||||
{
|
{
|
||||||
super(c,emp,l,pos);
|
super(c,emp,l,pos);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ public class Piece {
|
|||||||
private String couleur;
|
private String couleur;
|
||||||
//private Position emplacementIni;
|
//private Position emplacementIni;
|
||||||
private String emp;
|
private String emp;
|
||||||
private char lettre = '.';
|
private String lettre = "..";
|
||||||
private boolean enVie = true;
|
private boolean enVie = true;
|
||||||
private Position position;
|
private Position position;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ public class Piece {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Piece(String couleur,String emp, char l, Position pos)
|
public Piece(String couleur,String emp, String l, Position pos)
|
||||||
{
|
{
|
||||||
this.couleur = couleur;
|
this.couleur = couleur;
|
||||||
this.lettre = l;
|
this.lettre = l;
|
||||||
@ -52,10 +52,10 @@ public class Piece {
|
|||||||
// gets & sets
|
// gets & sets
|
||||||
|
|
||||||
|
|
||||||
public char getLettre() {
|
public String getLettre() {
|
||||||
return lettre;
|
return lettre;
|
||||||
}
|
}
|
||||||
public void setLettre(char lettre) {
|
public void setLettre(String lettre) {
|
||||||
this.lettre = lettre;
|
this.lettre = lettre;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
package piecesEchiquier;
|
package piecesEchiquier;
|
||||||
|
|
||||||
public class Pion extends Piece {
|
public class Pion extends Piece {
|
||||||
public Pion(String c, String emp,char l, Position pos) {
|
public Pion(String couleur, String emp,String l, Position pos) {
|
||||||
|
|
||||||
super(c,emp,l, pos);
|
|
||||||
|
|
||||||
|
super(couleur,emp,l, pos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package piecesEchiquier;
|
|||||||
|
|
||||||
public class Reine extends Piece {
|
public class Reine extends Piece {
|
||||||
|
|
||||||
public Reine(String c, String emp,char l, Position pos)
|
public Reine(String c, String emp,String l, Position pos)
|
||||||
{
|
{
|
||||||
super(c,emp,l,pos);
|
super(c,emp,l,pos);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package piecesEchiquier;
|
|||||||
|
|
||||||
public class Roi extends Piece {
|
public class Roi extends Piece {
|
||||||
|
|
||||||
public Roi(String c, String emp,char l, Position pos)
|
public Roi(String c, String emp,String l, Position pos)
|
||||||
{
|
{
|
||||||
super(c,emp,l,pos);
|
super(c,emp,l,pos);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package piecesEchiquier;
|
|||||||
|
|
||||||
public class Tour extends Piece {
|
public class Tour extends Piece {
|
||||||
|
|
||||||
public Tour(String c, String emp,char l, Position pos)
|
public Tour(String c, String emp,String l, Position pos)
|
||||||
{
|
{
|
||||||
super(c,emp,l,pos);
|
super(c,emp,l,pos);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user