File size: 873 Bytes
dd561c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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)

    if help_mode == "hint":
        if transparency < 0.4:
            return f"{prefix}\n\nHint: {core}"
        return f"{prefix}\n\nHint:\n{core}"

    if help_mode == "walkthrough":
        if verbosity < 0.35:
            return f"{prefix}\n\n{core}"
        return f"{prefix}\n\nWalkthrough:\n{core}"

    if verbosity < 0.33:
        return f"{prefix}\n\n{core}"

    if transparency >= 0.5:
        return f"{prefix}\n\n{core}"

    return f"{prefix}\n\n{core}"