Пример #1
0
def player_enters_gate(level, BOARD, player, key, inventory, others):
    BOARD_level = BOARD[level]

    for board_ in BOARD:
        if board_ == level:
            for key_ in BOARD[board_]:
                if key_ == 'GATES':
                    for gate_ in BOARD[board_][key_]:

                        # entering gate that is up in relation to player
                        if (player['position_y'] - 1) == BOARD[board_][key_][
                                gate_]['GATE_POSITION_Y'] and (
                                    player['position_x']
                                ) == BOARD[board_][key_][gate_][
                                    'GATE_POSITION_X'] and key == 'w':
                            if gate_ == 'GATE_UP':
                                # Gate Requirements
                                if level == 'BOARD_1':
                                    if 'Donut' in inventory:  #and others['other']['other_health'] == 0:
                                        return BOARD_level['NEXT_LEVEL']
                                    else:
                                        ui.print_message(
                                            'Come back with Donut!!')
                                elif level == 'BOARD_2':
                                    if 'Pralines' in inventory and others[
                                            'other3']['other_health'] == 0:
                                        return BOARD_level['NEXT_LEVEL']
                                    elif 'Pralines' in inventory and others[
                                            'other3']['other_health'] > 0:
                                        ui.print_message(
                                            'Come back once you defeat the Cow!!'
                                        )
                                    elif 'Pralines' not in inventory and others[
                                            'other3']['other_health'] > 0:
                                        ui.print_message(
                                            "Once you defeat Cow, come back with Pralines!"
                                        )
                                    elif 'Pralines' not in inventory and others[
                                            'other3']['other_health'] == 0:
                                        ui.print_message(
                                            "Come back with Pralines!")
                                elif level == 'BOARD_3':
                                    if 'boss' not in others:
                                        return BOARD_level['NEXT_LEVEL']
                                    elif others['boss']['other_health'] > 0:
                                        ui.print_message(
                                            'Come back once you defeat the Boss!!'
                                        )
                            elif gate_ == 'GATE_DOWN':
                                return BOARD_level['PREVIOUS_LEVEL']

                        # entering gate that is down in relation to player
                        elif (player['position_y'] + 1) == BOARD[board_][key_][
                                gate_]['GATE_POSITION_Y'] and (
                                    player['position_x']
                                ) == BOARD[board_][key_][gate_][
                                    'GATE_POSITION_X'] and key == 's':
                            if gate_ == 'GATE_UP':
                                # Gate Requirements
                                if level == 'BOARD_1':
                                    if 'Donut' in inventory:  #and others['other']['other_health'] == 0:
                                        return BOARD_level['NEXT_LEVEL']
                                    else:
                                        ui.print_message(
                                            'Come back with Donut!!')
                                elif level == 'BOARD_2':
                                    if 'Pralines' in inventory and others[
                                            'other3']['other_health'] == 0:
                                        return BOARD_level['NEXT_LEVEL']
                                    elif 'Pralines' in inventory and others[
                                            'other3']['other_health'] > 0:
                                        ui.print_message(
                                            'Come back once you defeat the Cow!!'
                                        )
                                    elif 'Pralines' not in inventory and others[
                                            'other3']['other_health'] > 0:
                                        ui.print_message(
                                            "Once you defeat Cow, come back with Pralines!"
                                        )
                                    elif 'Pralines' not in inventory and others[
                                            'other3']['other_health'] == 0:
                                        ui.print_message(
                                            "Come back with Pralines!")
                                elif level == 'BOARD_3':
                                    if others['boss']['other_health'] == 0:
                                        return BOARD_level['NEXT_LEVEL']
                                    elif others['boss']['other_health'] > 0:
                                        ui.print_message(
                                            'Come back once you defeat the Boss!!'
                                        )
                            elif gate_ == 'GATE_DOWN':
                                return BOARD_level['PREVIOUS_LEVEL']

                        # entering gate that is left in relation to player
                        elif (player['position_x'] - 1) == BOARD[board_][key_][
                                gate_]['GATE_POSITION_X'] and player[
                                    'position_y'] == BOARD[board_][key_][gate_][
                                        'GATE_POSITION_Y'] and key == 'a':
                            if gate_ == 'GATE_UP':
                                # Gate Requirements
                                if level == 'BOARD_1':
                                    if 'Donut' in inventory:  #and others['other']['other_health'] == 0:
                                        return BOARD_level['NEXT_LEVEL']
                                    else:
                                        ui.print_message(
                                            'Come back with Donut!!')
                                elif level == 'BOARD_2':
                                    if 'Pralines' in inventory and others[
                                            'other3']['other_health'] == 0:
                                        return BOARD_level['NEXT_LEVEL']
                                    elif 'Pralines' in inventory and others[
                                            'other3']['other_health'] > 0:
                                        ui.print_message(
                                            'Come back once you defeat the Cow!!'
                                        )
                                    elif 'Pralines' not in inventory and others[
                                            'other3']['other_health'] > 0:
                                        ui.print_message(
                                            "Once you defeat Cow, come back with Pralines!"
                                        )
                                    elif 'Pralines' not in inventory and others[
                                            'other3']['other_health'] == 0:
                                        ui.print_message(
                                            "Come back with Pralines!")
                                elif level == 'BOARD_3':
                                    if others['boss']['other_health'] == 0:
                                        return BOARD_level['NEXT_LEVEL']
                                    elif others['boss']['other_health'] > 0:
                                        ui.print_message(
                                            'Come back once you defeat the Boss!!'
                                        )
                            elif gate_ == 'GATE_DOWN':
                                return BOARD_level['PREVIOUS_LEVEL']

                        # entering gate that is right in relation to player
                        elif (player['position_x'] + 1) == BOARD[board_][key_][
                                gate_]['GATE_POSITION_X'] and player[
                                    'position_y'] == BOARD[board_][key_][gate_][
                                        'GATE_POSITION_Y'] and key == 'd':
                            if gate_ == 'GATE_UP':
                                # Gate Requirements
                                if level == 'BOARD_1':
                                    if 'Donut' in inventory:  #and others['other']['other_health'] == 0:
                                        return BOARD_level['NEXT_LEVEL']
                                    else:
                                        ui.print_message(
                                            'Come back with Donut!!')
                                elif level == 'BOARD_2':
                                    if 'Pralines' in inventory and others[
                                            'other3']['other_health'] == 0:
                                        return BOARD_level['NEXT_LEVEL']
                                    elif 'Pralines' in inventory and others[
                                            'other3']['other_health'] > 0:
                                        ui.print_message(
                                            'Come back once you defeat the Cow!!'
                                        )
                                    elif 'Pralines' not in inventory and others[
                                            'other3']['other_health'] > 0:
                                        ui.print_message(
                                            "Once you defeat Cow, come back with Pralines!"
                                        )
                                    elif 'Pralines' not in inventory and others[
                                            'other3']['other_health'] == 0:
                                        ui.print_message(
                                            "Come back with Pralines!")
                                elif level == 'BOARD_3':
                                    if others['boss']['other_health'] == 0:
                                        return BOARD_level['NEXT_LEVEL']
                                    elif others['boss']['other_health'] > 0:
                                        ui.print_message(
                                            'Come back once you defeat the Boss!!'
                                        )
                            elif gate_ == 'GATE_DOWN':
                                return BOARD_level['PREVIOUS_LEVEL']
    return level
