Beispiel #1
0
 def gen_goals(self, verbose):
     world = self.mem.get(self.memKeys.MEM_STATES)[-1]
     blocks = blockstate.get_block_list(world)
     goal = self.tree.givegoal(blocks)
     if goal:
     	goal.priority = 1
     	return [goal]
     return []
Beispiel #2
0
	def gen_goals(self, verbose):
		world = self.mem.get(self.memKeys.MEM_STATES)[-1]
		block = self.random_fired_block(world)
		if not block:
			return []
		blocks = blockstate.get_block_list(world)
		for realblock in blocks:
			if realblock.id == block.name:
				block = realblock
				break
		goal = Goal(Goal.GOAL_NO_FIRE, [block])
		goal.priority = 1 #higher than stacking
		return [goal]
Beispiel #3
0
	def gen_goals(self, verbose):
		self.counter += 1
		if self.counter <= 1:
			return []

		world = self.mem.get(self.memKeys.MEM_STATES)[-1]
		blockset = blockstate.get_block_list(world)
		s = self.mem.get(self.memKeys.SOCKET_R)

		if verbose >= 2:
			print "In gengoal_fire.py"

		if s:
			text = s.recv(self.bufferSize)

			with open(self.logfile, 'a') as f:
				f.write(text)
				f.write("\n%s\n" % ("*"*75))

			if text != "None\n":
				if verbose >= 2:
					print "HERE IS TEXT: " + text

				# parse text
				p = Parser()
				frames = p.makeframegraph(text)

				# create mapping
				noem = {}   # Node Operator Effect Mapping
							# Keys are node/frame names, values are lists of [operatorname, effect] pairs

				noem['CRIMINAL-VOLITIONAL-AGENT.4697'] = [['apprehend', OPERATOR_EFFECT_NEGATION]]

				# Traverse
				t = Traverser(frames, noem)
				(frame, operator, effect) = t.traverse()

				if operator == "apprehend":
					return Goal(Goal.GOAL_APPREHEND, ["Gui Montag"])
				else:
					print "Unrecognized operator(!): " + str(operator) + ", now producing standard extinguish goal."
					for block in blockset:
						if block.onfire:
							return Goal(Goal.GOAL_NO_FIRE, [block])
Beispiel #4
0
 def gen_goals(self, verbose):
     world = self.mem.get(self.memKeys.MEM_STATES)[-1]
     blocks = blockstate.get_block_list(world)
     return [self.tree.givegoal(blocks)]