@Override
 public void findControlledStacks(String boardSpace) {
   Tile boardTile = new Tile();
   boardTile = boardTile.stringToTile(boardSpace);
   if (boardTile.getColor() == 'W') {
     int newScore = getScore() + boardTile.getPipsLeftEnd() + boardTile.getPipsRightEnd();
     setScore(newScore);
   }
 }
 /**
  * Puts the logic behind the computer's move into a string based on the move it made, wording
  * slightly changed to accommodate for help mode.
  *
  * @return String value cpuMove, cpuMoveDouble, or cpuMoveOwn. Depending on the move made a
  *     different message will be returned.
  */
 public String displayHelpMove() {
   int cpuTilePipTotal = tilePlayed.getTotalTilePipScore();
   int prevTilePipTotal = tileReplaced.getTotalTilePipScore();
   // Previous tile was human owned.
   if (tileReplaced.getColor() == 'W') {
     // A non-double, 5-5, or 6-6 double was played.
     if ((cpuTilePipTotal >= prevTilePipTotal) || cpuTilePipTotal == 10 || cpuTilePipTotal == 12) {
       StringBuffer cpuMove = new StringBuffer();
       cpuMove.append("CPU recommends moving domino ");
       cpuMove.append(tilePlayed.tileToString());
       cpuMove.append(" to location ");
       cpuMove.append(location);
       cpuMove.append(" because tile ");
       cpuMove.append(tileReplaced.tileToString());
       cpuMove.append(" presents the\n");
       cpuMove.append("highest available net score increase for that tile.");
       return cpuMove.toString();
     }
     // Any other double was played.
     else {
       StringBuffer cpuMoveDouble = new StringBuffer();
       cpuMoveDouble.append("CPU recommends moving domino ");
       cpuMoveDouble.append(tilePlayed.tileToString());
       cpuMoveDouble.append(" to location ");
       cpuMoveDouble.append(location);
       cpuMoveDouble.append(" to reset a stack since location\n");
       cpuMoveDouble.append(location);
       cpuMoveDouble.append(" had a higher value tile ");
       cpuMoveDouble.append(tileReplaced.tileToString());
       return cpuMoveDouble.toString();
     }
   }
   // Previous tile was cpu owned.
   else {
     StringBuffer cpuMoveOwn = new StringBuffer();
     cpuMoveOwn.append("CPU recommends moving domino ");
     cpuMoveOwn.append(tilePlayed.tileToString());
     cpuMoveOwn.append(" to location ");
     cpuMoveOwn.append(location);
     cpuMoveOwn.append(" because tile ");
     cpuMoveOwn.append(tileReplaced.tileToString());
     cpuMoveOwn.append(" was a low valued tile\n");
     cpuMoveOwn.append("of its own color.");
     return cpuMoveOwn.toString();
   }
 }
 /**
  * Creates an ArrayList of integers that represent the best possible moves on the board for a
  * given tile.
  *
  * @param cpuSelectedTile A Tile object that the computer player chose from its hand.
  * @param gameBoard A Board object that holds all the tiles currently on the board.
  * @return bestMove An ArrayList of integers whose values represent the desirability of a move at
  *     each location on the board. The higher the number the more desirable the move.
  */
 public ArrayList<Integer> calculateBestMoveVector(Tile cpuSelectedTile, Board gameBoard) {
   ArrayList<Integer> bestMove = new ArrayList<Integer>();
   for (int space = 0; space < gameBoard.getBoardStacks().size(); space++) {
     Tile boardTile = new Tile();
     // Get boardTile from the game board.
     String boardTileString = gameBoard.getBoardStacks().get(space);
     // Convert the tile from string to Tile.
     boardTile = boardTile.stringToTile(boardTileString);
     int moveScore = 0;
     // Positive score computer tile on human tile.
     if (cpuSelectedTile.getColor() == 'W' && boardTile.getColor() == 'B') {
       moveScore =
           (cpuSelectedTile.getPipsLeftEnd() + cpuSelectedTile.getPipsRightEnd())
               + (boardTile.getPipsLeftEnd() + boardTile.getPipsRightEnd());
     }
     // Negative score computer tile on own computer tile.
     else if (cpuSelectedTile.getColor() == 'W' && boardTile.getColor() == 'W') {
       moveScore =
           (cpuSelectedTile.getPipsLeftEnd() + cpuSelectedTile.getPipsRightEnd())
               - (boardTile.getPipsLeftEnd() + boardTile.getPipsRightEnd())
               - 10;
     }
     // This is for help function, positive score human tile on computer tile.
     else if (cpuSelectedTile.getColor() == 'B' && boardTile.getColor() == 'W') {
       moveScore =
           (cpuSelectedTile.getPipsLeftEnd() + cpuSelectedTile.getPipsRightEnd())
               + (boardTile.getPipsLeftEnd() + boardTile.getPipsRightEnd());
     }
     // Also for help function, negative score human tile on own human tile.
     else if (cpuSelectedTile.getColor() == 'B' && boardTile.getColor() == 'B') {
       moveScore =
           (cpuSelectedTile.getPipsLeftEnd() + cpuSelectedTile.getPipsRightEnd())
               - (boardTile.getPipsLeftEnd() + boardTile.getPipsRightEnd())
               - 10;
     }
     bestMove.add(moveScore);
   }
   return bestMove;
 }