Class GomokuCell

java.lang.Object
GomokuCell

public class GomokuCell extends Object
This class is cell of the board of the Gomoku game.
  • Field Details

    • neighbour

      private EnumMap<Cardinal, GomokuCell> neighbour
      Enumerate neighbor with key in Cardinal direction and key representing the cell in that direction.
    • state

      private Color 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

      public GomokuCell(Color state)
      The constructor of the cell.
      Parameters:
      state - The state by default of the cell.
  • Method Details

    • getNeighbour

      public GomokuCell getNeighbour(Cardinal car)
      Return one neighbour.
      Parameters:
      car - The Cardinal direction.
      Returns:
      The GomokuCell at the direction.
    • getAllNeighbour

      public EnumMap<Cardinal, GomokuCell> getAllNeighbour()
      Return neighbour.
      Returns:
      The EnumMap of neighbour.
    • getSate

      public Color getSate()
      Return the state.
      Returns:
      The state of the current cell with one Color.
    • 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

      public void linkCell(Cardinal car, GomokuCell cell)
      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.