AceWindgar1285's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
26 (0.04 per day)
Joined:
12-October 12
Profile Views:
230
Last Active:
User is offline Sep 19 2014 07:18 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   AceWindgar1285 has not set their status

Posts I've Made

  1. In Topic: Not giving what I'm seeking

    Posted 30 Aug 2014

    Attached File  Error.jpg (34.83K)
    Number of downloads: 2 Here is a screen shot of what happens when I run the program.
  2. In Topic: trying to reverse a string in assembly

    Posted 9 Apr 2014

    It was an old assignment my teacher gave us to practice with.
  3. In Topic: My problem is that the solution to the map is not marked right

    Posted 9 Dec 2012

    Sorry forgot to place it back in the program.


    /**
     * @author Chris
     *
     */
    public class Maze {
    	// Class Variables
    	final static char BLANK = ' ';
    	final static char WALL = 'X';
    	final static char BACK = 'B';
    	final static char PATH = '-';
    	static char[][] map=null;
    
    	Maze(String [] n)
    	{
    		map= new char[n.length][];
    		for(int i =0;i<n.length;i++){
    			map[i] = n[i].toCharArray();
    		}
    
    	}
    
    	public boolean findSolution(int row, int col)
    	  {
    	    boolean done = false;
    	    if (valid (row, col))
    	    {
    	      map[row][col] = BACK; // this cell has been tried
    	      if (row == map.length-1 && col == map[0].length-1)
    	        done = true; // the maze is solved
    	      else
    	      {
    	        done = findSolution (row, col+1); // down
    	        if (!done)
    	          done = findSolution (row-1, col); // right
    	        if (!done)
    	          done = findSolution (row, col-1); // up
    	        if (!done)
    	          done = findSolution (row+1, col); // left
    	      }
    	      if (done) // this location is part of the final path
    	        map[row][col] = PATH;
    	    }
    	    return done;
    	  }
    	  
    	  private boolean valid (int row, int column)
    	  {
    	    boolean result = false;
    	// check if cell is in the bounds of the matrix
    	    if (row >= 0 && row < map.length &&
    	        column >= 0 && column < map[row].length)
    	// check if cell is not blocked and not previously tried
    	      if (map[row][column] == BLANK) 
    	      result = true;
    	    return result;
    	  }
    
    	public boolean solution()
    	{
    		return findSolution(4,0);
    	}
    
    	public void displayMaze()
    	{
    		final char[ ][ ] maze = map;
    		for(int i = 0; i < maze.length; i++){
    			for(int j = 0; j < maze.length; j++)
    				System.out.print("|"+maze[i][j]);
    			System.out.println("|");
    		}
    	}
    }
    
    
    
  4. In Topic: having a java.lang.ArrayIndexOutOfBoundsException-1

    Posted 7 Dec 2012

    iactually figured out what i was doing wrong i was having it start at the wrong point. But now i can't get it to backtrack.
  5. In Topic: having a java.lang.ArrayIndexOutOfBoundsException-1

    Posted 7 Dec 2012

    is it possible to see a sample of what you would perfer me to do just a small sample to put me in the right direction?

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

AceWindgar1285 hasn't added any friends yet.

Comments

AceWindgar1285 has no profile comments yet. Why not say hello?