Esempio n. 1
0
 def __init__(self, what):
     Goal.__init__(self,"move this thing to my inventory (class)",
                   self.is_it_with_me,
                   [move_me_to_possession(what),
                    self.pick_it_up])
     self.what=what
     self.vars=["what"]
Esempio n. 2
0
 def __init__(self, what, location, speed=0):
     Goal.__init__(self, "move this to certain place", self.is_it_at_loc, [self.move_it_to_loc])
     self.what = what
     self.speed = speed
     self.location = location
     self.wait = 0
     self.vars = ["what", "location", "speed", "wait"]
Esempio n. 3
0
 def __init__(self, what):
     Goal.__init__(self, "acquire thing by name",
                   self.is_it_in_my_inventory,
                   [get_knowledge(what),
                    acquire_known_thing(what)])
     self.what = what
     self.vars = ["what"]
Esempio n. 4
0
 def __init__(self, location, range=30):
     Goal.__init__(self, "move me to certain area", self.am_I_in_area, [move_me(location), self.latch_loc])
     self.location = location
     self.range = range
     self.square_range = range * range
     self.arrived = 0
     self.vars = ["location", "range", "arrived"]
Esempio n. 5
0
 def __init__(self, who):
     Goal.__init__(self, "stay with someone",
                   self.am_i_with, 
                   [spot_something(who),
                    self.follow])
     self.who=who
     self.vars=["who"]
Esempio n. 6
0
 def __init__(self, what):
     Goal.__init__(self, "acquire known thing by name",
                   self.is_it_in_my_inventory,
                   [buy_thing(what),
                    pick_up_possession(what)])
     self.what = what
     self.vars = ["what"]
Esempio n. 7
0
 def __init__(self, what, where):
     Goal.__init__(self, "Keep " + what + " in " + where + ".",
                   self.are_they_there,
                   [self.keep_it])
     self.what = what
     self.where = where
     self.vars = ["what", "where"]
Esempio n. 8
0
 def __init__(self, location, speed=1):
     Goal.__init__(self,"move me to certain place",
                   self.am_I_at_loc,
                   [self.move_to_loc])
     self.location=location
     self.speed=speed
     self.vars=["location", "speed"]
Esempio n. 9
0
 def __init__(self):
     Goal.__init__(self, "forage for food by name and eat randomly",
                   self.am_i_full,
                   [self.do_peck])
     self.what = "world"
     self.full = 0.2
     self.vars = ["full"]
Esempio n. 10
0
 def __init__(self, what, cost, who, desc="buy livestock from someone"):
     Goal.__init__(self, desc, false,
                   [self.check])
     self.what=what
     self.cost=cost
     self.who=who
     self.last_valued=None
     self.vars=["what","cost","who","last_valued"]
Esempio n. 11
0
 def __init__(self, locations, extragoal=None):
     Goal.__init__(self, "patrol an area", false,
                   [move_me(locations[0]), extragoal, self.increment],
                   self.check_move_valid)
     self.list = locations
     self.stage = 0
     self.count = len(locations)
     self.vars = ["stage", "list"]
Esempio n. 12
0
 def __init__(self, what, range, proximity=5):
     Goal.__init__(self, "hunt for something", self.in_range, [self.run])
     self.what = what
     self.range = range
     self.proximity = proximity
     self.square_proximity = proximity * proximity
     self.direction = 1
     self.vars = ["what", "range", "direction"]
Esempio n. 13
0
 def __init__(self, location, radius=0.5, speed=0.5):
     Goal.__init__(self, "move me to certain place", self.am_I_at_loc,
                   [self.move_to_loc], self.is_reachable)
     self.location = location
     self.speed = speed
     self.radius = radius
     self.vars = ["location", "speed", "radius"]
     self.squared_radius = radius * radius
