This commit is contained in:
foo 2017-10-15 17:26:25 +01:00
parent f869de337f
commit e44b5356ab
2 changed files with 3 additions and 2 deletions

View File

@ -17,7 +17,7 @@ OBJS = ${SRCS:.java=.class}
all: build wordsearch.jar all: build wordsearch.jar
run: all run: all
$(JAVA) uk.org.mafoo.wordsearch.GridFactory 10 10 $(JAVA) uk.org.mafoo.wordsearch.GridFactory 15 15
.java.class: .java.class:
$(JAVAC) $(JFLAGS) $< $(JAVAC) $(JFLAGS) $<

View File

@ -155,7 +155,7 @@ public class GridFactory {
} }
public static char[][] makeGrid(List<String> words, int height, int width) { public static char[][] makeGrid(List<String> words, int height, int width) {
return makeGrid(words, height, width, Modes.NORMAL); return makeGrid(words, height, width, Modes.CROSSWORD);
} }
public static char[][] makeGrid(List<String> words, int height, int width, Modes mode) { public static char[][] makeGrid(List<String> words, int height, int width, Modes mode) {
@ -205,6 +205,7 @@ public class GridFactory {
// System.out.println("[" + word + "] Placing @ " + x + "," + y + " going " + direction); // System.out.println("[" + word + "] Placing @ " + x + "," + y + " going " + direction);
char[][] tempgrid = clone2d(grid); char[][] tempgrid = clone2d(grid);
for( char c : word.toUpperCase().toCharArray() ) { for( char c : word.toUpperCase().toCharArray() ) {
if(!Character.isLetter(c)) continue; if(!Character.isLetter(c)) continue;
if(grid[y][x] != Character.UNASSIGNED) { if(grid[y][x] != Character.UNASSIGNED) {
if (grid[y][x] != c) { if (grid[y][x] != c) {