Posted by: sangfroid July 28, 2008
Java help
Login in to Rate this Post:     0       ?        
first the question is too elongated to read....i didn't read it infact....

anyway,
well just went briefly through your code.... and i am wondering what you are doing here..


public void shoot(boolean targetAlive, double accuracy, int number_alive)
{
//  whatever .......
  

     number_alive--;
     }
      
}
 public  String startDuel()
{
 
 int num_alive = 3;

 do
 {
  if (aaronAlive)
  {
   if (charlieAlive)
    shoot(charlieAlive, 1/3.0, num_alive);
   else if (bobAlive)
    shoot(bobAlive, 1/3.0, num_alive);
  
  }


The variable num_alive are local in both cases ...how do you expect the value of that variable to be changed ???








Read Full Discussion Thread for this article