// TicTacToeBoard.java

/**
 * A TicTacToe Board.  This class accepts and records moves (or marks)
 * on a 3 x 3 grid.
 * Squares are numbered 1 through 9, ordered from left to right, starting on 
 * the top row and moving down.
 * An example layout is as follows:
 * <pre>
 *      |     |     
 *   X  |     |     
 *     1|  2  |3    
 * -----+-----+-----
 *      |     |     
 *   X  |  O  |     
 *     4|  5  |6    
 * -----+-----+-----
 *      |     |     
 *      |     |     
 *     7|  8  |9    
 * </pre
 *
 * @author  Zach Tomaszewski
 * @version    31 Aug 2003
 */
 
public class TicTacToeBoard {

  /** Player 1's mark. */
  public static final int X = 1;

  /** Player 2's mark */
  public static final int O = 2;

  /** Mark of an empty square */
  public static final int BLANK = 0;
  
  /* the number of squares on the board */
  private static final int SIZE = 9;
  
  /* The [SIZE]-square board.  
     Note that, due to the array indexing, square indexes
     are [square number - 1]. */
  private int[] squares;
  

  /**
   * Default constructor.  Creates a new board of all BLANK squares.
   */
  public TicTacToeBoard () {
  }


  /**
   * Sets all squares on this board to BLANK.
   */
  public void clearBoard () {
  }

  
  /**
   * Sets a player's mark on a square of the board.  See class description
   * for a diagram of how squares are numbered.  If this play results
   * in a win (presumably for the currently player; 
   * a win here means that checkEndGame returns > 0), returns true.  
   * Otherwise, returns false.
   *
   * @param  square  the number of the square to place the player's mark
   * @param  player  the mark of the current player (such as X or O)
   * @return  true if this move results in a win; false otherwise.
   *
   * @throws  SquareFullException  when a mark already exists in the given square
   * @throws  InputOutOfBoundsException  when there is no such square on the 
   *              board (NoSuchSquareException) or no such player's mark
   *              (NoSuchPlayerException)
   */
  public boolean setMark (int square, int player) throws 
                            SquareFullException, 
                            NoSuchSquareException, 
                            NoSuchPlayerException {
  }

  
  /**
   * Checks to see if the game has ended.
   * A player has won if there exist 3 of the same marks (other than BLANK)
   * in a row, either horizontally, vertically, or diagonally.
   * If so, this method returns the mark of the winning player. 
   * (If more than one player
   * has a winning setup--such as when the calling program has not checked for 
   * a winner every turn--will return the mark of the first winner determined).  
   * If the game has not yet ended, returns 0 (BLANK).
   * If the game has ended and no one had won, returns -1.
   *
   * @return  the mark of the winning player
   */
  public int checkEndGame () {
  }


  /**
   * Compares the three given squares of this board and reports if they 
   * are held by the same player.  Returns true if all contain the same
   * player's mark (such as X or O; BLANK does not count as a player mark);
   * returns false if they don't.
   */
  private boolean threeSquareCompare(int sq1, int sq2, int sq3) {
  }


  /**
   * Returns a char representation of the mark in this square.
   * For example, BLANK returns ' ', X returns 'X', etc.
   * Will return ' ' if the player mark is unrecognized 
   * (an unrecognized player meaning not either X or O).
   *
   * @param  sq  the number of the square to return
   * @return  a char representation of the given square's mark
   */
  protected char squareToString (int sq) {
  }


  /**
   * Returns a string version of this board.  
   * This version is like the diagram shown in the class description:
   * a 3x3 board with each square taking up 5x3 characters. 
   * Total dimensions of displayed string is 19 (width; includes a space 
   * on each side of the board) by 13 (height; includes a newline above
   * and below the board) characters.  
   * Also includes the numbering of the squares.
   *
   * @return  a String representation of this TicTacToeBoard
   */
  public String toString () {
  }

}//end class

