main.cpp
/**
 * @brief Given a Board object, prints the chessboard it contains in a human-readable display.
 * @param Board Board Board object to print.
 *
 * Loops through the board and prints chess piece characters depending on piece type.
 *
 */
@brief Given a Board object, prints the chessboard it contains in a human-readable display.

Loops through the board and prints chess piece characters depending on piece type.
@brief Given a Board object prints the chessboard it contains in a human - readable display . Loops through the board and prints chess piece characters depending on piece type .
void printBoard(Board *board) {
    int start = BOARD_SIZE;
    for (int i = BOARD_SIZE - 1; i >= 0; i--) {
        cout << start-- << " ";
        for (auto &j : board->p_squares[i]) {
            if (j->hasPiece()) {
                Square *cur = j;
                piece_t type = cur->getPiece()->type;
                if (cur->getPiece()->isWhite) {
                    switch (type) {
                        case pawn :
                            cout << "P ";
                            break;
                        case rook :
                            cout << "R ";
                            break;
                        case knight :
                            cout << "N ";
                            break;
                        case bishop :
                            cout << "B ";
                            break;
                        case queen :
                            cout << "Q ";
                            break;
                        case king :
                            cout << "K ";
                            break;
                    }
                } else {
                    switch (type) {
                        case pawn :
                            cout << "p ";
                            break;
                        case rook :
                            cout << "r ";
                            break;
                        case knight :
                            cout << "n ";
                            break;
                        case bishop :
                            cout << "b ";
                            break;
                        case queen :
                            cout << "q ";
                            break;
                        case king :
                            cout << "k ";
                            break;
                    }
                }
            } else {
                cout << "  ";
            }
        }
        cout << endl;
    }
    cout << "  a b c d e f g h " << endl;
}
void printBoard ( Board * board ) { int start = BOARD_SIZE ; for ( int i = BOARD_SIZE - 1 ; i >= 0 ; i -- ) { cout << start -- << " " ; for ( auto & j : board -> p_squares [ i ] ) { if ( j -> hasPiece ( ) ) { Square * cur = j ; piece_t type = cur -> getPiece ( ) -> type ; if ( cur -> getPiece ( ) -> isWhite ) { switch ( type ) { case pawn : cout << " " ; break ; case rook : cout << " " ; break ; case knight : cout << " " ; break ; case bishop : cout << " " ; break ; case queen : cout << " " ; break ; case king : cout << " " ; break ; } } else { switch ( type ) { case pawn : cout << " " ; break ; case rook : cout << " " ; break ; case knight : cout << " " ; break ; case bishop : cout << " " ; break ; case queen : cout << " " ; break ; case king : cout << " " ; break ; } } } else { cout << " " ; } } cout << endl ; } cout << " " << endl ; }
@brief Given a Board object, prints the chessboard it contains in a human-readable display.
@brief Given a Board object prints the chessboard it contains in a human - readable display .
//printDanger(board);
