public static void crowdsim(Map map)//working crowd simulation
    {
    	//uses three cells per person, one to start, one to be the move and one to clear the old cell
    	personCell3=personCell;// sets 3 to 1
    	personCell2=map.getnextperson(personCell); // sets the next cell to the lowest adjacent cell to the current cell
    	if(personCell3.getCost()==BLOCK){personCell3.setCost(NORMAL);}//sets the cell to be normal instead of block
        personCell=personCell2;// sets the current cell to the next cell
        
        personCell.setCost(BLOCK);//sets the cost of the block, this is then coloured seperatly in the paint method.


        personCell.repaint();
        personCell2.repaint();
        personCell3.repaint();
        
    	personCell6=personCell4;
    	personCell5=map.getnextperson(personCell4); // sets the next cell to the lowest adjacent cell to the current cell
    	if(personCell6.getCost()==BLOCK){personCell6.setCost(NORMAL);}
        personCell4=personCell5;// sets the current cell to the next cell
        
        personCell4.setCost(BLOCK);
 
    	personCell9=personCell7;
    	personCell8=map.getnextperson(personCell7); // sets the next cell to the lowest adjacent cell to the current cell
    	if(personCell9.getCost()==BLOCK){personCell9.setCost(NORMAL);}
        personCell7=personCell8;// sets the current cell to the next cell
        
        personCell7.setCost(BLOCK);


        personCell7.repaint();
        personCell8.repaint();
        personCell9.repaint();
        
    	personCell12=personCell10;
    	personCell11=map.getnextperson(personCell10); // sets the next cell to the lowest adjacent cell to the current cell
    	if(personCell12.getCost()==BLOCK){personCell12.setCost(NORMAL);}
        personCell10=personCell11;// sets the current cell to the next cell
        
        personCell10.setCost(BLOCK);


        personCell10.repaint();
        personCell11.repaint();
        personCell12.repaint();
        
    	personCell15=personCell13;
    	personCell14=map.getnextperson(personCell13); // sets the next cell to the lowest adjacent cell to the current cell
    	if(personCell15.getCost()==BLOCK){personCell15.setCost(NORMAL);}
        personCell13=personCell14;// sets the current cell to the next cell
        
        personCell13.setCost(BLOCK);


        personCell13.repaint();
        personCell14.repaint();
        personCell15.repaint();

    }