def main(): #Declare the variable that is used to end the loop loopend = False #This loop will always loop back to the main menu, prompting the user for a choice until they press play, or exit. while loopend == False: #We declare inRules to be False, which will prevent the ""invalidChoice"" functioning from running when the user presses 'any key' in the rules. inRules = False #We get the user's choice UserChoice = MainMenu() if UserChoice == '1': #User wants to play! #Here we set up the board and prompt them for a move TurtleMove.setup() TurtleMove.prompt_move() #So we must end the loop loopend = True else: #Check if the user wannts to see the rules or quit if UserChoice == '2': show_rules() #update inRules to prevent the invalidChoice function from running in line inRules = True if UserChoice == '3': #The user sucks and wants to quit exit() #Here we check if the user made a valid choice and dsiplay the appropriate text if they did not. if UserChoice is not '1' or '2' or '3': #This if statement will prevent InvalidChoice from running when the user is viewing the rules if inRules == False: if loopend == False: InvalidChoice()
print(column, "Column") #Prints the Column Letter print(row, "Row") #Prints the Row Number # print(game_state[moveIDX], ": Character at the move's index number.") #Prints the character at the index [moveIDX] print(moveIDX, "Index number of new move") #Takes the move and converts it to the index number for the string print(new_state) #Prints the new_state with the character at index.moveIDX in place print() ########################## return new_state #returns the new_state, The updated move. #Sets up the board using the pieces and reading through the string. def setup2(): """ new_state = stringInterpretSetup(("NNNNNNNN" * 8), "D4", -2) new_state = stringInterpretSetup((new_state), "E4", -1) new_state = stringInterpretSetup((new_state), "D5", -1) new_state = stringInterpretSetup((new_state), "E5", -2) """ new_state = "NNNNNNNNNNNNNNNNNNNNNNNNNNNBWNNNNNNWBNNNNNNNNNNNNNNNNNNNNNNNNNNN" start_board = stringToPiece(new_state) for turn in range(64): new_state = stringInterpret(new_state, input("Move?"), turn + 1) if __name__ == "__main__": TurtleMove.setup() setup2() Constants.WINDOW.exitonclick()