From 24fbab55d3a8a714a73068f6f456c8934ba8213a Mon Sep 17 00:00:00 2001
From: Hai Dang <hai-dang.le@etu.univ-amu.fr>
Date: Sun, 20 Sep 2020 13:34:53 +0200
Subject: [PATCH] Updated Crossword Ajout d'un compteur du nombre total
 d'occurence d'un mot. Task 3 fait.

---
 tp2/Crossword.java | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tp2/Crossword.java b/tp2/Crossword.java
index 4347bd4..1fdff78 100644
--- a/tp2/Crossword.java
+++ b/tp2/Crossword.java
@@ -147,6 +147,19 @@ public class Crossword {
         System.out.println();
     }
 
+    public int countWord(String word){
+        this.WordCount = 0;
+        for (int j = 0; j < columns; ++j) {
+            for (int i = 0; i < rows; ++i) {
+                if (searchRow(j, i, word)) {
+                    this.WordCount ++;
+                } else if (searchColumn(j, i, word)) {
+                    this.WordCount ++;
+                }
+            }
+        }
+        return this.WordCount;
+    }
 
 }
 
-- 
GitLab