def main(): """ overall function, checks the spreadsheet and outputs the errors """ workbook = open_workbook(sys.argv[1], on_demand=True) errorMessageList_setup = [] errorMessageList_questions = [] errorMessageList_choices = [] print "" if not check4correctSheets(workbook, errorMessageList_setup): for error in errorMessageList_setup: print error return "FATAL ERROR -- incorrect sheets in workbook" print "checking for correct worksheets.......................................OK!" # I wonder if it's ok to only have user input questions, and then no choices sheet or a blank one? # This definitely has to get checked and parsed before the survey questions can get checked if not choicesSheetHasCorrectSetup(workbook, errorMessageList_setup): for error in errorMessageList_setup: print error return "FATAL ERROR -- choices could not be parsed" choicesDict = parseChoices(workbook, errorMessageList_choices) print "checking choices sheet setup..........................................OK!" if not surveySheetHasCorrectSetup(workbook, errorMessageList_setup): for error in errorMessageList_setup: print error return "FATAL ERROR -- survey could not be parsed" questionsList = parseQuestions(workbook) print "checking survey sheet setup...........................................OK!" checkQuestions(questionsList, errorMessageList_questions) # This matters less so I put it below the other two so that they could still get checked if this fails if not settingsSheetHasCorrectSetup(workbook, errorMessageList_setup): for error in errorMessageList_setup: print error return "FATAL ERROR -- survey could not be parsed" print "checking settings sheet setup.........................................N/A" print "" if len(errorMessageList_choices) > 0: for error in errorMessageList_choices: print error print "" if len(errorMessageList_questions) > 0: for error in errorMessageList_questions: print error print "" print "Enjoy your survey!....................................................OK!" print ""
def game(): # On charge les questions questions = parseQuestions() menu() # Initialisation des variables de depart dead = 0 nb_people = [25] nb_wealth = [25] # Tant qu'on n'est pas mort et qu'il reste des questions while (len(questions) and not dead): print("\nPeuple:", nb_people[0]) print("Richesse:", nb_wealth[0]) # Recuperer la fonction et la supprimer du tableau question = getQuestion(questions) if (verbose): question.debug() # Afficher le dilemne showMonthQuestion(question) # Recuperer le choix choice = readChoice(question, nb_people, nb_wealth) # Appliquer l'effet de la question applyEffect(nb_people, nb_wealth, question, choice) # Check si on est dans les limites (peuple, richesse) if (checkDead(nb_people[0], nb_wealth[0])): dead = 1 # yes la meuf est dead if (dead): print("t mort pas dchance lol")
def main(): """ overall function, checks the spreadsheet and outputs the errors """ #workbook = open_workbook(sys.argv[1], on_demand=True) data = get_data(sys.argv[1]) workbookString = json.dumps(data) workbookDict = ast.literal_eval(workbookString) errorMessageList_setup = [] errorMessageList_questions = [] errorMessageList_choices = [] print "" if not check4correctSheets(workbookDict, errorMessageList_setup): for error in errorMessageList_setup: print error print "FATAL ERROR -- incorrect sheets in workbook" return False print "checking for correct worksheets.......................................OK!" # I wonder if it's ok to only have user input questions, and then no choices sheet or a blank one? # This definitely has to get checked and parsed before the survey questions can get checked if not choicesSheetHasCorrectSetup(workbookDict, errorMessageList_setup): for error in errorMessageList_setup: print error print "FATAL ERROR -- choices could not be parsed" return False choicesDict = parseChoices(workbookDict, errorMessageList_choices) print "checking choices sheet setup..........................................OK!" if not surveySheetHasCorrectSetup(workbookDict, errorMessageList_setup): for error in errorMessageList_setup: print error print "FATAL ERROR -- survey could not be parsed" return False questionsList = parseQuestions(workbookDict, errorMessageList_questions) ########SKETCHY######### questionsList = questionsList[:263] #print "there are this many questions: "+str(len(questionsList)) # print questionsList[-3].__dict__ print "checking survey sheet setup...........................................OK!" checkQuestions(questionsList, errorMessageList_questions, choicesDict) # This matters less so I put it below the other two so that they could still get checked if this fails if not settingsSheetHasCorrectSetup(workbookDict, errorMessageList_setup): for error in errorMessageList_setup: print error print "FATAL ERROR -- survey could not be parsed" return False print "checking settings sheet setup.........................................N/A" print "" if len(errorMessageList_choices) > 0: for error in errorMessageList_choices: print error print "" if len(errorMessageList_questions) > 0: for error in errorMessageList_questions: print error print "" print "Enjoy your survey!....................................................OK!" print "" return True