lab/lab15/creatures/Clorus.java
public Action chooseAction(Map<Direction, Occupant> neighbors) {
        List<Direction> empties = getNeighborsOfType(neighbors, "empty");

        // If no empty adjacent spaces, STAY.
        if (empties.size() == 0) {
            return new Action(Action.ActionType.STAY);
        } else {
            List<Direction> food = getNeighborsOfType(neighbors, "plip");
            if (food.size() > 0) {
                // Otherwise, if any Plips are seen, the Clorus will ATTACK one of them randomly.
                Direction foodDir = HugLifeUtils.randomEntry(food);
                return new Action(Action.ActionType.ATTACK, foodDir);
            } else if (energy >= 1) {
                // Otherwise, if the Clorus has energy greater than or equal to one, it will REPLICATE to a random empty square.
                Direction moveDir = HugLifeUtils.randomEntry(empties);
                return new Action(Action.ActionType.REPLICATE, moveDir);
            } else {
                Direction moveDir = HugLifeUtils.randomEntry(empties);
                return new Action(Action.ActionType.MOVE, moveDir);
            }

        }

    }
/**
     *  Cloruses should obey exactly the following behavioral rules:
     *
     *  1. If there are no empty squares, the Clorus will STAY (even if there are Plips nearby they could attack).
     *  2. Otherwise, if any Plips are seen, the Clorus will ATTACK one of them randomly.
     *  3. Otherwise, if the Clorus has energy greater than or equal to one, it will REPLICATE to a random empty square.
     *  4. Otherwise, the Clorus will MOVE to a random empty square.
     *
     * */
Cloruses should obey exactly the following behavioral rules:
1. If there are no empty squares, the Clorus will STAY (even if there are Plips nearby they could attack).
2. Otherwise, if any Plips are seen, the Clorus will ATTACK one of them randomly.
3. Otherwise, if the Clorus has energy greater than or equal to one, it will REPLICATE to a random empty square.
4. Otherwise, the Clorus will MOVE to a random empty square.
Cloruses should obey exactly the following behavioral rules : 1 . If there are no empty squares the Clorus will STAY ( even if there are Plips nearby they could attack ) . 2 . Otherwise if any Plips are seen the Clorus will ATTACK one of them randomly . 3 . Otherwise if the Clorus has energy greater than or equal to one it will REPLICATE to a random empty square . 4 . Otherwise the Clorus will MOVE to a random empty square .
public Action chooseAction(Map<Direction, Occupant> neighbors) {
        List<Direction> empties = getNeighborsOfType(neighbors, "empty");
        if (empties.size() == 0) {
            return new Action(Action.ActionType.STAY);
        } else {
            List<Direction> food = getNeighborsOfType(neighbors, "plip");
            if (food.size() > 0) {
                Direction foodDir = HugLifeUtils.randomEntry(food);
                return new Action(Action.ActionType.ATTACK, foodDir);
            } else if (energy >= 1) {
                Direction moveDir = HugLifeUtils.randomEntry(empties);
                return new Action(Action.ActionType.REPLICATE, moveDir);
            } else {
                Direction moveDir = HugLifeUtils.randomEntry(empties);
                return new Action(Action.ActionType.MOVE, moveDir);
            }
        }
    }
public Action chooseAction ( Map < Direction , Occupant > neighbors ) { List < Direction > empties = getNeighborsOfType ( neighbors , "empty" ) ; if ( empties . size ( ) == 0 ) { return new Action ( Action . ActionType . STAY ) ; } else { List < Direction > food = getNeighborsOfType ( neighbors , "plip" ) ; if ( food . size ( ) > 0 ) { Direction foodDir = HugLifeUtils . randomEntry ( food ) ; return new Action ( Action . ActionType . ATTACK , foodDir ) ; } else if ( energy >= 1 ) { Direction moveDir = HugLifeUtils . randomEntry ( empties ) ; return new Action ( Action . ActionType . REPLICATE , moveDir ) ; } else { Direction moveDir = HugLifeUtils . randomEntry ( empties ) ; return new Action ( Action . ActionType . MOVE , moveDir ) ; } } }
Cloruses should obey exactly the following behavioral rules:
  1.
Cloruses should obey exactly the following behavioral rules : 1 .
// If no empty adjacent spaces, STAY. // Otherwise, if any Plips are seen, the Clorus will ATTACK one of them randomly. // Otherwise, if the Clorus has energy greater than or equal to one, it will REPLICATE to a random empty square.