-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelper.py
More file actions
32 lines (29 loc) · 898 Bytes
/
helper.py
File metadata and controls
32 lines (29 loc) · 898 Bytes
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
"""
"""
from hlt import (
Location
)
def getTerritory(gameMap, userId):
territory = 0
for y in range(gameMap.height):
for x in range(gameMap.width):
curSite = gameMap.getSite(Location(x, y))
if curSite.owner == userId:
territory += 1
return territory
def getStrength(gameMap, userId):
strength = 0
for y in range(gameMap.height):
for x in range(gameMap.width):
curSite = gameMap.getSite(Location(x, y))
if curSite.owner == userId:
strength += curSite.strength
return strength
def getProduction(gameMap, userId):
production = 0
for y in range(gameMap.height):
for x in range(gameMap.width):
curSite = gameMap.getSite(Location(x, y))
if curSite.owner == userId:
production += curSite.production
return production