-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrandom_bot.py
32 lines (27 loc) · 922 Bytes
/
random_bot.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
import random
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from bot_package.bot import Bot
from bot_package.move import Move
class Random_Bot(Bot):
def preprocess(self) -> None:
self.map_size = self.arena_properties["arena"]["map_size"]
def make_move(self):
x = random.randint(0, self.map_size[0] - 1)
y = random.randint(0, self.map_size[1] - 1)
move = random.choice(['W', 'T', 'F', 'S'])
import sys
print("RAND", file=sys.stderr)
if move == 'W':
return Move.Wait()
elif move == 'T':
return Move.Build.Turret(x, y)
elif move == 'F':
return Move.Build.Farm(x, y)
elif move == 'S':
return Move.Spawn(unit_type= random.choice(["swordsman", "archer"]))
else:
return f'W'
while True:
Random_Bot().run()