Ejemplo n.º 1
0
def main():
    welcome = """
    #############################################
    ### WELCOME TO THE SUPER BYTE BOGGLE GAME ###
    #############################################
    
    """
    print(welcome)
    try:
        npt_dice_type = int(input("Would you like to play with the classic or new dice's type? (type '1' for Classic or '2' for New): "))
        if npt_dice_type not in [1, 2]:
            raise Exception()
    except:
        print("Invalid dice type.")
        return
    
    boggle = Boggle()
    boggle.start(npt_dice_type)
    print(boggle)
    
    boggle.user_words = get_user_answers(60*3)
    
    print('Wait, as soon the intern come back with my coffe he might start checking your answers...')
    boggle.get_all_words() #save all possible words based on dictionary on boggle.word_list
    points = 0
    valid_on_board = []
    for word in boggle.user_words:
        if boggle.has_word(word):
            valid_on_board.append(word)
    valid_on_dict = set(valid_on_board).intersection(boggle.word_list)
    for word in valid_on_dict:
        point = boggle.calculate_points(word)
        points += point
        print("{} = {} points".format(word, point))
    
    print("You total score is {} points!".format(points))
    print("Those were all possible words: ")
    print(boggle.word_list)
    print("Better lucky next time :)")