-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMonopoly_Simulation.ps1
56 lines (48 loc) · 1.67 KB
/
Monopoly_Simulation.ps1
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
# Check for existence of Virtual Environment
function check_for_virtual_environment {
$venv_directory = Join-Path -Path $pwd -ChildPath "\venv-win"
# Check if the Virtual Environment already exists
if (Test-Path -Path $venv_directory) {
Write-Host -ForegroundColor 'Green' "Found existing Virtual Environment`n"
} else {
Write-Host -ForegroundColor 'Green' "Creating Virtual Environment`n"
python.exe -m venv venv-win
}
}
# Activate Virtual Environment
function activate_virtual_environment {
Write-Host -ForegroundColor 'Green' "Activating Virtual Environment`n"
.\venv-win\Scripts\Activate.ps1
}
# Get current Virtual Environment name
function get_virtual_environment {
Write-Host -ForegroundColor 'Green' "Current Virtual Environment`n"
Write-Host "$env:VIRTUAL_ENV`n"
}
# Run the setup.py script
function run_setup {
Write-Host -ForegroundColor 'Green' "Running setup.py`n"
python.exe ./utils/setup.py $pwd
}
# Run the main.py script
function run_main($mode) {
Write-Host -ForegroundColor 'Green' "Running main.py`n"
Start-Sleep -s 3
Clear-Host
python.exe ./main.py $mode
}
# Run the whole project
function run($arguments) {
if($arguments.Count -lt 1){
Write-Host -ForegroundColor 'Red' "Missing Argument! Usage: .\Monopoly_Simulation.ps1 [Number of Rounds]`n"
} elseif ( $arguments.Count -eq 1 ){
check_for_virtual_environment
activate_virtual_environment
get_virtual_environment
run_setup
run_main($arguments)
} else {
Write-Host -ForegroundColor 'Red' "Too many arguments! Usage: .\Monopoly_Simulation.ps1 [Number of Rounds]`n"
}
}
run($args)