-
Notifications
You must be signed in to change notification settings - Fork 0
/
support.py
executable file
·42 lines (34 loc) · 1.16 KB
/
support.py
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
########################### support.py #############################
"""
STUDENT INFO: You may want to add new elif statements to support new bots
This file just contains a few support functions used by the other
files
"""
import bots
import ta_bots
def determine_bot_functions(bot_names):
bot_list = []
for name in bot_names:
if name == "student":
bot_list.append(bots.StudentBot())
elif name == "student2":
bot_list.append(bots.StudentBot2())
elif name == "random":
bot_list.append(bots.RandBot())
elif name == "wall":
bot_list.append(bots.WallBot())
elif name == "ta1":
bot_list.append(ta_bots.TABot1())
elif name == "ta2":
bot_list.append(ta_bots.TABot2())
else:
raise ValueError(
"""Bot name %s is not supported. Value names include "student",
"random", "wall", "ta1", "ta2" """
% name
)
return bot_list
class TimeoutException(Exception):
pass
def timeout_handler(signum, frame):
raise TimeoutException("Player action timed out.")