transformation vide -> new piece et bug réparé
This commit is contained in:
parent
4eecbc579b
commit
7a021bdfff
@ -61,14 +61,15 @@ public class Echiquier {
|
||||
{
|
||||
{TourN1,CavalierN1,FouN1,RoiN1,ReineN1,FouN2,CavalierN2,TourN2},
|
||||
{pionN1,pionN2,pionN3,pionN4,pionN5,pionN6,pionN7,pionN8},
|
||||
{vide,vide,vide,vide,vide,vide,vide,vide},
|
||||
{vide,vide,vide,vide,vide,vide,vide,vide},
|
||||
{vide,vide,vide,vide,vide,vide,vide,vide},
|
||||
{vide,vide,vide,vide,vide,vide,vide,vide},
|
||||
{new Piece(new Position(1,6)),new Piece(new Position(2,6)),new Piece(new Position(3,6)),new Piece(new Position(4,6)),new Piece(new Position(5,6)),new Piece(new Position(6,6)),new Piece(new Position(7,6)),new Piece(new Position(8,6))},
|
||||
{new Piece(new Position(1,5)),new Piece(new Position(2,5)),new Piece(new Position(3,5)),new Piece(new Position(4,5)),new Piece(new Position(5,5)),new Piece(new Position(6,5)),new Piece(new Position(7,5)),new Piece(new Position(8,5))},
|
||||
{new Piece(new Position(1,4)),new Piece(new Position(2,4)),new Piece(new Position(3,4)),new Piece(new Position(4,4)),new Piece(new Position(5,4)),new Piece(new Position(6,4)),new Piece(new Position(7,4)),new Piece(new Position(8,4))},
|
||||
{new Piece(new Position(1,3)),new Piece(new Position(2,3)),new Piece(new Position(3,3)),new Piece(new Position(4,3)),new Piece(new Position(5,3)),new Piece(new Position(6,3)),new Piece(new Position(7,3)),new Piece(new Position(8,3))},
|
||||
{pionB1,pionB2,pionB3,pionB4,pionB5,pionB6,pionB7,pionB8},
|
||||
{TourB1,CavalierB1,FouB1,RoiB1,ReineB1,FouB2,CavalierB2,TourB2}
|
||||
};
|
||||
|
||||
|
||||
public Echiquier()
|
||||
{
|
||||
|
||||
@ -106,57 +107,6 @@ public class Echiquier {
|
||||
}
|
||||
return echec;
|
||||
}
|
||||
/*
|
||||
public boolean verifierSelection(Joueur J, String A)
|
||||
{
|
||||
for (int i = 1; i <9;i++)
|
||||
{
|
||||
for (int j = 1; j < 9;j++) {
|
||||
if (getCodes()[i][j] == A)
|
||||
{
|
||||
if (this.getEchiquier()[i][j] == vide)
|
||||
{
|
||||
System.out.println("Vous avez choisi une case vide. Recommencez.");
|
||||
return false;
|
||||
}
|
||||
else if (this.getEchiquier()[i][j].getCouleur() != J.getCouleur())
|
||||
{
|
||||
System.out.println("Le pion choisi n'est pas de votre faction. Recommencez.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Un de vos codes est faux. Recommencez.");
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean verifierPlacementEtDeplacement(Joueur J, String A)
|
||||
{
|
||||
for (int i = 1; i <9;i++)
|
||||
{
|
||||
for (int j = 1; j < 9;j++) {
|
||||
if (getCodes()[i][j] == A)
|
||||
{
|
||||
if (this.getEchiquier()[i][j].getCouleur() == J.getCouleur())
|
||||
{
|
||||
System.out.println("Le pion que vous voulez manger est de votre faction. Recommencez.");
|
||||
return false;
|
||||
}else if (this.getEchiquier()[i][j].deplacable)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Un de vos codes est faux. Recommencez.");
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
public boolean VerifFinale(Joueur J, String A, String B)
|
||||
{
|
||||
|
@ -4,13 +4,12 @@ package piecesEchiquier;
|
||||
public class Piece {
|
||||
|
||||
|
||||
//variables
|
||||
|
||||
private String couleur; /* True = blanc & Flase = noir */
|
||||
private String emplacement;
|
||||
private String couleur;
|
||||
//private Position emplacementIni;
|
||||
private String emp;
|
||||
private char lettre = '.';
|
||||
private boolean enVie = true;
|
||||
private Position position;
|
||||
private Position position = new Position(0,0);
|
||||
|
||||
|
||||
|
||||
@ -22,12 +21,17 @@ public class Piece {
|
||||
}
|
||||
|
||||
// constructeur
|
||||
public Piece(Position pos)
|
||||
{
|
||||
position = pos;
|
||||
}
|
||||
|
||||
public Piece(String couleur,String emp, char l, Position pos)
|
||||
{
|
||||
this.couleur = couleur;
|
||||
this.lettre = l;
|
||||
this.emplacement = emp;
|
||||
//this.emplacementIni = emp;
|
||||
this.emp = emp;
|
||||
this.position = pos;
|
||||
}
|
||||
|
||||
@ -55,7 +59,7 @@ public class Piece {
|
||||
}
|
||||
|
||||
////////////
|
||||
|
||||
/*
|
||||
public String getEmplacement() {
|
||||
return emplacement;
|
||||
}
|
||||
@ -63,7 +67,7 @@ public class Piece {
|
||||
public void setEmplacement(String emplacement) {
|
||||
this.emplacement = emplacement;
|
||||
}
|
||||
|
||||
*/
|
||||
///////////
|
||||
|
||||
public boolean isEnVie() {
|
||||
|
@ -13,7 +13,6 @@ public class main {
|
||||
//ouvre une porte pour input
|
||||
Scanner sc = new Scanner(System.in);
|
||||
|
||||
|
||||
// variable tempo pour tests
|
||||
boolean jeu = true;
|
||||
|
||||
@ -46,13 +45,8 @@ public class main {
|
||||
|
||||
do {
|
||||
System.out.println("Quelle pièce voulez vous déplacer ? Donnez le code correspondant à la pièce à déplacer(ex : A1).\n");
|
||||
|
||||
//entrer coordonnées piece a bouger APRES ON PASSERA PAR DIRECT COMBINAISON LETTRE-CHIFFRE
|
||||
A = sc.nextLine();
|
||||
//if (A.equals("A1"))
|
||||
// System.out.println("OK");
|
||||
System.out.println("A quel endroit la poser ? Donnez le code correspondant à l'endroit où poser la pièce.\n");
|
||||
//entrer coordonnées endroit visé APRES ON PASSERA PAR DIRECT COMBINAISON LETTRE-CHIFFRE
|
||||
B = sc.nextLine();
|
||||
|
||||
}while (e.VerifFinale(j1, A,B) != true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user