A simple Tic-Tac-Toe game written in C++ with unit tests using Google Test.
- CMake (version 3.14 or higher)
- A C++ compiler supporting C++14 or higher.
- Internet connection (to fetch Google Test automatically via CMake).
- Create a build directory:
mkdir build cd build - Generate build files:
cmake ..
- Build the project:
cmake --build .
- Open "Developer Command Prompt for VS".
- Navigate to the project root.
- Run:
The executable will be in
mkdir build cd build cmake .. cmake --build . --config Release
build/Release/tic_tac_toe.exe.
- Open your terminal (e.g., PowerShell or CMD).
- Run:
mkdir build cd build cmake -G "MinGW Makefiles" .. cmake --build .
- Open Terminal.
- Run:
mkdir build cd build cmake .. make
- Open Terminal.
- Run:
mkdir build cd build cmake .. make
After building, run the executable:
- Windows:
build\tic_tac_toe.exe(orbuild\Release\tic_tac_toe.exe) - macOS/Linux:
./tic_tac_toe(inside the build directory)
To run the unit tests:
- Navigate to the
builddirectory. - Run the test executable:
- Windows:
build\tic_tac_toe_tests.exe(orbuild\Release\tic_tac_toe_tests.exe) - macOS/Linux:
./tic_tac_toe_tests
- Windows:
- Alternatively, use CTest:
ctest --output-on-failure
The game uses a keyboard-based grid:
qweasdzxc
Each key corresponds to a position on the 3x3 board.