This is what it do ... I have a .txt file that i have stored in a 2d Array and it works ... heres the problem im supposed to search for a word in the table and i can t figure out a way for me to compare the letters in the arrays and return it s index.... (so basically i want to find a letter in the 2d array and i want it to return it s index int c[][]) the real assignment was like a wordhunt puzzle ( where it can find it horizontal vertical diagonal (left and right) aswell as backwards ( in the said directions) but i m pretty sure i can get around it once i know how i can get the indexes of the 2st letter of the word i search for
import java.io.*;
import java.util.Scanner;
public class Mp6 {
public static void main(String[] args) throws IOException {
FileReader a = new FileReader("data/Data.txt");
BufferedReader ss = new BufferedReader(a);
char wla[][];
int x = 80;
int y = 80;
wla = new char [x][y];
String d;
Scanner p = new Scanner(System.in);
int c = 0;
int n = 0 ;
try {
for( c = 0; c < x; c++){
d = ss.readLine();
for ( n = 0; n<y;n++){
wla[c][n]=d.charAt(n);
System.out.print(wla[c][n]);
iii
System.out.println("");
iii
System.out.println("Search for:");
String h = p.nextLine();
h=h.toUpperCase();
char [] ph = new char[h.length()];
int counter = 0;
for(counter = 0 ; counter < h.length();counter++){
ph[counter]=h.charAt(counter);
System.out.print(ph[counter]);
iii
//horizontal
iii catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
iii
iii
iii