-
Notifications
You must be signed in to change notification settings - Fork 6
/
run_custom.py
38 lines (31 loc) · 1.1 KB
/
run_custom.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
import os
import sub_module # Important, do not remove!
from protossbot.bot import ProtossBot
from sc2.data import Race
from terranbot.bot import TerranBot
from zergbot.bot import ZergBot
from sc2.player import Bot
from bot_loader import GameStarter, BotDefinitions
from version import update_version_txt
def add_definitions(definitions: BotDefinitions):
definitions.add_bot(
"protossbot", lambda params: Bot(Race.Protoss, ProtossBot(BotDefinitions.index_check(params, 0, "default"))), None
)
definitions.add_bot(
"terranbot", lambda params: Bot(Race.Terran, TerranBot()), None
)
definitions.add_bot(
"zergbot", lambda params: Bot(Race.Zerg, ZergBot()),
None
)
def main():
update_version_txt()
root_dir = os.path.dirname(os.path.abspath(__file__))
ladder_bots_path = os.path.join("Bots")
ladder_bots_path = os.path.join(root_dir, ladder_bots_path)
definitions: BotDefinitions = BotDefinitions(ladder_bots_path)
add_definitions(definitions)
starter = GameStarter(definitions)
starter.play()
if __name__ == "__main__":
main()