SnakeGame  1
Implementing a game of Snake
 All Classes Functions Variables Pages
Public Member Functions | Private Attributes | List of all members
com.gradescope.spampede.BoardCell Class Reference

BoardCell - Represents a single cell within a Board. More...

Public Member Functions

 BoardCell (int inputRow, int inputColumn, CellType type)
 Constructor. More...
 
int getRow ()
 
int getColumn ()
 
boolean isWall ()
 
boolean isOpen ()
 
boolean isSpam ()
 
boolean isBody ()
 
boolean isHead ()
 
Color getCellColor ()
 
void becomeSpam ()
 Marks this BoardCell as spam. More...
 
void becomeOpen ()
 Marks this BoardCell as open.
 
void becomeHead ()
 Marks this BoardCell as the snake's head.
 
void becomeBody ()
 Marks this BoardCell as part of the snake's body.
 
void setAddedToSearchList ()
 Marks this cell as having been added to our BFS search queue.
 
boolean inSearchListAlready ()
 
void clear_RestartSearch ()
 Clear the search-related info for this cell (to allow a new search)
 
void setParent (BoardCell p)
 Set the parent of this cell.
 
BoardCell getParent ()
 
String toString ()
 
String toStringType ()
 
String toStringParent ()
 
 BoardCell (int inputRow, int inputColumn, CellType type)
 Constructor. More...
 
int getRow ()
 
int getColumn ()
 
boolean isWall ()
 
boolean isOpen ()
 
boolean isSpam ()
 
boolean isBody ()
 
boolean isHead ()
 
Color getCellColor ()
 
void becomeSpam ()
 Marks this BoardCell as spam. More...
 
void becomeOpen ()
 Marks this BoardCell as open.
 
void becomeHead ()
 Marks this BoardCell as the snake's head.
 
void becomeBody ()
 Marks this BoardCell as part of the snake's body.
 
void setAddedToSearchList ()
 Marks this cell as having been added to our BFS search queue.
 
boolean inSearchListAlready ()
 
void clear_RestartSearch ()
 Clear the search-related info for this cell (to allow a new search)
 
void setParent (BoardCell p)
 Set the parent of this cell.
 
BoardCell getParent ()
 
String toString ()
 
String toStringType ()
 
String toStringParent ()
 

Private Attributes

int row
 the row of this cell within the Board ( >= 0 )
 
int column
 the column of this cell within the Board ( >= 0 )
 
CellType myCellType
 the current contents of this cell
 
boolean addedToSearchList = false
 Has this cell been added to the search queue yet?
 
BoardCell parent = null
 Where did we came from, when search first reached this BoardCell?
 

Detailed Description

BoardCell - Represents a single cell within a Board.

Author
CS60 instructors

Constructor & Destructor Documentation

com.gradescope.spampede.BoardCell.BoardCell ( int  inputRow,
int  inputColumn,
CellType  type 
)

Constructor.

Parameters
inputRowthe row of this cell
inputColumnthe column of this cell
typethe initial contents of this cell
com.gradescope.spampede.BoardCell.BoardCell ( int  inputRow,
int  inputColumn,
CellType  type 
)

Constructor.

Parameters
inputRowthe row of this cell
inputColumnthe column of this cell
typethe initial contents of this cell

Member Function Documentation

void com.gradescope.spampede.BoardCell.becomeSpam ( )

Marks this BoardCell as spam.

void com.gradescope.spampede.BoardCell.becomeSpam ( )

Marks this BoardCell as spam.

Color com.gradescope.spampede.BoardCell.getCellColor ( )
Returns
The color for drawing this cell
Color com.gradescope.spampede.BoardCell.getCellColor ( )
Returns
The color for drawing this cell
int com.gradescope.spampede.BoardCell.getColumn ( )
Returns
the column of this BoardCell
int com.gradescope.spampede.BoardCell.getColumn ( )
Returns
the column of this BoardCell
BoardCell com.gradescope.spampede.BoardCell.getParent ( )
Returns
the parent of this cell
BoardCell com.gradescope.spampede.BoardCell.getParent ( )
Returns
the parent of this cell
int com.gradescope.spampede.BoardCell.getRow ( )
Returns
the row of this BoardCell
int com.gradescope.spampede.BoardCell.getRow ( )
Returns
the row of this BoardCell
boolean com.gradescope.spampede.BoardCell.inSearchListAlready ( )
Returns
Has this cell been added to our BFS search queue yet?
boolean com.gradescope.spampede.BoardCell.inSearchListAlready ( )
Returns
Has this cell been added to our BFS search queue yet?
boolean com.gradescope.spampede.BoardCell.isBody ( )
Returns
Does this cell contain part of the snake (not the head)?
boolean com.gradescope.spampede.BoardCell.isBody ( )
Returns
Does this cell contain part of the snake (not the head)?
boolean com.gradescope.spampede.BoardCell.isHead ( )
Returns
Does this cell contain the head of the snake?
boolean com.gradescope.spampede.BoardCell.isHead ( )
Returns
Does this cell contain the head of the snake?
boolean com.gradescope.spampede.BoardCell.isOpen ( )
Returns
Is this cell open (not a wall or a snake body part)?
boolean com.gradescope.spampede.BoardCell.isOpen ( )
Returns
Is this cell open (not a wall or a snake body part)?
boolean com.gradescope.spampede.BoardCell.isSpam ( )
Returns
Does this cell contain spam?
boolean com.gradescope.spampede.BoardCell.isSpam ( )
Returns
Does this cell contain spam?
boolean com.gradescope.spampede.BoardCell.isWall ( )
Returns
Is this cell a wall?
boolean com.gradescope.spampede.BoardCell.isWall ( )
Returns
Is this cell a wall?
String com.gradescope.spampede.BoardCell.toString ( )
Returns
the cell as a string.
String com.gradescope.spampede.BoardCell.toString ( )
Returns
the cell as a string.
String com.gradescope.spampede.BoardCell.toStringParent ( )
Returns
the parent of a cell, as a string
String com.gradescope.spampede.BoardCell.toStringParent ( )
Returns
the parent of a cell, as a string
String com.gradescope.spampede.BoardCell.toStringType ( )
Returns
the contents of the cell, as a single character.
String com.gradescope.spampede.BoardCell.toStringType ( )
Returns
the contents of the cell, as a single character.

The documentation for this class was generated from the following file: