public void run()
    {
        edge.addElement(GridCell.getStartCell());
        int attempts =0;
        int state=NOT_FOUND;
        while(state==NOT_FOUND && attempts<maxSteps)
        {
            attempts++;//counts the attempts
            state = step();//sets state to output of step
            
            try
            {
                Thread.sleep(speed*100);//sleep 
            }
            catch(InterruptedException e){}
            
        }
        if(state==FOUND)//when the path is found
        {
            try 
            {
				Path.setPath(map);//runs the path follower
			} catch (Exception e) 
			{
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        }
        
        else
        {
        	System.out.println("No Path Found");
        	JOptionPane.showMessageDialog(null,"No Path Can Be Found");
        	AStar.running=false;
        	Dijkstra.running=false;
    	}
    }