Esempio n. 14
0
 def __init__(self, what, location, speed=0):
     Goal.__init__(self, "move this to certain place", self.is_it_at_loc,
                   [self.move_it_to_loc])
     self.what = what
     self.speed = speed
     self.location = location
     self.wait = 0
     self.vars = ["what", "location", "speed", "wait"]
Esempio n. 15
0
 def __init__(self, what="", range=0, proximity=5):
     Goal.__init__(self, "hunt for something", self.in_range,
                   [pursuit(what=what, range=range)])
     self.what = what
     self.range = range
     self.proximity = proximity
     self.square_proximity = proximity * proximity
     self.vars = ["what", "range", "proximity"]
Esempio n. 16
0
 def __init__(self, what, cost, who, desc="buy livestock from someone"):
     Goal.__init__(self, desc, false,
                   [self.check])
     self.what = what
     self.cost = cost
     self.who = who
     self.last_valued = None
     self.vars = ["what", "cost", "who", "last_valued"]
Esempio n. 17
0
 def __init__(self, what, src, dest):
     Goal.__init__(
         self, "move thing to place", false,
         [FetchSomething(what, src),
          MoveMe(dest),
          MoveItOutOfMe(what)])
     self.what = what
     self.vars = ["what"]
Esempio n. 18
0
 def __init__(self, what, where):
     Goal.__init__(
         self, "fetch a thing", self.is_it_in_my_inventory,
         [MoveMeArea(where, 20),
          SpotSomething(what),
          PickUpFocus(what)])
     self.what = what
     self.vars = ["what"]
Esempio n. 19
0
 def __init__(self, what, src, dest):
     Goal.__init__(self, "move thing to place",
                   false,
                   [fetch_something(what, src),
                    move_me(dest),
                    move_it_outof_me(what)])
     self.what = what
     self.vars = ["what"]
Esempio n. 20
0
 def __init__(self, what, range):
     Goal.__init__(
         self, "defend against something", self.none_in_sight,
         [spot_something(what),
          hunt_for(what, range), self.fight])
     self.what = what
     self.range = range
     self.vars = ["what", "range"]
Esempio n. 21
0
 def __init__(self, what, range, proximity=5):
     Goal.__init__(self, "hunt for something", self.in_range, [self.run])
     self.what = what
     self.range = range
     self.proximity = proximity
     self.square_proximity = proximity * proximity
     self.direction = 1
     self.vars = ["what", "range", "direction"]
Esempio n. 22
0
 def __init__(self, what):
     Goal.__init__(self, "search for a thing",
                   self.do_I_have,
                   [wander(false),
                    spot_something(what, 30)])
     # Long range for testing only
     self.what=what
     self.vars=["what"]
Esempio n. 23
0
 def __init__(self, what, amount, what_desc="some thing", place=None):
     Goal.__init__(self, "make certain amount of things",
                   self.are_all_done,
                   [move_me(place), self.do_all])
     self.what = what
     self.amount = amount
     self.what_desc = what_desc
     self.vars = ["what", "amount"]
Esempio n. 24
0
 def __init__(self, what, who, cost):
     Goal.__init__(self, "conduct transaction", self.transaction_inactive,
                   [self.transact])
     self.what = what
     self.who = who
     self.cost = int(cost)
     self.payed = 0
     self.vars = ["what", "who", "cost", "payed"]
Esempio n. 25
0
 def __init__(self, what, src, dest):
     Goal.__init__(self, "move thing to place", false, [
         fetch_something(what, src),
         move_me(dest),
         move_it_outof_me(what)
     ])
     self.what = what
     self.vars = ["what"]
Esempio n. 26
0
 def __init__(self, what, where):
     Goal.__init__(self, "fetch a thing",
                   self.is_it_in_my_inventory,
                   [move_me_area(where, 20),
                    spot_something(what),
                    pick_up_focus(what)])
     self.what = what
     self.vars = ["what"]
Esempio n. 27
0
 def __init__(self, radius, locations):
     Goal.__init__(self,"roam randomly",false,
                   [move_me(None),
                    self.do_roaming])
     self.list = locations
     self.radius = radius
     self.count = len(locations)
     self.vars = ["radius", "list"]
