-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonopoly_Simulation
More file actions
68 lines (55 loc) · 1.58 KB
/
Monopoly_Simulation
File metadata and controls
68 lines (55 loc) · 1.58 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Color definitions
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
ROOT_DIR=$(pwd)
# Check for existence of Virtual Environment
function check_for_virtual_environment() {
if [ ! -d "$ROOT_DIR/venv-linux" ] ; then
# If not found create one
echo -e "${GREEN}Creating Virtual Environment\n${NC}"
python -m venv venv-linux
else
# If it exists inform the user
echo -e "${GREEN}Found existing Virtual Environment\n${NC}"
fi
}
# Activate Virtual Environment
function activate_virtual_environment() {
echo -e "${GREEN}Activating Virtual Environment\n${NC}"
source "$ROOT_DIR/venv-linux/bin/activate"
}
# Get current Virtual Environment name
function get_virtual_environment() {
echo -e "${GREEN}Current Virtual Environment\n${NC}"
echo "$VIRTUAL_ENV"
}
# Run the setup.py script
function run_setup() {
echo -e "${GREEN}\nRunning setup.py\n${NC}"
python "$ROOT_DIR/utils/setup.py" "$ROOT_DIR"
}
# Run the main.py script
function run_main() {
echo -e "${GREEN}\nRunning main.py\n${NC}"
sleep 3;
clear;
python "$ROOT_DIR/main.py" "$1"
}
# Run the whole project
function run() {
clear;
if [ "$#" -lt 1 ]; then
echo -e "${RED}Missing Argument! Usage: ./Monopoly_Simulation [Number of Rounds]\n${NC}"
elif [ "$#" -eq 1 ]; then
check_for_virtual_environment
activate_virtual_environment
get_virtual_environment
run_setup
run_main "$1"
else
echo -e "${RED}Too many arguments! Usage: ./Monopoly_Simulation [Number of Rounds]\n${NC}"
fi
}
run "$@"