From 9915458037a080cf95df263f7df4c7562da888fd Mon Sep 17 00:00:00 2001 From: bitcraft Date: Wed, 24 Apr 2013 10:13:15 -0500 Subject: [PATCH] changes for merge --- npc/pirate/actions.py | 6 +++--- pygoap/agent.py | 2 +- pygoap/blackboard.py | 12 ++++++------ pygoap/goals.py | 13 +++++++------ 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/npc/pirate/actions.py b/npc/pirate/actions.py index a8b25fe..597875b 100644 --- a/npc/pirate/actions.py +++ b/npc/pirate/actions.py @@ -4,7 +4,7 @@ The module must contain a list called "exported_actions". This list should contain any classes that you would like to add to the planner. -To make it convienent, I have chosen to add the class to the list after each +To make it convenient, I have chosen to add the class to the list after each declaration, although you may choose another way. """ @@ -80,7 +80,7 @@ class move_to_entity(ActionBuilder): """ def get_actions(self, caller, memory): - here = get_position(caller, memory) + here = get_position(caller, memory) visited = [] for pct in memory.of_class(PositionPrecept): @@ -109,7 +109,7 @@ def get_actions(self, caller, memory): if here == pct.position and pct.entity is not caller: action = PickupAction(caller) action.effects.append(HasItemGoal(pct.entity)) - yield action + yield action exported_actions.append(pickup) diff --git a/pygoap/agent.py b/pygoap/agent.py index 097821e..cf607e9 100644 --- a/pygoap/agent.py +++ b/pygoap/agent.py @@ -97,7 +97,7 @@ def replan(self): s = [ g for g in s if g[0] > 0.0 ] s.sort(reverse=True) - debug("[agent] %s goals %s", self, s) + debug("[agent] %s has goals %s", self, s) start_action = NullAction diff --git a/pygoap/blackboard.py b/pygoap/blackboard.py index 797cb5d..1783f1c 100644 --- a/pygoap/blackboard.py +++ b/pygoap/blackboard.py @@ -8,14 +8,14 @@ class MemoryManager(set): """ Store and manage precepts. - shared blackboards violate reality in that multiple agents share the same - thoughts, to extend the metaphore. but, the advantage of this is that in + Shared blackboards violate reality in that multiple agents share the same + thoughts, to extend the metaphor. But, the advantage of this is that in a real-time simulation, it gives the player the impression that the agents - are able to collobroate in some meaningful way, without a significant - impact in performace. + are able to collaborate in some meaningful way, without a significant + impact in performance. - that being said, i have chosen to restrict blackboards to a per-agent - basis. this library is meant for rpgs, where the action isn't real-time + That being said, i have chosen to restrict blackboards to a per-agent + basis. This library is meant for RPGs, where the action isn't real-time and would require a more realistic simulation of intelligence. """ diff --git a/pygoap/goals.py b/pygoap/goals.py index 8592339..2ff2d71 100644 --- a/pygoap/goals.py +++ b/pygoap/goals.py @@ -3,7 +3,7 @@ planning. Goals are known to the agent and are constantly monitored and evaluated. The agent will attempt to choose the most relevant goal for it's state (determined by the blackboard) and then the planner will determine a -plan for the agent to follw that will (possibly) satisfy the chosen goal. +plan for the agent to follow that will (possibly) satisfy the chosen goal. See the modules effects.py and goals.py to see how these are used. @@ -15,6 +15,7 @@ """ from memory import MemoryManager +from environment2d import distance from precepts import * import sys, logging @@ -186,13 +187,13 @@ class PositionGoal(GoalBase): def test(self, memory): """ - search memory for last known position of the target if target is not - in agent's memory return 0.0. + search memory for last known position of the target + if target is not in agent's memory then return 0.0. - do pathfinding and determine if the target is accessable - - if not return 0.0 + do pathfinding and determine if the target is accessible + if not return 0.0 - determine the distance required to travel to the target + Determine the distance required to travel to the target return 1.0 if the target is reachable """