Could anyone check my coding here. I'm trying to create a word search program. I have a 6x6 word board and a file that contain 3 word in the list 6x6 word baord: A E N T E R A P A E A A E N P E R S A D A L A F A F A F E F wordlist: ACE APPLE ENTER and i'm suppose to search for the word in 8 directions public void readWord () { word1 = new char [3][]; puzzle1 = new char [6][6]; finalWord = new char [6][6]; int i,j; String s,p; for (i=0; i<word1.length; i++){ //For loop to read in search words s = puzzle.readString(); word1[i] = s.toCharArray(); } for (i=0; i<6; i++){ //For loop to read in jumbled puzzle p = puzzle.readString(); puzzle1[i] = p.toCharArray(); } //Search private boolean found1(int i, int b) { for ( int k=0; k<word1[2].length; k++) { if(Character.toUpperCase(word1[2][k]) != puzzle1[i][b+k]) { return false; } } return true; } //Forward search method private void forward(){ boolean tmp = false; for (int i=0; i<puzzle1.length; i++) { for (int b=0; b<=word1[13].length; b++){ tmp = found1(i, b); if (tmp) { for (int k=0; k<5; k++) { msg.writeChar(puzzle1[i][b+k]); //foward search } } } }
And what in god's wide world, if I may be so bold to ask, made you think that this forum was the right place to ask a question about, of all things, Java programming?
the code only works when i put [13], if i put like a variable it doesn't work at all. thanks!!!
That code's illegible! Please read the instructions about posting code, and then do what it says! (instructions are immediately above the 'Message' box when you make a post!)
View all questions in Keil forum