Пример #1
0
def tutorial_player_round(stage, colors, simon_pattern):
    tutorial_countdown = ['Ready', 'Set', 'GO']
    for count in tutorial_countdown:
        time.sleep(.5)
        if count == 'GO':
            print(f'{Fore.LIGHTGREEN_EX}{Bold_text.BOLD}{count}!', end='')
        else:
            print(f'{Fore.LIGHTGREEN_EX}{Bold_text.BOLD}{count}...', end='')
    time.sleep(.4)
    print('', end='\r')
    player_turn = input(
        f'{Fore.RESET}Don\'t worry about capitalization or spaces. Enter your response now: '
    )
    player_pattern = ' '.join(player_turn.upper()).split(
    )  # creates space between each char, then splits at each space
    if player_pattern == simon_pattern:  # checks for match against simon's color pattern
        winsound.PlaySound('audio\\correct.wav', winsound.SND_ASYNC)
        print(f'{Fore.LIGHTBLUE_EX}{Bold_text.BOLD}Correct! It\'s a match!',
              end='')
        time.sleep(1.5)  # short delay before beginning next round
        print('', end='\r')
        transitions.next_round()
    else:
        # if doesn't match
        winsound.PlaySound('audio\\incorrect.wav', winsound.SND_ASYNC)
        print(
            '\nIncorrect pattern, but for tutorial purposes let\'s continue. Normally, this would result in '
            f'\"Game Over\".\n')
        time.sleep(3.5)

    tutorial_simon_round(stage, colors,
                         simon_pattern)  # passes player data to simon
Пример #2
0
def player_round(stage, colors, simon_pattern):
    countdown = ['Ready', 'Set', 'GO']
    for count in countdown:
        time.sleep(.4)
        if count == 'GO':
            print(f'{Fore.LIGHTGREEN_EX}{Bold_text.BOLD}{count}!', end='')
        else:
            print(f'{Fore.LIGHTGREEN_EX}{Bold_text.BOLD}{count}...', end='')
    time.sleep(.3)
    print('', end='\r')
    player_turn = input('')
    player_pattern = ' '.join(player_turn.upper()).split(
    )  # creates space between each char, then splits at each space
    if player_pattern == simon_pattern:  # checks for match against simon's color pattern
        winsound.PlaySound('audio\\correct.wav', winsound.SND_ASYNC)
        if stage < 3:
            print(f'{Fore.LIGHTBLUE_EX}{Bold_text.BOLD}Correct!', end='')
        elif 2 < stage < 6:
            print(f'{Fore.LIGHTBLUE_EX}{Bold_text.BOLD}Keep Going!', end='')
        elif 5 < stage < 10:
            print(f'{Fore.LIGHTBLUE_EX}{Bold_text.BOLD}You\'re on fire!',
                  end='')
        elif 9 < stage < 20:
            print(f'{Fore.LIGHTBLUE_EX}{Bold_text.BOLD}Unstoppable!!', end='')
        elif stage > 19:
            print(f'{Fore.LIGHTBLUE_EX}{Bold_text.BOLD}LEGENDARY!!!', end='')
        time.sleep(1.5)  # short delay before beginning next round
        print('', end='\r')
        transitions.next_round()
    else:
        game_over(stage)  # if doesn't match, calls game over function

    simon_round(stage, colors, player_pattern)  # passes player data to simon
Пример #3
0
def tutorial_intro():
    print(general_instruction)
    see_video = input(
        '\nWould you like to see a short (45 sec) video of the classic game? Y or Press Enter to \n'
        'continue with the tutorial. ').upper()
    if see_video == 'Y':
        webbrowser.open('https://www.youtube.com/watch?v=vLi1qnRmpe4'
                        )  # opens up link to youtube video,
        # https://stackoverflow.com/questions/4302027/how-to-open-a-url-in-python
        input('Press Enter when finished watching. ')
        time.sleep(.5)
    transitions.next_round()
    stage = 0
    colors = ['R', 'G', 'B', 'Y']  # possible colors in simon pattern
    simon_pattern = []
    time.sleep(.5)
    tutorial_simon_round(stage, colors, simon_pattern)