forked from matheusportela/Multiagent-RL
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpacmantest
executable file
·69 lines (61 loc) · 1.57 KB
/
pacmantest
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
69
#!/bin/bash
#
# @author Guilherme N. Ramos ([email protected])
#
# Tests for Pac-Man. There are 3 options:
#
# ./pacman - runs a simple test with a medium layout and 2 ghosts
# ./pacman classic - runs a simple test with the classic layout and 4 ghosts
# ./pacman all - runs all possible configurations of layouts and ghosts
# (may take a while....)
function setup_options {
EXP="[${PACMAN}] ${LAYOUT} ${NUM_GHOSTS} [${GHOST}] ghosts"
AGENT_OPTIONS="--ghost-agent ${GHOST} --pacman-agent ${PACMAN}"
ITERATION_OPTIONS="--learn-num 2 --test-num 1"
LAYOUT_OPTIONS="--layout ${LAYOUT} --num-ghosts ${NUM_GHOSTS}"
OPTIONS="${AGENT_OPTIONS} ${ITERATION_OPTIONS} ${LAYOUT_OPTIONS}"
}
function add_policy {
POLICY_FILE="${PACMAN}_${LAYOUT}_${NUM_GHOSTS}_${GHOST}.pol"
rm -f ${POLICY_FILE}
OPTIONS="${OPTIONS} --policy-file ${POLICY_FILE}"
EXP="${EXP} with policy"
}
function process {
echo -e "\n\n${EXP}\n"
python2 simulation.py pacman ${OPTIONS}
}
function test_with_current_setup {
setup_options
process
add_policy
process
EXP="${EXP} (${POLICY_FILE})"
process
}
TEST="${1}"
if [ "${TEST}" = "all" ]; then
for LAYOUT in "medium" "classic"; do
for GHOST in "random" "ai"; do
for PACMAN in "random " "ai" "eater"; do
for NUM_GHOSTS in "1" "2" "3" "4"; do
test_with_current_setup
done
done
done
done
else
if [ "${TEST}" = "classic" ]; then
PACMAN="eater"
LAYOUT="classic"
NUM_GHOSTS="4"
GHOST="ai"
test_with_current_setup
else
PACMAN="random"
LAYOUT="medium"
NUM_GHOSTS="2"
GHOST="ai"
test_with_current_setup
fi
fi