コード例 #1
0
ファイル: area.py プロジェクト: bitcraft/polerunner
    def update(self, time):
        self.last_scan += 1
        if self.last_scan > 200:
            [ self.look(agent) for agent in self.agents ]
            self.last_scan = 0

        Environment.update(self, time)
コード例 #2
0
ファイル: area.py プロジェクト: bitcraft/polerunner
 def __init__(self, area):
     Environment.__init__(self)
     self.area = area
     self.last_scan = 99999
コード例 #3
0
ファイル: area.py プロジェクト: bitcraft/polerunner
 def add(self, agent, entity):
     agent.entity = entity
     Environment.add(self, agent)
コード例 #4
0
ファイル: tutorial.py プロジェクト: bitcraft/pygoap
from pygoap.goals import *

from pygoap.agent import GoapAgent
from pygoap.environment import Environment


class PrintActionContext(CalledOnceContext):
    def enter(self):
        print "hello world"

class PrintAction(ActionBuilder):
    def get_actions(self, caller, memory):
        action = PrintActionContext(caller)
        action.effects.append(SimpleGoal(introduced_self=True))
        yield action



agent = GoapAgent()
agent.add_action(PrintAction())

friendly_goal = SimpleGoal(introduced_self=True)
agent.add_goal(friendly_goal)

env = Environment()
env.add(agent)

env.update(1)