Zeether

wordSearch

Sep 22nd, 2013
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Stephen Bonadies
  2. // COP3330-13
  3. // A program to solve a word search
  4.  
  5. import java.io.File;
  6. import java.io.PrintStream;
  7. import java.util.Scanner;
  8.  
  9.  
  10. public class WordSearch {
  11.  
  12.     public static void main(String[] args) throws Exception{
  13.        
  14.         Scanner sc = new Scanner(new File("puzzle.txt"));
  15.         // reading in rows and columns for the array
  16.         int numRows = sc.nextInt();
  17.         int numCols = sc.nextInt();
  18.         //int [][] wordArray = new int [numRows][numCols];
  19.        
  20.        
  21.         // looping over the array to find words
  22.         for(int i = 0; i < numRows; i++){
  23.             String getChar = new String(sc.next());
  24.             for(int j = 0; j < numCols; j++){
  25.                 char [][] charArray = new char [numRows][numCols];
  26.                 char puzzle = getChar.charAt(j); // this will get all the characters in the array to find the word
  27.                
  28.                
  29.             }
  30.         }
  31.        
  32.         // reading in number of words to find in the array
  33.         int numWords = sc.nextInt();
  34.         for(int i = 0; i < numWords; i++){
  35.             String getWord = new String(sc.next());
  36.             String [] wordArray = new String [numWords];
  37.         }
  38.        
  39.         // iterating over the array using the method wordCheck created
  40.         for(int x = 0; x < numRows - 1; x++){
  41.             for(int y = 0; y < numCols - 1; y++){
  42.                 // call the method
  43.             }
  44.         }
  45.        
  46.    
  47. sc.close();
  48.     }
  49.  
  50.  
  51. // this method will be used to check for the words
  52. // posx, posy, posx2 and posy2 are used to get the x and y positions, diffx and diffy are to check the difference in positions
  53. private void wordCheck(char puzzle [][], String wordArray[], int numWords, int posx, int posy, int posx2, int posy2, int diffx, int diffy, PrintStream prints){
  54.         for(int i = 0; i < numWords; i++){
  55.             int wordLength = wordArray.length;
  56.            
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment