Could I get some help with this whitespace issue?
There are exits to the: ES Which way do you want to move? You are in location row: 1 col:0 There are exits to the: NES Which way do you want to move? Your output You are in location row: 2 col:0 There are exits to the: NES You feel a breeze. Which way do you want to move? You have found the gold! You have won! Congratulations! Enter a map file name: You are in location row: 0 col:0 There are exits to the: ES Which way do you want to move? You are in location row: 1 col: 0 There are exits to the: NES Which way do you want to move? You are in location row: 2 col:0 There are exits to the: NES You feel a breeze. Which way do you want to move? You have found the gold! 1/ store the whole line in str String strasc. nextline(); I/split the string using separator, and store the values in string array named strs String strs[]=str, split(", "); /loop from j= to size-1 for (int j=;j exits new while(lvalid(exits, direction)) \{ //print the error message and again take input of direction System.out.println( "You can't go that way. "); System.out.print("Which way do you want to move? "); direction=sc. next() ) touppercase () . charAt(); \} I/if the direction entered by user is N if ( direction = ' N) \{ 1/ than decrement the currentRow by 1 currentRow=currentRow 1; \}/lelse if direction entered is 5 else if(direction=-' S ') f //increment the currentRow by 1 currentRow currentRow+1; \}/lelse if direction entered is W else if(direction=w ' W ') \} 1/ decrement the currentcol by 1 currentcol=currentCol-1; \}/lelse if direction entered is E else if (direction=" ' E) //increment the currentcol by 1 currentCol=currentCol+1; \} //update the current block (flag) flag=maze [currentRow] [currentcol]; Whand of whilo Iann (fame has andad) while(lvalid(exits, direction)) \{ //print the error message and again take input of direction System.out.println( "You can't go that way. "); System.out.print("Which way do you want to move? "); direction=sc. next() ) touppercase () . charAt(); \} I/if the direction entered by user is N if ( direction = ' N) \{ 1/ than decrement the currentRow by 1 currentRow=currentRow 1; \}/lelse if direction entered is 5 else if(direction=-' S ') f //increment the currentRow by 1 currentRow currentRow+1; \}/lelse if direction entered is W else if(direction=w ' W ') \} 1/ decrement the currentcol by 1 currentcol=currentCol-1; \}/lelse if direction entered is E else if (direction=" ' E) //increment the currentcol by 1 currentCol=currentCol+1; \} //update the current block (flag) flag=maze [currentRow] [currentcol]; Whand of whilo Iann (fame has andad) if (flag==1) //print the following mmessages System.out.println("Oh nol You have run into a ravenous Bugblatter Beast!"); System.out. println(" You have died! Game over!"); Y/lelse if current block is 2 (fallen into pit) else if (flag=2) \{ I/print the following mmessages System, out.println( "AAAARGH! You have fallen into a pit!"); System.out.println("'nYou have died! Game over!"); \} else/lelse (found the room with gold) \{ //print the following messages System, out. println ("You have found the gold1"); system, out. println(" You have won! Congratulations!"); \} \}//end of try block //to catch FileNotFoundexception catch(FileNotFoundException e) \{ //if FileNotfoundexception occurs print the following message System,out, println("ERROR - Cannot load file "+fileName); System.exit ( ); \} 3 //function to check if given direction (char) exists in the given Arraylist of chars static boolean valid(AnravList Chacacter exits, char direction) System.out.println(" You have won! Congratulations!"); 3 \}/lend of try block //to catch FileNotFoundException catch(FileNotFoundException e) \{ //if FileNotFoundException occurs print the following message System,out.println("ERROR - Cannot load file "+fileName); System,exit(0); \} \} //function to check if given direction (char) exists in the given Arraylist of chars static boolean valid(Arraylist exits, char direction) \{ I/loop to iterate Arraylist elements for(int i=; i;i++) \{ //if direction is available in the Arraylist if ( exits .get (i)== direction ) \{ //than return true return true; \} 3 l/if direction not found in Arraylist than return false return false