This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have a project where I need to make a word search game and I am completely lost.
These are the steps I think I should take, does it sound correct?
Read in the file that has the wordsearch and the guesses
The first two numbers are rows and columns followed by the wordsearch followed by how many words are in the search, lastly followed by the guesses.
The program is supposed to print out the location of the first letter of the word using (rows,columns) coordinates.
After I read the file in, what should be my next step?
I think it should be putting the wordsearch into an array but I am not sure.
Jamie Rico wrote:I think it should be putting the wordsearch into an array but I am not sure.
Sounds reasonable to me. Probably something like a char or maybe even a String (which may have a few advantages).
But before you do any of that, sit down with a piece of paper and a pencil, draw your wordsearch grid, and try things out for yourself.
What are the rules? Does the word have to be found in a single row, or can you find it diagonally? Can you find it backwards?
How do you think you should go about finding words? When can you stop? Unfortunately, our brains are quite sophisticated, so we can often just "see" things without having to think them through. A computer can't, and it doesn't have eyes.
I'd start with one guess word at a time and then work up. And only go back to Java only when you're sure you understand how to handle your searches. And by all means, come back and try out your logic on us.
Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Joined: Sep 27, 2012
The words can be found forward, vertically, and diagonally.
I am not sure what you mean by try things out myself.
I have the file scanned in the correct way I believe
I am not sure how to put it into a 10x10 that is searchable.
Once in the array I would run a search for the first letter of the first word, once it finds a match it would search for the second letter below, in front or diagonally down and right. Then continue in the direction it found the next letter, or move on to keep searching if no matches were found.