title: randomly generated numbers game with probability and loops
body: <p>In the land of Puzzlevania, Aaron, Bob, and Charlie had an argument over which
  one of them was the greatest puzzler of all time.
  To end the argument once and
  for all, they agreed on a duel to the death.</p>
  
  <p>Aaron was a poor shooter and only hit
  his target with a probability of 1>3.</p>
  
  <p>Bob was a bit better and hit his target with a
  probability of 1>2.</p>
  
  <p>Charlie was an expert marksman and never missed. A hit means
  a kill and the person hit drops out of the duel.</p>
  
  <p>To compensate for the inequities in their marksmanship skills, the three decided
  that they would fire in turns, starting with Aaron, followed by Bob, and then by
  Charlie. The cycle would repeat until there was one man standing, and that man
  would be the Greatest Puzzler of All Time.</p>
  
  <p>An obvious and reasonable strategy is for each man to shoot at the most accurate
  shooter still alive, on the grounds that this shooter is the deadliest and has the best
  chance of hitting back.Write a program to simulate the duel using this strategy.</p>
  
  <p>Your program should use
  random numbers and the probabilities given in the problem to determine whether
  a shooter hits the target.</p>
  
  <p>Create a class named Duelist that contains the dueler’s
  name and shooting accuracy, a Boolean indicating whether the dueler is still alive,
  and a method ShootAtTarget ( Duelist target ) that sets the target to dead if
  the dueler hits his target (using a random number and the shooting accuracy) and
  does nothing otherwise.</p>
  
  <p>Once you can simulate a single duel, add a loop to your program that simulates
  10,000 duels. Count the number of times that each contestant wins and print the
  probability of winning for each contestant (e.g., for Aaron your program might
  output “Aaron won 3,595>10,000 duels or 35.95%”).</p>
  
  <p>An alternate strategy is for Aaron to intentionally miss on his first shot. Modify the
  program to accommodate this new strategy and output the probability of winning
  for each contestant.</p>
  
  <p>Which strategy is better for Aaron: to intentionally miss on the
  first shot or to try and hit the best shooter? Who has the best chance of winning,
  the best shooter or the worst shooter?</p>
  
  <p>Ok so that the problem. Here is my code so far:</p>
  
  <pre><code>public class Duelist {
  
  private String name;
  private double probabilityOfHitting;
  private boolean alive = true;
  
  
  //Only declared instance variables. Must created setters and getters
  public void setName(String newName){
      name = newName;
  }
  //name setter created
  
  public void setProbabilityOfHitting( double newProbabilityOfHitting){
      probabilityOfHitting = newProbabilityOfHitting;
  }
  //probability of hitting setter created
  public void setAlive(boolean newAlive){
      alive = newAlive;
  }
  //name setter created
  //now must create getters
  public String getName(){
      return name;
  }
  //created the name getter
  public double getProbabilityOfHitting(){
      return probabilityOfHitting;
  }
  //created the probability of hitting getter
  public boolean getAlive(){
  
  return alive;
  }
  //created the alive getter
  //no constructors created before
  public Duelist(String tempName, double tempProbability){
      name = tempName;
      probabilityOfHitting = tempProbability;
  }
  //constructor is now created
  //need to create a method for the duelists to shoot at each other
  public void shootAtTarget(Duelist target){
      double randomNum = Math.random();
      if (this.probabilityOfHitting ==1){
          target.setAlive(false);
          target.getAlive();
      }
  
          else if (randomNum &lt;= this.probabilityOfHitting){
          target.setAlive(false);
          target.getAlive();
          }
          else {
              target.getAlive();
          }
      }           
  }
  
  
  public class Tester {
  public static void main(String[] args) {
  
      int winsA = 0;
      int winsB = 0;
      int winsC = 0;
  
  Duelist aaron = new Duelist("Aaron",(1/3));
  Duelist bob = new Duelist("Bob", (1/2));
  Duelist charlie = new Duelist("Charlie", 1);
  
  if(aaron.getAlive() == true){
  
      if(charlie.getAlive()== true){
          aaron.shootAtTarget(charlie);
          }
          else if(bob.getAlive() == true){
              aaron.shootAtTarget(bob);
          }
          else{
              winsA++;
          }
  
  }
      else if(bob.getAlive() == true){
          if(charlie.getAlive() == true){
              bob.shootAtTarget(charlie);
          }
              else if(aaron.getAlive() == true){
                  bob.shootAtTarget(aaron);
              }
              else{
                  winsB++;
              }
      }
      else{
          if (bob.getAlive() == true){
              charlie.shootAtTarget(bob);
          }
              else if(aaron.getAlive() == true){
                  charlie.shootAtTarget(aaron);
              }
              else{
                  winsC++;
              }
      }
      System.out.println(winsA);
      System.out.println(winsB);
      System.out.println(winsC);
  
  
   }
  
  }
  </code></pre>
  
  <p>I know I haven't gotten close to finishing the problem yet. What I did in my tester class was to try and simulate one duel and once when I simulated one duel, I would be able to loop  it so I can simulate more. The problem I'm having is that the when I run the code, the wins for Aaron, Bob, and Charlie all come up to 0 and I don't know why. </p>