CPP Blackjack is a console-based simulation of the classic Blackjack card game. It allows users to simulate multiple players in a game, each trying to achieve the best possible hand without exceeding a score of 21. This project was developed as part of an exam submission, showcasing object-oriented programming principles and the use of C++ for game development.
- Simulate multiple players in a game.
- Automatic calculation of hand values, including handling of Aces as 1 or 11.
- Automatic decision-making for drawing additional cards.
- Evaluation of player scores to determine winners, ties, and busts.
- Manual inclusion of GoogleTest in the build directory due to linking issues.
To compile and run the project, you will need g++
, cmake
, and googletest
installed. Note that GoogleTest was manually downloaded and included in the build/_deps
directory due to issues with linking. I removed the build folder for my online upload of this, if you would like to run my project the way I currently have it programmed, contact me or create an issue for the correct build folder to run this program. Follow these steps to set up the project:
- Clone the repository to your local machine.
- Open a terminal in the root directory of the project.
- Create a build directory:
mkdir build
- Run CMake to configure the project:
cmake -S . -B build
- Compile the project:
cmake --build build
The compiled binaries will be located in the build/app
and build/tests
directories.
To run the game simulation, execute the following command from the terminal:
./build/app/blackjack
To run the unit tests, execute:
./build/tests/blackjacktests
- app/: Contains the main game application code.
- inc/: Header files for the project, defining the
Card
,Deck
, andPlayer
classes. - src/: Source files for the project, implementing the logic for the card game.
- tests/: Unit tests for the project using GoogleTest.
- docs/: Documentation generated by Doxygen.
- build/_deps/: Contains the manually downloaded GoogleTest source.
This project is licensed under the MIT License. See the LICENSE file for more details.