I am doing the map program use stack. I set the color in the working stack as white(0), and other four colors in valid(1-4). However, when I run the program, it doesn't actually color the map. Could someone help to find my mistake?
public void go(){
Integer counter = 0;
Integer backup = 0;
while(!Working.empty()){
// work on the item at the top of the working stack
NodeInfo Current = Working.peek();
// Insert this statement every time you change the color of a map node
M.displayElement(Current.getName(), C[Current.getColor()], frame);
if(Current.getColor()>4){ // out from rank, use color other than white, red, yellow, green and blue
Current.setColor(0); // set color back to white
Working.push(Valid.pop()); //push back from Valid to Working
}
else{
Current.setColor(Current.getColor()+1); // set a new color if it doesn't run out rank 1-4
Valid.push(Working.pop()); //push from Working to Valid
}
}
/*Move items from one stack to the other with statements like
*
* Working.push(Valid.pop());
* and
* Valid.push(Working.pop());
*
*/
}