def bonus_game_menu():
    error_try_again = colours.error_try_again()
    bonus_game_menu_back_colour = colours.bonus_game_menu_back_colour()
    cls()
    for p in bonus_game_menu_back_colour:
        print(p)
    while True:
        menu_selection_main = input("\nType a selection: ").lower().strip()
        try:
            if menu_selection_main[0] == "n":
                cls()
                return bonus.bonus_player_game()
            elif menu_selection_main[0] == "q":
                return start_menu()
            else:
                for p in error_try_again:
                    print(p)
                print(
                    input(
                        "\n\nYou must type a single selection from the menu - try again !"
                    ))
                cls()
                return bonus_game_menu()
        except:
            for p in error_try_again:
                print(p)
            print(
                input(
                    "\n\nYou must type a single selection from the menu - try again !"
                ))
            cls()
            return bonus_game_menu()
def word_genre(
):  #function to ask which word set the player will be guessing from

    error_try_again = colours.error_try_again()

    print("\nChoose a word list: \n")
    print("""1. Generic Words
2. Girls Names""")

    while True:
        selection = input("\nEnter a selection: 1 or 2: ")
        try:
            if selection == "1":
                secret_word = words.secret_word_generic()
                return secret_word
            elif selection == "2":
                secret_word = words.secret_word_girls_names()
                return secret_word
            else:
                for p in error_try_again:
                    print(p)
                print(
                    input(
                        "\n\nYou must type a single digit from the menu - try again !\n\nPress ENTER to continue"
                    ))
                cls()
                return word_genre()
        except:
            for p in error_try_again:
                print(p)
            print(
                input(
                    "\n\nYou must type a single digit from the menu - try again !\n\nPress ENTER to continue"
                ))
            cls()
            return word_genre()
