Intelligent Hinting

version 5 by Aaron Reed

  • Home page
  • Beginning
  • Previous
  • Next



  • Section - Displaying and Carrying out Results


    Suggestion flag is a truth state that varies. [Useful if code ever needs to determine if an action being tried was the result of a "suggest" command or not.]

    Saved parent is an object that varies. [A recursion-loop checking variable.]

    To process appropriate action, actually performing and/or as a command:
        if as a command:
            if actually performing:
                print IH message for command-solving;
                now reparse flag is true;
            otherwise:
                print IH message for command-suggesting;
        otherwise:
            now saved parent is nothing;
            if relevant action is the action of the person asked going down:
                if actually-down is false:
                    if relevant-direction is a direction, now relevant action is the action of the person asked going relevant-direction;
                    otherwise now relevant action is the action of the person asked waiting;
            otherwise if relevant action is the action of the person asked fake-actioning:
                print IH message for no-action-found;
                now relevant action is the action of the person asked waiting;
            if actually performing:
                print IH message for action-solving;
                now suggestion flag is true;
                try relevant action;
                now suggestion flag is false;
            otherwise:
                print IH message for action-suggesting.

    Table of Intelligent Hinting Messages
    msg  txt  
    action-solving  "([relevant action])[line break]"  
    action-suggesting  "Try [relevant action].[line break]"  
    command-solving  "(trying: [relevant command])"  
    command-suggesting  "Try typing [relevant command].[line break]"  
    no-action-found  "(Can't find an action to take.)"  
    all-puzzles-solved  "(All puzzles are solved.)"  
    suggestions-disallowed  "(I am not able to make suggestions at the moment.)"  

    IH message is a kind of value. The IH messages are action-solving, action-suggesting, command-solving, command-suggesting, no-action-found, all-puzzles-solved, suggestions-disallowed.

    To print IH message for (ihmsg - an IH message):
        if there is a msg of ihmsg in Table of Intelligent Hinting Messages:
            choose row with a msg of ihmsg in Table of Intelligent Hinting Messages;
            say txt entry.

    [To perform a stored command (as indexed text), we need to be slightly trickier, since we can't change the player's input at this late stage. We'll skip to the next turn and override the normal procedure for reading a command from the player, replacing it with our stored text.]

    The relevant command is an indexed text that varies. Reparse flag is a truth state that varies.

    Rule for reading a command when reparse flag is true:
        now reparse flag is false;
        replace the player's command with "[relevant command]".