import java.awt.*;

/**
 * Created by zulupero on 20/06/16.
 */
public class Bug extends Buggle {
    public Bug(int posx, int posy, int dir) {
        super(posx, posy, dir);
    }

    public void enRoute() throws InterruptedException {
        //final int NB_BISCUITS_A_PRENDRE = 4;
        final int TOURS_A_FAIRE = 10;
        final int PAS_PAR_COTE = 8;
				final int GL_START = 255;
				final int GL_END   = 128;
        setVitesse(100);
        Color couleurPiste ;
        int coefCouleur ;
        setX(9);
        setY(1);

        baisseBrosse();
        for (int tour=0; tour < TOURS_A_FAIRE; tour++){
            coefCouleur = (int)(GL_START-(1.0*GL_END/GL_START)*tour);   // s'assombrit à chaque tour
            couleurPiste = new Color(coefCouleur,coefCouleur,coefCouleur) ;
            setCouleur(couleurPiste);
            for (int cote=0; cote<4; cote++) {
                for (int pas = 0; pas < PAS_PAR_COTE; pas++)
                    avance();
                gauche();
            }
            message("top "+(tour+1));
        }

    }
}
