[Home]AdamBurke

HomePage | RecentChanges | Preferences

Adam Burke has an economic attention span.


Freeloader

#! /usr/bin/python

# economic agent, resources in RRMaps 

from Agent import Agent
from RRMap import RRMap

class FreeLoaderAgent(Agent) :

    def type(self) :
        return "FreeLoaderAgent"

    def oneStep(self) : 
        if self.alive == 1 :
            for r in self.resources.values() :
                r.oneStep()
         
    def addResource(self, name, needRange, rgcRange, rcrRange) :
        r = RRMap(name)
        r.randomize(needRange,rgcRange,rcrRange)
        r.rgc = 0
        self.addRRMap(r)

I guess I should have subclassed RRMap instead of this hack :>

Breaks Table.py a bit at the moment ... Freeloaders are important for invalids etc, I suspect some of these environments are a bit too easy to survive in. Even if rgcRange << rcrRange a few Agents will manage to survive because the randomized result will have rgc > rcr.


HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited August 3, 2003 5:35 pm by 213.78.81.xxx (diff)
Search: