This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Java help please!!!

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

}
}
}
}

0