forked from SharifAIChallenge/AIC19-Client-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAI.py
29 lines (22 loc) · 931 Bytes
/
AI.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
import Model
from random import randint
class AI:
def preprocess(self, world):
print("preprocess")
def pick(self, world):
print("pick")
hero_names = [hero_name for hero_name in Model.HeroName]
world.pick_hero(hero_names[randint(0, len(hero_names) - 1)])
def move(self, world):
print("move")
dirs = [direction for direction in Model.Direction]
for hero in world.my_heroes:
world.move_hero(hero=hero, direction=dirs[randint(0, len(dirs) - 1)])
def action(self, world):
print("action")
for hero in world.my_heroes:
row_num = randint(0, world.map.row_num)
col_num = randint(0, world.map.column_num)
abilities = hero.abilities
world.cast_ability(hero=hero, ability=abilities[randint(0, len(abilities) - 1)],
cell=world.map.get_cell(row_num, col_num))