Permalink
Browse files

Add more comments to starter ai

  • Loading branch information...
okayzed committed Jul 8, 2011
1 parent f0ce001 commit 4ca49ff9df75beba8dd893793bc56f608e3e9404
Showing with 10 additions and 12 deletions.
  1. +10 −12 basic/starterai.py
View
@@ -14,7 +14,7 @@ def to_area((x,y)):
y / GRID_RESOLUTION * GRID_RESOLUTION)
-class BaseStrategy(object):
+class BaseStrategy(object):#{{{
def __init__(self, ai):
self.units = {}
self.ai = ai
@@ -32,8 +32,8 @@ def _deallocate(self, dead_unit):
del self.units[dead_unit]
except:
pass
-
-class DefendStrategy(BaseStrategy):
+#}}}
+class DefendStrategy(BaseStrategy):#{{{
def __init__(self, ai):
self.defenders = self.units = {}
self.ai = ai
@@ -49,13 +49,12 @@ def _allocate(self, unit):
if not b.position in defended:
self.defenders[unit] = b.position
return True
-
-class AttackStrategy(BaseStrategy):
+#}}}
+class AttackStrategy(BaseStrategy):#{{{
# No attack strategy, at the moment.
pass
-
-# {{{ Exploration code
-class ExploreStrategy(BaseStrategy):
+#}}}
+class ExploreStrategy(BaseStrategy):#{{{
def __init__(self, ai):
# Exploration Data
self.explorers = self.units = {}
@@ -117,10 +116,9 @@ def explore(self, unit, position):
self.destinations[unit] = self.next_destination(unit)
self.ai.highlightLine(unit.position, self.destinations[unit])
- unit.move(self.destinations[unit])
-# }}}
+ unit.move(self.destinations[unit])#}}}
-class StarterAI(ai.AI):
+class StarterAI(ai.AI):#{{{
# {{{ Initializer
def _init(self):
@@ -169,4 +167,4 @@ def _unit_died(self, dead_unit):
# }}}
-
+#}}}

0 comments on commit 4ca49ff

Please sign in to comment.