From a07842cd3103d8ba989b316732a728070d598cfe Mon Sep 17 00:00:00 2001 From: Cong <xuan-viet.cong@etu.univ-amu.fr> Date: Wed, 23 Sep 2020 11:34:26 +0200 Subject: [PATCH] lol --- tp2/Crossword.java | 9 ++++----- tp2/Main.java | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tp2/Crossword.java b/tp2/Crossword.java index 5b1263c..a0e1379 100644 --- a/tp2/Crossword.java +++ b/tp2/Crossword.java @@ -27,12 +27,11 @@ public class Crossword // Code pour calculer la taille du tableau et initialiser les variables d'instance "rows" et "columns" Scanner scan = new Scanner(file); - rows = 0; List<String> stringrow = new ArrayList<>(); while (scan.hasNextLine()){ - rows++; stringrow.add(scan.nextLine()); } + rows = stringrow.size(); columns = stringrow.get(0).length(); // Code pour créer le tableau "array" @@ -103,7 +102,7 @@ public class Crossword private boolean searchRow(int y, int x, String word) { boolean f = true; - if (word.length() + x >= this.columns) { + if (word.length() + x > this.columns) { return false; } @@ -119,7 +118,7 @@ public class Crossword private boolean searchDia(int y, int x, String word) { boolean f = true; - if ((word.length() + x >= this.columns)||(word.length() + y >= this.rows)) { + if ((word.length() + x > this.columns)||(word.length() + y > this.rows)) { return false; } @@ -137,7 +136,7 @@ public class Crossword private boolean searchColumn(int y, int x, String word) { boolean f = true; - if (word.length() + y >= this.rows) { + if (word.length() + y > this.rows) { return false; } diff --git a/tp2/Main.java b/tp2/Main.java index 3b594d1..ef04caf 100644 --- a/tp2/Main.java +++ b/tp2/Main.java @@ -24,7 +24,6 @@ public class Main { while (mot != "stop"){ mot = mot.toUpperCase(); tableau.search(mot); - System.out.println(tableau.countWord(mot)); mot = scan.nextLine(); } -- GitLab