Esempio n. 1
0
def game_loop(game):
    print(game)
    timer = timed_input.TimedInput(INPUT_PROMPT, TIMEOUT_SECONDS, TIMEOUT_MSG)
    timer.start()
    print("\nLet's see how you did...")
    round_score = game.score_words(timer.answers)
    return round_score
Esempio n. 2
0
def game_loop(game):
    print(game)
    timer = timed_input.TimedInput(INPUT_PROMPT, TIMEOUT_SECONDS, TIMEOUT_MSG)
    timer.start()
    print("\nLet's see how you did...")
    round_score = game.score_words(timer.answers)
    # TODO: If you're implementing a solver, it would be added here
    # 1. Ask the user if they'd like to see a solution for words they missed
    # 2. Probably also ask if there's a minimum word length of missed words
    # 3. Create a new board solver object
    # 4. Call the .solve() method of your board solver
    # 5. Sort the missing words by their length
    # 6. Print out the missing words on each line
    return round_score
Esempio n. 3
0
def game_loop(game):
    print(game)
    timer = timed_input.TimedInput(INPUT_PROMPT, TIMEOUT_SECONDS, TIMEOUT_MSG)
    timer.start()
    print("\nLet's see how you did...")
    round_score = game.score_words(timer.answers)
    # Check for new best round score

    if game.env.should_show_solver():
        board_solver = solver.Solver(game)
        all_words = board_solver.solve()
        missing_words = sorted(all_words - set(timer.answers),
                               key=lambda word: len(word))
        print("Here are the words you missed:")
        for word in missing_words:
            print(f"  {word} ({game.score_word(word)} points)")
    return round_score
Esempio n. 4
0
def game_loop(game, high_scores):
    print(game)
    timer = timed_input.TimedInput(INPUT_PROMPT, TIMEOUT_SECONDS, TIMEOUT_MSG)
    timer.start()
    print("\nLet's see how you did...")
    round_score = game.score_words(timer.answers, high_scores)
    high_scores.maybe_insert_new_high_score(game, scoring.TOP_ROUND_KEY,
                                            round_score)

    if game.env.should_show_solver():
        board_solver = solver.Solver(game)
        all_words = board_solver.solve()
        missing_words = sorted(all_words - set(timer.answers),
                               key=lambda word: len(word))
        print("Here are the words you missed:")
        for word in missing_words:
            print(f"  {word} ({game.score_word(word)} points)")
    return round_score
Esempio n. 5
0
def game_loop(game):
    print(game)
    timer = timed_input.TimedInput(INPUT_PROMPT, TIMEOUT_SECONDS, TIMEOUT_MSG)
    timer.start()
    print("\nLet's see how you did...")
    # TODO: The score_words function also takes a high_scores object now
    round_score = game.score_words(timer.answers)
    # TODO: Check for new best round score
    # Look in the methods defined in scoring to maybe insert a new top round score

    if game.env.should_show_solver():
        board_solver = solver.Solver(game)
        all_words = board_solver.solve()
        missing_words = sorted(all_words - set(timer.answers),
                               key=lambda word: len(word))
        print("Here are the words you missed:")
        for word in missing_words:
            print(f"  {word} ({game.score_word(word)} points)")
    return round_score
Esempio n. 6
0
def game_loop(game):
    print(game)
    timer = timed_input.TimedInput(INPUT_PROMPT, TIMEOUT_SECONDS, TIMEOUT_MSG)
    timer.start()
    print("\nLet's see how you did...")
    round_score = game.score_words(timer.answers)
    # Check for new best round score

    # TODO: Instead of asking for input if the solver should be shown, check the game.env variable
    show_solver = input("Would you like to see the words you missed [y/n]? ")
    if show_solver[0].lower() == "y":
        board_solver = solver.Solver(game)
        all_words = board_solver.solve()
        missing_words = sorted(all_words - set(timer.answers),
                               key=lambda word: len(word))
        print("Here are the words you missed:")
        for word in missing_words:
            print(f"  {word} ({game.score_word(word)} points)")
    return round_score