fixed unicode characters
This commit is contained in:
@@ -16,7 +16,7 @@ TIMER_SECONDS = 30 # how long the timer runs
|
|||||||
|
|
||||||
# ---------- HELPERS ----------
|
# ---------- HELPERS ----------
|
||||||
def load_words(path=WORDS_FILE):
|
def load_words(path=WORDS_FILE):
|
||||||
"""Return a list of non‑empty stripped lines from the given file."""
|
"""Return a list of non-empty stripped lines from the given file."""
|
||||||
try:
|
try:
|
||||||
with open(path, "r", encoding="utf-8") as f:
|
with open(path, "r", encoding="utf-8") as f:
|
||||||
words = [line.strip() for line in f if line.strip()]
|
words = [line.strip() for line in f if line.strip()]
|
||||||
@@ -70,22 +70,22 @@ def main():
|
|||||||
words = load_words()
|
words = load_words()
|
||||||
timer_thread = None
|
timer_thread = None
|
||||||
|
|
||||||
print("=== Catchphrase ===")
|
print("=== Catchphrase, but Better ===")
|
||||||
print("Commands:")
|
print("Commands:")
|
||||||
print(" start – begin the 30‑second timer and show a word immediately")
|
print(" start - begin the 30-second timer and show a word immediately")
|
||||||
print(" next – show another random word while the timer is running")
|
print(" next - show another random word while the timer is running")
|
||||||
print(" stop – cancel the timer early")
|
print(" stop - cancel the timer early")
|
||||||
print(" exit / quit – leave the program")
|
print(" exit / quit - leave the program")
|
||||||
|
|
||||||
# Helper that prints when the timer ends
|
# Helper that prints when the timer ends
|
||||||
def announce_finish():
|
def announce_finish():
|
||||||
print("\n⏰ Time’s up! Returning to menu.")
|
print("\n⏰ Time is up! Returning to menu.")
|
||||||
print("=== Catchphrase ===")
|
print("=== Catchphrase ===")
|
||||||
print("Commands:")
|
print("Commands:")
|
||||||
print(" start – begin the 30‑second timer and show a word immediately")
|
print(" start - begin the 30-second timer and show a word immediately")
|
||||||
print(" next – show another random word while the timer is running")
|
print(" next - show another random word while the timer is running")
|
||||||
print(" stop – cancel the timer early")
|
print(" stop - cancel the timer early")
|
||||||
print(" exit / quit – leave the program")
|
print(" exit / quit - leave the program")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
@@ -111,11 +111,11 @@ def main():
|
|||||||
|
|
||||||
# Show the first word right away
|
# Show the first word right away
|
||||||
print(pick_random(words))
|
print(pick_random(words))
|
||||||
print(f"[+] 30‑second timer started. ({TIMER_SECONDS}s)")
|
print(f"[+] 30-second timer started. ({TIMER_SECONDS}s)")
|
||||||
|
|
||||||
elif cmd == "next":
|
elif cmd == "next":
|
||||||
if not (timer_thread and timer_thread.is_running):
|
if not (timer_thread and timer_thread.is_running):
|
||||||
print("[!] No active timer – use 'start' first.")
|
print("[!] No active timer - use 'start' first.")
|
||||||
else:
|
else:
|
||||||
print(pick_random(words))
|
print(pick_random(words))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user