(db, cfg, profiles, hs, present_categories)
| 855 | finalize_game("Buzz's Choice", difficulty, profiles, hs, players, scores, {"rounds": rounds}, save=True) |
| 856 | |
| 857 | def mode_quickfire(db, cfg, profiles, hs, present_categories): |
| 858 | difficulty = choose_difficulty() |
| 859 | p1 = choose_player(profiles, "Player 1") |
| 860 | p2 = None |
| 861 | if cfg["max_players"] >= 2 and input("Add Player 2? (y/n): ").strip().lower().startswith("y"): |
| 862 | p2 = choose_player(profiles, "Player 2") |
| 863 | players = [p1] + ([p2] if p2 else []) |
| 864 | nicks = [p.get("nickname", p.get("display_name","Player")) for p in players] |
| 865 | scores = {n: 0 for n in nicks} |
| 866 | cat = choose_category_menu(present_categories) |
| 867 | pool = build_pool(db, cat, difficulty) |
| 868 | rng = random.Random() |
| 869 | if not pool: |
| 870 | print("No questions found for that category. Please pick another.") |
| 871 | pause() |
| 872 | return |
| 873 | |
| 874 | if not pool: |
| 875 | print("No questions found for that category. Please pick another.") |
| 876 | pause() |
| 877 | return |
| 878 | |
| 879 | if not pool: |
| 880 | print("No questions found for that category. Please pick another.") |
| 881 | pause() |
| 882 | return |
| 883 | |
| 884 | if not pool: |
| 885 | print("No questions found for that category. Please pick another.") |
| 886 | pause() |
| 887 | return |
| 888 | |
| 889 | if not pool: |
| 890 | print("No questions found for that category. Please pick another.") |
| 891 | pause() |
| 892 | return |
| 893 | |
| 894 | if not pool: |
| 895 | print("No questions found for that category. Please pick another.") |
| 896 | pause() |
| 897 | return |
| 898 | |
| 899 | if not pool: |
| 900 | print("No questions found for that category. Please pick another.") |
| 901 | pause() |
| 902 | return |
| 903 | |
| 904 | total = int(cfg.get("quickfire_questions", 20)) |
| 905 | clear() |
| 906 | print(f"=== QUICKFIRE ===\nCategory: {cat} | Questions: {total} | Diff: {difficulty}\n") |
| 907 | pause("Press ENTER to begin...") |
| 908 | for i in range(total): |
| 909 | p = nicks[i % len(nicks)] |
| 910 | clear() |
| 911 | print(f"Quickfire {i+1}/{total} | {p} | Score: " + " ".join([f"{x}:{scores[x]}" for x in nicks])) |
| 912 | ok, took, to, ans = ask_question(rng.choice(pool), 0) |
| 913 | if ok: |
| 914 | scores[p] += 75 |
no test coverage detected