Пример #2
0
def player_vs_other_quiz(player,
                         other,
                         others,
                         inventory,
                         questions,
                         questions_number=2):
    """
    Player fights agains the Other Character answering questions.
    When Player replies correctly, the Other Character loses health points.
    Otherwise Player loses health points.
    Player lost all health - game over. The Other Character losing
    health - it disappears and the Player gets flour.
    """

    ui.print_message(
        ("Play the quiz to get %s from the %s" %
         (others[other]["goal_quiz"], others[other]["other_name"])))

    q_count = 0

    questions = [question for question in questions if question[2] is False]

    while q_count <= questions_number and others[other]["other_health"] > 0:
        answer = input(questions[q_count][0])
        if answer == questions[q_count][1]:
            others[other]["other_health"] -= 1
            questions[q_count][2] = True
            ui.print_message("Correct!")
        else:
            ui.print_message("Wrong!")
        q_count += 1

    if others[other]["other_health"] > 0:
        player["player_life"] -= 1
        player['loss'] += 1
        ui.print_message(
            "To get %s you have to come back and reply correctly to the questions!"
            % others[other]["goal_quiz"])
    else:
        player["player_life"] += 1
        player['wins'] += 1
        add_to_inventory(inventory, "Jelly")
        ui.print_message(
            "Wonderful! The %s gave you %s." %
            (others[other]["other_name"], others[other]["goal_quiz"]))
        ui.print_message('+1 life point!')
Пример #3
0
def quit_program():
    ui.print_message('Bye and thank you!')
    exit()
