i've been trying to programm a game called Sokoban the last few days. The levels of the game are simple .txt files you can swap. I've already read the .txt file by using BufferedReader but have problems with saving it to an 2-dimensional char array because the number of rows and columns are different each level. Someone told me to make use of charAt but how do i do that.
Sokobanlevel format (http://www.sokoban-online.de/help/sokoban/level-format.html)
Hope you can help me. Thanks.
String file = "...";
BufferedReader br = Files.newBufferedReader();
String line = null;
int rows = file.length;
int cols = file[0].length;
char[][] room = new char [rows][cols];
while ((line = br.readLine()) != null) {
System.out.println(room[rows][cols]);
}