From bd0f4f68f4325d8dad7ffd7ae69b5db521f193df Mon Sep 17 00:00:00 2001 From: Manon Date: Fri, 3 May 2019 23:53:45 +0200 Subject: [PATCH] Push final du jour. --- src/game/.gitkeep | 0 src/gamemanager/.gitkeep | 0 src/ia/.gitkeep | 0 src/move/.gitkeep | 0 src/piecesEchiquier/Case.java | 154 ----------------------------- src/piecesEchiquier/Echiquier.java | 33 +------ src/piecesEchiquier/Piece.java | 1 + src/piecesEchiquier/Roi.java | 3 +- src/piecesEchiquier/Tour.java | 1 - src/player/.gitkeep | 0 src/visuel/main.java | 14 +-- 11 files changed, 9 insertions(+), 197 deletions(-) delete mode 100755 src/game/.gitkeep delete mode 100755 src/gamemanager/.gitkeep delete mode 100755 src/ia/.gitkeep delete mode 100755 src/move/.gitkeep delete mode 100755 src/piecesEchiquier/Case.java delete mode 100755 src/player/.gitkeep diff --git a/src/game/.gitkeep b/src/game/.gitkeep deleted file mode 100755 index e69de29..0000000 diff --git a/src/gamemanager/.gitkeep b/src/gamemanager/.gitkeep deleted file mode 100755 index e69de29..0000000 diff --git a/src/ia/.gitkeep b/src/ia/.gitkeep deleted file mode 100755 index e69de29..0000000 diff --git a/src/move/.gitkeep b/src/move/.gitkeep deleted file mode 100755 index e69de29..0000000 diff --git a/src/piecesEchiquier/Case.java b/src/piecesEchiquier/Case.java deleted file mode 100755 index b2761cb..0000000 --- a/src/piecesEchiquier/Case.java +++ /dev/null @@ -1,154 +0,0 @@ -package piecesEchiquier; - -import joueurs.Joueur; - -public class Case { - //attribut - private String NomCase; - private int posXCase; - private int posYCase; - private Piece pieceCase; - - //constructeur - public Case(String name, int x, int y) { - this.NomCase=name; - this.posXCase=x; - this.posYCase=y; - } - - - //méthodes - public boolean estVide() { - return pieceCase == null; - } - - //piecesInstantiation - - public void pieceClone(Case clone) { - clone.setPieceCase(this.getPieceCase()); - } - /* - public void ajouterPion(Joueur j) { - this.pieceCase = new Pion("Pi"+j.getNom().charAt(0), j); - } - - public void ajouterTour(Joueur j) { - this.pieceCase = new Tour("To"+j.getNom().charAt(0), j); - } - - public void ajouterCavalier(Joueur j) { - this.pieceCase = new Cavalier("Ca"+j.getNom().charAt(0), j); - } - - public void ajouterFou(Joueur j) { - this.pieceCase = new Fou("Fo"+j.getNom().charAt(0), j); - } - - public void ajouterReine(Joueur j) { - this.pieceCase = new Reine("Re"+j.getNom().charAt(0), j); - } - - public void ajouterRoi(Joueur j) { - this.pieceCase = new Roi("Ro"+j.getNom().charAt(0), j); - } - - public void vider() { - this.pieceCase = null; - } - - public int stringToX(Plateau p, String cas) { - for (Case[] cl : p.getCases()) { - for (Case c : cl) { - if(c.getcNom()== cas) { - return c.getcX(); - } - } - } - return -1; - } - - public int stringToY(Plateau p, String cas) { - for (Case[] cl : p.getCases()) { - for (Case c : cl) { - if(c.getcNom()== cas) { - return c.getcY(); - } - } - } - return -1; - } - - public static Case stringToCase(Plateau p, String cas) { - for (Case[] cl : p.getCases()) { - for (Case c : cl) { - if(c.getcNom().equals(cas)) { - return c; - } - } - } - return null; - } - - @Override - public String toString() { - return "Case [cNom=" + cNom + ", cX=" + cX + ", cY=" + cY + ", pieceCase=" + pieceCase + "]"; - } -*/ - /** - * @return the nomCase - */ - public String getNomCase() { - return NomCase; - } - - /** - * @param nomCase the nomCase to set - */ - public void setNomCase(String nomCase) { - NomCase = nomCase; - } - - /** - * @return the posXCase - */ - public int getPosXCase() { - return posXCase; - } - - /** - * @param posXCase the posXCase to set - */ - public void setPosXCase(int posXCase) { - this.posXCase = posXCase; - } - - /** - * @return the posYCase - */ - public int getPosYCase() { - return posYCase; - } - - /** - * @param posYCase the posYCase to set - */ - public void setPosYCase(int posYCase) { - this.posYCase = posYCase; - } - - /** - * @return the pieceCase - */ - public Piece getPieceCase() { - return pieceCase; - } - - /** - * @param pieceCase the pieceCase to set - */ - public void setPieceCase(Piece pieceCase) { - this.pieceCase = pieceCase; - } - - - } \ No newline at end of file diff --git a/src/piecesEchiquier/Echiquier.java b/src/piecesEchiquier/Echiquier.java index 9be8587..5497baa 100755 --- a/src/piecesEchiquier/Echiquier.java +++ b/src/piecesEchiquier/Echiquier.java @@ -99,6 +99,7 @@ public class Echiquier { String echec = ""; for (int i = 0; i < 8;i++) { + for (int j = 0; j < 8;j++) { echec +=echiquier[i][j].getLettre(); @@ -172,33 +173,5 @@ public class Echiquier { } System.out.println("Un de vos codes est faux. Recommencez."); return false; - } - - /* - public Piece recupererPiece(Joueur J, String A) - { - for (int i = 1; i <9;i++) - { - for (int j = 1; j < 9;j++) { - if (getCodes()[i][j] == A) - { - return this.getEchiquier()[i][j]; - } - } - } - }*/ - - /* - public void deplacer(String A , String B) - { - - if (this.getEchiquier()[x2][y2] != vide && this.getEchiquier()[x2][y2].getCouleur() != this.getEchiquier()[x1][y1].getCouleur()) - System.out.println("Vous avez manger une piece adverse !"); - this.getEchiquier()[x2][y2] = this.getEchiquier()[x1][y1]; - this.getEchiquier()[x1][y1] = vide; - */ - - } - - - + } +} diff --git a/src/piecesEchiquier/Piece.java b/src/piecesEchiquier/Piece.java index ceb2481..bcf6191 100755 --- a/src/piecesEchiquier/Piece.java +++ b/src/piecesEchiquier/Piece.java @@ -26,6 +26,7 @@ public class Piece { position = pos; } + public Piece(String couleur,String emp, char l, Position pos) { this.couleur = couleur; diff --git a/src/piecesEchiquier/Roi.java b/src/piecesEchiquier/Roi.java index 988d99a..b6dd98c 100755 --- a/src/piecesEchiquier/Roi.java +++ b/src/piecesEchiquier/Roi.java @@ -10,7 +10,8 @@ public class Roi extends Piece { /* public void enEchec() { Position positionCourante; - positionCourante= super.getEmplacement(); + positionCourante = super.getEmplacement(); + } */ diff --git a/src/piecesEchiquier/Tour.java b/src/piecesEchiquier/Tour.java index 97d03f1..929b676 100755 --- a/src/piecesEchiquier/Tour.java +++ b/src/piecesEchiquier/Tour.java @@ -2,7 +2,6 @@ package piecesEchiquier; public class Tour extends Piece { - public Tour(String c, String emp,char l, Position pos) { super(c,emp,l,pos); diff --git a/src/player/.gitkeep b/src/player/.gitkeep deleted file mode 100755 index e69de29..0000000 diff --git a/src/visuel/main.java b/src/visuel/main.java index 731ddee..bcc37ee 100755 --- a/src/visuel/main.java +++ b/src/visuel/main.java @@ -30,11 +30,9 @@ public class main { System.out.println("Bienvenue dans ce jeu d'echec sur console !\n"); - + Echiquier e = new Echiquier(); do { - Echiquier e = new Echiquier(); - // AFFICHAGE ECHIQUIER System.out.println(e.toString()); @@ -57,14 +55,8 @@ public class main { System.out.println(e.toString()); // JOUEUR2 - /*System.out.println("Tour de"+j2.getNom()+"\n"); - System.out.println("Quelle pièce voulez vous déplacer ? Donnez le numero de ligne puis de colonne.\n"); - x1 = sc.nextInt(); - y1 = sc.nextInt(); - System.out.println("A quel endroit la poser ? Donnez le numero de ligne puis de colonne.\n"); - x2 = sc.nextInt(); - y2 = sc.nextInt(); - e.deplacer(x1-1,y1-1,x2-1,y2-1);*/ + System.out.println("Tour de"+j2.getNom()+"\n"); + do { System.out.println("Quelle pièce voulez vous déplacer ? Donnez le code correspondant à la pièce à déplacer(ex : A1).\n");