|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectframework.BattleField
public class BattleField
A rectangular grid in which battles take place. Each location in the grid may be empty, or may contain one of the following: A red soldier, a blue soldier, or an obstacle.
Field Summary | |
---|---|
static int |
BLUE_TEAM
Blue Team Member is in the location queried |
static int |
EMPTY
The location queried is empty |
static int |
OBSTACLE
An obstacle is in the location queried |
static int |
OUT_OF_BOUNDS
The location queried is outside of the battle field |
static int |
RED_TEAM
Red Team Member is in the location queried |
Method Summary | |
---|---|
void |
attack(int row,
int col)
A soldier calls this method to attack another soldier on the enemy team. |
int |
get(int row,
int col)
Returns the contents of a particular location on the battlefield |
int |
getCols()
Returns the width of the battle field. |
int |
getRows()
Returns the height of the battle field. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int RED_TEAM
public static final int BLUE_TEAM
public static final int EMPTY
public static final int OUT_OF_BOUNDS
public static final int OBSTACLE
Method Detail |
---|
public void attack(int row, int col)
row
- row of grid coordinate under attackcol
- column of grid coordinate under attackpublic int get(int row, int col)
row
- row of location being queriedcol
- column of location being queried
public int getRows()
public int getCols()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |