This is a Risk console game developed in the context of a school assignment.
First, get the source code of the program. You can download the project files, or you can do the same through the command line (see below).
# Copy repository
git clone https://github.com/dzm-fiodarau/COMP345-RISK
# Enter directory of cloned repo
cd COMP345-RISK
Note that the project uses CMake
to generate project files from the configuration in the CMakeLists.txt
file.
Building using CMake
is preferred.
Below we build and run the project using g++
and CMake
.
# FOR WINDOWS
# In the directory of the source code
# Create output directory
mkdir bin
After making the build/bin directory, then you need to build the project. This can be done using the following command below:
g++ -o ./bin/COMP345_RISK -std=c++20 -I./headers ./src/*.cpp ./src/commandprocessing/*.cpp ./src/drivers/*.cpp ./src/gameengine/*.cpp ./src/player/*.cpp
After running the command, we can run the executable directly:
# Run built executable
./bin/COMP345_RISK
# FOR WINDOWS
# In the directory of the source code
# Create build directory
mkdir bin
# Generates the build files given the project files
cmake -S ./ -B ./bin/
# Generates the executable from the build files
cmake --build ./bin/
# Run build executable
./bin/Debug/COMP345_RISK
After obtaining an executable, you can then specify additional command line arguments:
You can specify from where the program will take input from. You can put commands in a file and watch the game play. By default, the game is set to console/player input.
# Assuming the name of the executable is 'COMP345_RISK'
# File input
./COMP345_RISK [-file] FILEPATH
# Console input
./COMP345_RISK [-console]
# Or without any arguments specified
./COMP345_RISK