def module_info(self, module, showInfo=True, showTitle=True): if showTitle == True: messages.title() if showInfo: # extract the payload class name from the instantiated object, then chop off the load folder prefix #modulename = "/".join(str(str(module.__class__)[str(module.__class__).find("ClassName"):]).split(".")[0].split("/")[1:]) print helpers.color(" Module information:\n", blue=True) print "\tName:\t\t" + module.name print "\tLanguage:\t" + module.language # format this all nice-like print helpers.formatLong("Description:", module.description) # if required options were specified, output them if hasattr(module, 'required_options'): print helpers.color("\n Required Options:\n", blue=True) print " Name\t\t\tCurrent Value\tDescription" print " ----\t\t\t-------------\t-----------" # sort the dictionary by key before we output, so it looks nice for key in sorted(module.required_options.iterkeys()): print " %s\t%s\t%s" % ('{0: <16}'.format(key), '{0: <8}'.format( module.required_options[key][0]), module.required_options[key][1]) print ""
def module_info(self, module, showInfo=True, showTitle=True): if showTitle == True: messages.title() if showInfo: # extract the payload class name from the instantiated object, then chop off the load folder prefix #modulename = "/".join(str(str(module.__class__)[str(module.__class__).find("ClassName"):]).split(".")[0].split("/")[1:]) print helpers.color(" Module information:\n", blue=True) print "\tName:\t\t" + module.name print "\tLanguage:\t" + module.language # format this all nice-like print helpers.formatLong("Description:", module.description) # if required options were specified, output them if hasattr(module, 'required_options'): print helpers.color("\n Required Options:\n", blue=True) print " Name\t\t\tCurrent Value\tDescription" print " ----\t\t\t-------------\t-----------" # sort the dictionary by key before we output, so it looks nice for key in sorted(module.required_options.iterkeys()): print " %s\t%s\t%s" % ('{0: <16}'.format(key), '{0: <8}'.format(module.required_options[key][0]), module.required_options[key][1]) print ""
def main_menu(self, showMessage=True): cmd = "" try: while cmd == "": if showMessage: # print the title, where we are, and number of payloads loaded messages.main_menu(self.modules) messages.help_msg(self.commands) cmd = raw_input(helpers.color(' OFF -> ', blue=True)).strip() # handle our tab completed commands if cmd.startswith("help"): messages.title() messages.help_msg(self.commands) cmd = "" showMessage = False elif cmd.startswith("use"): messages.title() self.call_handler(cmd) cmd = "" elif cmd.startswith("list"): if len(cmd.split()) == 1: messages.title() self.list_modules() cmd = "" showMessage = False elif cmd.startswith("update"): if len(cmd.split()) == 1: messages.title() self.list_modules() cmd = "" showMessage = False # catch any ctrl + c interrupts except KeyboardInterrupt: if self.oneRun: # if we're being invoked from external code, just return # an empty string on an exit/quit instead of killing everything return "" else: print helpers.color("\n\n [!] Exiting...\n", warning=True) sys.exit()
def main_menu(self, showMessage=True): cmd = "" try: while cmd == "": if showMessage: # print the title, where we are, and number of payloads loaded messages.main_menu(self.modules) messages.help_msg(self.commands) cmd = raw_input(helpers.color(' OFF -> ', blue=True)).strip() # handle our tab completed commands if cmd.startswith("help"): messages.title() messages.help_msg(self.commands) cmd = "" showMessage=False elif cmd.startswith("use"): messages.title() self.call_handler(cmd) cmd = "" elif cmd.startswith("list"): if len(cmd.split()) == 1: messages.title() self.list_modules() cmd = "" showMessage=False elif cmd.startswith("update"): if len(cmd.split()) == 1: messages.title() self.list_modules() cmd = "" showMessage=False # catch any ctrl + c interrupts except KeyboardInterrupt: if self.oneRun: # if we're being invoked from external code, just return # an empty string on an exit/quit instead of killing everything return "" else: print helpers.color("\n\n [!] Exiting...\n", warning=True) sys.exit()
def main(): count = 0 messages.title() user = messages.welcome_message(messages.name_prompt()) my_array = menu_2048.start_game() if my_array[0].count(2) > 1 or my_array[1].count( 2) > 1 or my_array[2].count(2) > 1 or my_array[3].count(2) > 1: count = int( file_handler_2048.heigh_score_import( "score_of_the_saved_game.csv")) controls = messages.set_controls() high_score = int(file_handler_2048.heigh_score_import("high_score.csv")) while True: design_2048.mapp(my_array) messages.current_player(user) print("\x1B[1mScore:\x1B[0m " + str(count) + " |", end=" ") print("\x1B[1mHigh Score:\x1B[0m " + str(high_score)) messages.defined_controls(controls) check_the_free_place_of_the_table = copy.deepcopy(my_array) move_2048.full_map(check_the_free_place_of_the_table) if my_array == check_the_free_place_of_the_table: design_2048.mapp(my_array) if count > high_score: file_handler_2048.heigh_score_export(count, "high_score.csv") break move = input("Command: ") if move == controls[0]: last_my_array = copy.deepcopy(my_array) move_2048.move_up(my_array) count = count + move_2048.up_addition(my_array) move_2048.no_move(my_array, last_my_array) design_2048.mapp(my_array) if move == controls[1]: last_my_array = copy.deepcopy(my_array) move_2048.down_move(my_array) count = count + move_2048.down_addition(my_array) move_2048.no_move(my_array, last_my_array) design_2048.mapp(my_array) if move == controls[2]: last_my_array = copy.deepcopy(my_array) move_2048.left_move(my_array) count = count + move_2048.left_addition(my_array) move_2048.no_move(my_array, last_my_array) design_2048.mapp(my_array) if move == controls[3]: last_my_array = copy.deepcopy(my_array) move_2048.right_move(my_array) count = count + move_2048.right_addition(my_array) move_2048.no_move(my_array, last_my_array) design_2048.mapp(my_array) if move == 'q': menu_2048.menu_exit(my_array, high_score, count) os.system("clear") design_2048.mapp(my_array) print("-=Game Over=-")