import rebelsky.fun.balloons.Balloon;
import rebelsky.fun.balloons.Strategist;
import rebelsky.fun.balloons.Wind;

/**
 * A simple strategy for winning balloon races.  If you're below
 * 1/4 of the maximum height, inflate the balloon with a 10%
 * probability.  If you're above 1/2 of the minimum height, deflate
 * the balloon.
 */
public class Inflater
  extends Strategist
{
  /**
   * Decide what to do based on knowledge of the balloon status.
   * Ignore the wind.
   */
  public void decide(Balloon b, int maxheight, Wind w) 
  {
    // If we're on the ground, inflate
    if (b.getHeight() == 0) { 
      b.inflate();
    }
    else if (b.getHeight() < (maxheight / 4)) {
      if (Math.random() < 0.10) {
        b.inflate();
      }
    }
    else if (b.getHeight() > (maxheight / 2)) {
      b.deflate();
    }
  } // decide()
} // Inflater