Пример #4
0
def main():
    # initial level
    level = 'BOARD_1'

    # initial key
    key = ''

    menu_start.run()

    ui.print_message('\n\n\n LEVEL %s \n\n\n' % (level[-1]))
    time.sleep(1.0)
    util.clear_screen()

    pass_key_input = False

    while level != 'WIN' and level != 'QUIT' and level != 'LOSE':

        util.clear_screen()
        pass_key_input = False

        view.print_table(players.data_to_print(dictionaries.player))

        # Set up board
        global BOARD_1
        global BOARD_2
        global BOARD_3
        # global items_u_will_use
        # global coordonate_of_items_that_u_will_use
        # player = create_player()
        BOARD_1 = engine.create_board()
        BOARD_2 = engine.create_board()
        BOARD_3 = engine.create_board()
        BOARD_1, items_u_will_use_1, coordonate_of_items_that_u_will_use_1 = engine.create_final_board(BOARD_1, little_boss_1)
        BOARD_2, items_u_will_use_2, coordonate_of_items_that_u_will_use_2 = engine.create_final_board(BOARD_2, little_boss_2)
        BOARD_3, items_u_will_use_3, coordonate_of_items_that_u_will_use_3 = engine.create_final_board(BOARD_3, boss)
        BOARD_1 = engine.create_board()
        BOARD_2 = engine.create_board()
        BOARD_3 = engine.create_board()
        util.clear_screen()
        is_running = True
        while is_running:
            print()
            print("U entered first level")
            print()
            items_u_will_use_1, coordonate_of_items_that_u_will_use_1 = engine.items_and_coordonates_that_u_can_use(BOARD_1)
            (BOARD_1, items_u_will_use, coordonate_of_items_that_u_will_use_1) = engine.create_final_board(BOARD_1, little_boss_1)
            (BOARD_1, items_u_will_use_1, coordonate_of_items_that_u_will_use_1) = engine.put_player_on_board(BOARD_1, little_boss_1)
            engine.move_something_and_gate(BOARD_1, player, little_boss_1, gate_1)

            if player['player_life'] > 0:
                print()
                print("U entered second level")
                print()
            items_u_will_use_2, coordonate_of_items_that_u_will_use_2 = engine.items_and_coordonates_that_u_can_use(BOARD_2)
            (BOARD_2, items_u_will_use_2, coordonate_of_items_that_u_will_use_2) = engine.create_final_board(BOARD_2, little_boss_2)
            engine.move_something_and_gate(BOARD_2, player, little_boss_2, gate_2)

            if player['player_life'] > 0:
                print()
                print("U entered the third level")
                print()
            items_u_will_use_3, coordonate_of_items_that_u_will_use_3 = engine.items_and_coordonates_that_u_can_use(BOARD_3)
            (BOARD_3, items_u_will_use_3, coordonate_of_items_that_u_will_use_3) = engine.create_final_board(BOARD_3, boss)
            engine.move_something_and_gate(BOARD_3, player, boss, gate_3)
            # ui.display_board(board)

        key = util.key_pressed()
        if key == 'q':
            is_running = False
        # elif key == 'i':
        #     print(inventory)
        is_running = False
        # util.clear_screen()
        print(key)
        # break
            # ui.display_board(board)

        key = util.key_pressed()
        # if key == 'q':
        #     is_running = False
        # elif key == 'i':
        #     print(inventory)

        # util.clear_screen()
        print(key)

        # Display essential info
        ui.print_player_essential_atributes(dictionaries.player)

        # Display board
        ui.display_board(board)

        # Message panel intoduction (always displayed)
        ui.print_message('  MESSAGE PANEL \n' + 17 * '-' + '\n')

        # Interaction whit items

        # Display inventory
        if key == 'i':
            ui.print_message('This is your inventory content: ')
            ui.print_table(dictionaries.inventory)

        # Interaction with other characters

        # Insert secret code
        if key == "c":
            engine.use_secret_code(dictionaries.player, dictionaries.others, level, dictionaries.codes)

        # Gate and level change handling
        # if engine.player_enters_gate() != level:
            # util.clear_screen()
            # level = engine.player_enters_gate()

            if level == 'BOARD_2' or level == 'BOARD_3':
                dictionaries.player['position_y'] = 15
                dictionaries.player['position_x'] = 3

            if level == 'WIN':
                pass_key_input = True
                pass
            else:
                ui.print_message('\n\n\n LEVEL %s \n\n\n' % (level[-1]))
                time.sleep(1.0)
                util.clear_screen()
                pass_key_input = True

        # Player input
        if pass_key_input is False:
            key = util.key_pressed()

        # Movement
        if pass_key_input is False:
            pass
        # engine.movement()

        # Check if quit
        if key == 'q':
            quit_assertion = ''
            while quit_assertion != 'y' and quit_assertion != 'n':
                util.clear_screen()
                print('Are you sure you want to quit? ( Y / N )')
                quit_assertion = util.key_pressed()
                if quit_assertion == 'y':
                    level = 'QUIT'
                elif quit_assertion == 'n':
                    pass
                else:
                    pass

        if dictionaries.player['player_life'] == 0:
            level = 'LOSE'

    if level == 'WIN':
        util.clear_screen()
        ui.display_board(board)
        print(text2art("VICTORY!", font='block', chr_ignore=True))

    elif level == 'LOSE':
        util.clear_screen()
        ui.display_board(board)
        print(text2art("GAME OVER!", font='block', chr_ignore=True))
        time.sleep(10.7)

    print('\n\n\n Goodbye, see you soon!')
    time.sleep(1.0)
