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

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 3 02:12:53 PST 2013


Author: mic
Date: 2013-02-03 02:12:53 -0800 (Sun, 03 Feb 2013)
New Revision: 54859

Modified:
   grass-addons/grass7/raster/r.agent/libagent/world.py
Log:
discuss freedom on world level and add comments

Modified: grass-addons/grass7/raster/r.agent/libagent/world.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/world.py	2013-02-03 10:10:39 UTC (rev 54858)
+++ grass-addons/grass7/raster/r.agent/libagent/world.py	2013-02-03 10:12:53 UTC (rev 54859)
@@ -13,6 +13,8 @@
 import playground
 import agent
 
+from math import sqrt
+
 class World(object):
     """Generic World class as basis for more complex worlds."""
 
@@ -21,18 +23,24 @@
         Create a World, a place with a playground, where agents meet
         @param type optional, the default agent type for this world
         @param playground optional, if playground already exists
+        @param int freedom optional, agent ability to move to neighbour cells
         """
+        # set an initial playground, as every world wants at least one..
         if pg == None:
             self.playground = playground.Playground()
         else:
             self.playground = pg
+        # per default, create this kind of agents
         if agenttype == None:
             self.agenttype = agent.Agent
         else:
             self.agenttype = agenttype
+        # list of agents
         self.agents = []
         #self.artefacts = []
         self.agentfreedom = freedom
+        # theoretical fix penalty value for diagonal walking
+        self.DIAGONAL = sqrt(2)-1
 
     def addlayertopg(self, layername):
         """



More information about the grass-commit mailing list