mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-06 09:06:51 +08:00
Add tests, remove main
in WordBoggle
(#5782)
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package com.thealgorithms.misc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@ -32,36 +31,6 @@ public final class WordBoggle {
|
||||
return new ArrayList<>(finalWords);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Testcase
|
||||
List<String> ans = new ArrayList<>(Arrays.asList("a", "boggle", "this", "NOTRE_PEATED", "is", "simple", "board"));
|
||||
assert (boggleBoard(
|
||||
new char[][] {
|
||||
{'t', 'h', 'i', 's', 'i', 's', 'a'},
|
||||
{'s', 'i', 'm', 'p', 'l', 'e', 'x'},
|
||||
{'b', 'x', 'x', 'x', 'x', 'e', 'b'},
|
||||
{'x', 'o', 'g', 'g', 'l', 'x', 'o'},
|
||||
{'x', 'x', 'x', 'D', 'T', 'r', 'a'},
|
||||
{'R', 'E', 'P', 'E', 'A', 'd', 'x'},
|
||||
{'x', 'x', 'x', 'x', 'x', 'x', 'x'},
|
||||
{'N', 'O', 'T', 'R', 'E', '_', 'P'},
|
||||
{'x', 'x', 'D', 'E', 'T', 'A', 'E'},
|
||||
},
|
||||
new String[] {
|
||||
"this",
|
||||
"is",
|
||||
"not",
|
||||
"a",
|
||||
"simple",
|
||||
"test",
|
||||
"boggle",
|
||||
"board",
|
||||
"REPEATED",
|
||||
"NOTRE_PEATED",
|
||||
})
|
||||
.equals(ans));
|
||||
}
|
||||
|
||||
public static void explore(int i, int j, char[][] board, TrieNode trieNode, boolean[][] visited, Set<String> finalWords) {
|
||||
if (visited[i][j]) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user