[GRASS-SVN] r49200 - grass-addons/grass7/raster/r.agent/libagent

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Nov 13 13:27:41 EST 2011


Author: mic
Date: 2011-11-13 10:27:41 -0800 (Sun, 13 Nov 2011)
New Revision: 49200

Modified:
   grass-addons/grass7/raster/r.agent/libagent/aco.py
   grass-addons/grass7/raster/r.agent/libagent/world.py
Log:
get tests running for stubs

Modified: grass-addons/grass7/raster/r.agent/libagent/aco.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/aco.py	2011-11-13 16:46:53 UTC (rev 49199)
+++ grass-addons/grass7/raster/r.agent/libagent/aco.py	2011-11-13 18:27:41 UTC (rev 49200)
@@ -11,17 +11,17 @@
 #
 #############################################################################
 
+import error
+import world
+import ant
+
 from math import sqrt
 from math import exp
 from random import randint
-import world
-import error
-import ant
 
 class ACO(world.World):
     """World class for using the Ant Colony Optimization Algorithm for
        modelling Agent Based worlds."""
     def __init__(self):
-        world.World.__init__(self)
         world.World.__init__(self, ant.Ant)
 

Modified: grass-addons/grass7/raster/r.agent/libagent/world.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/world.py	2011-11-13 16:46:53 UTC (rev 49199)
+++ grass-addons/grass7/raster/r.agent/libagent/world.py	2011-11-13 18:27:41 UTC (rev 49200)
@@ -11,45 +11,45 @@
 #
 #############################################################################
 
+import error
+import playground
 import agent
-import playground
-import error
 
 class World(object):
     """Generic World class as basis for more complex worlds."""
     def __init__(self, agenttype=None, pg=None):
-#        if pg == None:
-#            self.playground = playground.Playground()
-#        else:
-#            self.playground = pg
-#        self.agentclass = agent.Agent
-#        if agenttype == None:
-#            self.agenttype = self.agentclass
-#        else:
-#            self.setagenttype(agenttype)
+        if pg == None:
+            self.playground = playground.Playground()
+        else:
+            self.playground = pg
+        self.agentclass = agent.Agent
+        if agenttype == None:
+            self.agenttype = self.agentclass
+        else:
+            self.setagenttype(agenttype)
         self.agents = []
         self.artefacts = []
-    def addlayertopg(layername, layertype):
+    def addlayertopg(self, layername, layertype):
         pass
-    def getlayer(layername):
+    def getlayer(self, layername):
         pass
 #       return layer
-    def rmlayer(layername):
+    def rmlayer(self, layername):
         pass
-    def setagentype(agentype):
+    def setagenttype(self, agentype):
         pass
-    def getagenttype():
+    def getagenttype(self):
         pass
 #       return agenttype
-    def bear(timetolive, position, agenttype):
+    def bear(self, timetolive, position, agenttype):
         pass
 #       return agent
     def getnextagent():
-        return next(agents)
-    def move(agent, position):
+        return next(self, agents)
+    def move(self, agent, position):
         pass
-    def getposition(agent):
+    def getposition(self, agent):
         pass
-    def kill(agent):
+    def kill(self, agent):
         pass
 



More information about the grass-commit mailing list