Esempio n. 28
0
 def __init__(self, messages, responses, target):
     Goal.__init__(self, "help", self.message_complete, [self.give_help])
     self.iter = 0
     self.count = len(messages)
     self.messages = messages
     self.responses = responses
     self.target = target
     self.vars = ["iter", "count", "messages", "responses", "target"]
Esempio n. 29
0
 def __init__(self, messages, responses, target):
     Goal.__init__(self, "help", self.message_complete, [self.give_help])
     self.iter = 0
     self.count = len(messages)
     self.messages = messages
     self.responses = responses
     self.target = target
     self.vars = ["iter", "count", "messages", "responses", "target"]
Esempio n. 30
0
 def __init__(self, what):
     Goal.__init__(self, "search for a thing",
                   self.do_I_have,
                   [wander(),
                    spot_something(what, 30)])
     # Long range for testing only
     self.what=what
     self.vars=["what"]
Esempio n. 31
0
 def __init__(self, what, where):
     Goal.__init__(self, "fetch a thing", self.is_it_in_my_inventory, [
         move_me_area(where, 20),
         spot_something(what),
         pick_up_focus(what)
     ])
     self.what = what
     self.vars = ["what"]
Esempio n. 32
0
 def __init__(self, radius, locations):
     Goal.__init__(self,"roam randomly",false,
                   [move_me(None),
                    self.do_roaming])
     self.list = locations
     self.radius = radius
     self.count = len(locations)
     self.vars = ["radius", "list"]
Esempio n. 33
0
 def __init__(self, what):
     Goal.__init__(self, "move this thing to my inventory (class)",
                   self.is_it_with_me,
                   [move_me_to_focus(what), self.pick_it_up])
     if type(what) == list:
         self.what = what
     else:
         self.what = [what]
     self.vars = ["what"]
Esempio n. 34
0
 def __init__(self, locations):
     Goal.__init__(self, "patrol an area",
                   false,
                   [move_me(locations[0]),
                    self.increment])
     self.list = locations
     self.stage = 0
     self.count = len(locations)
     self.vars = ["stage", "list"]
Esempio n. 35
0
 def __init__(self, what, distance=2):
     Goal.__init__(self, "move me to this thing", self.am_i_at_it, [self.move_me_to_it])
     if type(what) == types.ListType:
         self.what = what
     else:
         self.what = [what]
     # How close we need to get to the thing.
     self.distance = distance
     self.vars = ["what", "distance"]
Esempio n. 36
0
 def __init__(self, minTicks, maxTicks):
     Goal.__init__(self, "linger awhile", self.activated, [self.wait])
     self.minTicks = minTicks
     if maxTicks:
         self.maxTicks = maxTicks
     else:
         self.maxTicks = minTicks
     self.tickCounter = randint(self.minTicks, self.maxTicks)
     self.vars = ["minTicks", "maxTicks", "tickCounter"]
Esempio n. 37
0
 def __init__(self, what):
     Goal.__init__(
         self, "forage for food by name", self.am_i_full,
         [spot_something(what, range=5),
          pick_up_focus(what), self.eat])
     self.what = what
     self.range = 5
     self.full = 0.2
     self.vars = ["what", "range"]
Esempio n. 38
0
 def __init__(self, what):
     Goal.__init__(self, "clear focus",
                   self.clear_focus,
                   [])
     if isinstance(what, list):
         self.what = what
     else:
         self.what = [what]
     self.vars = ["what"]
Esempio n. 39
0
 def __init__(self, what, who, cost):
     Goal.__init__(self, "conduct transaction",
                   self.transaction_inactive,
                   [self.transact])
     self.what = what
     self.who = who
     self.cost = int(cost)
     self.payed = 0
     self.vars = ["what", "who", "cost", "payed"]
