View Single Post
  #4 (permalink)  
Old 11-09-2007, 07:47 AM
hardwired hardwired is online now
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
why do you do it twice? Once in the beginning of the code; and the second in the while loop?
Consider the text file we are reading:
Code:
5 5 4 4 3 3 14 12 5 4 6 10 9 4 3 10 9 5 2 13 2 14 14 10 12 2 9 1 3 12 11
The first br.readLine reads the first line which has two tokens which we split and assigned to the variables width and height.
I skipped the next two lines with readLine statements.
The loop is going to read the last five lines in the file. Reading the first line returns the string "14 12 5 4 6". We need to split this to get the 5 values to parse into ints and then to assign to the next line in the mazeLine array. Each trip through the loop reads another line of tokens.
Reply With Quote