function:RenderSidePart pageleftbodycaption pageleftbody sidenote Main.CaptureTheFlag-SideNote Main.SideNote Site.SideNote

# Overview

There are two Flags, one red one blue. Flag is a subclass of Actor, and overrides the act() method. It looks for all the occupied locations of the grid, and if there are less than 2 flags, it means it is the winner, and proceeds to remove all Actors that are not the same color as itself.

Each team will start with the same number of AttackCritters each starting with a strength of 5. When they are initialized, they store the Color of its target. They move randomly like a Critter, but if they have a neighbor of the same color, their strength goes up. If they have a neighbor of the other color, their strength does down. If a neighbor is a Flag of their enemy's color, they remove it from the grid. If their strength is less than 1, they remove themselves from the grid (or for a less violent game, you can have them switch teams!).

# CaptureTheFlag.java

import java.awt.Color;
import info.gridworld.actor.*;
import info.gridworld.grid.*;
public class CaptureTheFlag {

public static void main(String[] args) {

ActorWorld battleField = new ActorWorld();
battleField.setGrid(new BoundedGrid(10, 19));

for (int i=0;i<5;i++){

1. Make accessor methods (getter and setter methods) to strength so you can test and manipulate the AttackCritters
2. Be mindful of the post conditions for Critters! If you are changing the state of an Actor, it can only be in processActors or in makeMove.