/**
 * Frog is the transformation of tadpole.
 * 
 * @author Jeff Minucci
 * @version 5/09/05
 */

import java.awt.Color;
import java.util.Random;
public class Frog extends Minnow
{
    // instance variables - replace the example below with your own
    
    private int lifespan;
    private int acts;

    /**
     * Constructor for objects of class Frog
     */
    public Frog(Environment env, Location loc)
    {
        super(env,loc);
        super.setColor(Color.green);
        Random randNumGen = RandNumGenerator.getInstance();
        lifespan = randNumGen.nextInt(16)+35;
    }
    
    public void act()
    {
        // A simulation asks objects to "act" -- to do whatever that
        // object should do in a single simulation timestep.  A minnow's
        // action is simply to move.
        super.move();
        acts++;
        if (acts==lifespan)
        {
            theEnv.remove(this);
            Random randNumGen = RandNumGenerator.getInstance();
            if (randNumGen.nextInt(8) > 1)
            {
                Egg eggy = new Egg(theEnv, myLoc);
            }
        }
    }
    
    public String toString()
    {
        return "F" + myLoc.toString() + myDir.toString();
    }


}