Results 1 to 4 of 4
Thread: Crossword PUzzle Help Please
- 11-16-2011, 08:58 PM #1
Crossword PUzzle Help Please
Objective: To pratice using 2D arrays, loops and comparisons.
General Application: a crossword puzzle game
Source: Horstmann, Big Java
Due date: Sunday, Nov. 20
Instructions
Arrays store a linear arrangement of values, accessed by a single index. Two-dimensional arrays or matrices store a tabular arrangement of values, accessed by two indices, for example matrix[i][j], where i is the row index, and j is the column index.
Crosswords are a type of puzzle where the "pieces" of the puzzle have letters in common. For example, these pieces share the letter 'o'.
d
a c r o s s
w
n
Write a program that will accept a list of words into an array list of strings, then make a 20 x 20 array of char that contains a crossword puzzle with these words.
For example, when given the list
addle, apple, clowning, incline, plan, burr
your program might display:
a d d l e
p
p
c l o w n i n g
e n
c
l
i
p l a n
e
Here is an example which is not legal because of words touching each other. Note how "prove" is added to the puzzle in a fashion which is illegal since it creates additional words "dr", "do", "lv", and "ee". Similarly, the addition of "no" vertically is illegal since it creates the extra word "no" horizontally. In this case, you might think it is legal since the new horizontal word is really a word. However, you do not have to check a dictionary in this assignment. Just assume that creation of any new word other than the one you are addition is illegal.
a d d l e
p r o v e
p
c l o w n i n g
e n o
c
l
i
p l a n
e
Here is another example which is OK. (Note the addition of "loon" uses two letters that are in the puzzle already, which creates no problem since there are no new words created other than the single one added "loon".)
a d d l e
p o
p o
c l o w n i n g
e n
c
l
i
p l a n
e
You may want to use the following method: Place the first word horizontally in the center of the grid. Place the next word vertically. Check if there is a common letter already on the grid, and if all the squares into which you want to place that word are still empty. (If you can't place it on any of the common letters, skip the word.) Then switch back to horizontal, place the next word if possible, and so on.
--------------------------------------------------------------------------------
Notes:
Submit the assignment as a single file called A2.java, in the usual way on Blackboard. The file can hold multiple classes, but the one called A2 must be the one with the main method, and it is the one that is public. The other classes are not declared public. Thus, the structure of the file is something like the following.
/**
The class A2 reads a list of words from standard input and
produces a crossword layout.
@author student name
*/
public class A2
{
public static void main(String[] args)
{
}
}
/**
The class Crossword knows how to build a crossword layout from
a list of words.
*/
class Crossword
{
}
...
The program should compile with the one command:
javac A2.java
The program should run with the command:
java A2 < input.txt
where input.txt contains the list of words. The list of words should be in the format of words separated by white space, for example:
clowning
incline
plan
apple
addle
loon
Note: given the above list, your program may produce a different crossword from the one shown here. The main rule is that if a word can be added at the time your program reads it, then your program will add it.
Marking: Identation: 0.5 marks, javadoc style comments: 1.5 marks, design: 2 marks, functionality: 6 marks.
Make sure that the author's name is in a comment at the top of the file. If you receive significant help from someone, then acknowledge that person's help in the comment at the top. Copying or letting your work be copied results in a mark of zero as well as other repercussions according to the student code of conduct described in your Calendar.
-
Re: Crossword PUzzle Help Please
As per your other post, please do not simply dump your work or homework in the forum without showing evidence of your work and without asking a specific answerable question. Please correct this deficiency so we don't have to lock this thread.
- 11-16-2011, 09:21 PM #3
Re: Crossword PUzzle Help Please
I am really sorry for that ...but had tried many times..so please help me....
-
Re: Crossword PUzzle Help Please
Last edited by Fubarable; 11-16-2011 at 09:43 PM.
Similar Threads
-
Tromino puzzle
By azertyazerty in forum New To JavaReplies: 0Last Post: 03-23-2011, 03:50 PM -
Crypto puzzle
By morello in forum Advanced JavaReplies: 0Last Post: 02-26-2011, 09:23 PM -
StringIndexOutOfBoundsException- Crossword Solver App.
By numbskull20 in forum Advanced JavaReplies: 3Last Post: 12-01-2010, 01:33 PM -
N-Puzzle Help!
By evan42781 in forum New To JavaReplies: 12Last Post: 04-29-2009, 11:34 PM -
Need help with Trees...(8-puzzle)
By ventrue in forum New To JavaReplies: 2Last Post: 03-23-2009, 11:04 PM


LinkBack URL
About LinkBacks


Bookmarks