Changements vide => new piece + autres modif annexes

This commit is contained in:
Manon 2019-05-03 23:11:52 +02:00
parent 7a021bdfff
commit 1f47ab7850
2 changed files with 13 additions and 13 deletions

View File

@ -55,7 +55,7 @@ public class Echiquier {
// A choisir soit on enleve abstract de piece pour avoir le vide soit on garde la classe vide
//private Vide vide = new Vide();
private Piece vide = new Piece();
//private Piece vide = new Piece();
private Piece[][] echiquier =
{
@ -122,7 +122,7 @@ public class Echiquier {
j++;
if (getCodes()[i][j].equals(A))
{
if (this.getEchiquier()[i][j] == vide)
if (this.getEchiquier()[i][j].getClass().getName().equals("Piece"))
{
System.out.println("Vous avez choisi une case vide. Recommencez.");
return false;
@ -163,7 +163,7 @@ public class Echiquier {
{
System.out.println("Choix validés. Déplacement en cours.");
this.getEchiquier()[k][l] = this.getEchiquier()[i][j];
this.getEchiquier()[i][j] = vide;
this.getEchiquier()[i][j] = new Piece(new Position(i,j));
return true;
}

View File

@ -9,7 +9,7 @@ public class Piece {
private String emp;
private char lettre = '.';
private boolean enVie = true;
private Position position = new Position(0,0);
private Position position;