From a72681e9b69b063305eefb320e6ddba90451f112 Mon Sep 17 00:00:00 2001 From: JunkJumper Date: Mon, 27 May 2019 17:56:31 +0200 Subject: [PATCH 01/11] add table of pieces --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f45624..910231d 100755 --- a/README.md +++ b/README.md @@ -71,6 +71,19 @@ S’il n’y parvient pas, son roi est alors « échec et mat ». Vous remportez Pour plus d'informations sur les règles, visitez [ce site](http://www.echecs.club/regles/) ou visitez les [crédits](https://git-iutinfo.unice.fr/good3nought/echesstria#cr%C3%A9dits-revenir-au-sommaire). +Vous trouverez ici un tableau résumant les pièces : + +| Pièce | Lettre | +|:---------:|:--------:| +|Cavalier | C | +|Fou | F | +|Pion | P | +|Reine | Q | +|Roi | K | +|Tour | T | + +La lettre ``B`` signifie qu'une pièce est de couleur blanche et la lettre ``N`` signifie qu'une pièce est de couleur noire. + ## Crédits [[revenir au sommaire]](https://git-iutinfo.unice.fr/good3nought/echesstria#sommaire) | Peronne ou Source | Role | @@ -83,7 +96,6 @@ Pour plus d'informations sur les règles, visitez [ce site](http://www.echecs.cl | | | [PRITCHARD Adam](https://github.com/adam-p) | [Utilisation](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) & syntaxe Markdown | | [http://www.echecs.club](http://www.echecs.club) | [Règles](http://www.echecs.club/regles/) du jeu d'échec | -| | ## License [[revenir au sommaire]](https://git-iutinfo.unice.fr/good3nought/echesstria#sommaire) From d276b330f449f7dc4a5fd64446d4edf8bfe5fe6a Mon Sep 17 00:00:00 2001 From: JunkJumper Date: Mon, 27 May 2019 18:15:14 +0200 Subject: [PATCH 02/11] add a javadoc --- tests/testGeneraux.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/testGeneraux.java b/tests/testGeneraux.java index 08bc56f..021e546 100644 --- a/tests/testGeneraux.java +++ b/tests/testGeneraux.java @@ -7,6 +7,20 @@ import org.junit.jupiter.api.Test; import joueurs.Joueur; import piecesEchiquier.*; +/* + * @AfterEach is used to signal that the annotated method should beexecuted after each @Test, @RepeatedTest, @ParameterizedTest, @TestFactory,and @TestTemplate method in the current test class. + * org.junit.jupiter.api.AfterEach; + * + * @BeforeEach is used to signal that the annotated method should beexecuted before each @Test, @RepeatedTest, @ParameterizedTest, @TestFactory,and @TestTemplate method in the current test class. + * org.junit.jupiter.api.BeforeEach; + * + * @Test is used to signal that the annotated method is a test method. + * @Test methods must not be private or staticand must not return a value. + * @Test methods may optionally declare parameters to beresolved by ParameterResolvers. + * @Test may also be used as a meta-annotation in order to createa custom composed annotation that inherits the semantics of @Test. + * org.junit.jupiter.api.Test; + * */ + class testGeneraux { private Echiquier e; private Joueur jb; From abea788fa540da34df1b9dbf85064a0aa4058218 Mon Sep 17 00:00:00 2001 From: JunkJumper Date: Mon, 27 May 2019 18:16:34 +0200 Subject: [PATCH 03/11] add a javadoc --- tests/testPiece.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/testPiece.java b/tests/testPiece.java index c0c48cc..22e470d 100644 --- a/tests/testPiece.java +++ b/tests/testPiece.java @@ -6,6 +6,21 @@ import org.junit.jupiter.api.Test; import joueurs.Joueur; import piecesEchiquier.*; +/* + * @AfterEach is used to signal that the annotated method should beexecuted after each @Test, @RepeatedTest, @ParameterizedTest, @TestFactory,and @TestTemplate method in the current test class. + * org.junit.jupiter.api.AfterEach; + * + * @BeforeEach is used to signal that the annotated method should beexecuted before each @Test, @RepeatedTest, @ParameterizedTest, @TestFactory,and @TestTemplate method in the current test class. + * org.junit.jupiter.api.BeforeEach; + * + * @Test is used to signal that the annotated method is a test method. + * @Test methods must not be private or staticand must not return a value. + * @Test methods may optionally declare parameters to beresolved by ParameterResolvers. + * @Test may also be used as a meta-annotation in order to createa custom composed annotation that inherits the semantics of @Test. + * org.junit.jupiter.api.Test; + * */ + + class testPiece { private Echiquier e; private Joueur jb; From f28aee00c6cd86e279f3405f01097aa2819a467a Mon Sep 17 00:00:00 2001 From: JunkJumper Date: Mon, 27 May 2019 18:17:49 +0200 Subject: [PATCH 04/11] fix table align --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 910231d..ac21808 100755 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Pour plus d'informations sur les règles, visitez [ce site](http://www.echecs.cl Vous trouverez ici un tableau résumant les pièces : -| Pièce | Lettre | +| Pièce | Lettre | |:---------:|:--------:| |Cavalier | C | |Fou | F | From 46be27bc9a64d33993242237be333d5a98230902 Mon Sep 17 00:00:00 2001 From: JunkJumper Date: Mon, 27 May 2019 18:19:03 +0200 Subject: [PATCH 05/11] fix other table align --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ac21808..7c9afee 100755 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ La lettre ``B`` signifie qu'une pièce est de couleur blanche et la lettre ``N`` ## Crédits [[revenir au sommaire]](https://git-iutinfo.unice.fr/good3nought/echesstria#sommaire) -| Peronne ou Source | Role | +| Peronne ou Source | Role | | :-------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------:| | [ALEXOVITZ Anthony](https://git-iutinfo.unice.fr/aa700867) | Conception et Développement | | [NOWICKI Johann](https://git-iutinfo.unice.fr/nj715143) | Conception et Développement | From ce6479aaaecaa20540b874ded390870ee9bc8496 Mon Sep 17 00:00:00 2001 From: JunkJumper Date: Mon, 27 May 2019 18:43:20 +0200 Subject: [PATCH 06/11] ajout javadoc --- src/visuel/main.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/visuel/main.java b/src/visuel/main.java index 88e0173..fa2a2ed 100755 --- a/src/visuel/main.java +++ b/src/visuel/main.java @@ -83,7 +83,9 @@ public class main { j1.setCouleur("Noir"); System.out.println("Le joueur " + j2.getNom() + " jouera les blancs et le joueur " + j1.getNom() + " jouera les noirs."); - + /* + * Alors ici on utilise un joueur temporaire pour faire passe le deuxième joueur en joueur numéro 1 + */ jTemp.setNom(j1.getNom()); jTemp.setCouleur(j1.getCouleur()); From 8a6a546a956fedf233379da3db05cc1178f31888 Mon Sep 17 00:00:00 2001 From: JunkJumper Date: Mon, 27 May 2019 18:56:48 +0200 Subject: [PATCH 07/11] add javadoc equalsignorecase --- src/piecesEchiquier/Echiquier.java | 47 +++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/piecesEchiquier/Echiquier.java b/src/piecesEchiquier/Echiquier.java index a2ec3a0..63f90bc 100644 --- a/src/piecesEchiquier/Echiquier.java +++ b/src/piecesEchiquier/Echiquier.java @@ -1,5 +1,43 @@ package piecesEchiquier; -//voir equalsIgnoreCase + + /* + * Dans cette classes et bien d'autres, nous utilsons la méthode equalsIgnoreCase, voici sa documentation + * + * Compares this {@code String} to another {@code String}, ignoring case + * considerations. Two strings are considered equal ignoring case if they + * are of the same length and corresponding characters in the two strings + * are equal ignoring case. + * + *

Two characters {@code c1} and {@code c2} are considered the same + * ignoring case if at least one of the following is true: + *

    + *
  • The two characters are the same (as compared by the + * {@code ==} operator) + *
  • Applying the method {@link + * java.lang.Character#toUpperCase(char)} to each character + * produces the same result + *
  • Applying the method {@link + * java.lang.Character#toLowerCase(char)} to each character + * produces the same result + *
+ * + * @param anotherString + * The {@code String} to compare this {@code String} against + * + * @return {@code true} if the argument is not {@code null} and it + * represents an equivalent {@code String} ignoring case; {@code + * false} otherwise + * + * @see #equals(Object) + * + * public boolean equalsIgnoreCase(String anotherString) { + * return (this == anotherString) ? true + * : (anotherString != null) + * && (anotherString.value.length == value.length) + * && regionMatches(true, 0, anotherString, 0, value.length); + * } + */ + import joueurs.Joueur; public class Echiquier { @@ -100,6 +138,13 @@ public class Echiquier { public boolean verificationMouvement(Joueur J, String A, String B) // FONCTION TRADUCTION, VERIF + DEPLACEMENTS SI POSSIBLE {// String A = coordonées de A; String B = coordonées de B + + /** + * Converts all of the characters in this String to lowercase using the rules of the default locale. This is equivalent to calling toLowerCase(Locale.getDefault()). + * Note: This method is locale sensitive, and may produce unexpectedresults if used for strings that are intended to be interpreted localeindependently.Examples are programming language identifiers, protocol keys, and HTMLtags.For instance, "TITLE".toLowerCase() in a Turkish localereturns "t\u0131tle", where '\u0131' is theLATIN SMALL LETTER DOTLESS I character.To obtain correct results for locale insensitive strings, use toLowerCase(Locale.ROOT). + * + * Ceci est pour forcer le passage en minuscule au cas ou la méthode dans le main ne fonctionne pas + */ A.toLowerCase(); B.toLowerCase(); From c759e45dd0dbe2db6a4c6597f2226aefddf37e43 Mon Sep 17 00:00:00 2001 From: JunkJumper Date: Mon, 27 May 2019 18:56:58 +0200 Subject: [PATCH 08/11] ajout commentaires explications --- src/visuel/main.java | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/visuel/main.java b/src/visuel/main.java index fa2a2ed..fb3d832 100755 --- a/src/visuel/main.java +++ b/src/visuel/main.java @@ -143,18 +143,18 @@ public class main { } else { do { - System.out.println( - "Quelle pièce voulez-vous déplacer ? Donnez le code correspondant de la pièce à déplacer(ex : A1).\n"); - A = sc.nextLine(); - - cA = A.charAt(0); - pA = A.charAt(1); - char cAl = Character.toLowerCase(cA); - sA = "" + cAl + pA; - - System.out.println( - "À quel endroit la poser ? Donnez le code correspondant à l'endroit où poser la pièce.\n"); - B = sc.nextLine(); + System.out.println( + "Quelle pièce voulez-vous déplacer ? Donnez le code correspondant de la pièce à déplacer(ex : A1).\n"); + A = sc.nextLine(); + + cA = A.charAt(0);//ici on récupère le premier caractère du String + pA = A.charAt(1);//ici on récupère le second caratère + char cAl = Character.toLowerCase(cA); //ici on convertis un 'A' en 'a' + sA = "" + cAl + pA; //ici on concatène dans un nouveau string le a transformé avec le chiffre récupéré. + + System.out.println( + "À quel endroit la poser ? Donnez le code correspondant à l'endroit où poser la pièce.\n"); + B = sc.nextLine(); }while(e.verificationMouvement(j1, sA, B) != true ); @@ -213,10 +213,10 @@ public class main { "Quelle pièce voulez-vous déplacer ? Donnez le code correspondant de la pièce à déplacer(ex : A1).\n"); A = sc.nextLine(); - cA = A.charAt(0); - pA = A.charAt(1); - char cAl = Character.toLowerCase(cA); - sA = "" + cAl + pA; + cA = A.charAt(0);//ici on récupère le premier caractère du String + pA = A.charAt(1);//ici on récupère le second caratère + char cAl = Character.toLowerCase(cA); //ici on convertis un 'A' en 'a' + sA = "" + cAl + pA; //ici on concatène dans un nouveau string le a transformé avec le chiffre récupéré. System.out.println( "À quel endroit la poser ? Donnez le code correspondant à l'endroit où poser la pièce.\n"); @@ -224,9 +224,7 @@ public class main { }while(e.verificationMouvement(j2, sA, B) != true ); - } - - //} while (e.verificationMouvement(j2, A, B) != true); // Tant que le mouvement n'est pas faisable on demande 2 coordonnées + } // Tant que le mouvement n'est pas faisable on demande 2 coordonnées // VERIF ECHECMAT From 78d3cc2c774c9e2f9377a3b2c31a64ee69626d92 Mon Sep 17 00:00:00 2001 From: sj801446 Date: Mon, 27 May 2019 19:04:55 +0200 Subject: [PATCH 09/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c9afee..dc880fd 100755 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ S’il n’y parvient pas, son roi est alors « échec et mat ». Vous remportez Pour plus d'informations sur les règles, visitez [ce site](http://www.echecs.club/regles/) ou visitez les [crédits](https://git-iutinfo.unice.fr/good3nought/echesstria#cr%C3%A9dits-revenir-au-sommaire). -Vous trouverez ici un tableau résumant les pièces : +### Vous trouverez ici un tableau résumant les pièces : | Pièce | Lettre | |:---------:|:--------:| From beff814bafbdc0033bae3c9225177209d959a168 Mon Sep 17 00:00:00 2001 From: JunkJumper Date: Mon, 27 May 2019 19:09:30 +0200 Subject: [PATCH 10/11] fix error OOB when null string for joueur or posistions --- src/visuel/main.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/visuel/main.java b/src/visuel/main.java index fb3d832..a411151 100755 --- a/src/visuel/main.java +++ b/src/visuel/main.java @@ -27,9 +27,15 @@ public class main { // déclaration des joueurs System.out.println("Entrez le nom du joueur 1 : "); Joueur j1 = new Joueur(sc.nextLine(), null); + if(j1.getNom().isEmpty()) { + j1.setNom("Joueur Par défaut 1"); + } System.out.println("Entrez le nom du joueur 2 : "); Joueur j2 = new Joueur(sc.nextLine(), null); + if(j2.getNom().isEmpty()) { + j2.setNom("Joueur Par défaut 2"); + } Joueur jTemp = new Joueur(null, null); // ce joueur sert de mémoire pour le choix de l'odre de jeu @@ -146,6 +152,9 @@ public class main { System.out.println( "Quelle pièce voulez-vous déplacer ? Donnez le code correspondant de la pièce à déplacer(ex : A1).\n"); A = sc.nextLine(); + if(A.isEmpty()) { + A = "Z99"; + } cA = A.charAt(0);//ici on récupère le premier caractère du String pA = A.charAt(1);//ici on récupère le second caratère @@ -155,6 +164,9 @@ public class main { System.out.println( "À quel endroit la poser ? Donnez le code correspondant à l'endroit où poser la pièce.\n"); B = sc.nextLine(); + if(B.isEmpty()) { + B = "Z99"; + } }while(e.verificationMouvement(j1, sA, B) != true ); From 6a2712948b98003c694f5cbd231c8604c473ab2c Mon Sep 17 00:00:00 2001 From: JunkJumper Date: Mon, 27 May 2019 19:36:01 +0200 Subject: [PATCH 11/11] launch bat file --- launch.bat | 1 + 1 file changed, 1 insertion(+) create mode 100644 launch.bat diff --git a/launch.bat b/launch.bat new file mode 100644 index 0000000..56c22e6 --- /dev/null +++ b/launch.bat @@ -0,0 +1 @@ +java -jar echesstria.jar \ No newline at end of file