forked from steve-coward/CS454-SW-Engineering-WordSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWordSearch.java
56 lines (45 loc) · 1.22 KB
/
WordSearch.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package wordSearch;
import java.util.ArrayList;
import java.util.Iterator;
import java.awt.Point;
public class WordSearch {
/**
* @param args
*/
static int m_size = 5;
public static void main(String[] args) {
// Create a game grid
wordArray wa = new wordArray(m_size);
// Initialize grid with some words
wa.initialize(1509);
wa.printGrid();
for (int i = 13; i < 1700; i+=17 ) {
wa.initialize(i);
wa.printGrid();
}
for (int i = 0; i <= 2; i++ ){
wa.initialize("test/test-word-count-" + i + ".txt");
wa.printGrid();
}
// Some simple testing
ArrayList<Point> listPoints = new ArrayList<Point>();
listPoints.add(new Point(0,0));
listPoints.add(new Point(4,5));
listPoints.add(new Point(19,20));
listPoints.add(new Point(0,23));
listPoints.add(new Point(16,20));
listPoints.add(new Point(5,12));
listPoints.add(new Point(22,23));
listPoints.add(new Point(7,22));
listPoints.add(new Point(20,4));
listPoints.add(new Point(10,22));
listPoints.add(new Point(16,4));
Iterator<Point> itr = listPoints.iterator();
while (itr.hasNext()){
Point p = itr.next();
if (wa.isWord( p.x, p.y )) {
System.out.println("Word: " + wa.getWord( p.x, p.y ));
}
}
}
}