def two_player_game():

    secret_word = functions.word_genre()
    # secret_word = words.secret_word_generic()
    game_board_display = words.secret_string_word(secret_word)
    underlined_secret_word = "_" * len(secret_word)
    game_board_display = list(underlined_secret_word)

    now = datetime.now()
    player_1_cash = []
    player_2_cash = []
    player_1_cash_balance = 0
    player_2_cash_balance = 0
    player_1_cash_balance_return = 0
    player_2_cash_balance_return = 0
    used_letters = {"111"}
    date_time = now.strftime("%d/%m/%Y %H:%M:%S")
    player1 = True
    player2 = False
    game_true = True

    game_board_top_colour = colours.game_board_top_back_colour()
    game_board_bottom_colour = colours.game_board_bottom_back_colour()
    bankrupt_colour = colours.bankrupt_colour_back()
    what_is_your_name_two = colours.what_is_your_name_two()
    bonus_game_question_colour = colours.bonus_game_question_colour()
    solve_correct_colour = colours.solve_correct_colour()
    r2_d2_vowels = colours.r2_d2_vowels()
    guess_question = colours.guess_question()
    ask_save_colour = colours.ask_save_colour()
    error_try_again = colours.error_try_again()
    solve_incorrect_colour = colours.solve_incorrect_colour()
    cheat = colours.cheat()
    r2_d2_numbers = colours.r2_d2_numbers()


    for p in what_is_your_name_two:
        print(p)
    player_1 = input("\nEnter your name Player 1: ")
    player_2 = input("\nEnter your name Player 2: ")
    player_name_highlight_two_colour = colours.player_name_highlight_two(player_1, player_2)

    for p in player_name_highlight_two_colour:
        print(p)
    print(input("\n!! Press ENTER to continue !!"))
    cls()
    while game_true == True:
                                                        ####### Player 1 ##########
        while player1 == True:
            cls()
            player_1_cash_balance = player_1_cash_balance_return            #player 1s persistant cash balance
            for p in game_board_top_colour:
                print(p)
            print("|*|       " + "       ".join(game_board_display))        #player 1 gameboard footer
            for p in game_board_bottom_colour:
                print(p)
            two_player_foot_one = colours.two_player_foot_one(player_1, player_1_cash_balance)
            for p in two_player_foot_one:
                print(p)
            menu_selection = input("\nEnter your selection: ").lower().strip()
            print(secret_word)
            try:
                if menu_selection[0] == "s":
                    print(wheel)
                    cash_prize = words.cash_value()
                    if cash_prize == 0:
                        player_1_cash.clear()
                        for p in bankrupt_colour:                       #player spin lands on bankrupt
                            print(p)
                        player1 = False
                        player2 = True
                        print(input("\nPress ENTER to continue"))
                        cls()   
                    elif cash_prize != 0:                                #spin lands on a cash value - ask for letter and check the condition of it
                        ask_letter_colour = colours.ask_letter_colour(cash_prize)
                        for p in ask_letter_colour:
                            print(p)
                        guess_letter = input(f"\nEnter selection: ").lower()
                        if guess_letter in used_letters:                #check to see if its alreayd been used
                            for p in cheat:
                                print(p)
                            time.sleep(2)
                            player1 = False
                            player2 = True
                        elif guess_letter.isdigit():                   #it is a letter right ? 
                            for p in r2_d2_numbers:
                                print(p)
                            time.sleep(2)
                            player1 = False
                            player2 = True
                        else:
                            vowels = "aeiou"
                            m = vowels.find(guess_letter)
                            a = secret_word.find(guess_letter)          #as long as its not a vowel, and in the word and not used -- use it and
                                                                        # credit cash and kep player ones turn
                            if guess_letter in secret_word[a] and guess_letter not in vowels[m]:
                                m = secret_word.count(guess_letter)
                                n = m * cash_prize
                                player_1_cash.append(n)
                                player_1_cash_balance_return = sum(player_1_cash)
                                for i in range(len(secret_word)):
                                    if guess_letter == secret_word[i]:
                                        game_board_display[i] = secret_word[i]
                                yoda_yes = colours.yoda_yes(m, guess_letter)
                                for p in yoda_yes:
                                    print(p)
                                time.sleep(2)
                                used_letters.add(guess_letter)
                            elif guess_letter in secret_word and guess_letter in vowels:
                                for p in r2_d2_vowels:
                                    print(p)
                                time.sleep(2)
                                used_letters.add(guess_letter)
                                player1 = False
                                player2 = True
                            elif guess_letter not in secret_word and guess_letter in vowels:
                                for p in r2_d2_vowels:
                                    print(p)
                                time.sleep(2)
                                used_letters.add(guess_letter)
                                player1 = False
                                player2 = True
                            elif guess_letter not in secret_word and guess_letter not in vowels:
                                r2_d2_letters = colours.r2_d2_letters(guess_letter)
                                for p in r2_d2_letters:
                                    print(p)
                                time.sleep(2)
                                used_letters.add(guess_letter)
                                player1 = False
                                player2 = True

                elif menu_selection[0] == "p":                          #Solve the word
                    player_1_cash_balance_return = sum(player_1_cash)
                    player_2_cash_balance_return = sum(player_2_cash)
                    for p in guess_question:
                        print(p)
                    solve = input("\nEnter your guess ").lower().strip()

                    if solve == secret_word and player_1_cash_balance_return > player_2_cash_balance_return: #checks who has the most cash if solve
                                                                                                                #was correct as they win (p1)
                        cls()
                        for p in solve_correct_colour:
                            print(p)
                        l = f"\n{player_1} scored ${player_1_cash_balance_return} on the {date_time}"
                        print(input("\nPress ENTER to continue"))
                        two_player_solve_p1 = colours.two_player_solve_p1(player_1)
                        for p in two_player_solve_p1:
                            print(p)
                        time.sleep(3)
                        two_player_p1_win = colours.two_player_p1_win(player_1, player_1_cash_balance_return)
                        for p in two_player_p1_win:
                            print(p)
                        time.sleep(2)
                        while True:
                            cls()
                            for p in ask_save_colour:
                                print(p)
                            save = input("\nEnter a selection: ").lower().strip()
                            try:
                                if save[0] == "y":
                                    single_scores = open("single_scores.txt", "a")
                                    single_scores.writelines(l)
                                    single_scores.close()
                                    while True:
                                        cls()
                                        for p in bonus_game_question_colour:
                                            print(p)
                                        ask = input("\nEnter a selection: ").lower().strip()
                                        try:
                                            if ask[0] == "y":
                                                bonus.bonus_player_game()
                                            elif ask[0] == "n":
                                                functions.two_player_rematch()
                                        except:
                                            for p in error_try_again:
                                                print(p)
                                            print(input("\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))
                                elif save[0] == "n":
                                    while True:
                                        cls()
                                        for p in bonus_game_question_colour:
                                            print(p)
                                        ask = input(f"\nEnter a selection: ").lower().strip()
                                        try:
                                            if ask[0] == "y":
                                                bonus.bonus_player_game()
                                            elif ask[0] == "n":
                                                functions.two_player_rematch()
                                        except:
                                            for p in error_try_again:
                                                print(p)
                                            print(input("\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))
                            except:
                                for p in error_try_again:
                                    print(p)
                                print(input("\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))

                    elif solve == secret_word and player_2_cash_balance_return > player_1_cash_balance_return: #p2 wins if they have more cash at the
                                                                                                            #end of the round when the word was solved
                        for p in solve_correct_colour:
                            print(p)
                        l = f"\n{player_1} scored ${player_1_cash_balance_return} on the {date_time}"
                        print(input("\nPress ENTER to continue"))
                        cls()
                        two_player_solve_p2 = colours.two_player_solve_p2(player_2)
                        for p in two_player_solve_p2:
                            print(p)
                        time.sleep(3)
                        two_player_p2_win = colours.two_player_p2_win(player_2, player_2_cash_balance_return)
                        for p in two_player_p2_win:
                            print(p)
                        time.sleep(2)
                        while True:
                            cls()
                            for p in ask_save_colour:
                                print(p)
                            save = input("\nEnter a selection: ").lower().strip()
                            try:
                                if save[0] == "y":
                                    single_scores = open("single_scores.txt", "a")
                                    single_scores.writelines(l)
                                    single_scores.close()
                                    while True:
                                        for p in bonus_game_question_colour:
                                            print(p)
                                        ask = input("\nEnter a selection: ").lower().strip()
                                        try:
                                            if ask[0] == "y":
                                                bonus.bonus_player_game()
                                            elif ask[0] == "n":
                                                functions.two_player_rematch()
                                        except:
                                            for p in error_try_again:
                                                print(p)
                                            print(input(
                                                "\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))
                                elif save[0] == "n":
                                    while True:
                                        cls()
                                        for p in bonus_game_question_colour:
                                            print(p)
                                        ask = input(f"\nEnter a selection: ").lower().strip()
                                        try:
                                            if ask[0] == "y":
                                                bonus.bonus_player_game()
                                            elif ask[0] == "n":
                                                functions.two_player_rematch()
                                        except:
                                            for p in error_try_again:
                                                print(p)
                                            print(input(
                                                "\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))
                            except:
                                for p in error_try_again:
                                    print(p)
                                print(input(
                                    "\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))
                    elif solve != secret_word:
                        for p in solve_incorrect_colour:
                            print(p)
                        player1 = False
                        player2 = True
                        print(input("\nPress ENTER to continue"))

            except:
                for p in error_try_again:
                    print(p)
                print(input("\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))



                                                                                ####### Player 2 ##########
        while player2 == True:
            cls()
            player_2_cash_balance = player_2_cash_balance_return
            for p in game_board_top_colour:
                print(p)
            print("|*|       " + "       ".join(game_board_display))        #player 2s foot with cash balance
            for p in game_board_bottom_colour:
                print(p)
            two_player_foot_one = colours.two_player_foot_two(player_2, player_2_cash_balance)
            for p in two_player_foot_one:
                print(p)
            menu_selection = input("\nEnter your selection: ").lower().strip()
            try:
                if menu_selection[0] == "s":
                    print(wheel)
                    cash_prize = words.cash_value()
                    if cash_prize == 0:
                        player_2_cash.clear()
                        for p in bankrupt_colour:
                            print(p)
                        player1 = True
                        player2 = False
                        print(input("\nPress ENTER to continue"))
                        cls()
                    elif cash_prize != 0:
                        ask_letter_colour = colours.ask_letter_colour(cash_prize)
                        for p in ask_letter_colour:
                            print(p)
                        vowels = "aeiou"
                        guess_letter = input(f"\nEnter selection: ").lower()
                        if guess_letter in used_letters:
                            for p in cheat:
                                print(p)
                            time.sleep(2)
                            player1 = True
                            player2 = False
                        elif guess_letter.isdigit():
                            for p in r2_d2_numbers:
                                print(p)
                            time.sleep(2)
                            player1 = True
                            player2 = False
                        else:
                            vowels = "aeiou"
                            m = vowels.find(guess_letter)
                            a = secret_word.find(guess_letter)
                            if guess_letter in secret_word[a] and guess_letter not in vowels[m]:
                                m = secret_word.count(guess_letter)
                                n = m * cash_prize
                                player_2_cash.append(n)
                                player_2_cash_balance_return = sum(player_2_cash)
                                for i in range(len(secret_word)):
                                    if guess_letter == secret_word[i]:
                                        game_board_display[i] = secret_word[i]
                                yoda_yes = colours.yoda_yes(m, guess_letter)
                                for p in yoda_yes:
                                    print(p)
                                time.sleep(2)
                                used_letters.add(guess_letter)
                            elif guess_letter in secret_word and guess_letter in vowels:
                                for p in r2_d2_vowels:
                                    print(p)
                                time.sleep(2)
                                used_letters.add(guess_letter)
                                player1 = True
                                player2 = False
                            elif guess_letter not in secret_word and guess_letter in vowels:
                                for p in r2_d2_vowels:
                                    print(p)
                                time.sleep(2)
                                used_letters.add(guess_letter)
                                player1 = True
                                player2 = False
                            elif guess_letter not in secret_word and guess_letter not in vowels:
                                r2_d2_letters = colours.r2_d2_letters(guess_letter)
                                for p in r2_d2_letters:
                                    print(p)
                                time.sleep(2)
                                used_letters.add(guess_letter)
                                player1 = True
                                player2 = False                       
                elif menu_selection[0] == "p":
                    player_1_cash_balance_return = sum(player_1_cash)
                    player_2_cash_balance_return = sum(player_2_cash)
                    for p in guess_question:
                        print(p)
                    solve = input("\nEnter your guess ").strip()
                    if solve == secret_word and player_1_cash_balance_return > player_2_cash_balance_return:
                        cls()
                        for p in solve_correct_colour:
                            print(p)
                        l = f"\n{player_2} scored ${player_2_cash_balance_return} on the {date_time}"
                        print(input("\nPress ENTER to continue"))
                        two_player_solve_p1 = colours.two_player_solve_p1(player_1)
                        for p in two_player_solve_p1:
                            print(p)
                        time.sleep(3)
                        two_player_p1_win = colours.two_player_p1_win(player_1, player_1_cash_balance_return)
                        for p in two_player_p1_win:
                            print(p)
                        time.sleep(2)
                        while True:
                            cls()
                            for p in ask_save_colour:
                                print(p)
                            save = input("\nEnter a selection: ").lower().strip()
                            try:
                                if save[0] == "y":
                                    single_scores = open("single_scores.txt", "a")
                                    single_scores.writelines(l)
                                    single_scores.close()
                                    while True:
                                        cls()
                                        for p in bonus_game_question_colour:
                                            print(p)
                                        ask = input("\nEnter a selection: ").lower().strip()
                                        try:
                                            if ask[0] == "y":
                                                bonus.bonus_player_game()
                                            elif ask[0] == "n":
                                                functions.two_player_rematch()
                                        except:
                                            for p in error_try_again:
                                                print(p)
                                            print(input(
                                                "\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))
                                elif save[0] == "n":
                                    while True:
                                        cls()
                                        for p in bonus_game_question_colour:
                                            print(p)
                                        ask = input(f"\nEnter a selection: ").lower().strip()
                                        try:
                                            if ask[0] == "y":
                                                bonus.bonus_player_game()
                                            elif ask[0] == "n":
                                                functions.two_player_rematch()
                                        except:
                                            for p in error_try_again:
                                                print(p)
                                            print(input(
                                                "\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))
                            except:
                                for p in error_try_again:
                                    print(p)
                                print(input(
                                    "\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))

                    elif solve == secret_word and player_2_cash_balance_return > player_1_cash_balance_return:
                        for p in solve_correct_colour:
                            print(p)
                        l = f"\n{player_2} scored ${player_2_cash_balance_return} on the {date_time}"
                        print(input("\nPress ENTER to continue"))
                        cls()
                        two_player_solve_p1 = colours.two_player_solve_p1(player_1)
                        for p in two_player_solve_p1:
                            print(p)
                        time.sleep(3)
                        two_player_p2_win = colours.two_player_p2_win(player_2, player_2_cash_balance_return)
                        for p in two_player_p2_win:
                            print(p)
                        time.sleep(2)
                        while True:
                            cls()
                            for p in ask_save_colour:
                                print(p)
                            save = input("\nEnter a selection: ").lower().strip()
                            try:
                                if save[0] == "y":
                                    single_scores = open("single_scores.txt", "a")
                                    single_scores.writelines(l)
                                    single_scores.close()
                                    while True:
                                        cls()
                                        for p in bonus_game_question_colour:
                                            print(p)
                                        ask = input("\nEnter a selection: ").lower().strip()
                                        try:
                                            if ask[0] == "y":
                                                bonus.bonus_player_game()
                                            elif ask[0] == "n":
                                                functions.two_player_rematch()
                                        except:
                                            for p in error_try_again:
                                                print(p)
                                            print(input(
                                                "\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))
                                elif save[0] == "n":
                                    while True:
                                        cls()
                                        for p in bonus_game_question_colour:
                                            print(p)
                                        ask = input(f"\nEnter a selection: ").lower().strip()
                                        try:
                                            if ask[0] == "y":
                                                bonus.bonus_player_game()
                                            elif ask[0] == "n":
                                                functions.two_player_rematch()
                                        except:
                                            for p in error_try_again:
                                                print(p)
                                            print(input(
                                                "\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))
                            except:
                                for p in error_try_again:
                                    print(p)
                                print(input(
                                    "\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))
                    elif solve != secret_word:
                        for p in solve_incorrect_colour:
                            print(p)
                        player1 = True
                        player2 = False
                        print(input("\nPress ENTER to continue"))

            except:
                for p in error_try_again:
                    print(p)
                print(input(
                    "\n\nYou must type a single selection from the menu - try again !\n\nPRESS ENTER TO CONTINUE"))
def start_menu():

    error_try_again = colours.error_try_again()
    bonus_score_colour = colours.bonus_score_back_colour()
    two_player_high_scores_colour = colours.two_player_high_scores_back_colour(
    )  #calls colour lists from functions into a variable to print to screen through for loops
    score_back_colour = colours.score_back_menu_colour()
    single_player_high_scores_colour = colours.single_player_high_scores_back_colour(
    )
    start_menu_colour = colours.start_menu_colour()
    return_menu = colours.return_menu()
    cls()
    for p in start_menu_colour:
        print(p)
    while True:
        menu_selection_main = input("\nType a selection: ").lower().strip()
        cls()
        try:
            if menu_selection_main[
                    0] == "b":  #inbuilt menu for High Scores from the main menu returns to main menu as default
                for p in score_back_colour:
                    print(p)
                while True:
                    selection_main = input(
                        "\nType a selection: ").lower().strip()
                    cls()
                    try:
                        if selection_main == "1":
                            with open(
                                    "single_scores.txt", "r"
                            ) as single_score:  #opens a txt from file and displays to screen - and returns to main menu
                                for p in single_player_high_scores_colour:
                                    print(p)
                                print(single_score.read())
                                for p in return_menu:
                                    print(p)
                                time.sleep(5)
                                return start_menu()
                        elif selection_main == "2":
                            with open(
                                    "two_player_scores.txt", "r"
                            ) as two_score:  #opens a txt from file and displays to screen - and returns to main menu
                                for p in two_player_high_scores_colour:
                                    print(p)
                                print(two_score.read())
                                for p in return_menu:
                                    print(p)
                                time.sleep(5)
                                return start_menu()
                        elif selection_main[0] == "b":
                            with open(
                                    "bonus.txt", "r"
                            ) as bonus:  #opens a txt from file and displays to screen - and returns to main menu
                                for p in bonus_score_colour:
                                    print(p)
                                print(bonus.read())
                                for p in return_menu:
                                    print(p)
                                time.sleep(5)
                                return start_menu()
                    except:
                        for p in error_try_again:
                            print(p)
                        print(
                            input(
                                "\n\nYou must type a single selection from the menu - try again !"
                            ))
                        return start_menu()
            elif menu_selection_main[0] == "h":
                cls()
                with open("help_file.txt",
                          "r") as help:  #Help text on how to play
                    cls()
                    print(help.read())
                    print(input("Hit enter to CONTUNUE"))
                return start_menu()
            elif menu_selection_main[0] == "n":
                return new_game_menu()
            elif menu_selection_main[0] == "q":
                return exit()
            else:
                for p in error_try_again:
                    print(p)
                print(
                    input(
                        "\nYou must type a single selection from the menu - try again !"
                    ))
                return start_menu()
        except:
            for p in error_try_again:
                print(p)
            print(
                input(
                    "\nYou must type a single selection from the menu - try again !"
                ))
            return start_menu()
def bonus_player_game():

    #secret_word = words.secret_word_generic()
    secret_word = words.secret_word_girls_names()
    game_board_display = words.secret_string_word(secret_word)                          #make the game board with secret word
    underlined_secret_word = "_" * len(secret_word)
    game_board_display = list(underlined_secret_word)

    cash_prize = words.cash_value()
    now = datetime.now()
    date_time = now.strftime("%d/%m/%Y %H:%M:%S")
    cash_count = []
    used_letters = {"111"}
    game_count = 0

    championship_round_colour = colours.championship_round_title_colour()
    game_board_top_colour = colours.game_board_top_back_colour()
    game_board_bottom_colour = colours.game_board_bottom_back_colour()
    car_colour_pic = colours.car_colour()
    use_force = colours.use_force()
    bonus_last_spin = colours.bonus_last_spin()                                         #preload the colour menus
    guess_question = colours.guess_question()
    solve_correct_colour = colours.solve_correct_colour()
    ask_save_colour = colours.ask_save_colour()
    error_try_again = colours.error_try_again()
    game_over_colour = colours.game_over_colour()
    cheat = colours.cheat()
    r2_d2_numbers = colours.r2_d2_numbers()

    cls()
    for p in championship_round_colour:
        print(p)
    hit_enter = input("\nPress enter to begin !!!")

    while True:
        cls()
        game_count += 1
        cash_prize = words.cash_value()
        for p in game_board_top_colour:
            print(p)
        print("|*|       " + "       ".join(game_board_display))
        for p in game_board_bottom_colour:
            print(p)
        a = sum(cash_count)
        bonus_colour_foot = colours.bonus_colour_footer(a)
        for p in bonus_colour_foot:
            print(p)
        menu_selection = input("\nEnter your selection: ")
        try:
            if menu_selection[0] == "s":
                print(wheel)
                if cash_prize == 0:
                    for p in car_colour_pic:
                        print(p)
                    for p in use_force:
                        print(p)
                    guess_letter = input("\nGive me a letter: ").lower().strip()
                    if guess_letter in used_letters:
                        for p in cheat:
                            print(p)
                        time.sleep(2)
                        incorrect_guesses += 1
                    elif guess_letter.isdigit():
                        for p in r2_d2_numbers:
                            print(p)
                        time.sleep(2)
                        a = secret_word.find(guess_letter)
                    else:
                        if guess_letter == secret_word[a]:
                            m = secret_word.count(guess_letter)
                            # n = m * cash_prize
                            cash_count.append(1000000)
                            for i in range(len(secret_word)):
                                if guess_letter == secret_word[i]:
                                    game_board_display[i] = secret_word[i]
                                yoda_yes = colours.yoda_yes(m,guess_letter)             #conditions to check letter 
                                cash_count.append(1000000)
                                for p in yoda_yes:
                                    print(p)
                                time.sleep(2)
                                used_letters.add(guess_letter)
                        elif guess_letter != secret_word[a]:
                            r2_d2_letters = colours.r2_d2_letters(guess_letter)
                            for p in r2_d2_letters:
                                print(p)
                            time.sleep(2)
                            used_letters.add(guess_letter)
                elif cash_prize != 0:
                    ask_letter_colour = colours.ask_letter_colour(cash_prize)
                    for p in ask_letter_colour:
                        print(p)
                    guess_letter = input(f"\nEnter selection: ").lower().strip()
                    a = secret_word.find(guess_letter)
                    if guess_letter in used_letters:
                        for p in cheat:
                            print(p)
                        time.sleep(2)
                        used_letters.add(guess_letter)
                    elif guess_letter.isdigit():
                        for p in r2_d2_numbers:
                            print(p)
                        time.sleep(2)
                        used_letters.add(guess_letter)
                    else:
                        if guess_letter == secret_word[a]:
                            m = secret_word.count(guess_letter)
                            n = m * cash_prize
                            cash_count.append(n)
                            for i in range(len(secret_word)):
                                if guess_letter == secret_word[i]:
                                    game_board_display[i] = secret_word[i]
                            yoda_yes = colours.yoda_yes(m,guess_letter)
                            for p in yoda_yes:
                                print(p)
                            time.sleep(2)
                            used_letters.add(guess_letter)
                        elif guess_letter != secret_word[a]:
                            r2_d2_letters = colours.r2_d2_letters(guess_letter)
                            for p in r2_d2_letters:
                                print(p)
                            time.sleep(2)
                            used_letters.add(guess_letter)

            if game_count == 3:                                     #warning of final spin
                for p in bonus_last_spin:
                    print(p)
                print("\n")
                time.sleep(3)

            if game_count == 4:                                     #forcing user to guess the word now after 4 spins
                for p in game_board_top_colour:
                    print(p)
                print("|*|       " + "       ".join(game_board_display))
                for p in game_board_bottom_colour:
                    print(p)
                print("\n")
                for p in guess_question:
                    print(p)
                guess = input("\nEnter your guess: ").lower().strip()
                if guess == secret_word:
                    cls()
                    for p in solve_correct_colour:
                        print(p)
                    k = sum(cash_count)
                    l = f"""You scored {k} dollars and won the round on the {date_time}"""
                    print(input("\nPress ENTER to continue"))
                    while True:
                        for p in ask_save_colour:
                            print(p)
                        save = input("\nEnter a selection: ").lower().strip()
                        try:
                            if save[0] == "y":
                                bonus = open("bonus.txt", "a")
                                bonus.writelines(l)
                                bonus.close()
                                functions.start_menu()
                            elif save[0] == "n":
                                functions.start_menu()
                        except:
                            for p in error_try_again:
                                print(p)
                            print(input("\n\nYou must type a single selection from the menu - try again !\n\nPress ENTER to continue"))

                elif guess != secret_word:
                    for p in game_over_colour:
                        print(p)
                    print(input("\nPress ENTER to continue"))
                    return functions.start_menu()
        except:
            for p in error_try_again:
                print(p)
            print(input("\n\nYou must type a single selection from the menu - try again !\n\nPress ENTER to continue"))
            cls()
示例#6
0
def single_player_game():
    secret_word = functions.word_genre()
    game_board_display = words.secret_string_word(secret_word)
    underlined_secret_word = "_" * len(secret_word)
    game_board_display = list(underlined_secret_word)

    cash_prize = words.cash_value()
    now = datetime.now()
    date_time = now.strftime("%d/%m/%Y %H:%M:%S")
    cash_count = []
    used_letters = {"111"}
    incorrect_guesses = 0
    game = True

    game_board_top_colour = colours.game_board_top_back_colour()
    game_board_bottom_colour = colours.game_board_bottom_back_colour()
    what_is_your_name = colours.what_is_your_name()
    bankrupt_colour = colours.bankrupt_colour_back()
    r2_d2_vowels = colours.r2_d2_vowels()
    guess_question = colours.guess_question()
    solve_correct_colour = colours.solve_correct_colour()
    solve_incorrect_colour = colours.solve_incorrect_colour()
    error_try_again = colours.error_try_again()
    last_guess = colours.last_guess_colour()
    one_guess_left = colours.one_guess_left()
    guess_question = colours.guess_question()
    game_over = colours.game_over_colour()
    cheat = colours.cheat()
    r2_d2_numbers = colours.r2_d2_numbers()



    for p in what_is_your_name:
        print(p)
    player_1 = input("\nEnter your name Player 1: ")
    print("\n")
    a = sum(cash_count)

    while game == True:
        cls()
        for p in game_board_top_colour:                                     #displays the gameboard you see to screen
            print(p)
        print("|*|       " + "       ".join(game_board_display))
        for p in game_board_bottom_colour:
            print(p)
        a = sum(cash_count)
        player_one_cycle_colour = colours.player_one_cycle_colour(a)        #player 1 footer /cash balance 
        for p in player_one_cycle_colour:
            print(p)
        menu_selection = input("\nEnter your selection: ").lower()
        try:
            if menu_selection[0] == "s":                                    #spin the wheel
                print(wheel)
                cash_prize = words.cash_value()
                if cash_prize == 0:                                         #land on bankrupt
                    cls()
                    cash_count.clear()
                    bankrupt_colour = colours.bankrupt_colour_back()
                    for p in bankrupt_colour:
                        print(p)
                    print(input("\nPress ENTER to continue"))
                    cls()
                elif cash_prize != 0:                                           #land on a case value -asked for a letter
                    ask_letter_colour = colours.ask_letter_colour(cash_prize)
                    for p in ask_letter_colour:
                        print(p)
                    guess_letter = input(f"\nEnter selection: ").lower()
                    if guess_letter in used_letters:                               #checks letter to se if already used
                        for p in cheat:
                            print(p)
                        time.sleep(2)
                        incorrect_guesses += 1
                    elif guess_letter.isdigit():
                        for p in r2_d2_numbers:
                            print(p)
                        time.sleep(2)                    
                    else:
                        vowels = "aeiou"
                        m = vowels.find(guess_letter)                               #checks letter to see if its a vowel and in the secret word or
                                                                                    #vice versa and adds to lists if needed
                        a = secret_word.find(guess_letter)
                        if guess_letter in secret_word and guess_letter not in vowels:
                            m = secret_word.count(guess_letter)
                            n = m * cash_prize
                            cash_count.append(n)
                            a = sum(cash_count)
                            for i in range(len(secret_word)):
                                if guess_letter == secret_word[i] and guess_letter not in vowels:
                                    game_board_display[i] = secret_word[i]
                            yoda_yes = colours.yoda_yes(m,guess_letter)        
                            for p in yoda_yes:
                                print(p)
                            time.sleep(2)
                            used_letters.add(guess_letter)
                        elif guess_letter in secret_word and guess_letter in vowels:
                            r2_d2_vowels = colours.r2_d2_vowels()
                            for p in r2_d2_vowels:
                                print(p)
                            time.sleep(2)
                            used_letters.add(guess_letter)
                        elif guess_letter not in secret_word and guess_letter in vowels:
                            r2_d2_vowels = colours.r2_d2_vowels()
                            for p in r2_d2_vowels:
                                print(p)
                            time.sleep(2)
                            used_letters.add(guess_letter)
                        elif guess_letter not in secret_word and guess_letter not in vowels:
                            r2_d2_letters = colours.r2_d2_letters(guess_letter)
                            for p in r2_d2_letters:
                                print(p)
                            time.sleep(2)
                            incorrect_guesses += 1
                            used_letters.add(guess_letter)

            elif menu_selection[0] == "p":                          #solving the word section when user select P to solve
                k = sum(cash_count)
                guess_question = colours.guess_question()
                for p in guess_question:
                    print(p)
                solve = input("\nEnter your guess ")
                if solve == secret_word:
                    solve_correct_colour = colours.solve_correct_colour()
                    for p in solve_correct_colour:
                        print(p)
                    print(input("\nPress ENTER to continue"))
                    if_correct(player_1,k)
                elif solve != secret_word:
                    solve_incorrect_colour = colours.solve_incorrect_colour()
                    for p in solve_incorrect_colour:
                        print(p)
                    print(input("\nPress ENTER to continue"))
                    incorrect_guesses += 1
        except:
            error_try_again = colours.error_try_again()
            for p in error_try_again:
                print(p)
            print(input("\n\nYou must type a single selection from the menu - try again !\n\nPress ENTER to continue"))

        if incorrect_guesses == 9:                              #first warning that they have one incorrect guess left
            cls()
            one_guess_left = colours.one_guess_left()
            for p in one_guess_left:
                print(p)
            print(input("\n\nPress ENTER to continue"))

        elif incorrect_guesses == 10:                           #game forces the player one last spin before aone last final guess of the word
            cls()
            last_guess = colours.last_guess_colour()
            for p in last_guess:
                print(p)
            print(input("\n\nPress ENTER to continue"))
            k = sum(cash_count)
            guess_question = colours.guess_question()
            for p in game_board_top_colour:
                print(p)
            print("|*|       " + "       ".join(game_board_display))
            for p in game_board_bottom_colour:
                print(p)
            for p in guess_question:
                print(p)
            solve = input("\nEnter your guess: ").lower()
            if solve == secret_word:
                if_correct(player_1, k)
            elif solve != secret_word:
                cls()
                game_over = colours.game_over_colour()
                for p in game_over:
                    print(p)
                print(input("\n\nPress ENTER to continue"))
                functions.single_player_menu()