Jump to content

How to write a word search program in Java?

- - - - -

  • Please log in to reply
No replies to this topic

#1
yeeesh

yeeesh

    Newbie

  • Members
  • Pip
  • 4 posts
Im looking for a starting point I have my methods I just need to fill them in thanks

generateWordSearchProblem()
• makeGrid()
o instantiate an array of a given size
o fill it with random chars
• placeWords()
o read in each line
o parse it to obtain the starting row, starting col, direction, and word
o place the word
• printGrid()



public class WordSearch {

     Scanner scan;

     char [][] grid;

      

     public WordSearch(String filename){

         

     }


     public void generateWordSearchProblem(){

          makeGrid();

          placeWords();

          printGrid();

     }


     public void makeGrid(){ 

         

     }


     public void placeWords(){

       

      }


     public void printGrid(){

     }

}

the Sample output would look like this


For instance:
10 15
0 0 S HELLO
5 9 W GOODBYE
3 2 E HELP
would produce this grid:
Huhksdoval
Ethlrwayrz
Lttxkkwlcu
LsHELPpgyg
Owylzoigvi
tqhEYBDOOG
kcqjrlalgj
qbeqhnhjeh
niqzjkyyir
vtfdefbhjt

Edited by Alyn, 19 October 2011 - 02:29 AM.
added code tag





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users