def __init__(self): espeak.synth("Hello Master!") self.rec = VoiceRecognizer() self.actions = ActionManager().loadActions() self.canHear = True
def __init__(self): espeak.synth("Hello Master!") self.rec = VoiceRecognizer() self.actions = ActionManager().loadActions() # Variable used for command voice control, if True the voice command is executed self.canHear = True
def main(): # First of all, load the registry registry = Registry() # Initialize player, display_manager player = Actor(Actors.HERO, "Player", '@', Colors.WHITE, behavior=None, registry=registry) # XXX: Give player level boost for testing purposes player.level = 10 # Initialize Dungeon dungeon = Dungeon() dungeon.initialize(player, registry) # Initialize Display Manager display_manager = DisplayManager(player, dungeon) message("Hello world!", Colors.RED) # Initialize Action Manager action_manager = ActionManager(player, dungeon) # Game loop while not tdl.event.is_window_closed(): display_manager.refresh() # TODO: Add player and enemy turn states and cycle between both # Player turn # TODO: Use game states to handle turns action_manager.get_user_input() if action_manager.handle_key_input() is False: continue # Enemy turn for entity in dungeon.current_level.entities: entity.take_turn(player) # Check for player death # TODO: Handle player death as a game state if player.dead: # TODO: Show death screen print("You died!") return 0
def initialize(self, id, num_players, k, board, deck_type, my_hand, hands, discard_pile, deck_size): """ To be called once before the beginning. """ self.id = id self.num_players = num_players self.k = k # number of cards per hand self.board = board self.deck_type = deck_type # store a copy of the full deck self.full_deck = get_appearance(DECKS[deck_type]()) self.full_deck_composition = Counter(self.full_deck) # hands self.my_hand = my_hand # says in which positions there is actually a card self.hands = hands # discard pile self.discard_pile = discard_pile # deck size self.deck_size = deck_size # for each of my card, store its possibilities self.possibilities = [Counter(self.full_deck) for i in range(self.k)] # remove cards of other players from possibilities self.update_possibilities() # knowledge of all players self.knowledge = [[ Knowledge(color=False, number=False) for j in range(k) ] for i in range(num_players)] # hints scheduler self.hints_scheduler = HintsScheduler(self) # action manager self.action_manager = ActionManager(self)
def __init__(self, version, parent=None): QtGui.QMainWindow.__init__(self, parent) self.version = version self.modules = [] self.viewers = {} self.menus = MenuManager(self) self.actions = ActionManager(self) self.createUI() self.createActions() self.createMenus() self.themes = ThemeManager(self) self.plugins = {} self.setContextMenuPolicy(QtCore.Qt.NoContextMenu) self.dockWidgets = [] self.windowManager = WindowManager(self) self.statusBar().showMessage( self.tr("Gorgon: Protein Visualization Suite")) self.setWindowTitle(self.tr("Gorgon - v" + self.version)) pathname = os.path.abspath(os.path.dirname(sys.argv[0])) self.setWindowIcon(QtGui.QIcon(pathname + '/gorgon.ico'))
def custom_objects(robot: cozmo.robot.Robot): # Gestionnaires d'évennements à chaque fois que Cozmo vois ou arrète de voir un objet robot.add_event_handler(cozmo.objects.EvtObjectAppeared, handle_object_appeared) robot.add_event_handler(cozmo.objects.EvtObjectDisappeared, handle_object_disappeared) # Création des custom objects objs = objects(robot) if None not in objs: print("All objects defined successfully!") else: print("One or more object definitions failed!") return robot.say_text("À la recherche des objet").wait_for_completed() setup_camera(robot) origin = robot.pose am = ActionManager(robot) stops = 1 while len(stops_visited) < 6: # Chercer les objest lookaround = robot.start_behavior( cozmo.behavior.BehaviorTypes.LookAroundInPlace) objs = robot.world.wait_until_observe_num_objects( num=1, object_type=CustomObject, timeout=60) lookaround.stop() if objs[0].object_type in stops_visited: continue stops_visited.append(objs[0].object_type) robot.say_text("Objet trouvé").wait_for_completed() if len(objs) > 0: photo(robot) pose = custom_object_pose(robot, objs[0]) robot.go_to_pose(pose, relative_to_robot=False).wait_for_completed() photo(robot) robot.say_text(f"Arrête {stops}").wait_for_completed() am.launch(objs[0]) print("origin: ", origin) robot.go_to_pose(origin, relative_to_robot=False).wait_for_completed() stops += 1 else: print("Cannot locate custom box") robot.play_anim_trigger( cozmo.anim.Triggers.SparkSuccess).wait_for_completed() while True: time.sleep(0.1)
def __init__(self): parser_description = 'Syncronizes a folder with a Google Drive account' parser_epilog = 'Please notice that this software is still under development' main_parser = argparse.ArgumentParser(prog='jds', description=parser_description, epilog=parser_epilog, add_help=False) subparsers = main_parser.add_subparsers(title='Commands', dest='command', metavar='') # Basic ops download_parser = subparsers.add_parser('download', help=HELPS['download'][0], add_help=False) list_parser = subparsers.add_parser('list', help=HELPS['list'][0], add_help=False) mkdir_parser = subparsers.add_parser('mkdir', help=HELPS['mkdir'][0], add_help=False) move_parser = subparsers.add_parser('move', help=HELPS['move'][0], add_help=False) rename_parser = subparsers.add_parser('rename', help=HELPS['rename'][0], add_help=False) rm_parser = subparsers.add_parser('remove', help=HELPS['remove'][0], add_help=False) untrash_parser = subparsers.add_parser('untrash', help=HELPS['untrash'][0], add_help=False) # Sync ops start_parser = subparsers.add_parser('start', help=HELPS['start'][0], add_help=False) subparsers.add_parser('stop', help=HELPS['stop'][0]) subparsers.add_parser('pause', help=HELPS['pause'][0]) self.add_download_parser(download_parser) self.add_list_parsers(list_parser) self.add_move_parsers(move_parser) self.add_mkdir_parsers(mkdir_parser) self.add_rename_parsers(rename_parser) self.add_rm_parsers(rm_parser) self.add_untrash_parsers(untrash_parser) self.add_start_parsers(start_parser) self.add_options(main_parser) if len(sys.argv) == 1: print(main_parser.format_help()) return args = main_parser.parse_args() # Just need drive session if performing any task with session if args.command is not None\ or args.sync_cache\ or args.sync_mirror: session = DriveSession(CREDENTIALS_FILE) print('Drive session started') root_file = session.get_service().files().get( fileId='root').execute() am = ActionManager(session.get_service(), root_file) sc = SyncController(session.get_service(), am, root_file) else: am = ActionManager(None, None) sc = SyncController(None, am, None) config_manager = ConfigManager() #Operations if args.command == 'download': for file1 in args.download_files: am.download(file1, destination=args.download_destination) elif args.command == 'list': if args.list_file == 'root': am.list_files('root', args.list_trash) else: for file1 in args.list_file: if len(args.list_file) > 1: print(file1, ':', sep='') am.list_files(file1) elif args.command == 'mkdir': for file1 in args.mkdir_file: am.mkdir(file1) elif args.command == 'move': am.move(args.move_origin, args.move_destination[0]) elif args.command == 'rename': am.rename(args.rename_file, args.rename_name[0]) elif args.command == 'remove': for file1 in args.rm_files: am.rm(file1, args.force_remove, args.trash_remove) elif args.command == 'untrash': for file1 in args.untrash_files: am.untrash(file1) #Sync elif args.command == 'start': sc.start(args.start_target) elif args.command == 'stop': sc.stop() elif args.command == 'pause': sc.pause() #Options # -sc if args.show_cache: am.show_cache() # -cc if args.clear_cache: am.clear_cache() # -syc if args.sync_cache: am.sync_cache() # -sym if args.sync_mirror: sc.sync_mirror(filter_enabled=config_manager.get_filter_enabled()) # -sm if args.show_mirror: sc.show_mirror() # -cm if args.clear_mirror: sc.clear_mirror() # filter settings # -b if args.add_blacklist is not None: if args.add_blacklist: config_manager.append_blacklist_files(args.add_blacklist) if not config_manager.get_blacklist_enabled(): config_manager.switch_blacklist_enabled() else: config_manager.switch_blacklist_enabled() # -w elif args.add_whitelist is not None: if args.add_whitelist: config_manager.append_whitelist_files(args.add_whitelist) if not config_manager.get_whitelist_enabled(): config_manager.switch_whitelist_enabled() else: config_manager.switch_whitelist_enabled() # -rb elif args.remove_blacklist is not None: config_manager.remove_from_blacklist(args.remove_blacklist) # -rw elif args.remove_whitelist is not None: config_manager.remove_from_whitelist(args.remove_whitelist) # -B elif args.set_blacklist is not None: config_manager.set_blacklist_files(args.set_blacklist) if not config_manager.get_blacklist_enabled(): config_manager.switch_blacklist_enabled() # -W elif args.set_whitelist is not None: config_manager.set_whitelist_files(args.set_whitelist) if not config_manager.get_whitelist_enabled(): config_manager.switch_whitelist_enabled() # -sf if args.show_filter: config_manager.show_filter_status() # -dc if args.download_cache: am.download_cache() # -dm if args.download_mirror: sc.download_mirror()
def __init__(self): self.contexts = {} self.previous_contexts = {} self.switching_contexts = Lock() self.am = ActionManager(self)
def __init__(self): self.db = database.DataBase() self.action_manager = ActionManager()