0
동일한 텍스트 파일에서 두 개 이상의 미로를 읽는 방법을 알아 내려고하고 있습니다.두 개의 미로를 텍스트 파일에서 읽음
내 주요 방법은 하나이지만 미로는 하나만 읽고 두 개의 미로를 읽고이를 별도로 해결하고 싶습니다. 아무도 내게 어떻게 설명 할 수 있니?
String fileName = "Maze.txt";
try {
String readline;
FileReader fileReader =
new FileReader(fileName);
BufferedReader br =
new BufferedReader(fileReader);
int line = 0;
while((readline = br.readLine()) != null) {
System.out.println(readline); //loads the maze
char[] charArr = readline.toCharArray();
maze[line] = charArr;
line++;
}
br.close();
}
Maze.txt
파일이
000100000000000
000100001000010
000111111111000
000100000001000
000111110001000
000000010001000
000011110001000
000010010001010
000010010000000
000010000000000
000011111110000
000000000010000
000000000010000
000001000011110
000000000010000
010000000000000
010000000000000
010000000000000
011100000000000
000111110001000
011100010000000
000100010001000
000000010001000
000000011111100
000000000000100
000000000000100
000000001111100
000000000000100
000000000000100
000000000000100
두 번째 미로가 빈 줄 때문에 읽히지 않았다고 생각합니다. 디버그를 실행하여 확인하십시오. –