Class Board


public class Board extends GameObject
Class to visualize enviroment in game.
  • Field Details

    • board

      public Cell[][] board
  • Constructor Details

    • Board

      public Board​(int obstaclesCount)
      Constructor set borders of scene, spawn obstacles and fill empty spaces with cells.
  • Method Details

    • GetCell

      public Cell GetCell​(int x, int y)
      Return cell in position.
    • GetCell

      public Cell GetCell​(Vector2D lastPosition)
      Return cell in position.
    • GetFirstEmptyCell

      public Cell GetFirstEmptyCell()
      Return first empty cell starting from (0,0) else return null.
    • GetRandomEmptyCell

      public Cell GetRandomEmptyCell()
      Return random empty cell on board. If there is non return null.
    • GetClosestEmptyCell

      public Cell GetClosestEmptyCell​(Cell cell)
      Return empty cell closest to cell.
    • GetClosestFruit

      public Cell GetClosestFruit​(Cell origin)
      Return fruit closest to origin else return null.