def main(splash=True): """ The main function, how the system is mostly interacted with. """ login(splash) if splash: show_splash() print("Type below to interact with Paul.", "\nEnter 'bye' without quotes to exit.", "\n", "\nHello, {}".format(brain.paul.system.flags["USER"]["name"])) exit = False while not exit: try: command = input(brain.paul.get_prompt() + " ") if command.lower() == "bye": exit = True else: brain.process(command) except KeyboardInterrupt: exit = True print() except EOFError: exit = True print() brain.paul.interact("Bye!")
def think(self, command): com = command.get() if com.lower() == "bye": self.master.destroy() else: brain.process(com) command.delete(0, len(command.get()))
def interact(): loop = True # switch for when to turn off loop/stop asking for input while loop: input = raw_input(greeting()) if input.lower() == "no": break output = brain.process(input) print output
import ear, brain, mouth while True: your_voice = ear.heart() print("you :" + your_voice) robot_voice = brain.process(your_voice) print('robot :' + robot_voice) mouth.speak(robot_voice) if robot_voice == 'bye': break
temp_holder = "" temp_q_holder = "" def get_text_simple(): q = temp_holder code = ('display dialog "' + q + '" default answer ""\n' + 'set res to text returned of result\n' + 'return res') result = brain.paul.run_script(code, language="applescript", response=True) return result def set_text_simple(text): global temp_holder temp_holder = text brain.paul.send_notification(temp_q_holder, text) if len(argv) > 1: brain.login("default") paul = Application(Tk()) setup_gui(paul) brain.set_IO(set_text_simple, get_text_simple) temp_q_holder = " ".join(argv[1:]) brain.process(temp_q_holder) else: main()
cv.imshow("screen grab", restored) if recording: action = [ int(keyboard.is_pressed('w')), int(keyboard.is_pressed('a')), int(keyboard.is_pressed('s')), int(keyboard.is_pressed('d')) ] if (abs(np.max(action)) > 1): continue #the action and screenshot for each frame are a one dimensional array, with the first four numbers being the elements and the remaining elments being the flattened array of pixels from the screenshot saved_actions = np.vstack( (saved_actions, np.append(action, np.reshape(grayscale, (scaledw * scaledh))))) else: actions = brain.process(screenshot) if actions[0]: #W PressKey(0x11) if actions[1]: #A PressKey(0x1E) if actions[2]: #S PressKey(0x1F) if actions[3]: #D PressKey(0x20) if cv.waitKey(1) == ord('q') or keyboard.is_pressed("q"): cv.destroyAllWindows() break np.save( "data.npy", saved_actions[1:] ) #there is a slice because the first element is just all zeros, which is how I initialized the array so I could use vertical stack without worrying about trying to stack on top of nothing, which produces an error
try: command = input(brain.paul.get_prompt() + " ") if command.lower() == "bye": exit = True else: brain.process(command) except KeyboardInterrupt: exit = True print() except EOFError: exit = True print() brain.paul.interact("Bye!") if len(sys.argv) > 1: brain.login("default") items = None if sys.argv[1] == "-nw": if len(sys.argv) > 2: items = sys.argv[2:] else: main() elif sys.argv[1] == '-qnw': main(False) else: items = sys.argv[1:] if items: brain.process(" ".join(items)) else: main()