
public  class LiveStrategy extends Strategy {
  Genome g;            // The genome that controls decisions

  public LiveStrategy (int strategyNumberIn, String nameIn, Genome gIn) {
    strategyNumber = strategyNumberIn;
    name = nameIn;
    pop = 0;
    g = gIn;
  }

  protected int firstMove () {
    return (Math.random() < g.firstMove) ? 0 : 1;
  }
  
  protected int secondMove (int myLastPlay, int otherLastPlay, int currentScore) {
    return (Math.random() < g.secondMove[myLastPlay][otherLastPlay]) ? 0 : 1;
  }
  
  protected int thirdMove  (int myLastPlay, int otherLastPlay,
                            int myPreviousPlay, int otherPreviousPlay, int currentScore)
  {
    return (Math.random() < 
      g.thirdMove[myLastPlay][otherLastPlay][myPreviousPlay][otherPreviousPlay]) ? 0 : 1;
  }
    
  protected boolean leave (int myLastPlay, int otherLastPlay, int currentScore) {
    return (Math.random() < g.leave[otherLastPlay]) ? false : true;
  }
  
    
  public String toString() {
    return "["+strategyNumber+",pop="+pop+",g="+g+"]";
  }
  
}

