Help! Maze Problem

Could someone lend a hand? I am attempting to write a program that will read characters from a input file into a two-dimensional char array. The character will be a 'x'. The program will give the path to the other side. Example(0,0;1,1;1,2... and so on)Give the path to the other side of the maze. The 'x' signifies a road block. See sample file
(Input File)
XXX XXX
X XXX
X X XXXXX
X XXXXX
X XXXX
X X X
X X XXX X
XXXXXXX X
Here is the code I have so far. I'm have a problem getting searching the array. Can anyone help? Here is my code thus far.
import java.io.*;
import java.util.*;
public class Maze {
     public static void solve(char[] [] maze) {
     if (!solve(maze, 0, 0))
          System.out.println("No Solution Possible");
     private static boolean solve(char[][] maze, int x, int y) {
     // Insert your code here
     String result = "";
               for (int row = maze.length - 1; row >=0; row--){
               for (int col = 0; col < maze[row].length; col++){
          result = result + maze[row][col] ;
          System.out.println(row + ", " + col+ " " + result);
          result += "\n";
     return false;
public class TestMaze{
public static void main(String[] args) {
     if (args.length < 1) {
     System.err.println("Usage java TestMaze <input file>");
     System.exit(1);
     try {
     BufferedReader br = new BufferedReader(new FileReader(args[0]));
     String line;
     ArrayList mazeArrayList = new ArrayList();
     while ((line = br.readLine()) != null) {
          char[] row = line.substring(0,line.length()-1).toCharArray();
          mazeArrayList.add(row);
     char[][]maze = (char[][])mazeArrayList.toArray
          (new char[mazeArrayList.size()][]);
     Maze.solve(maze);
     catch (Exception ex) {
     System.err.println("Exception " + ex);
     ex.printStackTrace();
     System.exit(1);
Your thoughts are appreciated.

here is my java swing method for reading a file, and loading it line by line into an array.
to call it:
readFile("file.txt")and it'll read the file file.txt
public void readFile(String fileName) {
String s, s2 = "";
int lineCount = 0;
BufferedReader in;
try {
in = new BufferedReader(new FileReader(fileName));
while((s = in.readLine()) != null) {
lineCount++;
array = new String[lineCount];
in.close();
in = new BufferedReader(new FileReader(fileName));
int j = 0;
while((s = in.readLine()) != null) {
array[j] = s;
j++;
catch(IOException e) {
System.out.println("Error");
}hope that's of some help.
izy_t
p.s. when they say code tabs, they meet when you're writing your post, when
it comes to posting code, put a html-stlye tab like this <code></code>, only with [] instead of <>

Similar Messages

  • I downloaded my sons ipod 4g to the new iOS and now when we try to sync it says we have no space, but there is nothing but a few apps on his ipod.  I've tried to reset but that didn't help the problem.  What can I do?

    I downloaded my sons ipod 5g with the latest iOS and now when we try to sync it says we have no space, but there is nothing but a few apps on his ipod and he has plenty of space.  The messege says that most of is space is taken up by video but there is no video or music on his ipod right now.  I've tried to reset his ipod but that did not help the problem. What can I do?

    Did you try to set it up again as new device?
    How to back up your data and set up as a new device

  • TS4040 I assumed this would help my problem with not being able to open apps like Preview or TextEdit since I installed Mountain Lion. Instead, first I'm prompted to enter a password, then once I do that, I get an error box telling me the Library needs re

    I assumed this would help my problem with not being able to open apps like Preview or TextEdit since I installed Mountain Lion. Instead, first I'm prompted to enter a password, then once I do that, I get an error box telling me the Library needs repairing. So I click on Repair, and once again I'm prompted for a password, which I enter, then the same error box opens, and so it goes. Can anyone help me with this problem? I'd greatly appreciate it.
    Thor

    Back up all data. Don't continue unless you're sure you can restore from a backup, even if you're unable to log in.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. To do that, unlock the preference pane using the credentials of an administrator, check the box marked Allow user to administer this computer, then reboot. You can demote the problem account back to standard status when this step has been completed.
    Triple-click the following line to select it. Copy the selected text to the Clipboard (command-C):
    { sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -Rh $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
    Paste into the Terminal window (command-V). You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2 (optional)
    Step 1 should give you usable permissions in your home folder. This step will restore special attributes set by OS X on some user folders to protect them from unintended deletion or renaming. You can skip this step if you don't consider that protection to be necessary, and if everything is working as expected after step 1.
    Boot into Recovery by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.
    When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    res
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window will open. You’re not  going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • I have not been able to open up Lightroom on my computer for over a year now. Whenever I double click on it, this comes up - can anyone help? Problem signature:   Problem Event Name:APPCRASH   Application Name:lightroom.exe   Application Version:3.4.1.10

    I have not been able to open up Lightroom on my computer for over a year now. Whenever I double click on it, this comes up - can anyone help? Problem signature:   Problem Event Name:APPCRASH   Application Name:lightroom.exe   Application Version:3.4.1.10

    First thing to try is the latest version of Lightroom (currently 5.6). If it don't crash, then problem solved - upgrade.
    If Lr5 won't run on your machine, then Lr4 instead.
    If both Lr5 and Lr4 crash on your machine, then at least you know it's a not a Lightroom version problem but something wonked in your system.
    If you can't figure out how to resolve the crash on the system you have, then it's time for a new system (or try another converter/editor app).
    PS - A few things to try:
    * After re-installing new version, if that doesn't fix it, then get rid of all Lightroom-related data files (rename them so they can be restored), in case problem is in Lr data file.
    * Remove all non-essential hardware in case problem is hardware/driver.
    * Startup up machine with minimal software services.
    * If still no go, consider updating driver software, including mainboard drivers and/or bios firmware if need be.
    * Of course run all the system hardware and software diagnostics you can - problem could be failing disk or ram..
    * Check system event logs for any clues.
    If you don't know how to do some of these things - ask.
    Do not say "you've tried everything" unless you want a lecture - there is most definitely something you haven't tried. It's like when you can't find your car keys - you haven't looked everywhere -  there is somewhere you haven't looked!
    PS - Has Lightroom EVER worked on your machine? what's changed since then..
    Good luck,
    Rob

  • Google browser and others show all web page on netbook but firefox wont i have to scrool why can i change settings on firefos to help this problem

    all other web browsers when i use on my net book show full web page but with Firefox i have to scroll side ways cant see full width of page sometimes Firefox will show full page but this is not often are the settings in Firefox to help this problem i have the latest version of Firefox 4.0.1

    I have had a similar problem with my system. I just recently (within a week of this post) built a brand new desktop. I installed Windows 7 64-bit Home and had a clean install, no problems. Using IE downloaded an anti-virus program, and then, because it was the latest version, downloaded and installed Firefox 4.0. As I began to search the internet for other programs to install after about maybe 10-15 minutes my computer crashes. Blank screen (yet monitor was still receiving a signal from computer) and completely frozen (couldn't even change the caps and num lock on keyboard). I thought I perhaps forgot to reboot after an update so I did a manual reboot and it started up fine.
    When ever I got on the internet (still using firefox) it would crash after anywhere between 5-15 minutes. Since I've had good experience with FF in the past I thought it must be either the drivers or a hardware problem. So in-between crashes I updated all the drivers. Still had the same problem. Took the computer to a friend who knows more about computers than I do, made sure all the drivers were updated, same problem. We thought that it might be a hardware problem (bad video card, chipset, overheating issues, etc.), but after my friend played around with my computer for a day he found that when he didn't start FF at all it worked fine, even after watching a movie, or going through a playlist on Youtube.
    At the time of this posting I'm going to try to uninstall FF 4.0 and download and install FF 3.6.16 which is currently on my laptop and works like a dream. Hopefully that will do the trick, because I love using FF and would hate to have to switch to another browser. Hopefully Mozilla will work out the kinks with FF 4 so I can continue to use it.
    I apologize for the lengthy post. Any feedback would be appreciated, but is not necessary. I will try and post back after I try FF 3.16.6.

  • Someone who can say how to get Adpbe flash player version 11.2.202.197 to work together with Lion on mac mini. Support from Apple can obviously not help the problem and do not care if it works

    Someone who can say how to get Adpbe flash player version 11.2.202.197 to work together with Lion on mac mini. Support from Apple can obviously not help the problem and do not care if it works

    Adobe flash player version 11.2.202.197 is for Windows Vista / Windows 7 / Vista 64 / Windows 7 64
    Adobe Flash Player version 11.1.102.55 is the current version for Snow Leopard and Lion.
    Adobe - Install Adobe Flash Player

  • .problem is that icon of  iblacklist in i tune is "disc phone" like One, named iblacklist, but  on screen appear as "secret contact" not as iblacklist icon wich is  contact like icon .please  help . iblacklist problem still , I download it again ,this was

    .problem is that icon of  iblacklist in i tune is "disc phone" like One, named iblacklist, but  on screen appear as "secret contact" not as iblacklist icon wich is  contact like icon .please  help .
    iblacklist problem still , I download it again ,this was not helpfull 

    Have you read my reply to one of your duplicate threads : https://discussions.apple.com/message/22774845#22774845 ?

  • Can anyone help with problem updating iphone5s cant get anything only apple on screen sometimes screen flashes blue

    can anyone help with problem updating iphone5s cant get anything only apple on screen sometimes screen flashes blue

    Hey damien555,
    Thanks for the question, I understand how frustrating this may be. It sounds like the update process may have been interrupted, and to resolve the issue, we’ll need to restore your device in recovery mode with iTunes:
    If you can't update or restore your iOS device
    http://support.apple.com/kb/HT1808
    Thanks,
    Matt M.

  • Can you help with problems receiving faxes- powerbook g4?

    Can I get help with problems receiving faxes on the powerbook G4?

    Link for Download & Install & Setup & Activation problems may help
    -Online Chat http://www.adobe.com/support/download-install/supportinfo/
    More information needed for someone to help... please click below and provide the requested information
    -Premiere Pro Video Editing Information FAQ http://forums.adobe.com/message/4200840

  • Can you help with Problems that one of our users i having with regiistration of Premiere Pro?

    Can you help with Problems that one of our users i having with registration of Premiere Pro?

    Link for Download & Install & Setup & Activation problems may help
    -Online Chat http://www.adobe.com/support/download-install/supportinfo/
    More information needed for someone to help... please click below and provide the requested information
    -Premiere Pro Video Editing Information FAQ http://forums.adobe.com/message/4200840

  • I have installed photoshop elements 12. when I try use the editing features it said that i must login to Adobe to register the product. but each time i try to it said there is a problem. help the problem stated that the internet is not connected, but that

    i have installed photoshop elements 12.
    when I try use the editing features it said that i must login to Adobe to register the product.
    but each time i try to it said there is a problem.
    help
    the problem stated that the internet is not connected, but that is not the case.

    I had the same issue and I'm running Windows 7.  Tried working with technical support for several hours but they were no help.  They just had me doing the same things over and over, offering no real answers.  I finally got fed up and have decided to return my product for a full refund.

  • Help classpath problem j2sdk1.4.2_04

    help classpath problem j2sdk1.4.2_04
    how can i run the java program with specify the file location
    such as :
    -----this one is fine ok and return HelloWorld.class-----
    [root@localhost root]javac /serverData/studentAC/s001/HelloWorld.java
    -----but this one cause exception-----
    [root@localhost root]java /serverData/studentAC/s001/HelloWorld
    -----result-----
    Exception in thred "main" java.lang.NoClassDefFoundError: /serverData/studentAC/s001/HelloWorld
    [root@localhost root]
    I have tried a lot of classpath setting:
    I just want to compile and run the java program without specify the classpath only !! please help !!! and give suggest !! if you have this exp!!
    # ---1
    #PATH=/usr/java/j2sdk1.4.2_04/bin:$PATH:$HOME/bin:./
    #export PATH
    #export JAVA_HOME=/usr/java/j2sdk1.4.2_04/
    #export #CLASSPATH=/usr/java/j2sdk1.4.2_04/lib/tools.jar:/usr/java/j2sdk1.4.2_04/jre/lib/rt.jar:./
    # ---2
    #set java environment
    # Java Setup Section START
    export JAVA_HOME="/usr/java/j2sdk1.4.2_04"
    export JRE="$JAVA_HOME/jre"
    export CLASSPATH="$JAVA_HOME/lib:$JRE/lib:$JAVA_HOME/lib/tools.jar:."
    export PATH="$PATH:$JAVA_HOME/bin"
    # Java Setup Section END
    # ---3
    #PATH=$PATH:/usr/java/j2sdk1.4.2_04/bin
    #JAVA_HOME=/usr/java/j2sdk1.4.2_04/
    #export PATH
    # ---4
    # Java Setup Section START
    #JAVA_HOME=/usr/java/j2sdk1.4.2_04
    #export JAVA_HOME
    #CLASSPATH=$CLASSPATH:/usr/java/j2sdk1.4.2_04/lib:/usr/java/j2sdk1.4.2_04/jre/lib:./
    #export CLASSPATH
    #PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
    #export PATH
    # Java Setup Section END
    # ---5
    #export PATH=$PATH:/usr/java/j2sdk1.4.2_04/bin
    #export JAVA_HOME=/usr/java/j2sdk1.4.2_04
    #export CLASSPATH=/usr/java/j2sdk1.4.2_04/lib:$CLASSPATH:.
    # ---6
    #====================================================
    #export JAVA_HOME=/usr/java/j2sdk1.4.2_04
    #export PATH=$JAVA_HOME/bin:$PATH
    #export CLASSPATH=/usr/java/j2sdk1.4.2_04/lib:$CLASSPATH
    #====================================================

    I think this will work. java -classpath /serverData/studentAC/s001 HelloWorld

  • HT4061 How do I unlock my iPad? Unable to get serial number since I can't open iPad to get serial number to get help fixing problem.

    How do I unlock my iPad? Unable to get serial number since I can't open iPad to get serial number to get help fixing problem.

    What do you need the serial number for to unlock the iPad? If the iPad is locked because you forgot the Passcode, you have to restore the device.
    What are you trying to unlock?
    Your serial number is written on the back of the iPad and on the box that the iPad came in.

  • Video player is choppy,audio keeps skipping,unable to watch any movies online,help fix problem ?

    Never been able to watch TV shows,videos, without player freezing up,skipping,audio problems sounds being choppy. Please help fix problem? Can you auto repair or troubleshoot problem ?Thankyou.
                                                    Joaquin Rodriguez

    ooo wrote:first thing I'd do is try changing your video output driver in either video players.
    Did not help, same result.
    Last edited by uppectle (2015-03-06 18:58:59)

  • Genius needs to help! problems with my video card and system

    Hey guys! I'm going to post my specs first so that you get a good idea of what I'm running on:
    MSI Neo2 LS 865PE.....MAT=Slow
    Pentium4 2.4C.....FSB=233=2.8C hyperthreading enabled ~>1.55V
    Corsair TwinX 1gig PC3700.....memory on "AUTO" in BIOS with timings at 3,4,4,8 ~> 2.7V
    Radeon 9700NP.....stock speeds ~>1.7V
    AlienX case with 2 fan400 watt power supply and 6 case fans
    Zalman Alum/Copper heatsink fan
    1:I've had this motherboard for a few months now. I upgraded my video card from a nVidia Ti4200(128meg) to a Radeon 9800 a month ago, but I couldn't get it working at 8X AGP, no matter what voltages I threw at it. I returned it for a Radeon 9700NP hoping that it would work, but it still won't.
    I'm using BIOS 1.9 and since there is no option to select your AGP speed, I could only try using ATI's drivers. Once booted into Windows, there is a slider you can move to select you AGP speed. On my machine It says that It has performed some tests and has concluded that AGP 4x is the best for my system....but my system supports AGP 8X!
    I've moved the slider over to 8x (which requires a reboot) at least 5 times with each card but the slider refuses to move past 4xAGP after the reboot.
    2: My second problem: I had an old stick of KingMax PC3200 and decided to buy 3 more sticks. Unfortunatly, the 3 I bought did not match the one I had, so I only put 2 of the new sticks I bought into my system. Immediatly, My system would crash, lock up, files were corrupt, and I got PLENTY of blue screens of death with a long message containing: 0x0000007  with all these other numbers and "0"s. I did a search online and found out I had a hardware incompatibility problem. I never got this with my old stick of ram.
    I returned the 3 sticks of Ram and replaced them with the Corsair. Put my new Radeon 9700 in, formatted my hard drive....and within 24 hours, my system locked up 3 times, rebooted itself 5 times, and gave me the same BSOD as mentioned above with the same long message.  
    I didn't change anything except for the memory and the video card. I've been wanting to overclock, (thats why i bought the faster memory   ) but I'm not sure what to do at this point.
         I have my FSB at 233 but I'm scared to go any higher because of previous system instability at stock speeds. My RAM was running on 400 and MAT=Turbo with the most relaxed timings at 3,4,4,8.
    I've given myself hours of sleepless nights formatting when my system wouldnt boot into windows; overclocking....etc. I NEED HELP. PLEASE. PLEASE. Anything could work at this point.  
         I'm trying to get more info on how to run my system at a 5:4 ratio, also.  
    If anyone has problems like me or knows what could be the problem with my system, please reply to this post, it would help me a lot. I've been trying to fix these problems for a few months now so anything is greatly appreciated.  

    Thanks a lot to you guys that responded. I brought my computer home this past holiday and I want to let you know where I stand as of now. I guess this thread is like my blog for my computer. I want to clear some things before my first post makes everyone confused.
    1- I have only 2 sticks of memory in my system: the Corsair PC3700 TwinX 512x2
    I returned the 3 KingMax I bought, and still keep my old stick just in case.
    2- I am using the 400 watt power supply that came with the case. I read some reviews of the case and I know the reviewer did not have problems with the power supply. In my BIOS, there are some voltages it is weak on. Lets say: it it should be 5.00+, my power supply will be feeding it 4.96v or something like that, but I dont know, or think, that is a major problem...
    3- My computer will refuse to boot if memory speeds are set at anything below 400. SO....if I want to use a 5:4 ratio and have to set my memory speeds to "333" in BIOS, my system refuses to boot.
    4- This morning, I did manage to overclock my FSB to 250. Specs are as follow:
    Memory Timing @3,4,4,8,4.....speed set at "AUTO".....MAT at "SLOW"
    MY 2.4C's FSB was raised to 250 = 3.0gig  
    AGP/PCI frequency: 67.xx/3x.xx (cant go any lower)
    CPU voltage: 1.5500
    Memory voltage: 2.75
    Video Card voltage: 1.7
         Everything was fine for the whole day until I heard something click in my computer around midnight, and then seconds later, my computer froze and made a continuous beeeeeeeeeeeeeeeeeep. (you can imagine)
         This "click" and system crash has been plaguing me for months now. I dont know whay it happens. I was just using AIM when I heard the click and my heart stopped.
    My memory speeds have been set to "AUTO" even at the FSB of 250. But I don't know if this still means my system is at a 1:1 ratio. I know the BIOS then adjusts the memory to work at 500 if my FSB is 250...so I assume it is?    I love 3gig, but somehow I feel that 2.8 is faster, since the FSB=233 running parallel to my memory, also at 233
    A FSB of 250 is good enough for me, that's what I've been waiting 6 months for. If anyone knows how to set other ratios to achieve a FSB of 250+, please let me know, but as I said, my memory won't boot if its set at "333"

Maybe you are looking for

  • How do i stop my iphone from automatically transferring purchases from iphone to computer?

    I purchase songs and convert them to mp3 and then delete AAC files so as to not have duplicates which I've done for years since the new update the iphone automatically transfers all the AAC files from the iphone thus creating duplicates I have tried

  • Dump when run Report RPTQTA00 - Generate Absence Quotas

    Hi, I run a report RPTQTA00 - Generate Absence Quotas. when we execute it, a runtime error display. What happened?     Error in the ABAP Application Program     The current ABAP program "SAPLHRP3" had to be terminated because it has     come across a

  • K89 NEO4 PLAT/SLI Do I have to send it back?

    Was hoping to get a GEFORCE 7800 GTX for this mobo with either a 3800 or 4000 athlon 64 do I have to send it back to MSI for a bios flash. P.S this is my first build so any tips would be welcomed.

  • Satellite Pro A300 - shutdown issue

    I have a brand new Satellite Pro A300-15V, which I have downgraded from Vista Business to XP Professional, using the original recovery disc. Now I have problem shutting down the computer. When I click "Turn Off" it just shuts down and then restarts a

  • Help/Tips for writing my WindowAdapter

    I'm writing a program which has many popup windows. I need some advice and tips on writing a good WindowListener/WindowAdapter so the windows act properly in regards to focus. Here is what I have: public class PopupWindow extends WindowAdapter {