All pastes #422065 Raw Edit

Stuff

public text v1 · immutable
·published 2007-04-03 07:06 UTC
rendered paste body
public List isOnBoard(String wordToCheck)
    {
        cordinates = new LinkedList<Integer>();
        String startingPoint = "";
        tempBoard = theBoard;
        
        if(wordToCheck.substring(0,2).equalsIgnoreCase("qu"))
        {
            startingPoint += "Qu";
        }
        else
        {
            startingPoint += wordToCheck.substring(0,1);
            System.out.println("Inside else, starting point is" + startingPoint);
        }
        
        for(int x = 0; x < BoggleGUI.DICEROWS; x++)
            for(int y = 0; y <BoggleGUI.DICECOLS; y++)
            {
                if(theBoard[x][y].equalsIgnoreCase(startingPoint))
                {
                    tempBoard = theBoard;
                    System.out.println("    starting at " + x + ", " + y);
                    //tempBoard[x][y] = null;
                    traverse(x,y,wordToCheck,new String(),tempBoard);
                    //System.out.println("StartingPoint found");
                }
            }
        
        System.out.println("Is On Board called");
        return cordinates;
    }*/
   /* 
   public boolean traverse (int row, int column, String targetWord, String curentWord, String[][] freshBoard)
   {
      boolean done = false;
      
      if (valid (row, column) && tempBoard[row][column] != null)
      {
         curentWord += tempBoard[row][column];
         freshBoard[row][column] = null;  // this cell has been tried
         
         System.out.println("   Curent word is"+curentWord);

         if (curentWord.equalsIgnoreCase(targetWord))
            done = true;  // the maze is solved
         else
         {
            if(!done)
                done = traverse (row+1, column, targetWord, curentWord, freshBoard);     // down
            if (!done) 
               done = traverse (row, column+1, targetWord, curentWord, freshBoard);  // right
            if (!done)
               done = traverse (row-1, column, targetWord, curentWord, freshBoard);  // up
            if (!done)
               done = traverse (row, column-1, targetWord, curentWord, freshBoard);  // left
            if(!done)
                done = traverse (row-1, column-1, targetWord, curentWord, freshBoard); //upper left
            if(!done)
                done = traverse (row-1, column+1, targetWord, curentWord, freshBoard); //upper right
            if(!done)
                done = traverse (row+1, column-1, targetWord, curentWord, freshBoard); //lower left
            if(!done)
                done = traverse (row+1, column+1, targetWord, curentWord, freshBoard); //lower right
         }


      }
           if (done)  // this location is part of the final path
            cordinates.add(row * BoggleGUI.DICEROWS + column);    
      return done;
   }
    */