-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·52 lines (42 loc) · 985 Bytes
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Exit if any command fails
set -e
workspace=$(pwd)
cd ${workspace}
# If the build directory exists, delete it
if [ -d "build" ]; then
echo "Deleting old build directory..."
rm -r build
fi
# Create the build directory
echo "Creating new build directory..."
mkdir -p build
cd build
# Run CMake
echo "Running CMake..."
if ! cmake ..; then
echo "CMake failed!"
exit 1
fi
# Run Make
echo "Running Make..."
if ! make -j$(nproc); then
echo "Make failed!"
exit 1
fi
echo -e "Build completed successfully! :) \n"
echo
# Ask the user if they want to run the game
read -p "Do you want to run the game? (y/n) " answer
case ${answer:0:1} in
y|Y )
# Ask the user for their piece type
read -p "Choose a piece type (X or O): " piece_type
echo
# Run the game with the chosen piece type
./Othello $piece_type
;;
* )
echo "Not running the game. You can run it later with './build/Othello <X|O>'."
;;
esac