def add(table):
    """
    Asks user for input and adds it into the table.

    Args:
        table: table to add new record to

    Returns:
        Table with a new record
    """

    # your code

    current_year = common.current_year()
    not_proper_input = True
    inputs = None
    is_int = None
    #  while not_proper_input: # wrong input handling
    inputs = ui.get_inputs(["Name", "Birth date"], "\nPlease add a worker.")
    if any(char.isalpha() for char in inputs[0]):  # checks if there
        #  is a letter in user input. If at least 1 letter is present, input is ok.
        not_proper_input = False
        if inputs[0] == "":
            ui.print_gap()
            ui.print_error_message("Please type something in 'Name'.")
            ui.print_gap()
            not_proper_input = True
            #  continue
    else:
        if inputs[0] == "":
            ui.print_gap()
            ui.print_error_message("Please type something in 'Name'.")
            ui.print_gap()
            not_proper_input = True
        else:
            ui.print_gap()
            ui.print_error_message("Wrong name type input.")
            ui.print_gap()
            not_proper_input = True

    try:
        is_int = int(inputs[1])
        if int(inputs[1]) > int(current_year):
            ui.print_gap()
            ui.print_error_message(
                "Birth date can't be higher than current year.")
            ui.print_gap()
            not_proper_input = True
    except:
        if inputs[1] == "":
            ui.print_gap()
            ui.print_error_message("Please type something in 'Birth date'.")
            not_proper_input = True
        else:
            ui.print_gap()
            ui.print_error_message("Wrong birth date type input.")
            ui.print_gap()
            not_proper_input = True
        #continue
    #else:
    #    not_proper_input = False

    table = data_manager.get_table_from_file('hr/persons.csv')
    list_of_ids = []
    random_id = common.generate_random(table)
    one_input = random_id, inputs[0], inputs[1]
    one_input_list = list(one_input)  # we must do it
    table = data_manager.get_table_from_file('hr/persons.csv')
    if not_proper_input == False:
        table.append(one_input_list)
        ui.print_gap()
        ui.print_message("Added.")
        ui.print_gap()
    data_manager.write_table_to_file('hr/persons.csv', table)
    #ui.print_gap()
    #ui.print_message("Added.")
    #ui.print_gap()
    ui.print_gap()

    return table
