Package com.iwolverton.smartbeetle
Class GameState
- java.lang.Object
-
- com.iwolverton.smartbeetle.GameState
-
- Direct Known Subclasses:
GameStateBuilder
public class GameState extends Object
The current state of the game at a given point in time.
-
-
Constructor Summary
Constructors Constructor Description GameState(int turn, List<ChargingPad> chargingPads, AntHill antHill, List<Bead> beads, Beetle beetle, Spider spider, List<Ant> ants)GameState(GameState from)GameState(GameState from, Beetle beetle)GameState(GameState from, Beetle beetle, List<Ant> ants)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AntHillgetAntHill()The ant hill.List<Ant>getAnts()Ants always move toward the beetle.List<Bead>getBeads()The beetle can collect beads to be used as ammunition against ants.BeetlegetBeetle()Our protagonist, a robotic beetle that must keeps its battery charged while fighting off ants and avoiding the spider.List<ChargingPad>getChargingPads()A list of exactly 2 charging pads.ActingElementgetPlayerAt(int x, int y)Returns the beetle, spider, or ant at the given coordinate.ActingElementgetPlayerAt(Coord coordinate)Returns the beetle, spider, or ant at the given coordinate.SpidergetSpider()The spider is unstoppable, but slow.GameElementgetTerrainAt(int x, int y)Returns the charging pad, ant hill, or bead at the given coordinate.GameElementgetTerrainAt(Coord coordinate)Returns the charging pad, ant hill, or bead at the given coordinate.intgetTurn()Number of turns completed.
-
-
-
Field Detail
-
FIELD_DIMENSION
public static final int FIELD_DIMENSION
- See Also:
- Constant Field Values
-
turn
protected int turn
-
chargingPads
protected List<ChargingPad> chargingPads
-
antHill
protected AntHill antHill
-
beetle
protected Beetle beetle
-
spider
protected Spider spider
-
-
Method Detail
-
getTurn
public int getTurn()
Number of turns completed.
-
getChargingPads
public List<ChargingPad> getChargingPads()
A list of exactly 2 charging pads. The beetle receives charge when it ends its turn on one of these.
-
getAntHill
public AntHill getAntHill()
The ant hill. Ants periodically appear from this hill. The frequency increases as the game goes on. Check itsnextMoveproperty to see how many turns until the next ant--one means it will be this turn, immediately after the beetle's action.
-
getBeads
public List<Bead> getBeads()
The beetle can collect beads to be used as ammunition against ants.There is a constant total number of beads in the game. (the beetle's ammo + the beads on the field)
-
getBeetle
public Beetle getBeetle()
Our protagonist, a robotic beetle that must keeps its battery charged while fighting off ants and avoiding the spider.
-
getSpider
public Spider getSpider()
The spider is unstoppable, but slow. It doesn't move every turn. Check itsnextMoveproperty to see how many turns until it moves again--one means it will be this turn, immediately after the beetle's action.
-
getAnts
public List<Ant> getAnts()
Ants always move toward the beetle. They move one space per turn, just like the beetle. They can be stopped by shooting beads (ammo) at them, but only when they are directly adjacent to the beetle in one of the four cardinal directions.Ants spawn from the ant hill at intervals.
-
getPlayerAt
public ActingElement getPlayerAt(int x, int y)
Returns the beetle, spider, or ant at the given coordinate. No two of these are allowed to be in the same space at the same time.
-
getPlayerAt
public ActingElement getPlayerAt(Coord coordinate)
Returns the beetle, spider, or ant at the given coordinate. No two of these are allowed to be in the same space at the same time.
-
getTerrainAt
public GameElement getTerrainAt(int x, int y)
Returns the charging pad, ant hill, or bead at the given coordinate. No two of these are allowed to be in the same space at the same time.
-
getTerrainAt
public GameElement getTerrainAt(Coord coordinate)
Returns the charging pad, ant hill, or bead at the given coordinate. No two of these are allowed to be in the same space at the same time.
-
-