Class GomokuCell
java.lang.Object
GomokuCell
This class is cell of the board of the Gomoku game.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate EnumMap<Cardinal, GomokuCell> Enumerate neighbor with key in Cardinal direction and key representing the cell in that direction.private ColorThe state of the cell represented by the enumerate Color, Nil is empty, white and black for the color of a token -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn neighbour.getNeighbour(Cardinal car) Return one neighbour.getSate()Return the state.booleanisEmpty()This method returns if the current cell is emptybooleanReturn if the cell is playable.booleanisPlayed()This method returns if the cell has already played.voidlinkCell(Cardinal car, GomokuCell cell) This method link the cell at the Cardinal position on the current cell.voidtoString()
-
Field Details
-
neighbour
Enumerate neighbor with key in Cardinal direction and key representing the cell in that direction. -
state
The state of the cell represented by the enumerate Color, Nil is empty, white and black for the color of a token
-
-
Constructor Details
-
GomokuCell
The constructor of the cell.- Parameters:
state- The state by default of the cell.
-
-
Method Details
-
getNeighbour
Return one neighbour.- Parameters:
car- The Cardinal direction.- Returns:
- The GomokuCell at the direction.
-
getAllNeighbour
Return neighbour.- Returns:
- The EnumMap of neighbour.
-
getSate
-
setState
-
isEmpty
public boolean isEmpty()This method returns if the current cell is empty- Returns:
- True if is empty, False if is not.
-
isPlayed
public boolean isPlayed()This method returns if the cell has already played.- Returns:
- True if the cell is already played, False if is not.
-
isPlayable
public boolean isPlayable()Return if the cell is playable.- Returns:
- True if the current cell can be played with the condition of the gomoku.
-
linkCell
This method link the cell at the Cardinal position on the current cell.- Parameters:
car- The Cardinal direction of the cell to link.cell- The GomokuCell to link.
-
toString
-