Example #1
0
  /**
   * Checks whether the position is located on the playing area or the outer dots.
   *
   * @param p the position of which should be determined whether it is on the board
   */
  public boolean isPositionOnPlayAreaOrOuterDots(Position p) {
    int col = p.getColName() - 'a' + 1;
    int row = p.getRowNumber();

    // See google doc for explanation of the formula
    return !(row <= 0 || col >= 10 || row + col >= 15 || col - row <= -5 || col <= 0);
  }
Example #2
0
  /**
   * Checks whether the position is located on the inner board (the playing area). Returns false for
   * positions on the outer positions, as well as positions that are not on the board.
   *
   * <p>By Leroy
   *
   * @param p position of which is to be determined whether the position is located on the inner
   *     board
   */
  private boolean isOnInnerBoard(Position p) {
    int col = p.getColName() - 'a' + 1;
    int row = p.getRowNumber();

    // See google doc for explanation of the formula
    return !(row <= 1 || col >= 9 || row + col >= 14 || col - row <= -4 || col <= 1);
  }