Esempio n. 40
0
 def __init__(self, what="", range=0, proximity=5):
     Goal.__init__(self, "hunt for something",
                   self.in_range,
                   [pursuit(what=what, range=range)])
     self.what = what
     self.range = range
     self.proximity = proximity
     self.square_proximity = proximity * proximity
     self.vars = ["what", "range", "proximity"]
Esempio n. 41
0
 def __init__(self, shop, updown, time):
     Goal.__init__(self, "run a shop",
                   self.is_it,
                   [spot_something(shop),
                    self.set_it], time)
     # FIXME This probably does not work, but I'll fix it when we need it
     self.shop = shop
     self.state = updown
     self.vars = ["shop"]
Esempio n. 42
0
 def __init__(self, what, range):
     Goal.__init__(self, "predate something", self.am_i_full, [
         spot_something(what, range=range),
         hunt_for(what, range), self.eat
     ])
     self.what = what
     self.range = range
     self.full = 0.1
     self.vars = ["what", "range"]
Esempio n. 43
0
 def __init__(self, what):
     Goal.__init__(self,"move me to this thing",
                   self.am_i_at_it,
                   [self.move_me_to_it])
     if type(what) == types.ListType:
         self.what = what
     else:
         self.what = [ what ]
     self.vars=["what"]
Esempio n. 44
0
 def __init__(self, what, range):
     Goal.__init__(self, "defend against something",
                   self.none_in_sight,
                   [spot_something(what),
                    hunt_for(what, range),
                    self.fight])
     self.what=what
     self.range=range
     self.vars=["what", "range"]
Esempio n. 45
0
 def __init__(self,
              condition_fn,
              goals_left,
              goals_right,
              desc="condition"):
     Goal.__init__(self, desc=desc, fulfilled=self.assess_condition)
     self.condition_fn = condition_fn
     self.goals_left = goals_left
     self.goals_right = goals_right
Esempio n. 46
0
 def __init__(self, what):
     # CHEAT!: doesn't work for static goals ;-(
     # goal systems needs redesign
     Goal.__init__(self, "buy thing by name (I am at shop)",
                   self.do_I_have_it,
                   [move_me_place(what),
                    self.buy_it])
     self.what = what
     self.vars = ["what"]
Esempio n. 47
0
 def __init__(self, what, location, range=30, condition=lambda a: 1, seconds_until_forgotten=30):
     Goal.__init__(self, "spot a thing in area",
                   self.do_I_have,
                   [self.do])
     self.range = range
     self.sqr_range = range * range
     self.area_location_name = location
     self.condition = condition
     self.inner_spot_goal = spot_something(what, range=range, seconds_until_forgotten=seconds_until_forgotten, condition=self.is_thing_in_area)
Esempio n. 48
0
 def __init__(self, location, range=30):
     Goal.__init__(self, "move me to certain area",
                   self.am_I_in_area,
                   [move_me(location),self.latch_loc])
     self.location=location
     self.range=range
     self.square_range=range*range
     self.arrived=0
     self.vars=["location","range","arrived"]
Esempio n. 49
0
 def __init__(self, whlist):
     Goal.__init__(self, "patrol an area",
                   false,
                   [move_me(whlist[0]),
                    self.increment])
     self.list = whlist
     self.stage = 0
     self.count = len(whlist)
     self.vars = ["stage", "list"]
Esempio n. 50
0
 def __init__(self, what, where, when=None):
     Goal.__init__(self, "Sell to the public",
                   self.dont_I_have_it,
                   [move_me(where),
                    self.announce_trade],
                   when)
     self.what = what
     self.ticks = 0
     self.vars = ["what"]
Esempio n. 51
0
 def __init__(self, what):
     Goal.__init__(self,"move this thing to my inventory (class)",
                   self.is_it_with_me,
                   [move_me_to_focus(what),
                    self.pick_it_up])
     if type(what) == types.ListType:
         self.what = what
     else:
         self.what = [ what ]
     self.vars=["what"]