GameAI / formatting.py
j-js's picture
Upload 11 files
fa70564 verified
raw
history blame
782 Bytes
from __future__ import annotations
def style_prefix(tone: float) -> str:
if tone < 0.33:
return "Let’s solve it efficiently."
if tone < 0.66:
return "Let’s work through it."
return "You’ve got this — let’s solve it cleanly."
def format_reply(core: str, tone: float, verbosity: float, transparency: float, help_mode: str) -> str:
prefix = style_prefix(tone)
core = (core or "").strip()
if not core:
return prefix
if help_mode == "hint":
return f"{prefix}\n\nHint:\n{core}"
if help_mode == "walkthrough" and verbosity >= 0.4:
return f"{prefix}\n\nWalkthrough:\n{core}"
if transparency >= 0.75 and help_mode == "answer":
return f"{prefix}\n\n{core}"
return f"{prefix}\n\n{core}"