Jive Bug

<< | APQuestionsTrailIndex | >>

import info.gridworld.grid.*; 
import info.gridworld.grid.Location; 
import info.gridworld.actor.*; 
import java.util.ArrayList;
public class JiveBug extends Bug
{
    private double probOfFlowerToss;
    private int[] myTurns = {-90,-90,90,180,-90};

    public JiveBug(double probToss)
    {
       probOfFlowerToss =  probToss;

    }


    public int getDanceTurn()
    {
       // part (a)
       return 0;
    }
    public void turn()
    {
        //part (b)
    }
    public void move()
    {
        Grid<Actor> gr = getGrid();
        if(gr == null) 
            return;
        Location loc = getLocation();
        Location next = loc.getAdjacentLocation(getDirection());
        if (gr.isValid(next))
           moveTo(next);
        else
            removeSelfFromGrid();
        tossFlower();
    }
    public void tossFlower()
    {
        //part c
    }
    public void act()
    {
        //part (d)
    }

}