def move_manual(trace, dirs, grid):
    """Return new (x,y) that belongs to grid by user picked direction."""
    dest = None
    last_loc = trace[-1]

    while dest not in grid:
        new_dir = input("Choose direction: ").lower()

        # Note: Pretty messy upto return satement. Can I refactor this?
        if new_dir == "quit":
            print("\nBye\n")
            sys.exit()

        if new_dir in dirs:
            dest = game_grid.add_vector(last_loc, dirs[new_dir])
            if dest not in grid:
                print("\nYou hit a wall but warewolf is keep looking for you.\n")
                return last_loc  # Adds penalty for hitting wall.
        else:
            print(
                """\nYou try to move but it appears that your anxiety has lost sense of direction.
                \rYou take a breath and try to move again.\n"""
            )

    return dest
def move_random(trace, dirs, grid):
    """Returns new (x,y) that belongs to grid by randomly picked direction.
    """
    dest = None
    last_loc = trace[-1]
    dirs = list(dirs.values())

    while dest not in grid:
        rand_dir = random.choice(dirs)
        dest = game_grid.add_vector(last_loc, rand_dir)

    return dest