/**
 *
 * @author Ryan J. Marcotte
 */

package game;

import java.util.ArrayList;

public abstract class ChessPiece
{
    private Square location;
    private ArrayList<Integer> possibleMoves;
    private Team team;

    protected Square getLocation()
    {
        return location;
    }

    protected Team getTeam()
    {
        return team;
    }
    
    protected void setLocation(Square location)
    {
        this.location = location;
        location.setOccupant(this);
    }

    protected void setPossibleMoves(ArrayList<Integer> possibleMoves)
    {
        this.possibleMoves = possibleMoves;
    }

    protected void setTeamFromInitialLocation(Square initialLocation)
    {
        final int NUM_SQUARES = 64;

        if (initialLocation.getIntLocation() < NUM_SQUARES / 2)
            team = Team.BLACK;
        else
            team = Team.WHITE;
    }
}

@@ -155,39 +155,38 @@
 ivate ArrayList%3C
-Integer
+Square
 %3E possibleMoves;
@@ -210,16 +210,689 @@
  team;%0A%0A
+    protected void addMovesInDirection(ArrayList%3CSquare%3E moveList, int direction, int limit)%0A    %7B%0A        Square neighbor = location.getNeighbor(direction);%0A        int squaresTraveled = 0;%0A%0A        while (neighbor != null && squaresTraveled %3C limit) %7B%0A            if (neighbor.isOccupied()) %7B%0A                ChessPiece occupant = neighbor.getOccupant();%0A                Team theirTeam = occupant.getTeam();%0A%0A                if (theirTeam != team)%0A                    moveList.add(neighbor);%0A%0A                break;%0A            %7D%0A%0A            moveList.add(neighbor);%0A            neighbor = neighbor.getNeighbor(direction);%0A            squaresTraveled++;%0A        %7D%0A    %7D%0A%0A
     prot
@@ -1204,15 +1204,14 @@
 ist%3C
-Integer
+Square
 %3E po

add function for adding moves in a particular direction