Start allowing more than just Normal and Simple mode... crossword mode won't fill in the random letters.

This commit is contained in:
Matthew Slowe
2017-10-08 22:02:56 +01:00
parent 3c18a2c831
commit cc2c7eee29
3 changed files with 21 additions and 11 deletions

View File

@@ -155,12 +155,14 @@ public class GridFactory {
}
public static char[][] makeGrid(List<String> words, int height, int width) {
return makeGrid(words, height, width, false);
return makeGrid(words, height, width, Modes.NORMAL);
}
public static char[][] makeGrid(List<String> words, int height, int width, boolean simple) {
public static char[][] makeGrid(List<String> words, int height, int width, Modes mode) {
char[][] grid = new char[height][width];
bool simple = (mode == Modes.SIMPLE || mode == Modes.CROSSWORD);
// Place words at random?
for (String word : words) {
int tries = 0;
@@ -180,12 +182,14 @@ public class GridFactory {
}
}
// Fill rest of grid
for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) {
if (grid[y][x] == Character.UNASSIGNED)
// grid[y][x] = '_';
grid[y][x] = getRandomChar();
if(mode != Modes.CROSSWORD) {
// Fill rest of grid
for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) {
if (grid[y][x] == Character.UNASSIGNED)
// grid[y][x] = '_';
grid[y][x] = getRandomChar();
}
}
}