|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.ou.pacman.board.GameBoard
public class GameBoard
Class used to perform all actions for the game. Holds the characters, locations, items, etc.
Field Summary | |
---|---|
static int |
GAME_OVER_REWARD
|
static int |
GHOST_WORTH
|
int |
m_maxSteps
|
boolean[] |
m_xThroughWayIndecies
|
boolean[] |
m_yThroughWayIndecies
|
static int |
PELLET_WORTH
|
Constructor Summary | |
---|---|
GameBoard(boolean hasView,
AI pacman_ai,
AI team_ai,
java.lang.String template)
|
Method Summary | |
---|---|
BoardLocation[][] |
board()
|
java.util.ArrayList<Location2D> |
bonusItemLocations()
Return a list of all available bonus items still on the board. |
int |
bonusItemsCollected()
|
static int |
bonusValue(BonusType bonus)
Return the value of the given bonus. |
boolean |
canMove(CharacterType character,
Direction direction)
Determine whether a player can move in a given direction. |
Location2D |
characterLocation(CharacterType character)
Returns the location of the given character. |
int[] |
charactersVisible(CharacterType character1,
CharacterType character2)
Checks whether 2 characters are in sight of each other in any direction. |
void |
cleanupGame()
|
boolean[] |
colorsEatenCurrently()
Blue, Orange, Pink, Red |
boolean[] |
directionsToCharacter(CharacterType char1,
CharacterType char2)
Gives the directions from char1 to char2. |
void |
endGame()
End the game. |
boolean |
gameOver()
|
PacmanCharacter[] |
getCharacters()
|
java.util.ArrayList<Location2D> |
ghostLocations()
Returns a list of all the locations a ghost currently occupies. |
Location2D |
goalState()
Returns the goal state of this game board. |
int |
height()
|
boolean |
isRunning()
|
CharacterType |
pacmanCapturer()
|
int[] |
pacmanVisible(CharacterType character)
Helper method to see which directions pacman is visible in for the given character. |
boolean |
paused()
|
void |
pauseGame()
|
java.util.ArrayList<Location2D> |
pelletLocations()
Return a list of all available pellets still on the board. |
int |
pelletsCollected()
|
java.util.ArrayList<Location2D> |
powerPelletLocations()
Return a list of all available power pellets still on the board. |
void |
restartGame()
Start the game back up from a paused state. |
void |
runGame()
Method used to control the game operations. |
void |
setupGame()
|
Location2D |
simulateMove(Location2D startingLocation,
Direction direction)
Simulate moving from one location to another (but don't actually update the game board) |
void |
step()
|
int |
stepsTaken()
|
int[] |
teammatesVisible(CharacterType character)
|
int |
totalEatenColors()
|
int |
totalPellets()
Return the total number of pellets that were originally on the board. |
boolean |
upgraded()
|
int |
upgradesCollected()
|
boolean[] |
viableDirections(CharacterType character)
Return a list of the viable directions for a given character. |
int |
width()
|
boolean |
xScrollBetweenIndex(int y)
Check if the given y index is a scroll between index. |
boolean |
yScrollBetweenIndex(int x)
Check if the given x index is a scroll between index. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int GAME_OVER_REWARD
public static final int GHOST_WORTH
public static final int PELLET_WORTH
public final boolean[] m_xThroughWayIndecies
public final boolean[] m_yThroughWayIndecies
public final int m_maxSteps
Constructor Detail |
---|
public GameBoard(boolean hasView, AI pacman_ai, AI team_ai, java.lang.String template)
Method Detail |
---|
public PacmanCharacter[] getCharacters()
public java.util.ArrayList<Location2D> bonusItemLocations()
public static int bonusValue(BonusType bonus)
bonus
- - The bonus to get the value for
public boolean canMove(CharacterType character, Direction direction)
character
- - The character to movedirection
- - The direction to move
public Location2D characterLocation(CharacterType character)
character
- - The character whose location we are to retrieve
public int[] charactersVisible(CharacterType character1, CharacterType character2)
character1
- - The first character to measure the location fromcharacter2
- - The second character to measure the location to
public boolean[] directionsToCharacter(CharacterType char1, CharacterType char2)
char1
- - The character to go fromchar2
- - The character to go to
public void endGame()
public java.util.ArrayList<Location2D> ghostLocations()
public Location2D goalState()
public Location2D simulateMove(Location2D startingLocation, Direction direction)
startingLocation
- - the location to move fromdirection
- - the direction to move
public int[] pacmanVisible(CharacterType character)
character
- - The character to try and find pacman with
public boolean paused()
public void pauseGame()
public java.util.ArrayList<Location2D> pelletLocations()
public java.util.ArrayList<Location2D> powerPelletLocations()
public void restartGame()
public void step()
public void setupGame()
public void cleanupGame()
public void runGame()
public int[] teammatesVisible(CharacterType character)
character
- - The character to find the teammates for
public int totalPellets()
public boolean[] viableDirections(CharacterType character)
character
- - The character to look at viable directions for
public boolean xScrollBetweenIndex(int y)
public boolean yScrollBetweenIndex(int x)
public BoardLocation[][] board()
public int bonusItemsCollected()
public boolean[] colorsEatenCurrently()
public boolean gameOver()
public int height()
public boolean isRunning()
public CharacterType pacmanCapturer()
public int pelletsCollected()
public int stepsTaken()
public int totalEatenColors()
public boolean upgraded()
public int upgradesCollected()
public int width()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |