mirror of
				https://github.com/fooflington/wordsearch.git
				synced 2025-11-04 06:19:03 +00:00 
			
		
		
		
	Start allowing more than just Normal and Simple mode... crossword mode won't fill in the random letters.
This commit is contained in:
		@@ -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();
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user