From 0015cde35a079e6c4e57a2e38c645ef42d25595b Mon Sep 17 00:00:00 2001 From: foo Date: Mon, 17 Apr 2017 17:50:30 +0100 Subject: [PATCH] allow output of grid pre-filled --- Makefile | 2 +- README.md | 7 ++++++- uk/org/mafoo/wordsearch/GridFactory.java | 20 +++++++++++--------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 332549c..9a6529a 100755 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ OBJS = ${SRCS:.java=.class} all: build wordsearch.jar run: all - $(JAVA) uk.org.mafoo.wordsearch.GridFactory 10 10 + $(JAVA) uk.org.mafoo.wordsearch.GridFactory 30 30 .java.class: $(JAVAC) $(JFLAGS) $< diff --git a/README.md b/README.md index db76d9c..9439e62 100644 --- a/README.md +++ b/README.md @@ -17,5 +17,10 @@ Once built, you need to make a "war" file to deploy to your J2EE container (test ``` $ cd war && jar cfv ../wordsearch.war . ``` - Then deploy your war file :-) + +Alternatively you can test-run the engine... +``` +$ make run words, int height, int width) { - return makeGrid(words, height, width, false); + return makeGrid(words, height, width, false, true); } - public static char[][] makeGrid(List words, int height, int width, boolean simple) { + public static char[][] makeGrid(List words, int height, int width, boolean simple, boolean fill) { char[][] grid = new char[height][width]; // Place words at random? @@ -181,11 +181,13 @@ public class GridFactory { } // Fill rest of grid - for (int y=0; y