Class Board

java.lang.Object
com.takenoko.engine.Board

public class Board extends Object
Board class. The board contains the tiles.
  • Field Details

    • tileLayer

      private final TileLayer tileLayer
    • bambooLayer

      private final BambooLayer bambooLayer
    • irrigationLayer

      private final IrrigationLayer irrigationLayer
    • panda

      private final Panda panda
    • gardener

      private final Gardener gardener
    • gameAssets

      private final GameAssets gameAssets
    • weather

      private Weather weather
    • roundNumber

      int roundNumber
    • boardStatistics

      private final BoardStatistics boardStatistics
  • Constructor Details

    • Board

      public Board(TileLayer tileLayer, BambooLayer bambooLayer, Panda panda, Gardener gardener, GameAssets gameAssets, IrrigationLayer irrigationLayer, BoardStatistics boardStatistics)
      Constructor for the Board class.
      Parameters:
      tileLayer - the tile layer
      bambooLayer - the bamboo layer
      panda - the panda
      gardener - the gardener
      gameAssets - the game assets : dice
      irrigationLayer - the irrigation layer
    • Board

      public Board()
      Constructor for the Board class.
    • Board

      public Board(Board board)
  • Method Details

    • rollWeather

      public void rollWeather()
    • peekWeather

      public Weather peekWeather()
    • getAvailableTiles

      public List<Tile> getAvailableTiles()
      Return the list of available tiles.
      Returns:
      the list of available tiles
    • getTiles

      public Map<PositionVector,Tile> getTiles()
      Returns a copy of the hashmap of tiles.
      Returns:
      the map of tiles
    • getAvailableTilePositions

      public List<PositionVector> getAvailableTilePositions()
      Returns the available tile positions.
      Returns:
      the available tile positions
    • getTilesWithoutPond

      public Map<PositionVector,Tile> getTilesWithoutPond()
      Returns a copy of the hashmap of tiles without the pond.
      Returns:
      the map of tiles without the pond
    • isTile

      public boolean isTile(PositionVector positionVector)
      Returns if the position is a tile.
      Parameters:
      positionVector - the position of the tile
      Returns:
      if there is a tile at the position
    • getTileAt

      public Tile getTileAt(PositionVector positionVector)
      Returns the tile at the position.
      Parameters:
      positionVector - the position of the tile
      Returns:
      the tile at the position
    • placeTile

      public LayerBambooStack placeTile(Tile tile, PositionVector position)
      Place a tile on the board. and update the available tiles and the available tile positions.
      Parameters:
      tile - the tile to add to the board
      position - the position of the tile
      Returns:
      the LayerBambooStack at the position of the tile
    • getBambooAt

      public LayerBambooStack getBambooAt(PositionVector positionVector)
      Get the bamboo stack at the position.
      Parameters:
      positionVector - the position of the tile
    • growBamboo

      public LayerBambooStack growBamboo(PositionVector positionVector)
      Grow bamboo on a tile. By default, the number of bamboo is 1 if the tile is irrigated.
      Parameters:
      positionVector - the position of the tile
      Returns:
      the bamboo stack at the position
    • eatBamboo

      public void eatBamboo(PositionVector positionVector)
      Eat a bamboo from a tile.
      Parameters:
      positionVector - the position of the tile
    • isBambooEatableAt

      public boolean isBambooEatableAt(PositionVector positionVector)
      Check if the bamboo at the position is eatable.
      Parameters:
      positionVector - the position of the tile
      Returns:
      if the bamboo at the position is eatable
    • getPandaPosition

      public PositionVector getPandaPosition()
      Get the Position of the Panda
    • getGardenerPosition

      public PositionVector getGardenerPosition()
      Get the Position of the Gardener
    • getPandaPossibleMoves

      public List<PositionVector> getPandaPossibleMoves()
      Returns possible moves for the panda.
      Returns:
      the possible moves
    • getGardenerPossibleMoves

      public List<PositionVector> getGardenerPossibleMoves()
      Returns possible moves for the gardener.
      Returns:
      the possible moves
    • movePanda

      public Map<PositionVector,LayerBambooStack> movePanda(PositionVector vector)
      Move the panda with a vector.
      Parameters:
      vector - the vector to move the panda
      Returns:
      bamboo stack of one if the panda ate bamboo
    • moveGardener

      public Map<PositionVector,LayerBambooStack> moveGardener(PositionVector vector)
      Move the gardener with a vector.
      Parameters:
      vector - the vector to move the gardener
      Returns:
      bamboo stack of one if the gardener planted bamboo
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • copy

      public Board copy()
    • getWeather

      public Optional<Weather> getWeather()
    • setWeather

      public void setWeather(Weather weather)
    • resetWeather

      public void resetWeather()
      Changes the weather to null. This is used when the weather is over.
    • isBambooGrowableAt

      public boolean isBambooGrowableAt(PositionVector positionVector)
    • drawImprovement

      public ImprovementType drawImprovement(ImprovementType improvementType)
      Parameters:
      improvementType - the type of improvement
      Returns:
      the improvement of the type
    • peekImprovement

      public ImprovementType peekImprovement()
      Returns last improvement drawn.
      Returns:
      the last improvement drawn
    • hasImprovementInDeck

      public boolean hasImprovementInDeck(ImprovementType improvementType)
      Parameters:
      improvementType - the type of improvement
      Returns:
      if the improvement is available
    • getAvailableImprovementPositions

      public List<PositionVector> getAvailableImprovementPositions()
    • drawTiles

      public void drawTiles()
    • peekTileDeck

      public List<Tile> peekTileDeck()
    • chooseTileInTileDeck

      public void chooseTileInTileDeck(Tile tile)
    • isTileDeckEmpty

      public boolean isTileDeckEmpty()
    • applyImprovement

      public void applyImprovement(ImprovementType improvementType, PositionVector positionVector)
    • drawObjective

      public void drawObjective(ObjectiveType objectiveType)
    • peekObjectiveDeck

      public Objective peekObjectiveDeck()
    • isObjectiveDeckEmpty

      public boolean isObjectiveDeckEmpty()
    • drawIrrigation

      public void drawIrrigation()
    • hasIrrigation

      public boolean hasIrrigation()
    • updateAvailableIrrigationChannelPositions

      public void updateAvailableIrrigationChannelPositions(PositionVector position)
    • placeIrrigation

      public void placeIrrigation(EdgePosition edgePosition)
    • getAvailableIrrigationPositions

      public List<EdgePosition> getAvailableIrrigationPositions()
    • isIrrigatedAt

      public boolean isIrrigatedAt(PositionVector position)
    • getRoundNumber

      public int getRoundNumber()
    • nextRound

      public void nextRound()
    • getGrowablePositions

      public List<PositionVector> getGrowablePositions()
    • getStarterDeck

      public List<Objective> getStarterDeck()
      Return the list of objectives for the starting deck
      Returns:
      list of objectives
    • getBoardStatistics

      public BoardStatistics getBoardStatistics()
    • analyze

      public void analyze()
    • getPlacedIrrigations

      public List<EdgePosition> getPlacedIrrigations()
    • hasImprovementInDeck

      public boolean hasImprovementInDeck()
    • hasObjectiveTypeInDeck

      public boolean hasObjectiveTypeInDeck(ObjectiveType objectiveType)