def update(table, id_):
    """
    Updates specified record in the table. Ask users for new data.

    Args:
        table: list in which record should be updated
        id_ (str): id of a record to update

    Returns:
        table with updated record
    """

    # your code

    def change_name(id_):
        """Works if user what to change only name of a worker."""

        list_labels2 = ['Name']
        title2 = ''
        counter = 0
        for data in range(len(table)):
            if table[data][0] == id_:
                not_proper_input = True
                inputs = None
                while not_proper_input:
                    inputs = ui.get_inputs(list_labels2, title2)
                    if not any(char.isalpha() for char in inputs[0]):
                        if inputs[0] == "":
                            ui.print_error_message("Please type something.")
                            ui.print_gap()
                            not_proper_input = True
                            continue
                        not_proper_input = True
                        ui.print_error_message("Wrong type input.")
                        ui.print_gap()
                    else:
                        not_proper_input = False
                table[data][1] = inputs[0]
                counter += 1
        return counter

    def change_birth_date(id_):
        """Works if user what to change only birth date of a worker."""
        title2 = ''
        counter = 0
        list_labels2 = ['Birth date']
        for data in range(len(table)):
            if table[data][0] == id_:
                not_proper_input = True
                inputs = None
                while not_proper_input:  # Makes users input contains something
                    inputs = ui.get_inputs(list_labels2, title2)
                    try:
                        is_int = int(inputs[0])
                    except:
                        if inputs[0] == "":
                            ui.print_error_message("Please type something")
                            not_proper_input = True
                        else:
                            ui.print_error_message("Wrong type input.")
                            ui.print_gap()
                            not_proper_input = True
                        continue
                    else:
                        not_proper_input = False
                table[data][2] = inputs[0]
                counter += 1
        return counter

    def change_name_and_birth_date(id_):
        """Works if user what to change name and birth date of a worker."""
        change_name(id_)
        change_birth_date(id_)
        counter = 0
        counter += 1
        return counter

    table = data_manager.get_table_from_file('hr/persons.csv')
    title = 'Name, birth date'
    list_labels = ['Name', 'Birth date']
    is_id_ok = True
    for data in range(len(table)):
        if table[data][0] == id_[0]:
            list_labels2 = [
                "Select what do you want to change:\n1 - name\n\
2 - birth date \n3 - change name and birth date"
            ]
            ui.print_gap()
            title2 = ""
            while True:
                inputs = ui.get_inputs(list_labels2, title2)
                ui.print_gap()
                ui.print_gap()
                if inputs[0] == str(1):
                    is_id_ok = True
                    change_name_checker = 0
                    change_birth_date_checker = 0
                    change_name_and_birth_date_checker = 0
                    change_name_checker = change_name(id_[0])
                    break
                elif inputs[0] == str(2):
                    is_id_ok = True
                    change_name_checker = 0
                    change_birth_date_checker = 0
                    change_name_and_birth_date_checker = 0
                    change_birth_date_checker = change_birth_date(id_[0])
                    break
                elif inputs[0] == str(3):
                    is_id_ok = True
                    change_name_checker = 0
                    change_birth_date_checker = 0
                    change_name_and_birth_date_checker = 0
                    change_name_and_birth_date_checker = change_name_and_birth_date(
                        id_[0])
                    break
                else:
                    ui.print_gap()
                    ui.print_error_message("There is no such option.")
                    ui.print_gap()
                    change_name_checker = 0
                    change_birth_date_checker = 0
                    change_name_and_birth_date_checker = 0
                    is_id_ok = True
                    break

        else:
            is_id_ok = False

    if is_id_ok == False:
        ui.print_gap()
        ui.print_error_message("There is no such ID.")
        change_name_checker = 0
        change_birth_date_checker = 0
        change_name_and_birth_date_checker = 0

    data_manager.write_table_to_file("hr/persons.csv", table)
    if change_name_checker or change_birth_date_checker or change_name_and_birth_date_checker:
        ui.print_gap()
        ui.print_message("Done.")
        ui.print_gap()
    else:
        ui.print_gap()
        ui.print_message("No changes have been done.")
        ui.print_gap()

    return table
Пример #7
0
 def test_print_message(self):
     message = 'Hello!'
     response = ui.print_message(message)
     self.assertEqual(response, None)
