Piezas.cpp
/**
 * Places a piece of the current turn on the board, returns what
 * piece is placed, and toggles which Piece's turn it is. dropPiece does 
 * NOT allow to place a piece in a location where a column is full.
 * In that case, placePiece returns Piece Blank value 
 * Out of bounds coordinates return the Piece Invalid value
 * Trying to drop a piece where it cannot be placed loses the player's turn
**/
Places a piece of the current turn on the board, returns what
piece is placed, and toggles which Piece's turn it is. dropPiece does
NOT allow to place a piece in a location where a column is full.
In that case, placePiece returns Piece Blank value
Out of bounds coordinates return the Piece Invalid value
Trying to drop a piece where it cannot be placed loses the player's turn
Places a piece of the current turn on the board returns what piece is placed and toggles which Piece ' s turn it is . dropPiece does NOT allow to place a piece in a location where a column is full . In that case placePiece returns Piece Blank value Out of bounds coordinates return the Piece Invalid value Trying to drop a piece where it cannot be placed loses the player ' s turn
Piece Piezas::dropPiece(int column)
{
    if (column >= BOARD_COLS || column < 0) {
        if (turn == X) {
            turn = O;
        } else  if (turn == O) {
            turn = X;
        }
        return Invalid;
    } else if (pieceAt(BOARD_ROWS - 1, column) != Blank) {
        if (turn == X) {
            turn = O;
        } else  if (turn == O) {
            turn = X;
        }
        return Blank;
    } else if (pieceAt(BOARD_ROWS-1, column) == Blank) {
        for (int i = 0; i < BOARD_ROWS; i++) {
            if (pieceAt(i, column) == Blank) { 
                board[i][column] = turn;
                if (turn == X) {
                    turn = O;
                } else  if (turn == O) {
                    turn = X;
                }
                return pieceAt(i, column);
            }
        }
    }
    return Invalid;
}
Piece Piezas :: dropPiece ( int column ) { if ( column >= BOARD_COLS || column < 0 ) { if ( turn == X ) { turn = O ; } else if ( turn == O ) { turn = X ; } return Invalid ; } else if ( pieceAt ( BOARD_ROWS - 1 , column ) != Blank ) { if ( turn == X ) { turn = O ; } else if ( turn == O ) { turn = X ; } return Blank ; } else if ( pieceAt ( BOARD_ROWS - 1 , column ) == Blank ) { for ( int i = 0 ; i < BOARD_ROWS ; i ++ ) { if ( pieceAt ( i , column ) == Blank ) { board [ i ] [ column ] = turn ; if ( turn == X ) { turn = O ; } else if ( turn == O ) { turn = X ; } return pieceAt ( i , column ) ; } } } return Invalid ; }
Places a piece of the current turn on the board, returns what
 piece is placed, and toggles which Piece's turn it is.
Places a piece of the current turn on the board returns what piece is placed and toggles which Piece ' s turn it is .
//Checks if column is out of bounds //toggle the turn //column full and toggle turn //toggle the turn //checks to make sure the column is not full //An empty spot //Place turn and toggle turn