返回
🪨

Caveman Interpreter

START_CAVE

HP: 100 | LOC: 0,0
RENDER_MODE: TERMINAL_ASCII | ENGINE: V8

当前上下文 (Context)

环境 (Env)
DARK
威胁 (Threat)
NONE
caveman_interpreter.exe
# 欢迎来到 Caveman 解释器。
# 尝试输入简单命令: "go north", "look rock", "take stick", "attack dragon"
# 系统仅识别 [动词] + [名词] 结构。
>
parser.py (Logic View) READ-ONLY
def parse(input_string):
    tokens = input_string.lower().split() # Tokenize
    
    if len(tokens) < 2:
        return "Me confused. Need VERB and NOUN."

    verb, noun = tokens[0], tokens[1]
    context = get_current_context() # Get current location data

    if verb == "go":
        if noun in context.exits:
            move_player(noun)
            return f"Ugg go {noun}."
        else:
            return "Cannot go there. Wall maybe?"

    elif verb == "look":
        return context.description

    elif verb == "attack":
        if noun in context.entities:
            resolve_combat(noun)
        else:
            return "Nothing to attack here."
            
    # ... 更多极简逻辑