Пример #8
0
def main():
    MUSIC_FILE = "Cookie Monster Sings C is for Cookie.wav"
    mixer.init()
    mixer.music.load(MUSIC_FILE)
    mixer.music.play()
    view.print_images(data_manager.read_file_record('ascii-art.txt'))
    view.start_descriptions()
    # initial level
    level = 'BOARD_1'

    # initial key
    key = ''

    menu_start.run()

    ui.print_message('\n\n\n LEVEL %s \n\n\n' % (level[-1]))
    time.sleep(1.0)
    util.clear_screen()

    pass_key_input = False

    while level != 'WIN' and level != 'QUIT' and level != 'LOSE':

        util.clear_screen()
        pass_key_input = False

        view.print_table(players.data_to_print(dictionaries.player))

        # Set up board
        board = engine.create_board(dictionaries.BOARD[level])
        board = engine.put_other_on_board(board, dictionaries.others, level)
        board = engine.put_item_on_board(board, dictionaries.items, level)
        board = engine.put_player_on_board(board, dictionaries.player)

        # Display essential info
        ui.print_player_essential_atributes(dictionaries.player)

        # Display board
        ui.display_board(board)

        # Message panel intoduction (always displayed)
        ui.print_message('  MESSAGE PANEL \n' + 17 * '-' + '\n')

        # Interaction whit items
        engine.item_vs_player(dictionaries.inventory, dictionaries.items,
                              dictionaries.player, level, dictionaries.items)

        # Display inventory
        if key == 'i':
            ui.print_message('This is your inventory content: ')
            ui.print_table(dictionaries.inventory)

        # Display statistics
        if key == "p":
            engine.show_statistics(dictionaries.player)

        # Interaction with other characters
        if engine.player_meets_other(dictionaries.others, dictionaries.player,
                                     level, board) != False:
            other = engine.player_meets_other(dictionaries.others,
                                              dictionaries.player, level,
                                              board)
            if dictionaries.others[other]['other_type'] == 'enemy':
                engine.fight(dictionaries.player, dictionaries.others, other,
                             dictionaries.inventory, dictionaries.items)
            elif dictionaries.others[other]['other_type'] == 'quiz':
                engine.player_vs_other_quiz(
                    dictionaries.player, other, dictionaries.others,
                    dictionaries.inventory,
                    dictionaries.others[other]['questions'])

        # Insert secret code
        if key == "c":
            engine.use_secret_code(dictionaries.player, dictionaries.others,
                                   level, dictionaries.codes)

        # Gate and level change handling
        if engine.player_enters_gate(
                level, dictionaries.BOARD, dictionaries.player, key,
                dictionaries.inventory, dictionaries.others) != level:
            util.clear_screen()
            level = engine.player_enters_gate(level, dictionaries.BOARD,
                                              dictionaries.player, key,
                                              dictionaries.inventory,
                                              dictionaries.others)

            if level == 'BOARD_2' or level == 'BOARD_3':
                dictionaries.player['position_y'] = 15
                dictionaries.player['position_x'] = 3

            if level == 'WIN':
                pass_key_input = True
                pass
            else:
                ui.print_message('\n\n\n LEVEL %s \n\n\n' % (level[-1]))
                time.sleep(1.0)
                util.clear_screen()
                pass_key_input = True

        # Player input
        if pass_key_input == False:
            key = util.key_pressed()

        # Movement
        if pass_key_input == False:
            engine.movement(board, dictionaries.player, key,
                            dictionaries.others)

        # Check if quit
        if key == 'q':
            quit_assertion = ''
            while quit_assertion != 'y' and quit_assertion != 'n':
                util.clear_screen()
                print('Are you sure you want to quit? ( Y / N )')
                quit_assertion = util.key_pressed()
                if quit_assertion == 'y':
                    level = 'QUIT'
                elif quit_assertion == 'n':
                    pass
                else:
                    pass

        if dictionaries.player['player_life'] == 0:
            level = 'LOSE'

    if level == 'WIN':
        util.clear_screen()
        ui.display_board(board)
        print(text2art("VICTORY!", font='block', chr_ignore=True))

    elif level == 'LOSE':
        util.clear_screen()
        ui.display_board(board)
        print(text2art("GAME OVER!", font='block', chr_ignore=True))

        time.sleep(10.7)

    ui.authors_presentation()
    players.add_results(players.count_points(), "results.txt")
    print('\n\n\n Goodbye, see you soon!')
    time.sleep(1.0)

    with Image.open("cookiemonster.jpg") as img:
        img.show()
Пример #9
0
def choose(meetings_dic):
    inputs = ui.get_inputs(["Please enter an option: "], "")
    option = inputs[0]

    if option == "s":
        ui.print_schedule(meetings_dic)
        ui.print_message(' Schedule a new meeting.')
        meetings_dic = schedule_meeting(meetings_dic)
        ui.print_message(' Meeting added.')
    elif option == "c":
        ui.print_schedule(meetings_dic)
        ui.print_message(' Cancel an existing meeting.')
        meetings_dic = cancel_meeting(meetings_dic)
        ui.print_message(' Meeting canceled.')
    elif option == "L":
        storage.export_schedule(meetings_dic)
        ui.print_message('\n Exported schedule')
    elif option == "M":
        ui.print_schedule(meetings_dic)
        meetings_dic = change_meeting(meetings_dic)
        ui.print_message('\n Changed meeting')
    elif option == "z":
        compact_meetings(meetings_dic)
        ui.print_message('\n Compact meetings')
        meetings_dic = ui.print_schedule(meetings_dic)
    elif option == "q":
        sys.exit(0)
    else:
        raise KeyError("There is no such option.")