44from itertools import dropwhile
55from sets import Set
66from Image import open as PIL_open
7- from Image import ANTIALIAS
7+ from Image import ANTIALIAS
88from StringIO import StringIO
99from collections import defaultdict
1010
@@ -31,7 +31,7 @@ def handleUnitInitEvent(self,event,replay):
3131 if event .unit_type_name in ["CreepTumor" , "Hatchery" ,"NydusCanal" ] :
3232 self .creepTracker .add_to_list (event .control_pid ,event .unit_id ,\
3333 (event .x , event .y ), event .unit_type_name ,event .second )
34-
34+
3535 def handleUnitBornEvent (self ,event ,replay ):
3636 if event .unit_type_name == "Hatchery" :
3737 self .creepTracker .add_to_list (event .control_pid , event .unit_id ,\
@@ -51,12 +51,12 @@ def handleEndGame(self, event, replay):
5151 ## Else statement is for players with no creep spread(ie: not Zerg)
5252 player .max_creep_spread = 0
5353
54- ## The class used to used to calculate the creep spread
54+ ## The class used to used to calculate the creep spread
5555class creep_tracker ():
5656 def __init__ (self ,replay ):
5757 #if the debug option is selected, minimaps will be printed to a file
58- ##and a stringIO containing the minimap image will be saved for
59- ##every minite in the game and the minimap with creep highlighted
58+ ##and a stringIO containing the minimap image will be saved for
59+ ##every minite in the game and the minimap with creep highlighted
6060 ## will be printed out.
6161 self .debug = replay .opt .debug
6262 ##This list contains creep spread area for each player
@@ -76,7 +76,7 @@ def __init__(self,replay):
7676 for x in self .unit_name_to_radius :
7777 self .radius_to_coordinates [self .unit_name_to_radius [x ]] = \
7878 self .radius_to_map_positions (self .unit_name_to_radius [x ])
79-
79+
8080 #Get map information
8181 replayMap = replay .map
8282 # extract image from replay package
@@ -89,7 +89,7 @@ def __init__(self,replay):
8989 # resize height to MAPHEIGHT, and compute new width that
9090 # would preserve aspect ratio
9191 self .map_width = int (cropsize [0 ] * (float (self .map_height ) / cropsize [1 ]))
92- self .mapSize = self .map_height * self .map_width
92+ self .mapSize = self .map_height * self .map_width
9393 ## the following parameters are only needed if minimaps have to be printed
9494 minimapSize = ( self .map_width ,int (self .map_height ) )
9595 self .minimap_image = cropped .resize (minimapSize , ANTIALIAS )
@@ -100,10 +100,10 @@ def __init__(self,replay):
100100 imageCenter = [(self .map_width / 2 ), self .map_height / 2 ]
101101 # this is the scaling factor to go from the SC2 coordinate
102102 # system to pixel coordinates
103- self .image_scale = float (self .map_height ) / cropsize [0 ]
103+ self .image_scale = float (self .map_height ) / cropsize [0 ]
104104 self .transX = imageCenter [0 ] + self .image_scale * (mapCenter [0 ])
105105 self .transY = imageCenter [1 ] + self .image_scale * (mapCenter [1 ])
106-
106+
107107 def radius_to_map_positions (self ,radius ):
108108 ## this function converts all radius into map coordinates
109109 ## centred around the origin that the creep can exist
@@ -142,7 +142,7 @@ def add_to_list(self,player_id,unit_id,unit_location,unit_type,event_time):
142142 def remove_from_list (self ,unit_id ,time_frame ):
143143 ## This function searches is given a unit ID for every unit who died
144144 ## the unit id will be searched in cgu_gen_units for matches
145- ## if there are any, that unit will be removed from active CGUs
145+ ## if there are any, that unit will be removed from active CGUs
146146 ## and appended as a new time frame
147147 for player_id in self .creep_gen_units :
148148 length_cgu_list = len (self .creep_gen_units [player_id ])
@@ -179,12 +179,12 @@ def reduce_cgu_per_minute(self,player_id):
179179 cgu_time_per_player_new .append (self .creep_gen_units_times [player_id ][cgu_max_in_min_index ])
180180 last_minute_found = cgu_time / 60
181181 cgu_last_minute_list = list ()
182-
182+
183183 self .creep_gen_units [player_id ] = cgu_per_player_new
184184 self .creep_gen_units_times [player_id ] = cgu_time_per_player_new
185185
186186 def get_creep_spread_area (self ,player_id ):
187- ## iterates through all cgus and and calculate the area
187+ ## iterates through all cgus and and calculate the area
188188 for index ,cgu_per_player in enumerate (self .creep_gen_units [player_id ]):
189189 # convert cgu list into centre of circles and radius
190190 cgu_radius = map (lambda x : (x [1 ], self .unit_name_to_radius [x [2 ]]),\
@@ -209,7 +209,7 @@ def cgu_radius_to_map_positions(self,cgu_radius,radius_to_coordinates):
209209 point = cgu [0 ]
210210 radius = cgu [1 ]
211211 ## subtract all radius_to_coordinates with centre of
212- ## cgu radius to change centre of circle
212+ ## cgu radius to change centre of circle
213213 cgu_map_position = map ( lambda x :(x [0 ]+ point [0 ],x [1 ]+ point [1 ])\
214214 ,self .radius_to_coordinates [radius ])
215215 total_points_on_map = total_points_on_map | Set (cgu_map_position )
0 commit comments