Class CachedBoard


  • public class CachedBoard
    extends Board
    • Field Detail

      • emptyNeighborSquares

        public int[][] emptyNeighborSquares
    • Constructor Detail

      • CachedBoard

        public CachedBoard()
        creates a cached board with default values that match the default initial board of the game
    • Method Detail

      • updateCache

        public void updateCache​(Turn turn,
                                PlayerColor player)
        updates the cache with the information from the next turn. needs to be called before the squares of the board get changed.
        Parameters:
        turn - that will be executed on the board
        player - the player that will make the turn
      • updateCacheUndo

        public void updateCacheUndo​(Turn turn,
                                    PlayerColor player)
        updates the cache with the information from the previous turn. needs to be called before the squares of the board get changed.
        Parameters:
        turn - that will be undone on the board
        player - the player that made the turn
      • copy

        public CachedBoard copy()
        creates a deep copy of the cached board
        Overrides:
        copy in class Board
        Returns:
        new cached board